sdmod1.cxx (74cbd1f1) | sdmod1.cxx (2155a943) |
---|---|
1/************************************************************** | 1/************************************************************** |
2 * | 2 * |
3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at | 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at |
10 * | 10 * |
11 * http://www.apache.org/licenses/LICENSE-2.0 | 11 * http://www.apache.org/licenses/LICENSE-2.0 |
12 * | 12 * |
13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. | 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. |
19 * | 19 * |
20 *************************************************************/ 21 22 23 24// MARKER(update_precomp.py): autogen include statement, do not remove 25#include "precompiled_sd.hxx" 26 27#include <svl/lckbitem.hxx> --- 16 unchanged lines hidden (view full) --- 44#include <editeng/eeitem.hxx> 45#include <unotools/useroptions.hxx> 46 47#include "app.hrc" 48#include "glob.hrc" 49#include "strings.hrc" 50#include "res_bmp.hrc" 51 | 20 *************************************************************/ 21 22 23 24// MARKER(update_precomp.py): autogen include statement, do not remove 25#include "precompiled_sd.hxx" 26 27#include <svl/lckbitem.hxx> --- 16 unchanged lines hidden (view full) --- 44#include <editeng/eeitem.hxx> 45#include <unotools/useroptions.hxx> 46 47#include "app.hrc" 48#include "glob.hrc" 49#include "strings.hrc" 50#include "res_bmp.hrc" 51 |
52#define _SD_DLL // fuer SD_MOD() | 52#define _SD_DLL // for SD_MOD() |
53#include "sdmod.hxx" 54#include "sddll.hxx" 55#include "pres.hxx" 56#include "optsitem.hxx" 57#include "ViewShell.hxx" 58#include "sdattr.hxx" 59#include "sdpage.hxx" 60#include "DrawDocShell.hxx" --- 21 unchanged lines hidden (view full) --- 82using ::com::sun::star::uno::Reference; 83using ::com::sun::star::frame::XFrame; 84 85namespace { 86 87class OutlineToImpressFinalizer 88{ 89public: | 53#include "sdmod.hxx" 54#include "sddll.hxx" 55#include "pres.hxx" 56#include "optsitem.hxx" 57#include "ViewShell.hxx" 58#include "sdattr.hxx" 59#include "sdpage.hxx" 60#include "DrawDocShell.hxx" --- 21 unchanged lines hidden (view full) --- 82using ::com::sun::star::uno::Reference; 83using ::com::sun::star::frame::XFrame; 84 85namespace { 86 87class OutlineToImpressFinalizer 88{ 89public: |
90 OutlineToImpressFinalizer ( 91 ::sd::ViewShellBase& rBase, 92 SdDrawDocument& rDocument, 93 SvLockBytes& rBytes); 94 virtual ~OutlineToImpressFinalizer (void) {}; 95 void operator() (bool bEventSeen); | 90 OutlineToImpressFinalizer ( 91 ::sd::ViewShellBase& rBase, 92 SdDrawDocument& rDocument, 93 SvLockBytes& rBytes); 94 virtual ~OutlineToImpressFinalizer (void) {}; 95 void operator() (bool bEventSeen); |
96private: | 96private: |
97 ::sd::ViewShellBase& mrBase; 98 SdDrawDocument& mrDocument; 99 ::boost::shared_ptr<SvMemoryStream> mpStream; | 97 ::sd::ViewShellBase& mrBase; 98 SdDrawDocument& mrDocument; 99 ::boost::shared_ptr<SvMemoryStream> mpStream; |
100}; 101 102 | 100}; 101 102 |
103} //end of anonymous namespace | 103} // end of anonymous namespace |
104 105 106/************************************************************************* | 104 105 106/************************************************************************* |
107|* | |
108|* Execute | 107|* Execute |
109|* | |
110\************************************************************************/ 111 112void SdModule::Execute(SfxRequest& rReq) 113{ 114 const SfxItemSet* pSet = rReq.GetArgs(); 115 sal_uLong nSlotId = rReq.GetSlot(); 116 117 switch ( nSlotId ) 118 { 119 case SID_NEWDOC: 120 { | 108\************************************************************************/ 109 110void SdModule::Execute(SfxRequest& rReq) 111{ 112 const SfxItemSet* pSet = rReq.GetArgs(); 113 sal_uLong nSlotId = rReq.GetSlot(); 114 115 switch ( nSlotId ) 116 { 117 case SID_NEWDOC: 118 { |
121 SFX_APP()->ExecuteSlot(rReq, SFX_APP()->GetInterface()); | 119 SFX_APP()->ExecuteSlot(rReq, SFX_APP()->GetInterface()); |
122 } 123 break; 124 125 case SID_AUTOSPELL_CHECK: 126 { 127 // automatische Rechtschreibpruefung 128 const SfxPoolItem* pItem; 129 if( pSet && SFX_ITEM_SET == pSet->GetItemState( --- 14 unchanged lines hidden (view full) --- 144 case SID_ATTR_METRIC: 145 { 146 const SfxPoolItem* pItem; 147 if ( pSet && SFX_ITEM_SET == pSet->GetItemState( SID_ATTR_METRIC, sal_True, &pItem ) ) 148 { 149 FieldUnit eUnit = (FieldUnit)((const SfxUInt16Item*)pItem)->GetValue(); 150 switch( eUnit ) 151 { | 120 } 121 break; 122 123 case SID_AUTOSPELL_CHECK: 124 { 125 // automatische Rechtschreibpruefung 126 const SfxPoolItem* pItem; 127 if( pSet && SFX_ITEM_SET == pSet->GetItemState( --- 14 unchanged lines hidden (view full) --- 142 case SID_ATTR_METRIC: 143 { 144 const SfxPoolItem* pItem; 145 if ( pSet && SFX_ITEM_SET == pSet->GetItemState( SID_ATTR_METRIC, sal_True, &pItem ) ) 146 { 147 FieldUnit eUnit = (FieldUnit)((const SfxUInt16Item*)pItem)->GetValue(); 148 switch( eUnit ) 149 { |
152 case FUNIT_MM: // nur die Einheiten, die auch im Dialog stehen | 150 case FUNIT_MM: // nur die Einheiten, die auch im Dialog stehen |
153 case FUNIT_CM: 154 case FUNIT_INCH: 155 case FUNIT_PICA: 156 case FUNIT_POINT: 157 { 158 ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() ); 159 if(pDocSh) 160 { --- 16 unchanged lines hidden (view full) --- 177 break; 178 179 case SID_ATTR_LANGUAGE: 180 case SID_ATTR_CHAR_CJK_LANGUAGE: 181 case SID_ATTR_CHAR_CTL_LANGUAGE: 182 { 183 const SfxPoolItem* pItem; 184 if( pSet && | 151 case FUNIT_CM: 152 case FUNIT_INCH: 153 case FUNIT_PICA: 154 case FUNIT_POINT: 155 { 156 ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() ); 157 if(pDocSh) 158 { --- 16 unchanged lines hidden (view full) --- 175 break; 176 177 case SID_ATTR_LANGUAGE: 178 case SID_ATTR_CHAR_CJK_LANGUAGE: 179 case SID_ATTR_CHAR_CTL_LANGUAGE: 180 { 181 const SfxPoolItem* pItem; 182 if( pSet && |
185 ( 186 SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_LANGUAGE, sal_False, &pItem ) || | 183 ( 184 SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_LANGUAGE, sal_False, &pItem ) || |
187 SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_CHAR_CJK_LANGUAGE, sal_False, &pItem ) || 188 SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_CHAR_CTL_LANGUAGE, sal_False, &pItem ) | 185 SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_CHAR_CJK_LANGUAGE, sal_False, &pItem ) || 186 SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_CHAR_CTL_LANGUAGE, sal_False, &pItem ) |
189 ) 190 ) | 187 ) 188 ) |
191 { 192 // am Dokument sichern: 193 ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current()); 194 if ( pDocSh ) 195 { 196 LanguageType eLanguage = ( (SvxLanguageItem*)pItem )->GetValue(); 197 SdDrawDocument* pDoc = pDocSh->GetDoc(); 198 --- 32 unchanged lines hidden (view full) --- 231 ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current()); 232 if (pDocShell) 233 { 234 ::sd::ViewShell* pViewShell = pDocShell->GetViewShell(); 235 if (pViewShell) 236 { 237 if( sd::SlideShow::IsRunning( pViewShell->GetViewShellBase() ) ) 238 { | 189 { 190 // am Dokument sichern: 191 ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current()); 192 if ( pDocSh ) 193 { 194 LanguageType eLanguage = ( (SvxLanguageItem*)pItem )->GetValue(); 195 SdDrawDocument* pDoc = pDocSh->GetDoc(); 196 --- 32 unchanged lines hidden (view full) --- 229 ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current()); 230 if (pDocShell) 231 { 232 ::sd::ViewShell* pViewShell = pDocShell->GetViewShell(); 233 if (pViewShell) 234 { 235 if( sd::SlideShow::IsRunning( pViewShell->GetViewShellBase() ) ) 236 { |
239 // Prevent documents from opening while the slide 240 // show is running, except when this request comes 241 // from a shape interaction. 242 if (rReq.GetArgs() == NULL) 243 { 244 bIntercept = sal_True; 245 } | 237 // Prevent documents from opening while the slide 238 // show is running, except when this request comes 239 // from a shape interaction. 240 if (rReq.GetArgs() == NULL) 241 { 242 bIntercept = sal_True; 243 } |
246 } 247 } 248 } 249 250 if (!bIntercept) 251 { | 244 } 245 } 246 } 247 248 if (!bIntercept) 249 { |
252 SFX_APP()->ExecuteSlot(rReq, SFX_APP()->GetInterface()); | 250 SFX_APP()->ExecuteSlot(rReq, SFX_APP()->GetInterface()); |
253 } 254 else 255 { 256 ErrorBox(NULL, WB_OK, String(SdResId(STR_CANT_PERFORM_IN_LIVEMODE))).Execute(); 257 | 251 } 252 else 253 { 254 ErrorBox(NULL, WB_OK, String(SdResId(STR_CANT_PERFORM_IN_LIVEMODE))).Execute(); 255 |
258 SFX_REQUEST_ARG( rReq, pLinkItem, SfxLinkItem, SID_DONELINK, sal_False ); | 256 SFX_REQUEST_ARG( rReq, pLinkItem, SfxLinkItem, SID_DONELINK, sal_False ); |
259 if( pLinkItem ) | 257 if( pLinkItem ) |
260 pLinkItem->GetValue().Call( 0 ); | 258 pLinkItem->GetValue().Call( 0 ); |
261 } 262 } 263 break; 264 265 case SID_OUTLINE_TO_IMPRESS: | 259 } 260 } 261 break; 262 263 case SID_OUTLINE_TO_IMPRESS: |
266 OutlineToImpress (rReq); 267 break; | 264 OutlineToImpress (rReq); 265 break; |
268 269 default: 270 break; 271 } 272} 273 274 275 276 277void SdModule::OutlineToImpress (SfxRequest& rRequest) 278{ | 266 267 default: 268 break; 269 } 270} 271 272 273 274 275void SdModule::OutlineToImpress (SfxRequest& rRequest) 276{ |
279 const SfxItemSet* pSet = rRequest.GetArgs(); | 277 const SfxItemSet* pSet = rRequest.GetArgs(); |
280 | 278 |
281 if (pSet) 282 { 283 SvLockBytes* pBytes = ((SfxLockBytesItem&) pSet->Get(SID_OUTLINE_TO_IMPRESS)).GetValue(); | 279 if (pSet) 280 { 281 SvLockBytes* pBytes = ((SfxLockBytesItem&) pSet->Get(SID_OUTLINE_TO_IMPRESS)).GetValue(); |
284 | 282 |
285 if (pBytes) 286 { 287 SfxObjectShellLock xDocShell; 288 ::sd::DrawDocShell* pDocSh; 289 xDocShell = pDocSh = new ::sd::DrawDocShell( 290 SFX_CREATE_MODE_STANDARD, sal_False); 291 if(pDocSh) 292 { 293 pDocSh->DoInitNew(NULL); 294 SdDrawDocument* pDoc = pDocSh->GetDoc(); 295 if(pDoc) 296 { 297 pDoc->CreateFirstPages(); 298 pDoc->StopWorkStartupDelay(); 299 } | 283 if (pBytes) 284 { 285 SfxObjectShellLock xDocShell; 286 ::sd::DrawDocShell* pDocSh; 287 xDocShell = pDocSh = new ::sd::DrawDocShell( 288 SFX_CREATE_MODE_STANDARD, sal_False); 289 if(pDocSh) 290 { 291 pDocSh->DoInitNew(NULL); 292 SdDrawDocument* pDoc = pDocSh->GetDoc(); 293 if(pDoc) 294 { 295 pDoc->CreateFirstPages(); 296 pDoc->StopWorkStartupDelay(); 297 } |
300 | 298 |
301 SFX_REQUEST_ARG( rRequest, pFrmItem, SfxFrameItem, SID_DOCFRAME, sal_False); 302 SfxViewFrame::LoadDocumentIntoFrame( *pDocSh, pFrmItem, ::sd::OUTLINE_FACTORY_ID ); | 299 SFX_REQUEST_ARG( rRequest, pFrmItem, SfxFrameItem, SID_DOCFRAME, sal_False); 300 SfxViewFrame::LoadDocumentIntoFrame( *pDocSh, pFrmItem, ::sd::OUTLINE_FACTORY_ID ); |
303 | 301 |
304 ::sd::ViewShell* pViewSh = pDocSh->GetViewShell(); | 302 ::sd::ViewShell* pViewSh = pDocSh->GetViewShell(); |
305 | 303 |
306 if (pViewSh) 307 { 308 // AutoLayouts muessen fertig sein 309 pDoc->StopWorkStartupDelay(); | 304 if (pViewSh) 305 { 306 // AutoLayouts muessen fertig sein 307 pDoc->StopWorkStartupDelay(); |
310 | 308 |
311 SfxViewFrame* pViewFrame = pViewSh->GetViewFrame(); | 309 SfxViewFrame* pViewFrame = pViewSh->GetViewFrame(); |
312 | 310 |
313 // When the view frame has not been just created we have 314 // to switch synchronously to the outline view. 315 // (Otherwise the request will be ignored anyway.) 316 ::sd::ViewShellBase* pBase 317 = dynamic_cast< ::sd::ViewShellBase*>(pViewFrame->GetViewShell()); 318 if (pBase != NULL) 319 { 320 ::boost::shared_ptr<FrameworkHelper> pHelper ( 321 FrameworkHelper::Instance(*pBase)); 322 pHelper->RequestView( 323 FrameworkHelper::msOutlineViewURL, 324 FrameworkHelper::msCenterPaneURL); | 311 // When the view frame has not been just created we have 312 // to switch synchronously to the outline view. 313 // (Otherwise the request will be ignored anyway.) 314 ::sd::ViewShellBase* pBase 315 = dynamic_cast< ::sd::ViewShellBase*>(pViewFrame->GetViewShell()); 316 if (pBase != NULL) 317 { 318 ::boost::shared_ptr<FrameworkHelper> pHelper ( 319 FrameworkHelper::Instance(*pBase)); 320 pHelper->RequestView( 321 FrameworkHelper::msOutlineViewURL, 322 FrameworkHelper::msCenterPaneURL); |
325 | 323 |
326 pHelper->RunOnResourceActivation( 327 FrameworkHelper::CreateResourceId( 328 FrameworkHelper::msOutlineViewURL, 329 FrameworkHelper::msCenterPaneURL), 330 OutlineToImpressFinalizer(*pBase, *pDoc, *pBytes)); 331 } 332 } 333 } 334 } 335 } | 324 pHelper->RunOnResourceActivation( 325 FrameworkHelper::CreateResourceId( 326 FrameworkHelper::msOutlineViewURL, 327 FrameworkHelper::msCenterPaneURL), 328 OutlineToImpressFinalizer(*pBase, *pDoc, *pBytes)); 329 } 330 } 331 } 332 } 333 } |
336 | 334 |
337 rRequest.IsDone(); | 335 rRequest.IsDone(); |
338} 339 340 341 342 343/************************************************************************* | 336} 337 338 339 340 341/************************************************************************* |
344|* | |
345|* GetState | 342|* GetState |
346|* | |
347\************************************************************************/ 348 349static bool bOnce = false; 350 351void SdModule::GetState(SfxItemSet& rItemSet) 352{ 353 // Autopilot waehrend der Praesentation disablen 354 if (rItemSet.GetItemState(SID_SD_AUTOPILOT) != SFX_ITEM_UNKNOWN) --- 29 unchanged lines hidden (view full) --- 384 SdOptions* pOptions = GetSdOptions(eDocType); 385 rItemSet.Put( SfxUInt16Item( SID_ATTR_METRIC, pOptions->GetMetric() ) ); 386 } 387 } 388 389 // der Status von SID_OPENDOC wird von der Basisklasse bestimmt 390 if (rItemSet.GetItemState(SID_OPENDOC) != SFX_ITEM_UNKNOWN) 391 { | 343\************************************************************************/ 344 345static bool bOnce = false; 346 347void SdModule::GetState(SfxItemSet& rItemSet) 348{ 349 // Autopilot waehrend der Praesentation disablen 350 if (rItemSet.GetItemState(SID_SD_AUTOPILOT) != SFX_ITEM_UNKNOWN) --- 29 unchanged lines hidden (view full) --- 380 SdOptions* pOptions = GetSdOptions(eDocType); 381 rItemSet.Put( SfxUInt16Item( SID_ATTR_METRIC, pOptions->GetMetric() ) ); 382 } 383 } 384 385 // der Status von SID_OPENDOC wird von der Basisklasse bestimmt 386 if (rItemSet.GetItemState(SID_OPENDOC) != SFX_ITEM_UNKNOWN) 387 { |
392 const SfxPoolItem* pItem = SFX_APP()->GetSlotState(SID_OPENDOC, SFX_APP()->GetInterface()); | 388 const SfxPoolItem* pItem = SFX_APP()->GetSlotState(SID_OPENDOC, SFX_APP()->GetInterface()); |
393 if (pItem) 394 rItemSet.Put(*pItem); 395 } 396 397 // der Status von SID_OPENHYPERLINK wird von der Basisklasse bestimmt 398 if (rItemSet.GetItemState(SID_OPENHYPERLINK) != SFX_ITEM_UNKNOWN) 399 { | 389 if (pItem) 390 rItemSet.Put(*pItem); 391 } 392 393 // der Status von SID_OPENHYPERLINK wird von der Basisklasse bestimmt 394 if (rItemSet.GetItemState(SID_OPENHYPERLINK) != SFX_ITEM_UNKNOWN) 395 { |
400 const SfxPoolItem* pItem = SFX_APP()->GetSlotState(SID_OPENHYPERLINK, SFX_APP()->GetInterface()); | 396 const SfxPoolItem* pItem = SFX_APP()->GetSlotState(SID_OPENHYPERLINK, SFX_APP()->GetInterface()); |
401 if (pItem) 402 rItemSet.Put(*pItem); 403 } 404 | 397 if (pItem) 398 rItemSet.Put(*pItem); 399 } 400 |
405 if( SFX_ITEM_AVAILABLE == rItemSet.GetItemState( SID_AUTOSPELL_CHECK ) ) | 401 if( SFX_ITEM_AVAILABLE == rItemSet.GetItemState( SID_AUTOSPELL_CHECK ) ) |
406 { 407 ::sd::DrawDocShell* pDocSh = | 402 { 403 ::sd::DrawDocShell* pDocSh = |
408 PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current()); | 404 PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current()); |
409 if( pDocSh ) 410 { 411 SdDrawDocument* pDoc = pDocSh->GetDoc(); 412 rItemSet.Put( SfxBoolItem( SID_AUTOSPELL_CHECK, pDoc->GetOnlineSpell() ) ); 413 } 414 } 415 416 if( SFX_ITEM_AVAILABLE == rItemSet.GetItemState( SID_ATTR_LANGUAGE ) ) --- 12 unchanged lines hidden (view full) --- 429 430 if( SFX_ITEM_AVAILABLE == rItemSet.GetItemState( SID_ATTR_CHAR_CTL_LANGUAGE ) ) 431 { 432 ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current()); 433 if( pDocSh ) 434 rItemSet.Put( SvxLanguageItem( pDocSh->GetDoc()->GetLanguage( EE_CHAR_LANGUAGE_CTL ), SID_ATTR_CHAR_CTL_LANGUAGE ) ); 435 } 436 | 405 if( pDocSh ) 406 { 407 SdDrawDocument* pDoc = pDocSh->GetDoc(); 408 rItemSet.Put( SfxBoolItem( SID_AUTOSPELL_CHECK, pDoc->GetOnlineSpell() ) ); 409 } 410 } 411 412 if( SFX_ITEM_AVAILABLE == rItemSet.GetItemState( SID_ATTR_LANGUAGE ) ) --- 12 unchanged lines hidden (view full) --- 425 426 if( SFX_ITEM_AVAILABLE == rItemSet.GetItemState( SID_ATTR_CHAR_CTL_LANGUAGE ) ) 427 { 428 ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current()); 429 if( pDocSh ) 430 rItemSet.Put( SvxLanguageItem( pDocSh->GetDoc()->GetLanguage( EE_CHAR_LANGUAGE_CTL ), SID_ATTR_CHAR_CTL_LANGUAGE ) ); 431 } 432 |
437 if ( !bOnce ) 438 { 439 ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current()); 440 if( pDocShell ) // Impress or Draw ? 441 { 442 ::sd::ViewShell* pViewShell = pDocShell->GetViewShell(); | 433 if ( !bOnce ) 434 { 435 ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current()); 436 if( pDocShell ) // Impress or Draw? 437 { 438 ::sd::ViewShell* pViewShell = pDocShell->GetViewShell(); |
443 | 439 |
444 if( pViewShell && (pDocShell->GetDocumentType() == DOCUMENT_TYPE_IMPRESS) ) 445 { 446 // add our event listener as soon as possible 447 Application::AddEventListener( LINK( this, SdModule, EventListenerHdl ) ); 448 bOnce = true; 449 } 450 } 451 } | 440 if( pViewShell && (pDocShell->GetDocumentType() == DOCUMENT_TYPE_IMPRESS) ) 441 { 442 // add our event listener as soon as possible 443 Application::AddEventListener( LINK( this, SdModule, EventListenerHdl ) ); 444 bOnce = true; 445 } 446 } 447 } |
452} 453 454IMPL_LINK( SdModule, EventListenerHdl, VclSimpleEvent*, pEvent ) 455{ | 448} 449 450IMPL_LINK( SdModule, EventListenerHdl, VclSimpleEvent*, pEvent ) 451{ |
456 if( pEvent && (pEvent->GetId() == VCLEVENT_WINDOW_COMMAND) && static_cast<VclWindowEvent*>(pEvent)->GetData() ) 457 { 458 const CommandEvent& rEvent = *(const CommandEvent*)static_cast<VclWindowEvent*>(pEvent)->GetData(); | 452 if( pEvent && (pEvent->GetId() == VCLEVENT_WINDOW_COMMAND) && static_cast<VclWindowEvent*>(pEvent)->GetData() ) 453 { 454 const CommandEvent& rEvent = *(const CommandEvent*)static_cast<VclWindowEvent*>(pEvent)->GetData(); |
459 | 455 |
460 if( rEvent.GetCommand() == COMMAND_MEDIA ) 461 { 462 switch( rEvent.GetMediaCommand() ) 463 { 464 case MEDIA_COMMAND_PLAY: 465 { 466 ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current()); 467 if( pDocShell ) // Impress or Draw ? 468 { 469 ::sd::ViewShell* pViewShell = pDocShell->GetViewShell(); | 456 if( rEvent.GetCommand() == COMMAND_MEDIA ) 457 { 458 switch( rEvent.GetMediaCommand() ) 459 { 460 case MEDIA_COMMAND_PLAY: 461 { 462 ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current()); 463 if( pDocShell ) // Impress or Draw? 464 { 465 ::sd::ViewShell* pViewShell = pDocShell->GetViewShell(); |
470 | 466 |
471 // #i97925# start the presentation if and only if an Impress document is focused 472 if( pViewShell && (pDocShell->GetDocumentType() == DOCUMENT_TYPE_IMPRESS) ) 473 pViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_PRESENTATION ); 474 } 475 } 476 break; | 467 // #i97925# start the presentation if and only if an Impress document is focused 468 if( pViewShell && (pDocShell->GetDocumentType() == DOCUMENT_TYPE_IMPRESS) ) 469 pViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_PRESENTATION ); 470 } 471 } 472 break; |
477 | 473 |
478 default: 479 break; 480 } 481 } 482 } 483 return 0; | 474 default: 475 break; 476 } 477 } 478 } 479 return 0; |
484} 485 486 487void SdModule::AddSummaryPage (SfxViewFrame* pViewFrame, SdDrawDocument* pDocument) 488{ 489 if( !pViewFrame || !pViewFrame->GetDispatcher() || !pDocument ) 490 return; 491 | 480} 481 482 483void SdModule::AddSummaryPage (SfxViewFrame* pViewFrame, SdDrawDocument* pDocument) 484{ 485 if( !pViewFrame || !pViewFrame->GetDispatcher() || !pDocument ) 486 return; 487 |
492 pViewFrame->GetDispatcher()->Execute(SID_SUMMARY_PAGE, 493 SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD); | 488 pViewFrame->GetDispatcher()->Execute(SID_SUMMARY_PAGE, 489 SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD); |
494 | 490 |
495 OSL_ASSERT (pDocument!=NULL); | 491 OSL_ASSERT (pDocument!=NULL); |
496 | 492 |
497 sal_Int32 nPageCount = pDocument->GetSdPageCount (PK_STANDARD); | 493 sal_Int32 nPageCount = pDocument->GetSdPageCount (PK_STANDARD); |
498 | 494 |
499 // We need at least two pages: the summary page and one to use as 500 // template to take the transition parameters from. 501 if (nPageCount >= 2) 502 { 503 // Get a page from which to retrieve the transition parameters. 504 SdPage* pTemplatePage = pDocument->GetSdPage (0, PK_STANDARD); 505 OSL_ASSERT (pTemplatePage!=NULL); | 495 // We need at least two pages: the summary page and one to use as 496 // template to take the transition parameters from. 497 if (nPageCount >= 2) 498 { 499 // Get a page from which to retrieve the transition parameters. 500 SdPage* pTemplatePage = pDocument->GetSdPage (0, PK_STANDARD); 501 OSL_ASSERT (pTemplatePage!=NULL); |
506 | 502 |
507 // The summary page, if it exists, is the last page. 508 SdPage* pSummaryPage = pDocument->GetSdPage ( 509 (sal_uInt16)nPageCount-1, PK_STANDARD); 510 OSL_ASSERT (pSummaryPage!=NULL); | 503 // The summary page, if it exists, is the last page. 504 SdPage* pSummaryPage = pDocument->GetSdPage ( 505 (sal_uInt16)nPageCount-1, PK_STANDARD); 506 OSL_ASSERT (pSummaryPage!=NULL); |
511 | 507 |
512 // Take the change mode of the template page as indication of the 513 // document's kiosk mode. 514 pSummaryPage->setTransitionDuration(pTemplatePage->getTransitionDuration()); 515 pSummaryPage->SetPresChange(pTemplatePage->GetPresChange()); 516 pSummaryPage->SetTime(pTemplatePage->GetTime()); 517 pSummaryPage->SetSound(pTemplatePage->IsSoundOn()); 518 pSummaryPage->SetSoundFile(pTemplatePage->GetSoundFile()); | 508 // Take the change mode of the template page as indication of the 509 // document's kiosk mode. 510 pSummaryPage->setTransitionDuration(pTemplatePage->getTransitionDuration()); 511 pSummaryPage->SetPresChange(pTemplatePage->GetPresChange()); 512 pSummaryPage->SetTime(pTemplatePage->GetTime()); 513 pSummaryPage->SetSound(pTemplatePage->IsSoundOn()); 514 pSummaryPage->SetSoundFile(pTemplatePage->GetSoundFile()); |
519 pSummaryPage->setTransitionType(pTemplatePage->getTransitionType()); 520 pSummaryPage->setTransitionSubtype(pTemplatePage->getTransitionSubtype()); 521 pSummaryPage->setTransitionDirection(pTemplatePage->getTransitionDirection()); 522 pSummaryPage->setTransitionFadeColor(pTemplatePage->getTransitionFadeColor()); 523 pSummaryPage->setTransitionDuration(pTemplatePage->getTransitionDuration()); | 515 pSummaryPage->setTransitionType(pTemplatePage->getTransitionType()); 516 pSummaryPage->setTransitionSubtype(pTemplatePage->getTransitionSubtype()); 517 pSummaryPage->setTransitionDirection(pTemplatePage->getTransitionDirection()); 518 pSummaryPage->setTransitionFadeColor(pTemplatePage->getTransitionFadeColor()); 519 pSummaryPage->setTransitionDuration(pTemplatePage->getTransitionDuration()); |
524 } | 520 } |
525} 526 527SfxFrame* SdModule::CreateFromTemplate( const String& rTemplatePath, const Reference< XFrame >& i_rFrame ) 528{ 529 SfxFrame* pFrame = 0; 530 531 SfxObjectShellLock xDocShell; 532 --- 5 unchanged lines hidden (view full) --- 538 SfxObjectShell* pDocShell = xDocShell; 539 540 if( lErr ) 541 { 542 ErrorHandler::HandleError(lErr); 543 } 544 else if( pDocShell ) 545 { | 521} 522 523SfxFrame* SdModule::CreateFromTemplate( const String& rTemplatePath, const Reference< XFrame >& i_rFrame ) 524{ 525 SfxFrame* pFrame = 0; 526 527 SfxObjectShellLock xDocShell; 528 --- 5 unchanged lines hidden (view full) --- 534 SfxObjectShell* pDocShell = xDocShell; 535 536 if( lErr ) 537 { 538 ErrorHandler::HandleError(lErr); 539 } 540 else if( pDocShell ) 541 { |
546 SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pDocShell, i_rFrame ); 547 OSL_ENSURE( pViewFrame, "SdModule::CreateFromTemplate: no view frame - was the document really loaded?" ); 548 pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL; | 542 SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pDocShell, i_rFrame ); 543 OSL_ENSURE( pViewFrame, "SdModule::CreateFromTemplate: no view frame - was the document really loaded?" ); 544 pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL; |
549 } 550 551 return pFrame; 552 553} 554 555SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq ) 556{ 557 SfxFrame* pFrame = 0; 558 if ( SvtModuleOptions().IsImpress() ) 559 { | 545 } 546 547 return pFrame; 548 549} 550 551SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq ) 552{ 553 SfxFrame* pFrame = 0; 554 if ( SvtModuleOptions().IsImpress() ) 555 { |
560 Reference< XFrame > xTargetFrame; | 556 Reference< XFrame > xTargetFrame; |
561 SFX_REQUEST_ARG( rReq, pFrmItem, SfxUnoFrameItem, SID_FILLFRAME, sal_False); 562 if ( pFrmItem ) | 557 SFX_REQUEST_ARG( rReq, pFrmItem, SfxUnoFrameItem, SID_FILLFRAME, sal_False); 558 if ( pFrmItem ) |
563 xTargetFrame = pFrmItem->GetFrame(); | 559 xTargetFrame = pFrmItem->GetFrame(); |
564 565 bool bMakeLayoutVisible = false; 566 SfxViewFrame* pViewFrame = NULL; 567 568 SdOptions* pOpt = GetSdOptions(DOCUMENT_TYPE_IMPRESS); 569 bool bStartWithTemplate = pOpt->IsStartWithTemplate(); 570 571 bool bNewDocDirect = rReq.GetSlot() == SID_NEWSD; 572 if( bNewDocDirect && !bStartWithTemplate ) 573 { | 560 561 bool bMakeLayoutVisible = false; 562 SfxViewFrame* pViewFrame = NULL; 563 564 SdOptions* pOpt = GetSdOptions(DOCUMENT_TYPE_IMPRESS); 565 bool bStartWithTemplate = pOpt->IsStartWithTemplate(); 566 567 bool bNewDocDirect = rReq.GetSlot() == SID_NEWSD; 568 if( bNewDocDirect && !bStartWithTemplate ) 569 { |
574 //we start without wizard | 570 // we start without wizard |
575 | 571 |
576 //check whether we should load a template document | 572 // check whether we should load a template document |
577 const ::rtl::OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ); 578 String aStandardTemplate( SfxObjectFactory::GetStandardTemplate( aServiceName ) ); 579 580 if( aStandardTemplate.Len() > 0 ) 581 { | 573 const ::rtl::OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ); 574 String aStandardTemplate( SfxObjectFactory::GetStandardTemplate( aServiceName ) ); 575 576 if( aStandardTemplate.Len() > 0 ) 577 { |
582 //load a template document | 578 // load a template document |
583 pFrame = CreateFromTemplate( aStandardTemplate, xTargetFrame ); 584 } 585 else 586 { | 579 pFrame = CreateFromTemplate( aStandardTemplate, xTargetFrame ); 580 } 581 else 582 { |
587 //create an empty document | 583 // create an empty document |
588 pFrame = CreateEmptyDocument( DOCUMENT_TYPE_IMPRESS, xTargetFrame ); 589 bMakeLayoutVisible = true; 590 } 591 } 592 else 593 { 594 SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); 595 std::auto_ptr< AbstractAssistentDlg > pPilotDlg( pFact ? pFact->CreateAssistentDlg( NULL, !bNewDocDirect ) : 0 ); --- 27 unchanged lines hidden (view full) --- 623 SfxAllItemSet aSet( *rReq.GetArgs()->GetPool() ); 624 aSet.Put( aFile ); 625 aSet.Put( aReferer ); 626 // Put the password into the request 627 // only if it is not empty. 628 if (aPasswrd.Len() > 0) 629 aSet.Put( aPassword ); 630 | 584 pFrame = CreateEmptyDocument( DOCUMENT_TYPE_IMPRESS, xTargetFrame ); 585 bMakeLayoutVisible = true; 586 } 587 } 588 else 589 { 590 SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); 591 std::auto_ptr< AbstractAssistentDlg > pPilotDlg( pFact ? pFact->CreateAssistentDlg( NULL, !bNewDocDirect ) : 0 ); --- 27 unchanged lines hidden (view full) --- 619 SfxAllItemSet aSet( *rReq.GetArgs()->GetPool() ); 620 aSet.Put( aFile ); 621 aSet.Put( aReferer ); 622 // Put the password into the request 623 // only if it is not empty. 624 if (aPasswrd.Len() > 0) 625 aSet.Put( aPassword ); 626 |
631 const SfxPoolItem* pRet = SfxFrame::OpenDocumentSynchron( aSet, xTargetFrame ); 632 const SfxViewFrameItem* pFrameItem = PTR_CAST( SfxViewFrameItem, pRet ); 633 if ( pFrameItem && pFrameItem->GetFrame() ) 634 pFrame = &pFrameItem->GetFrame()->GetFrame(); | 627 const SfxPoolItem* pRet = SfxFrame::OpenDocumentSynchron( aSet, xTargetFrame ); 628 const SfxViewFrameItem* pFrameItem = PTR_CAST( SfxViewFrameItem, pRet ); 629 if ( pFrameItem && pFrameItem->GetFrame() ) 630 pFrame = &pFrameItem->GetFrame()->GetFrame(); |
635 } 636 else 637 { 638 SfxRequest aRequest (SID_OPENDOC, SFX_CALLMODE_SYNCHRON, SFX_APP()->GetPool()); 639 aRequest.AppendItem (aFile); 640 aRequest.AppendItem (aReferer); 641 // Put the password into the request 642 // only if it is not empty. 643 if (aPasswrd.Len() > 0) 644 aRequest.AppendItem (aPassword); 645 aRequest.AppendItem (SfxStringItem ( 646 SID_TARGETNAME, 647 String (RTL_CONSTASCII_USTRINGPARAM ("_default")))); 648 try 649 { | 631 } 632 else 633 { 634 SfxRequest aRequest (SID_OPENDOC, SFX_CALLMODE_SYNCHRON, SFX_APP()->GetPool()); 635 aRequest.AppendItem (aFile); 636 aRequest.AppendItem (aReferer); 637 // Put the password into the request 638 // only if it is not empty. 639 if (aPasswrd.Len() > 0) 640 aRequest.AppendItem (aPassword); 641 aRequest.AppendItem (SfxStringItem ( 642 SID_TARGETNAME, 643 String (RTL_CONSTASCII_USTRINGPARAM ("_default")))); 644 try 645 { |
650 const SfxPoolItem* pRet = SFX_APP()->ExecuteSlot (aRequest); 651 const SfxViewFrameItem* pFrameItem = PTR_CAST( SfxViewFrameItem, pRet ); 652 if ( pFrameItem ) 653 pFrame = &pFrameItem->GetFrame()->GetFrame(); | 646 const SfxPoolItem* pRet = SFX_APP()->ExecuteSlot (aRequest); 647 const SfxViewFrameItem* pFrameItem = PTR_CAST( SfxViewFrameItem, pRet ); 648 if ( pFrameItem ) 649 pFrame = &pFrameItem->GetFrame()->GetFrame(); |
654 } 655 catch (::com::sun::star::uno::Exception e) 656 { 657 DBG_ASSERT (sal_False, "caught IllegalArgumentException while loading document from Impress autopilot"); 658 } 659 } 660 } 661 --- 7 unchanged lines hidden (view full) --- 669 } 670 } 671 else 672 { 673 SfxObjectShellLock xShell( pPilotDlg->GetDocument() ); 674 SfxObjectShell* pShell = xShell; 675 if( pShell ) 676 { | 650 } 651 catch (::com::sun::star::uno::Exception e) 652 { 653 DBG_ASSERT (sal_False, "caught IllegalArgumentException while loading document from Impress autopilot"); 654 } 655 } 656 } 657 --- 7 unchanged lines hidden (view full) --- 665 } 666 } 667 else 668 { 669 SfxObjectShellLock xShell( pPilotDlg->GetDocument() ); 670 SfxObjectShell* pShell = xShell; 671 if( pShell ) 672 { |
677 pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pShell, xTargetFrame ); | 673 pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pShell, xTargetFrame ); |
678 DBG_ASSERT( pViewFrame, "no ViewFrame!!" ); | 674 DBG_ASSERT( pViewFrame, "no ViewFrame!!" ); |
679 pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL; | 675 pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL; |
680 681 if(bNewDocDirect && !bStartWithTemplate) 682 { 683 std::auto_ptr< SfxItemSet > pRet( CreateItemSet( SID_SD_EDITOPTIONS ) ); 684 if(pRet.get()) 685 ApplyItemSet( SID_SD_EDITOPTIONS, *pRet.get() ); 686 } 687 --- 24 unchanged lines hidden (view full) --- 712 AddSummaryPage(pViewFrame, pDoc); 713 714 // empty document 715 if((aDocPath.Len() == 0) && pViewFrame && pViewFrame->GetDispatcher()) 716 { 717 SfxBoolItem aIsChangedItem(SID_MODIFYPAGE, !bIsDocEmpty); 718 SfxUInt32Item eAutoLayout( ID_VAL_WHATLAYOUT, (sal_uInt32) AUTOLAYOUT_TITLE ); 719 pViewFrame->GetDispatcher()->Execute(SID_MODIFYPAGE, | 676 677 if(bNewDocDirect && !bStartWithTemplate) 678 { 679 std::auto_ptr< SfxItemSet > pRet( CreateItemSet( SID_SD_EDITOPTIONS ) ); 680 if(pRet.get()) 681 ApplyItemSet( SID_SD_EDITOPTIONS, *pRet.get() ); 682 } 683 --- 24 unchanged lines hidden (view full) --- 708 AddSummaryPage(pViewFrame, pDoc); 709 710 // empty document 711 if((aDocPath.Len() == 0) && pViewFrame && pViewFrame->GetDispatcher()) 712 { 713 SfxBoolItem aIsChangedItem(SID_MODIFYPAGE, !bIsDocEmpty); 714 SfxUInt32Item eAutoLayout( ID_VAL_WHATLAYOUT, (sal_uInt32) AUTOLAYOUT_TITLE ); 715 pViewFrame->GetDispatcher()->Execute(SID_MODIFYPAGE, |
720 SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aIsChangedItem, &eAutoLayout, 0L); | 716 SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aIsChangedItem, &eAutoLayout, 0L); |
721 } 722 723 // clear document info | 717 } 718 719 // clear document info |
724 using namespace ::com::sun::star; 725 uno::Reference<document::XDocumentPropertiesSupplier> xDPS( 726 pDocShell->GetModel(), uno::UNO_QUERY_THROW); 727 uno::Reference<document::XDocumentProperties> 728 xDocProps(xDPS->getDocumentProperties()); 729 DBG_ASSERT(xDocProps.is(), "no DocumentProperties"); 730 xDocProps->resetUserData( 731 SvtUserOptions().GetFullName() ); 732 xDocProps->setTemplateName(xDocProps->getTitle()); 733 xDocProps->setTemplateURL(pPilotDlg->GetDocPath()); | 720 using namespace ::com::sun::star; 721 uno::Reference<document::XDocumentPropertiesSupplier> xDPS( 722 pDocShell->GetModel(), uno::UNO_QUERY_THROW); 723 uno::Reference<document::XDocumentProperties> 724 xDocProps(xDPS->getDocumentProperties()); 725 DBG_ASSERT(xDocProps.is(), "no DocumentProperties"); 726 xDocProps->resetUserData( 727 SvtUserOptions().GetFullName() ); 728 xDocProps->setTemplateName(xDocProps->getTitle()); 729 xDocProps->setTemplateURL(pPilotDlg->GetDocPath()); |
734 | 730 |
735 pDoc->SetChanged(!bIsDocEmpty); | 731 pDoc->SetChanged(!bIsDocEmpty); |
736 737 pDocShell->SetUseUserData(sal_True); 738 739 // #94652# clear UNDO stack after autopilot 740 pDocShell->ClearUndoBuffer(); 741 742 bMakeLayoutVisible = true; 743 } --- 19 unchanged lines hidden (view full) --- 763 pNewDocSh->DoInitNew(NULL); 764 SdDrawDocument* pDoc = pNewDocSh->GetDoc(); 765 if(pDoc) 766 { 767 pDoc->CreateFirstPages(); 768 pDoc->StopWorkStartupDelay(); 769 } 770 | 732 733 pDocShell->SetUseUserData(sal_True); 734 735 // #94652# clear UNDO stack after autopilot 736 pDocShell->ClearUndoBuffer(); 737 738 bMakeLayoutVisible = true; 739 } --- 19 unchanged lines hidden (view full) --- 759 pNewDocSh->DoInitNew(NULL); 760 SdDrawDocument* pDoc = pNewDocSh->GetDoc(); 761 if(pDoc) 762 { 763 pDoc->CreateFirstPages(); 764 pDoc->StopWorkStartupDelay(); 765 } 766 |
771 SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pNewDocSh, i_rFrame ); 772 OSL_ENSURE( pViewFrame, "SdModule::CreateEmptyDocument: no view frame - was the document really loaded?" ); 773 pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL; | 767 SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pNewDocSh, i_rFrame ); 768 OSL_ENSURE( pViewFrame, "SdModule::CreateEmptyDocument: no view frame - was the document really loaded?" ); 769 pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL; |
774 } 775 776 return pFrame; 777} 778 779void SdModule::ChangeMedium( ::sd::DrawDocShell* pDocShell, SfxViewFrame* pViewFrame, const sal_Int32 eMedium ) 780{ 781 if( !pDocShell ) --- 20 unchanged lines hidden (view full) --- 802 { 803 // Der Printer gibt leider kein exaktes 804 // Format (z.B. A4) zurueck 805 Size aSize(pPrinter->GetPaperSize()); 806 Paper ePaper = SvxPaperInfo::GetSvxPaper( aSize, MAP_100TH_MM, sal_True); 807 808 if (ePaper != PAPER_USER) 809 { | 770 } 771 772 return pFrame; 773} 774 775void SdModule::ChangeMedium( ::sd::DrawDocShell* pDocShell, SfxViewFrame* pViewFrame, const sal_Int32 eMedium ) 776{ 777 if( !pDocShell ) --- 20 unchanged lines hidden (view full) --- 798 { 799 // Der Printer gibt leider kein exaktes 800 // Format (z.B. A4) zurueck 801 Size aSize(pPrinter->GetPaperSize()); 802 Paper ePaper = SvxPaperInfo::GetSvxPaper( aSize, MAP_100TH_MM, sal_True); 803 804 if (ePaper != PAPER_USER) 805 { |
810 // Korrekte Size holen | 806 // Get correct size |
811 aSize = SvxPaperInfo::GetPaperSize(ePaper, MAP_100TH_MM); 812 } 813 814 if (aSize.Height() > aSize.Width()) 815 { | 807 aSize = SvxPaperInfo::GetPaperSize(ePaper, MAP_100TH_MM); 808 } 809 810 if (aSize.Height() > aSize.Width()) 811 { |
816 // Stets Querformat | 812 // Always Landscape |
817 aNewSize.Width() = aSize.Height(); 818 aNewSize.Height() = aSize.Width(); 819 } 820 else 821 { 822 aNewSize = aSize; 823 } 824 } --- 24 unchanged lines hidden (view full) --- 849 aNewSize = Size(27000, 18000); 850 nLeft =0; 851 nRight=0; 852 nUpper=0; 853 nLower=0; 854 } 855 break; 856 | 813 aNewSize.Width() = aSize.Height(); 814 aNewSize.Height() = aSize.Width(); 815 } 816 else 817 { 818 aNewSize = aSize; 819 } 820 } --- 24 unchanged lines hidden (view full) --- 845 aNewSize = Size(27000, 18000); 846 nLeft =0; 847 nRight=0; 848 nUpper=0; 849 nLower=0; 850 } 851 break; 852 |
857 case OUTPUT_PRESENTATION: | 853 case OUTPUT_PRESENTATION_4_BY_3: |
858 { 859 aNewSize = Size(28000, 21000); 860 nLeft =0; 861 nRight=0; 862 nUpper=0; 863 nLower=0; 864 } 865 break; | 854 { 855 aNewSize = Size(28000, 21000); 856 nLeft =0; 857 nRight=0; 858 nUpper=0; 859 nLower=0; 860 } 861 break; |
862 863 case OUTPUT_PRESENTATION_16_BY_9: // not used yet 864 { 865 aNewSize = Size(28000, 15750); 866 nLeft =0; 867 nRight=0; 868 nUpper=0; 869 nLower=0; 870 } 871 break; 872 873 case OUTPUT_PRESENTATION_16_BY_10: // not used yet 874 { 875 aNewSize = Size(28000, 17500); 876 nLeft =0; 877 nRight=0; 878 nUpper=0; 879 nLower=0; 880 } 881 break; |
|
866 } 867 868 sal_Bool bScaleAll = sal_True; 869 sal_uInt16 nPageCnt = pDoc->GetMasterSdPageCount(PK_STANDARD); 870 sal_uInt16 i; 871 SdPage* pPage; 872 873 // master pages first --- 52 unchanged lines hidden (view full) --- 926 927 928 929//===== OutlineToImpressFinalize ============================================== 930 931namespace { 932 933OutlineToImpressFinalizer::OutlineToImpressFinalizer ( | 882 } 883 884 sal_Bool bScaleAll = sal_True; 885 sal_uInt16 nPageCnt = pDoc->GetMasterSdPageCount(PK_STANDARD); 886 sal_uInt16 i; 887 SdPage* pPage; 888 889 // master pages first --- 52 unchanged lines hidden (view full) --- 942 943 944 945//===== OutlineToImpressFinalize ============================================== 946 947namespace { 948 949OutlineToImpressFinalizer::OutlineToImpressFinalizer ( |
934 ::sd::ViewShellBase& rBase, 935 SdDrawDocument& rDocument, 936 SvLockBytes& rBytes) 937 : mrBase(rBase), 938 mrDocument(rDocument), 939 mpStream() | 950 ::sd::ViewShellBase& rBase, 951 SdDrawDocument& rDocument, 952 SvLockBytes& rBytes) 953 : mrBase(rBase), 954 mrDocument(rDocument), 955 mpStream() |
940{ | 956{ |
941 // The given stream has a lifetime shorter than this new 942 // OutlineToImpressFinalizer object. Therefore a local copy of the 943 // stream is created. 944 const SvStream* pStream (rBytes.GetStream()); 945 if (pStream != NULL) 946 { 947 // Create a memory stream and prepare to fill it with the content of 948 // the original stream. 949 mpStream.reset(new SvMemoryStream()); 950 static const sal_Size nBufferSize = 4096; 951 ::boost::scoped_array<sal_Int8> pBuffer (new sal_Int8[nBufferSize]); | 957 // The given stream has a lifetime shorter than this new 958 // OutlineToImpressFinalizer object. Therefore a local copy of the 959 // stream is created. 960 const SvStream* pStream (rBytes.GetStream()); 961 if (pStream != NULL) 962 { 963 // Create a memory stream and prepare to fill it with the content of 964 // the original stream. 965 mpStream.reset(new SvMemoryStream()); 966 static const sal_Size nBufferSize = 4096; 967 ::boost::scoped_array<sal_Int8> pBuffer (new sal_Int8[nBufferSize]); |
952 | 968 |
953 sal_Size nReadPosition (0); 954 bool bLoop (true); 955 while (bLoop) 956 { 957 // Read the next part of the original stream. 958 sal_Size nReadByteCount (0); 959 const ErrCode nErrorCode ( 960 rBytes.ReadAt( 961 nReadPosition, 962 reinterpret_cast<void*>(pBuffer.get()), 963 nBufferSize, 964 &nReadByteCount)); | 969 sal_Size nReadPosition (0); 970 bool bLoop (true); 971 while (bLoop) 972 { 973 // Read the next part of the original stream. 974 sal_Size nReadByteCount (0); 975 const ErrCode nErrorCode ( 976 rBytes.ReadAt( 977 nReadPosition, 978 reinterpret_cast<void*>(pBuffer.get()), 979 nBufferSize, 980 &nReadByteCount)); |
965 | 981 |
966 // Check the error code and stop copying the stream data when an 967 // error has occurred. 968 switch (nErrorCode) 969 { 970 case ERRCODE_NONE: 971 if (nReadByteCount == 0) 972 bLoop = false; 973 break; 974 case ERRCODE_IO_PENDING: 975 break; | 982 // Check the error code and stop copying the stream data when an 983 // error has occurred. 984 switch (nErrorCode) 985 { 986 case ERRCODE_NONE: 987 if (nReadByteCount == 0) 988 bLoop = false; 989 break; 990 case ERRCODE_IO_PENDING: 991 break; |
976 | 992 |
977 default: 978 bLoop = false; 979 nReadByteCount = 0; 980 break; 981 } | 993 default: 994 bLoop = false; 995 nReadByteCount = 0; 996 break; 997 } |
982 | 998 |
983 // Append the read bytes to the end of the memory stream. 984 if (nReadByteCount > 0) 985 { 986 mpStream->Write(reinterpret_cast<void*>(pBuffer.get()), nReadByteCount); 987 nReadPosition += nReadByteCount; 988 } 989 } | 999 // Append the read bytes to the end of the memory stream. 1000 if (nReadByteCount > 0) 1001 { 1002 mpStream->Write(reinterpret_cast<void*>(pBuffer.get()), nReadByteCount); 1003 nReadPosition += nReadByteCount; 1004 } 1005 } |
990 | 1006 |
991 // Rewind the memory stream so that in the operator() method its 992 // content is properly read. 993 mpStream->Seek(STREAM_SEEK_TO_BEGIN); 994 } | 1007 // Rewind the memory stream so that in the operator() method its 1008 // content is properly read. 1009 mpStream->Seek(STREAM_SEEK_TO_BEGIN); 1010 } |
995} 996 997 998 999 1000void OutlineToImpressFinalizer::operator() (bool) 1001{ | 1011} 1012 1013 1014 1015 1016void OutlineToImpressFinalizer::operator() (bool) 1017{ |
1002 // Fetch the new outline view shell. 1003 ::sd::OutlineViewShell* pOutlineShell 1004 = dynamic_cast<sd::OutlineViewShell*>(FrameworkHelper::Instance(mrBase)->GetViewShell(FrameworkHelper::msCenterPaneURL).get()); | 1018 // Fetch the new outline view shell. 1019 ::sd::OutlineViewShell* pOutlineShell 1020 = dynamic_cast<sd::OutlineViewShell*>(FrameworkHelper::Instance(mrBase)->GetViewShell(FrameworkHelper::msCenterPaneURL).get()); |
1005 | 1021 |
1006 if (pOutlineShell != NULL && mpStream.get() != NULL) 1007 { 1008 sd::OutlineView* pView = static_cast<sd::OutlineView*>(pOutlineShell->GetView()); 1009 // mba: the stream can't contain any relative URLs, because we don't 1010 // have any information about a BaseURL! 1011 if ( pOutlineShell->Read(*mpStream, String(), EE_FORMAT_RTF) == 0 ) 1012 { | 1022 if (pOutlineShell != NULL && mpStream.get() != NULL) 1023 { 1024 sd::OutlineView* pView = static_cast<sd::OutlineView*>(pOutlineShell->GetView()); 1025 // mba: the stream can't contain any relative URLs, because we don't 1026 // have any information about a BaseURL! 1027 if ( pOutlineShell->Read(*mpStream, String(), EE_FORMAT_RTF) == 0 ) 1028 { |
1013/* 1014 sd::OutlineViewPageChangesGuard aGuard( pView ); 1015 | 1029/* 1030 sd::OutlineViewPageChangesGuard aGuard( pView ); 1031 |
1016 // Remove the first empty pages 1017 sal_uInt16 nPageCount = mrDocument.GetPageCount(); 1018 mrDocument.RemovePage( --nPageCount ); // notes page 1019 mrDocument.RemovePage( --nPageCount ); // standard page | 1032 // Remove the first empty pages 1033 sal_uInt16 nPageCount = mrDocument.GetPageCount(); 1034 mrDocument.RemovePage( --nPageCount ); // notes page 1035 mrDocument.RemovePage( --nPageCount ); // standard page |
1020*/ | 1036*/ |
1021 } | 1037 } |
1022 | 1038 |
1023 // Call UpdatePreview once for every slide to resync the 1024 // document with the outliner of the OutlineViewShell. 1025 sal_uInt16 nPageCount (mrDocument.GetSdPageCount(PK_STANDARD)); 1026 for (sal_uInt16 nIndex=0; nIndex<nPageCount; nIndex++) 1027 { 1028 SdPage* pPage = mrDocument.GetSdPage(nIndex, PK_STANDARD); 1029 // Make the page the actual page so that the 1030 // following UpdatePreview() call accesses the 1031 // correct paragraphs. 1032 pView->SetActualPage(pPage); 1033 pOutlineShell->UpdatePreview(pPage, true); 1034 } 1035 // Select the first slide. 1036 SdPage* pPage = mrDocument.GetSdPage(0, PK_STANDARD); 1037 pView->SetActualPage(pPage); 1038 pOutlineShell->UpdatePreview(pPage, true); 1039 } | 1039 // Call UpdatePreview once for every slide to resync the 1040 // document with the outliner of the OutlineViewShell. 1041 sal_uInt16 nPageCount (mrDocument.GetSdPageCount(PK_STANDARD)); 1042 for (sal_uInt16 nIndex=0; nIndex<nPageCount; nIndex++) 1043 { 1044 SdPage* pPage = mrDocument.GetSdPage(nIndex, PK_STANDARD); 1045 // Make the page the actual page so that the 1046 // following UpdatePreview() call accesses the 1047 // correct paragraphs. 1048 pView->SetActualPage(pPage); 1049 pOutlineShell->UpdatePreview(pPage, true); 1050 } 1051 // Select the first slide. 1052 SdPage* pPage = mrDocument.GetSdPage(0, PK_STANDARD); 1053 pView->SetActualPage(pPage); 1054 pOutlineShell->UpdatePreview(pPage, true); 1055 } |
1040 1041 | 1056 1057 |
1042 // #97231# Undo-Stack needs to be cleared, else the user may remove the 1043 // only drawpage and this is a state we cannot handle ATM. 1044 ::sd::DrawDocShell* pDocShell = mrDocument.GetDocSh(); | 1058 // #97231# Undo-Stack needs to be cleared, else the user may remove the 1059 // only drawpage and this is a state we cannot handle ATM. 1060 ::sd::DrawDocShell* pDocShell = mrDocument.GetDocSh(); |
1045 if( pDocShell ) 1046 pDocShell->ClearUndoBuffer(); 1047} 1048 1049 1050} // end of anonymous namespace | 1061 if( pDocShell ) 1062 pDocShell->ClearUndoBuffer(); 1063} 1064 1065 1066} // end of anonymous namespace |
1067 1068/* vim: set noet sw=4 ts=4: */ |
|