office-gobmx/sd/source/ui/app/sdmod1.cxx

1066 lines
38 KiB
C++
Raw Normal View History

2000-09-18 11:07:07 -05:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2000-09-18 11:07:07 -05:00
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
2000-09-18 11:07:07 -05:00
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 11:07:07 -05:00
*
* This file is part of OpenOffice.org.
2000-09-18 11:07:07 -05:00
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
2000-09-18 11:07:07 -05:00
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
2000-09-18 11:07:07 -05:00
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
2000-09-18 11:07:07 -05:00
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sd.hxx"
#include <svl/lckbitem.hxx>
2000-09-18 11:07:07 -05:00
#include <sfx2/frame.hxx>
#include <sfx2/viewfrm.hxx>
#include <unotools/moduleoptions.hxx>
#include "framework/FrameworkHelper.hxx"
2000-09-18 11:07:07 -05:00
#include <svx/dialogs.hrc>
#include <editeng/langitem.hxx>
#include <editeng/editdata.hxx>
2000-09-18 11:07:07 -05:00
#include <vcl/msgbox.hxx>
#include <editeng/svxenum.hxx>
2000-09-18 11:07:07 -05:00
#include <sfx2/dispatch.hxx>
#include <sfx2/request.hxx>
#include <sfx2/printer.hxx>
#include <sfx2/docfile.hxx>
#include <editeng/paperinf.hxx>
#include <editeng/eeitem.hxx>
#include <unotools/useroptions.hxx>
2000-09-18 11:07:07 -05:00
#include "app.hrc"
#include "glob.hrc"
#include "strings.hrc"
#include "res_bmp.hrc"
#define _SD_DLL // fuer SD_MOD()
#include "sdmod.hxx"
#include "sddll.hxx"
#include "pres.hxx"
#include "optsitem.hxx"
#include "ViewShell.hxx"
2000-09-18 11:07:07 -05:00
#include "sdattr.hxx"
#include "sdpage.hxx"
#include "DrawDocShell.hxx"
2000-09-18 11:07:07 -05:00
#include "drawdoc.hxx"
#include "assclass.hxx"
#include "sdenumdef.hxx"
2000-09-18 11:07:07 -05:00
#include "sdresid.hxx"
#include "OutlineViewShell.hxx"
#include "ViewShellBase.hxx"
#ifndef SD_FRAMW_VIEW_HXX
#include "FrameView.hxx"
#endif
#include "FactoryIds.hxx"
#include "sdabstdlg.hxx"
#include <memory>
#include <boost/shared_ptr.hpp>
#include <boost/scoped_array.hpp>
#include "slideshow.hxx"
2000-09-18 11:07:07 -05:00
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
using ::sd::framework::FrameworkHelper;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::frame::XFrame;
namespace {
class OutlineToImpressFinalizer
{
public:
OutlineToImpressFinalizer (
::sd::ViewShellBase& rBase,
SdDrawDocument& rDocument,
SvLockBytes& rBytes);
virtual ~OutlineToImpressFinalizer (void) {};
void operator() (bool bEventSeen);
private:
::sd::ViewShellBase& mrBase;
SdDrawDocument& mrDocument;
::boost::shared_ptr<SvMemoryStream> mpStream;
};
} //end of anonymous namespace
2000-09-18 11:07:07 -05:00
/*************************************************************************
|*
|* Execute
|*
\************************************************************************/
void SdModule::Execute(SfxRequest& rReq)
{
const SfxItemSet* pSet = rReq.GetArgs();
2000-11-27 02:13:01 -06:00
ULONG nSlotId = rReq.GetSlot();
2000-09-18 11:07:07 -05:00
2000-11-27 02:13:01 -06:00
switch ( nSlotId )
2000-09-18 11:07:07 -05:00
{
case SID_NEWDOC:
{
SFX_APP()->ExecuteSlot(rReq, SFX_APP()->GetInterface());
2000-09-18 11:07:07 -05:00
}
break;
case SID_AUTOSPELL_CHECK:
{
// automatische Rechtschreibpruefung
const SfxPoolItem* pItem;
if( pSet && SFX_ITEM_SET == pSet->GetItemState(
SID_AUTOSPELL_CHECK, FALSE, &pItem ) )
{
BOOL bOnlineSpelling = ( (const SfxBoolItem*) pItem )->GetValue();
// am Dokument sichern:
::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
2000-09-18 11:07:07 -05:00
if( pDocSh )
{
SdDrawDocument* pDoc = pDocSh->GetDoc();
pDoc->SetOnlineSpell( bOnlineSpelling );
}
}
}
break;
case SID_ATTR_METRIC:
{
const SfxPoolItem* pItem;
if ( pSet && SFX_ITEM_SET == pSet->GetItemState( SID_ATTR_METRIC, TRUE, &pItem ) )
{
FieldUnit eUnit = (FieldUnit)((const SfxUInt16Item*)pItem)->GetValue();
switch( eUnit )
{
case FUNIT_MM: // nur die Einheiten, die auch im Dialog stehen
case FUNIT_CM:
case FUNIT_INCH:
case FUNIT_PICA:
case FUNIT_POINT:
{
::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() );
2000-09-18 11:07:07 -05:00
if(pDocSh)
{
DocumentType eDocType = pDocSh->GetDoc()->GetDocumentType();
PutItem( *pItem );
SdOptions* pOptions = GetSdOptions( eDocType );
if(pOptions)
pOptions->SetMetric( (UINT16)eUnit );
2000-09-18 11:07:07 -05:00
rReq.Done();
}
}
break;
default:
break;
2000-09-18 11:07:07 -05:00
}
}
}
break;
case SID_ATTR_LANGUAGE:
2000-11-27 02:13:01 -06:00
case SID_ATTR_CHAR_CJK_LANGUAGE:
case SID_ATTR_CHAR_CTL_LANGUAGE:
2000-09-18 11:07:07 -05:00
{
const SfxPoolItem* pItem;
2000-11-27 02:13:01 -06:00
if( pSet &&
CWS-TOOLING: integrate CWS impress166 2009-01-27 11:42:29 +0100 af r266972 : #i98508# Handle non DrawViewShell view shells correctly. 2009-01-21 10:41:32 +0100 af r266635 : #i98069# Do not call PreModelChange() for every ModelLock. 2009-01-20 15:25:41 +0100 af r266588 : #i98069# Added friend declaration that became necessary on Solaris after recent changes. 2009-01-19 13:48:47 +0100 af r266493 : #i97478# Prevent SID_PARASPACE_(DE|IN)CREASE from crashing when style sheet is missing. 2009-01-16 11:52:37 +0100 af r266411 : #i97338# Check the dispatcher before using it to show a context menu. 2009-01-15 14:33:55 +0100 sj r266373 : #153716# taking care of font-independent line spacing (editmode and hittest) 2009-01-15 14:29:46 +0100 sj r266372 : #153716# taking care of font-independent line spacing also in presentation styles 2009-01-14 14:04:16 +0100 af r266301 : #i97634# Do view change synchronously. Use shared pointers for view shells. 2009-01-14 14:01:27 +0100 af r266300 : #i97634# Added non-API methods that update the configuration synchronously. 2009-01-14 13:34:40 +0100 af r266295 : #i98069# Be more carefull with handling model updates to avoid assertion regarding number of selected pages. 2009-01-14 11:34:57 +0100 cl r266270 : #i97261# force outliner para oibject after text edit 2009-01-14 10:49:08 +0100 cl r266269 : #i97413# dispose cell undo action if shape dies 2009-01-13 18:50:05 +0100 cl r266247 : #i97347# fixed cell undo crash 2009-01-12 14:16:56 +0100 af r266156 : #i97296# Using is() method to check WeakReference for validity. 2009-01-12 13:52:00 +0100 af r266155 : #i97190# Turned static_cast to dynamic_cast in CreateChildList. 2009-01-12 13:06:57 +0100 af r266153 : #i97552# Catching Exceptions caught while accessing OLE-Object that is to be inserted. 2009-01-12 13:06:37 +0100 cl r266152 : #i96164# applied patch to fix ambiguous operation
2009-02-12 06:44:26 -06:00
(
2000-11-27 02:13:01 -06:00
SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_LANGUAGE, FALSE, &pItem ) ||
SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_CHAR_CJK_LANGUAGE, FALSE, &pItem ) ||
CWS-TOOLING: integrate CWS impress166 2009-01-27 11:42:29 +0100 af r266972 : #i98508# Handle non DrawViewShell view shells correctly. 2009-01-21 10:41:32 +0100 af r266635 : #i98069# Do not call PreModelChange() for every ModelLock. 2009-01-20 15:25:41 +0100 af r266588 : #i98069# Added friend declaration that became necessary on Solaris after recent changes. 2009-01-19 13:48:47 +0100 af r266493 : #i97478# Prevent SID_PARASPACE_(DE|IN)CREASE from crashing when style sheet is missing. 2009-01-16 11:52:37 +0100 af r266411 : #i97338# Check the dispatcher before using it to show a context menu. 2009-01-15 14:33:55 +0100 sj r266373 : #153716# taking care of font-independent line spacing (editmode and hittest) 2009-01-15 14:29:46 +0100 sj r266372 : #153716# taking care of font-independent line spacing also in presentation styles 2009-01-14 14:04:16 +0100 af r266301 : #i97634# Do view change synchronously. Use shared pointers for view shells. 2009-01-14 14:01:27 +0100 af r266300 : #i97634# Added non-API methods that update the configuration synchronously. 2009-01-14 13:34:40 +0100 af r266295 : #i98069# Be more carefull with handling model updates to avoid assertion regarding number of selected pages. 2009-01-14 11:34:57 +0100 cl r266270 : #i97261# force outliner para oibject after text edit 2009-01-14 10:49:08 +0100 cl r266269 : #i97413# dispose cell undo action if shape dies 2009-01-13 18:50:05 +0100 cl r266247 : #i97347# fixed cell undo crash 2009-01-12 14:16:56 +0100 af r266156 : #i97296# Using is() method to check WeakReference for validity. 2009-01-12 13:52:00 +0100 af r266155 : #i97190# Turned static_cast to dynamic_cast in CreateChildList. 2009-01-12 13:06:57 +0100 af r266153 : #i97552# Catching Exceptions caught while accessing OLE-Object that is to be inserted. 2009-01-12 13:06:37 +0100 cl r266152 : #i96164# applied patch to fix ambiguous operation
2009-02-12 06:44:26 -06:00
SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_CHAR_CTL_LANGUAGE, FALSE, &pItem )
)
)
2000-09-18 11:07:07 -05:00
{
// am Dokument sichern:
::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
2000-09-18 11:07:07 -05:00
if ( pDocSh )
{
LanguageType eLanguage = ( (SvxLanguageItem*)pItem )->GetValue();
SdDrawDocument* pDoc = pDocSh->GetDoc();
2000-11-27 02:13:01 -06:00
if( nSlotId == SID_ATTR_CHAR_CJK_LANGUAGE )
2000-12-08 06:31:46 -06:00
pDoc->SetLanguage( eLanguage, EE_CHAR_LANGUAGE_CJK );
2000-11-27 02:13:01 -06:00
else if( nSlotId == SID_ATTR_CHAR_CTL_LANGUAGE )
2000-12-08 06:31:46 -06:00
pDoc->SetLanguage( eLanguage, EE_CHAR_LANGUAGE_CTL );
2000-11-27 02:13:01 -06:00
else
2000-12-08 06:31:46 -06:00
pDoc->SetLanguage( eLanguage, EE_CHAR_LANGUAGE );
2000-09-18 11:07:07 -05:00
if( pDoc->GetOnlineSpell() )
{
pDoc->StopOnlineSpelling();
pDoc->StartOnlineSpelling();
}
}
}
}
break;
case SID_SD_AUTOPILOT:
case SID_NEWSD:
2000-09-18 11:07:07 -05:00
{
SfxFrame* pFrame = ExecuteNewDocument( rReq );
// #94442# if a frame was created, set it as return value
if(pFrame)
rReq.SetReturnValue(SfxFrameItem(0, pFrame));
2000-09-18 11:07:07 -05:00
}
break;
2000-09-18 11:07:07 -05:00
case SID_OPENHYPERLINK:
2000-09-18 11:07:07 -05:00
case SID_OPENDOC:
{
BOOL bIntercept = FALSE;
::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
2000-09-18 11:07:07 -05:00
if (pDocShell)
{
::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
2000-09-18 11:07:07 -05:00
if (pViewShell)
{
if( sd::SlideShow::IsRunning( pViewShell->GetViewShellBase() ) )
2000-09-18 11:07:07 -05:00
{
// Prevent documents from opening while the slide
// show is running, except when this request comes
// from a shape interaction.
if (rReq.GetArgs() == NULL)
{
bIntercept = TRUE;
}
2000-09-18 11:07:07 -05:00
}
}
}
if (!bIntercept)
{
SFX_APP()->ExecuteSlot(rReq, SFX_APP()->GetInterface());
2000-09-18 11:07:07 -05:00
}
else
{
ErrorBox(NULL, WB_OK, String(SdResId(STR_CANT_PERFORM_IN_LIVEMODE))).Execute();
SFX_REQUEST_ARG( rReq, pLinkItem, SfxLinkItem, SID_DONELINK, FALSE );
if( pLinkItem )
pLinkItem->GetValue().Call( 0 );
}
}
break;
case SID_OUTLINE_TO_IMPRESS:
OutlineToImpress (rReq);
break;
2000-09-18 11:07:07 -05:00
default:
break;
}
}
2000-09-18 11:07:07 -05:00
void SdModule::OutlineToImpress (SfxRequest& rRequest)
{
const SfxItemSet* pSet = rRequest.GetArgs();
2000-09-18 11:07:07 -05:00
if (pSet)
{
SvLockBytes* pBytes = ((SfxLockBytesItem&) pSet->Get(SID_OUTLINE_TO_IMPRESS)).GetValue();
2000-09-18 11:07:07 -05:00
if (pBytes)
{
SfxObjectShellLock xDocShell;
::sd::DrawDocShell* pDocSh;
xDocShell = pDocSh = new ::sd::DrawDocShell(
SFX_CREATE_MODE_STANDARD, FALSE);
if(pDocSh)
{
pDocSh->DoInitNew(NULL);
SdDrawDocument* pDoc = pDocSh->GetDoc();
if(pDoc)
{
pDoc->CreateFirstPages();
pDoc->StopWorkStartupDelay();
}
2000-09-18 11:07:07 -05:00
SFX_REQUEST_ARG( rRequest, pFrmItem, SfxFrameItem, SID_DOCFRAME, FALSE);
SfxViewFrame::LoadDocumentIntoFrame( *pDocSh, pFrmItem, ::sd::OUTLINE_FACTORY_ID );
::sd::ViewShell* pViewSh = pDocSh->GetViewShell();
if (pViewSh)
{
// AutoLayouts muessen fertig sein
pDoc->StopWorkStartupDelay();
SfxViewFrame* pViewFrame = pViewSh->GetViewFrame();
// When the view frame has not been just created we have
// to switch synchronously to the outline view.
// (Otherwise the request will be ignored anyway.)
::sd::ViewShellBase* pBase
= dynamic_cast< ::sd::ViewShellBase*>(pViewFrame->GetViewShell());
if (pBase != NULL)
{
::boost::shared_ptr<FrameworkHelper> pHelper (
FrameworkHelper::Instance(*pBase));
pHelper->RequestView(
FrameworkHelper::msOutlineViewURL,
FrameworkHelper::msCenterPaneURL);
pHelper->RunOnResourceActivation(
FrameworkHelper::CreateResourceId(
FrameworkHelper::msOutlineViewURL,
FrameworkHelper::msCenterPaneURL),
OutlineToImpressFinalizer(*pBase, *pDoc, *pBytes));
}
2000-09-18 11:07:07 -05:00
}
}
2000-09-18 11:07:07 -05:00
}
}
rRequest.IsDone();
2000-09-18 11:07:07 -05:00
}
2000-09-18 11:07:07 -05:00
/*************************************************************************
|*
|* GetState
|*
\************************************************************************/
CWS-TOOLING: integrate CWS appleremote02 2009-01-11 00:33:34 +0100 ericb r266127 : #i97925# start the presentation if and only if an Impress document is focused 2009-01-10 00:02:19 +0100 ericb r266124 : #i96978# cosmetic changes 2009-01-09 23:56:02 +0100 ericb r266123 : #i96978# simplify the code, and make the remote work in windowed mode 2009-01-08 21:25:52 +0100 ericb r266040 : #i96978# avoid to add the eventlistener several times 2009-01-08 14:54:38 +0100 ericb r266013 : #i96978# keep the MEDIA_COMMAND_VOLUME cases for QUARTZ only for the moment 2009-01-08 14:49:17 +0100 ericb r266011 : #i96978# fix wrong comments 2009-01-03 01:42:02 +0100 cloph r265848 : CWS-TOOLING: rebase CWS appleremote02 -> DEV300_m38 (manually, module was left out when using the tooling) 2008-12-30 00:11:30 +0100 ericb r265827 : CWS-TOOLING: rebase CWS appleremote02 to trunk@265758 (milestone: DEV300:m38) 2008-12-29 21:42:14 +0100 ericb r265825 : #i96978# comment the menu in appleremote02 2008-12-29 10:30:40 +0100 ericb r265816 : #i97195# remove the event listener in the dtor 2008-12-23 23:39:55 +0100 ericb r265794 : #i96978# cleanup 2008-12-23 08:49:49 +0100 ericb r265771 : #i96978# add MEDIA_COMMAND_VOLUME_UP and MEDIA_COMMAND_VOLUME_DOWN and the kRemoteButtonMenu (temporarly) 2008-12-23 08:47:27 +0100 ericb r265769 : #i96978# add all cases, for future use 2008-12-20 13:38:25 +0100 ericb r265743 : #i96978# fix a potential breaker (causing warning) 2008-12-20 12:22:15 +0100 ericb r265742 : #i97195# implement the new event listener + callback in Impress, to detect play 2008-12-20 12:20:42 +0100 ericb r265741 : #i97195# add the event listener in SdModule 2008-12-20 12:19:02 +0100 ericb r265740 : #i97195# add the nCommand for MEDIA_COMMAND_PLAY 2008-12-14 18:32:52 +0100 ericb r265456 : #i96978# add the possibility to switch the way to send the PLAY event in debug mode (will be removed once i97195 will be fixed) 2008-12-08 22:18:29 +0100 ericb r265050 : #i96978# removing Carbon dependancy and simplify 2008-12-07 19:54:18 +0100 ericb r264966 : #i96978# implement the new MEDIA_COMMAND events in salinst 2008-12-07 19:53:10 +0100 ericb r264965 : #i96978# add new event type for the Apple Remote on Mac OS X 2008-12-07 19:51:21 +0100 ericb r264964 : #i96978# add gotoLastSlide with MEDIA_COMMAND events (was missing) 2008-12-07 19:46:35 +0100 ericb r264962 : #i96992# fix an error when building with debug enabled 2008-12-07 19:45:04 +0100 ericb r264961 : #i96978# Implement a new event mangement for the Apple remote 2008-12-07 18:59:58 +0100 ericb r264957 : #i96554# fix wrong argument causing warnings 2008-12-07 18:57:56 +0100 ericb r264956 : #i96554# fix wrong argument type 2008-12-07 18:55:22 +0100 ericb r264955 : #i96978# adding a new event type
2009-01-20 09:57:31 -06:00
static bool bOnce = false;
2000-09-18 11:07:07 -05:00
void SdModule::GetState(SfxItemSet& rItemSet)
{
// Autopilot waehrend der Praesentation disablen
if (rItemSet.GetItemState(SID_SD_AUTOPILOT) != SFX_ITEM_UNKNOWN)
{
if (!SvtModuleOptions().IsImpress())
2000-09-18 11:07:07 -05:00
{
rItemSet.DisableItem(SID_SD_AUTOPILOT);
}
else
{
::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
2000-09-18 11:07:07 -05:00
if (pDocShell)
{
::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
2000-09-18 11:07:07 -05:00
if (pViewShell)
{
if( sd::SlideShow::IsRunning( pViewShell->GetViewShellBase() ) )
2000-09-18 11:07:07 -05:00
{
rItemSet.DisableItem(SID_SD_AUTOPILOT);
}
}
}
}
}
if( SFX_ITEM_AVAILABLE == rItemSet.GetItemState( SID_ATTR_METRIC ) )
{
::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() );
2000-09-18 11:07:07 -05:00
if(pDocSh)
{
DocumentType eDocType = pDocSh->GetDoc()->GetDocumentType();
SdOptions* pOptions = GetSdOptions(eDocType);
rItemSet.Put( SfxUInt16Item( SID_ATTR_METRIC, pOptions->GetMetric() ) );
}
}
// der Status von SID_OPENDOC wird von der Basisklasse bestimmt
if (rItemSet.GetItemState(SID_OPENDOC) != SFX_ITEM_UNKNOWN)
{
const SfxPoolItem* pItem = SFX_APP()->GetSlotState(SID_OPENDOC, SFX_APP()->GetInterface());
2000-09-18 11:07:07 -05:00
if (pItem)
rItemSet.Put(*pItem);
}
// der Status von SID_OPENHYPERLINK wird von der Basisklasse bestimmt
if (rItemSet.GetItemState(SID_OPENHYPERLINK) != SFX_ITEM_UNKNOWN)
{
const SfxPoolItem* pItem = SFX_APP()->GetSlotState(SID_OPENHYPERLINK, SFX_APP()->GetInterface());
if (pItem)
rItemSet.Put(*pItem);
}
2008-12-15 06:01:46 -06:00
if( SFX_ITEM_AVAILABLE == rItemSet.GetItemState( SID_AUTOSPELL_CHECK ) )
2000-09-18 11:07:07 -05:00
{
::sd::DrawDocShell* pDocSh =
PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
2000-09-18 11:07:07 -05:00
if( pDocSh )
{
SdDrawDocument* pDoc = pDocSh->GetDoc();
2000-11-27 02:24:52 -06:00
rItemSet.Put( SfxBoolItem( SID_AUTOSPELL_CHECK, pDoc->GetOnlineSpell() ) );
2000-09-18 11:07:07 -05:00
}
}
2000-11-27 02:24:52 -06:00
if( SFX_ITEM_AVAILABLE == rItemSet.GetItemState( SID_ATTR_LANGUAGE ) )
{
::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
2000-11-27 02:24:52 -06:00
if( pDocSh )
rItemSet.Put( SvxLanguageItem( pDocSh->GetDoc()->GetLanguage( EE_CHAR_LANGUAGE ), SID_ATTR_LANGUAGE ) );
2000-11-27 02:24:52 -06:00
}
if( SFX_ITEM_AVAILABLE == rItemSet.GetItemState( SID_ATTR_CHAR_CJK_LANGUAGE ) )
{
::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
2000-11-27 02:24:52 -06:00
if( pDocSh )
rItemSet.Put( SvxLanguageItem( pDocSh->GetDoc()->GetLanguage( EE_CHAR_LANGUAGE_CJK ), SID_ATTR_CHAR_CJK_LANGUAGE ) );
2000-11-27 02:24:52 -06:00
}
if( SFX_ITEM_AVAILABLE == rItemSet.GetItemState( SID_ATTR_CHAR_CTL_LANGUAGE ) )
{
::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
2000-11-27 02:24:52 -06:00
if( pDocSh )
rItemSet.Put( SvxLanguageItem( pDocSh->GetDoc()->GetLanguage( EE_CHAR_LANGUAGE_CTL ), SID_ATTR_CHAR_CTL_LANGUAGE ) );
2000-11-27 02:24:52 -06:00
}
CWS-TOOLING: integrate CWS appleremote02 2009-01-11 00:33:34 +0100 ericb r266127 : #i97925# start the presentation if and only if an Impress document is focused 2009-01-10 00:02:19 +0100 ericb r266124 : #i96978# cosmetic changes 2009-01-09 23:56:02 +0100 ericb r266123 : #i96978# simplify the code, and make the remote work in windowed mode 2009-01-08 21:25:52 +0100 ericb r266040 : #i96978# avoid to add the eventlistener several times 2009-01-08 14:54:38 +0100 ericb r266013 : #i96978# keep the MEDIA_COMMAND_VOLUME cases for QUARTZ only for the moment 2009-01-08 14:49:17 +0100 ericb r266011 : #i96978# fix wrong comments 2009-01-03 01:42:02 +0100 cloph r265848 : CWS-TOOLING: rebase CWS appleremote02 -> DEV300_m38 (manually, module was left out when using the tooling) 2008-12-30 00:11:30 +0100 ericb r265827 : CWS-TOOLING: rebase CWS appleremote02 to trunk@265758 (milestone: DEV300:m38) 2008-12-29 21:42:14 +0100 ericb r265825 : #i96978# comment the menu in appleremote02 2008-12-29 10:30:40 +0100 ericb r265816 : #i97195# remove the event listener in the dtor 2008-12-23 23:39:55 +0100 ericb r265794 : #i96978# cleanup 2008-12-23 08:49:49 +0100 ericb r265771 : #i96978# add MEDIA_COMMAND_VOLUME_UP and MEDIA_COMMAND_VOLUME_DOWN and the kRemoteButtonMenu (temporarly) 2008-12-23 08:47:27 +0100 ericb r265769 : #i96978# add all cases, for future use 2008-12-20 13:38:25 +0100 ericb r265743 : #i96978# fix a potential breaker (causing warning) 2008-12-20 12:22:15 +0100 ericb r265742 : #i97195# implement the new event listener + callback in Impress, to detect play 2008-12-20 12:20:42 +0100 ericb r265741 : #i97195# add the event listener in SdModule 2008-12-20 12:19:02 +0100 ericb r265740 : #i97195# add the nCommand for MEDIA_COMMAND_PLAY 2008-12-14 18:32:52 +0100 ericb r265456 : #i96978# add the possibility to switch the way to send the PLAY event in debug mode (will be removed once i97195 will be fixed) 2008-12-08 22:18:29 +0100 ericb r265050 : #i96978# removing Carbon dependancy and simplify 2008-12-07 19:54:18 +0100 ericb r264966 : #i96978# implement the new MEDIA_COMMAND events in salinst 2008-12-07 19:53:10 +0100 ericb r264965 : #i96978# add new event type for the Apple Remote on Mac OS X 2008-12-07 19:51:21 +0100 ericb r264964 : #i96978# add gotoLastSlide with MEDIA_COMMAND events (was missing) 2008-12-07 19:46:35 +0100 ericb r264962 : #i96992# fix an error when building with debug enabled 2008-12-07 19:45:04 +0100 ericb r264961 : #i96978# Implement a new event mangement for the Apple remote 2008-12-07 18:59:58 +0100 ericb r264957 : #i96554# fix wrong argument causing warnings 2008-12-07 18:57:56 +0100 ericb r264956 : #i96554# fix wrong argument type 2008-12-07 18:55:22 +0100 ericb r264955 : #i96978# adding a new event type
2009-01-20 09:57:31 -06:00
if ( !bOnce )
{
::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
if( pDocShell ) // Impress or Draw ?
{
::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
if( pViewShell && (pDocShell->GetDocumentType() == DOCUMENT_TYPE_IMPRESS) )
{
// add our event listener as soon as possible
Application::AddEventListener( LINK( this, SdModule, EventListenerHdl ) );
bOnce = true;
}
}
}
2000-09-18 11:07:07 -05:00
}
CWS-TOOLING: integrate CWS appleremote02 2009-01-11 00:33:34 +0100 ericb r266127 : #i97925# start the presentation if and only if an Impress document is focused 2009-01-10 00:02:19 +0100 ericb r266124 : #i96978# cosmetic changes 2009-01-09 23:56:02 +0100 ericb r266123 : #i96978# simplify the code, and make the remote work in windowed mode 2009-01-08 21:25:52 +0100 ericb r266040 : #i96978# avoid to add the eventlistener several times 2009-01-08 14:54:38 +0100 ericb r266013 : #i96978# keep the MEDIA_COMMAND_VOLUME cases for QUARTZ only for the moment 2009-01-08 14:49:17 +0100 ericb r266011 : #i96978# fix wrong comments 2009-01-03 01:42:02 +0100 cloph r265848 : CWS-TOOLING: rebase CWS appleremote02 -> DEV300_m38 (manually, module was left out when using the tooling) 2008-12-30 00:11:30 +0100 ericb r265827 : CWS-TOOLING: rebase CWS appleremote02 to trunk@265758 (milestone: DEV300:m38) 2008-12-29 21:42:14 +0100 ericb r265825 : #i96978# comment the menu in appleremote02 2008-12-29 10:30:40 +0100 ericb r265816 : #i97195# remove the event listener in the dtor 2008-12-23 23:39:55 +0100 ericb r265794 : #i96978# cleanup 2008-12-23 08:49:49 +0100 ericb r265771 : #i96978# add MEDIA_COMMAND_VOLUME_UP and MEDIA_COMMAND_VOLUME_DOWN and the kRemoteButtonMenu (temporarly) 2008-12-23 08:47:27 +0100 ericb r265769 : #i96978# add all cases, for future use 2008-12-20 13:38:25 +0100 ericb r265743 : #i96978# fix a potential breaker (causing warning) 2008-12-20 12:22:15 +0100 ericb r265742 : #i97195# implement the new event listener + callback in Impress, to detect play 2008-12-20 12:20:42 +0100 ericb r265741 : #i97195# add the event listener in SdModule 2008-12-20 12:19:02 +0100 ericb r265740 : #i97195# add the nCommand for MEDIA_COMMAND_PLAY 2008-12-14 18:32:52 +0100 ericb r265456 : #i96978# add the possibility to switch the way to send the PLAY event in debug mode (will be removed once i97195 will be fixed) 2008-12-08 22:18:29 +0100 ericb r265050 : #i96978# removing Carbon dependancy and simplify 2008-12-07 19:54:18 +0100 ericb r264966 : #i96978# implement the new MEDIA_COMMAND events in salinst 2008-12-07 19:53:10 +0100 ericb r264965 : #i96978# add new event type for the Apple Remote on Mac OS X 2008-12-07 19:51:21 +0100 ericb r264964 : #i96978# add gotoLastSlide with MEDIA_COMMAND events (was missing) 2008-12-07 19:46:35 +0100 ericb r264962 : #i96992# fix an error when building with debug enabled 2008-12-07 19:45:04 +0100 ericb r264961 : #i96978# Implement a new event mangement for the Apple remote 2008-12-07 18:59:58 +0100 ericb r264957 : #i96554# fix wrong argument causing warnings 2008-12-07 18:57:56 +0100 ericb r264956 : #i96554# fix wrong argument type 2008-12-07 18:55:22 +0100 ericb r264955 : #i96978# adding a new event type
2009-01-20 09:57:31 -06:00
IMPL_LINK( SdModule, EventListenerHdl, VclSimpleEvent*, pEvent )
{
if( pEvent && (pEvent->GetId() == VCLEVENT_WINDOW_COMMAND) && static_cast<VclWindowEvent*>(pEvent)->GetData() )
{
const CommandEvent& rEvent = *(const CommandEvent*)static_cast<VclWindowEvent*>(pEvent)->GetData();
2000-09-18 11:07:07 -05:00
CWS-TOOLING: integrate CWS appleremote02 2009-01-11 00:33:34 +0100 ericb r266127 : #i97925# start the presentation if and only if an Impress document is focused 2009-01-10 00:02:19 +0100 ericb r266124 : #i96978# cosmetic changes 2009-01-09 23:56:02 +0100 ericb r266123 : #i96978# simplify the code, and make the remote work in windowed mode 2009-01-08 21:25:52 +0100 ericb r266040 : #i96978# avoid to add the eventlistener several times 2009-01-08 14:54:38 +0100 ericb r266013 : #i96978# keep the MEDIA_COMMAND_VOLUME cases for QUARTZ only for the moment 2009-01-08 14:49:17 +0100 ericb r266011 : #i96978# fix wrong comments 2009-01-03 01:42:02 +0100 cloph r265848 : CWS-TOOLING: rebase CWS appleremote02 -> DEV300_m38 (manually, module was left out when using the tooling) 2008-12-30 00:11:30 +0100 ericb r265827 : CWS-TOOLING: rebase CWS appleremote02 to trunk@265758 (milestone: DEV300:m38) 2008-12-29 21:42:14 +0100 ericb r265825 : #i96978# comment the menu in appleremote02 2008-12-29 10:30:40 +0100 ericb r265816 : #i97195# remove the event listener in the dtor 2008-12-23 23:39:55 +0100 ericb r265794 : #i96978# cleanup 2008-12-23 08:49:49 +0100 ericb r265771 : #i96978# add MEDIA_COMMAND_VOLUME_UP and MEDIA_COMMAND_VOLUME_DOWN and the kRemoteButtonMenu (temporarly) 2008-12-23 08:47:27 +0100 ericb r265769 : #i96978# add all cases, for future use 2008-12-20 13:38:25 +0100 ericb r265743 : #i96978# fix a potential breaker (causing warning) 2008-12-20 12:22:15 +0100 ericb r265742 : #i97195# implement the new event listener + callback in Impress, to detect play 2008-12-20 12:20:42 +0100 ericb r265741 : #i97195# add the event listener in SdModule 2008-12-20 12:19:02 +0100 ericb r265740 : #i97195# add the nCommand for MEDIA_COMMAND_PLAY 2008-12-14 18:32:52 +0100 ericb r265456 : #i96978# add the possibility to switch the way to send the PLAY event in debug mode (will be removed once i97195 will be fixed) 2008-12-08 22:18:29 +0100 ericb r265050 : #i96978# removing Carbon dependancy and simplify 2008-12-07 19:54:18 +0100 ericb r264966 : #i96978# implement the new MEDIA_COMMAND events in salinst 2008-12-07 19:53:10 +0100 ericb r264965 : #i96978# add new event type for the Apple Remote on Mac OS X 2008-12-07 19:51:21 +0100 ericb r264964 : #i96978# add gotoLastSlide with MEDIA_COMMAND events (was missing) 2008-12-07 19:46:35 +0100 ericb r264962 : #i96992# fix an error when building with debug enabled 2008-12-07 19:45:04 +0100 ericb r264961 : #i96978# Implement a new event mangement for the Apple remote 2008-12-07 18:59:58 +0100 ericb r264957 : #i96554# fix wrong argument causing warnings 2008-12-07 18:57:56 +0100 ericb r264956 : #i96554# fix wrong argument type 2008-12-07 18:55:22 +0100 ericb r264955 : #i96978# adding a new event type
2009-01-20 09:57:31 -06:00
if( rEvent.GetCommand() == COMMAND_MEDIA )
{
switch( rEvent.GetMediaCommand() )
{
case MEDIA_COMMAND_PLAY:
{
::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
if( pDocShell ) // Impress or Draw ?
{
::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
// #i97925# start the presentation if and only if an Impress document is focused
if( pViewShell && (pDocShell->GetDocumentType() == DOCUMENT_TYPE_IMPRESS) )
pViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_PRESENTATION );
}
}
break;
default:
break;
}
}
}
return 0;
}
void SdModule::AddSummaryPage (SfxViewFrame* pViewFrame, SdDrawDocument* pDocument)
{
if( !pViewFrame || !pViewFrame->GetDispatcher() || !pDocument )
return;
pViewFrame->GetDispatcher()->Execute(SID_SUMMARY_PAGE,
SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD);
OSL_ASSERT (pDocument!=NULL);
sal_Int32 nPageCount = pDocument->GetSdPageCount (PK_STANDARD);
// We need at least two pages: the summary page and one to use as
// template to take the transition parameters from.
if (nPageCount >= 2)
{
// Get a page from which to retrieve the transition parameters.
SdPage* pTemplatePage = pDocument->GetSdPage (0, PK_STANDARD);
OSL_ASSERT (pTemplatePage!=NULL);
// The summary page, if it exists, is the last page.
SdPage* pSummaryPage = pDocument->GetSdPage (
(USHORT)nPageCount-1, PK_STANDARD);
OSL_ASSERT (pSummaryPage!=NULL);
// Take the change mode of the template page as indication of the
// document's kiosk mode.
pSummaryPage->setTransitionDuration(pTemplatePage->getTransitionDuration());
pSummaryPage->SetPresChange(pTemplatePage->GetPresChange());
pSummaryPage->SetTime(pTemplatePage->GetTime());
pSummaryPage->SetSound(pTemplatePage->IsSoundOn());
pSummaryPage->SetSoundFile(pTemplatePage->GetSoundFile());
pSummaryPage->setTransitionType(pTemplatePage->getTransitionType());
pSummaryPage->setTransitionSubtype(pTemplatePage->getTransitionSubtype());
pSummaryPage->setTransitionDirection(pTemplatePage->getTransitionDirection());
pSummaryPage->setTransitionFadeColor(pTemplatePage->getTransitionFadeColor());
pSummaryPage->setTransitionDuration(pTemplatePage->getTransitionDuration());
}
}
SfxFrame* SdModule::CreateFromTemplate( const String& rTemplatePath, const Reference< XFrame >& i_rFrame )
{
SfxFrame* pFrame = 0;
SfxObjectShellLock xDocShell;
SfxItemSet* pSet = new SfxAllItemSet( SFX_APP()->GetPool() );
pSet->Put( SfxBoolItem( SID_TEMPLATE, TRUE ) );
ULONG lErr = SFX_APP()->LoadTemplate( xDocShell, rTemplatePath, TRUE, pSet );
SfxObjectShell* pDocShell = xDocShell;
if( lErr )
{
ErrorHandler::HandleError(lErr);
}
else if( pDocShell )
{
SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pDocShell, i_rFrame );
OSL_ENSURE( pViewFrame, "SdModule::CreateFromTemplate: no view frame - was the document really loaded?" );
pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL;
}
return pFrame;
}
SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq )
{
SfxFrame* pFrame = 0;
if ( SvtModuleOptions().IsImpress() )
{
Reference< XFrame > xTargetFrame;
SFX_REQUEST_ARG( rReq, pFrmItem, SfxUnoFrameItem, SID_FILLFRAME, FALSE);
if ( pFrmItem )
xTargetFrame = pFrmItem->GetFrame();
bool bMakeLayoutVisible = false;
SfxViewFrame* pViewFrame = NULL;
SdOptions* pOpt = GetSdOptions(DOCUMENT_TYPE_IMPRESS);
bool bStartWithTemplate = pOpt->IsStartWithTemplate();
bool bNewDocDirect = rReq.GetSlot() == SID_NEWSD;
if( bNewDocDirect && !bStartWithTemplate )
{
//we start without wizard
//check wether we should load a template document
const ::rtl::OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) );
String aStandardTemplate( SfxObjectFactory::GetStandardTemplate( aServiceName ) );
if( aStandardTemplate.Len() > 0 )
{
//load a template document
pFrame = CreateFromTemplate( aStandardTemplate, xTargetFrame );
}
else
{
//create an empty document
pFrame = CreateEmptyDocument( DOCUMENT_TYPE_IMPRESS, xTargetFrame );
bMakeLayoutVisible = true;
}
}
else
{
SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
std::auto_ptr< AbstractAssistentDlg > pPilotDlg( pFact ? pFact->CreateAssistentDlg( NULL, !bNewDocDirect ) : 0 );
// Open the Pilot
if( pPilotDlg.get() && pPilotDlg->Execute()==RET_OK )
{
const String aDocPath( pPilotDlg->GetDocPath());
const sal_Bool bIsDocEmpty = pPilotDlg->IsDocEmpty();
// So that you can open the document without AutoLayout-Dialog
pOpt->SetStartWithTemplate(FALSE);
if(bNewDocDirect && !pPilotDlg->GetStartWithFlag())
bStartWithTemplate = FALSE;
if( pPilotDlg->GetStartType() == ST_OPEN )
{
String aFileToOpen = aDocPath;
DBG_ASSERT( aFileToOpen.Len()!=0, "The autopilot should have asked for a file itself already!" );
if(aFileToOpen.Len() != 0)
{
const String aPasswrd( pPilotDlg->GetPassword() );
SfxStringItem aFile( SID_FILE_NAME, aFileToOpen );
SfxStringItem aReferer( SID_REFERER, UniString() );
SfxStringItem aPassword( SID_PASSWORD, aPasswrd );
if ( xTargetFrame.is() )
{
SfxAllItemSet aSet( *rReq.GetArgs()->GetPool() );
aSet.Put( aFile );
aSet.Put( aReferer );
// Put the password into the request
// only if it is not empty.
if (aPasswrd.Len() > 0)
aSet.Put( aPassword );
const SfxPoolItem* pRet = SfxFrame::OpenDocumentSynchron( aSet, xTargetFrame );
const SfxViewFrameItem* pFrameItem = PTR_CAST( SfxViewFrameItem, pRet );
if ( pFrameItem && pFrameItem->GetFrame() )
pFrame = &pFrameItem->GetFrame()->GetFrame();
}
else
{
SfxRequest aRequest (SID_OPENDOC, SFX_CALLMODE_SYNCHRON, SFX_APP()->GetPool());
aRequest.AppendItem (aFile);
aRequest.AppendItem (aReferer);
// Put the password into the request
// only if it is not empty.
if (aPasswrd.Len() > 0)
aRequest.AppendItem (aPassword);
aRequest.AppendItem (SfxStringItem (
SID_TARGETNAME,
String (RTL_CONSTASCII_USTRINGPARAM ("_default"))));
try
{
const SfxPoolItem* pRet = SFX_APP()->ExecuteSlot (aRequest);
const SfxViewFrameItem* pFrameItem = PTR_CAST( SfxViewFrameItem, pRet );
if ( pFrameItem )
pFrame = &pFrameItem->GetFrame()->GetFrame();
}
catch (::com::sun::star::uno::Exception e)
{
DBG_ASSERT (FALSE, "caught IllegalArgumentException while loading document from Impress autopilot");
}
}
}
pOpt->SetStartWithTemplate(bStartWithTemplate);
if(bNewDocDirect && !bStartWithTemplate)
{
std::auto_ptr< SfxItemSet > pRet( CreateItemSet( SID_SD_EDITOPTIONS ) );
if(pRet.get())
ApplyItemSet( SID_SD_EDITOPTIONS, *pRet.get() );
}
}
else
{
SfxObjectShellLock xShell( pPilotDlg->GetDocument() );
SfxObjectShell* pShell = xShell;
if( pShell )
{
pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pShell, xTargetFrame );
DBG_ASSERT( pViewFrame, "no ViewFrame!!" );
pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL;
if(bNewDocDirect && !bStartWithTemplate)
{
std::auto_ptr< SfxItemSet > pRet( CreateItemSet( SID_SD_EDITOPTIONS ) );
if(pRet.get())
ApplyItemSet( SID_SD_EDITOPTIONS, *pRet.get() );
}
if( pShell && pViewFrame )
{
::sd::DrawDocShell* pDocShell =
PTR_CAST(::sd::DrawDocShell,pShell);
SdDrawDocument* pDoc = pDocShell->GetDoc();
::sd::ViewShellBase* pBase =
::sd::ViewShellBase::GetViewShellBase (
pViewFrame);
OSL_ASSERT (pBase!=NULL);
::boost::shared_ptr<sd::ViewShell> pViewSh = pBase->GetMainViewShell();
SdOptions* pOptions = GetSdOptions(pDoc->GetDocumentType());
if (pOptions && pViewSh.get())
{
// The AutoPilot-document shall be open without its own options
::sd::FrameView* pFrameView = pViewSh->GetFrameView();
pFrameView->Update(pOptions);
pViewSh->ReadFrameViewData(pFrameView);
}
ChangeMedium( pDocShell, pViewFrame, pPilotDlg->GetOutputMedium() );
if(pPilotDlg->IsSummary())
AddSummaryPage(pViewFrame, pDoc);
// empty document
if((aDocPath.Len() == 0) && pViewFrame && pViewFrame->GetDispatcher())
{
SfxBoolItem aIsChangedItem(SID_MODIFYPAGE, !bIsDocEmpty);
SfxUInt32Item eAutoLayout( ID_VAL_WHATLAYOUT, (UINT32) AUTOLAYOUT_TITLE );
pViewFrame->GetDispatcher()->Execute(SID_MODIFYPAGE,
SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aIsChangedItem, &eAutoLayout, 0L);
}
// clear document info
using namespace ::com::sun::star;
uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
pDocShell->GetModel(), uno::UNO_QUERY_THROW);
uno::Reference<document::XDocumentProperties>
xDocProps(xDPS->getDocumentProperties());
DBG_ASSERT(xDocProps.is(), "no DocumentProperties");
xDocProps->resetUserData(
SvtUserOptions().GetFullName() );
xDocProps->setTemplateName(xDocProps->getTitle());
xDocProps->setTemplateURL(pPilotDlg->GetDocPath());
CWS-TOOLING: integrate CWS impress171 2009-06-02 16:32:02 +0200 cl r272511 : fixed build error 2009-05-29 16:40:09 +0200 cl r272471 : CWS-TOOLING: rebase CWS impress171 to trunk@272291 (milestone: DEV300:m49) 2009-05-19 15:14:08 +0200 sj r272082 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:31 +0200 sj r272081 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:14 +0200 sj r272080 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-18 13:34:05 +0200 sj r272015 : #i47689# fixed rectangles toolbar 2009-05-13 14:59:08 +0200 sj r271862 : #i101563# fixed crash when loading pptx document 2009-05-12 19:31:58 +0200 sj r271835 : #101684# fixed rotation of customshapes 2009-05-08 16:37:01 +0200 sj r271724 : #i101683,i101584,i48160# added shearing of customshapes, fixed rotation problem 2009-04-28 17:32:14 +0200 sj r271335 : #i48160# fixed gluepoint rotation of customshapes 2009-04-27 16:31:54 +0200 cl r271291 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:30:52 +0200 cl r271290 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:28:55 +0200 cl r271289 : #i100138# applied patch for japanese reconversion feature 2009-04-23 14:22:59 +0200 cl r271170 : #i95342# #i96820# #i97298# multiple table handling fixes 2009-04-23 14:18:54 +0200 sj r271169 : #i60368# ignoring gamma values for toolbar/menu icons 2009-04-23 11:54:28 +0200 cl r271146 : #i97298# set style to text even during text edit 2009-04-23 11:46:38 +0200 cl r271145 : fixed compiler error with debug 2009-04-22 19:09:37 +0200 sj r271135 : #i101051# applied patch (proper import of notes page object) 2009-04-22 11:07:54 +0200 cl r271082 : #i96820# modify doc after merging cells 2009-04-22 10:57:35 +0200 cl r271081 : #i100307# applied patch from jlcheng to correctly set modfiy state 2009-04-22 10:31:11 +0200 cl r271079 : #i96736# copy merge information on clone 2009-04-21 08:27:22 +0200 cl r271016 : #i89541# use SfxErrorContext to make the ErrorHandler dialog modal 2009-04-20 17:52:56 +0200 cl r271003 : #i98480# removed 'EndPosition' and 'StartPosition' from styles 2009-04-20 16:41:55 +0200 cl r270994 : #i98403# fixed state handling for selected motion path 2009-04-17 11:35:25 +0200 cl r270931 : #i61274# export to pdf should behave like printing considering layer visibility 2009-04-17 10:00:17 +0200 cl r270924 : #i98967# set default style on any new shape except a page obj 2009-04-16 16:28:20 +0200 cl r270893 : #i98859# use percentage type for relative font height
2009-06-17 05:58:14 -05:00
pDoc->SetChanged(!bIsDocEmpty);
pDocShell->SetUseUserData(TRUE);
// #94652# clear UNDO stack after autopilot
pDocShell->ClearUndoBuffer();
bMakeLayoutVisible = true;
}
}
pOpt->SetStartWithTemplate(bStartWithTemplate);
}
}
}
if (bMakeLayoutVisible && pViewFrame!=NULL)
{
// Make the layout menu visible in the tool pane.
::sd::ViewShellBase* pBase = ::sd::ViewShellBase::GetViewShellBase(pViewFrame);
if (pBase != NULL)
{
FrameworkHelper::Instance(*pBase)->RequestTaskPanel(
FrameworkHelper::msLayoutTaskPanelURL);
}
}
}
return pFrame;
}
SfxFrame* SdModule::CreateEmptyDocument( DocumentType eDocType, const Reference< XFrame >& i_rFrame )
{
SfxFrame* pFrame = 0;
SfxObjectShellLock xDocShell;
::sd::DrawDocShell* pNewDocSh;
xDocShell = pNewDocSh = new ::sd::DrawDocShell(SFX_CREATE_MODE_STANDARD,FALSE,eDocType);
if(pNewDocSh)
{
pNewDocSh->DoInitNew(NULL);
SdDrawDocument* pDoc = pNewDocSh->GetDoc();
if(pDoc)
{
pDoc->CreateFirstPages();
pDoc->StopWorkStartupDelay();
}
SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pNewDocSh, i_rFrame );
OSL_ENSURE( pViewFrame, "SdModule::CreateEmptyDocument: no view frame - was the document really loaded?" );
pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL;
}
return pFrame;
}
void SdModule::ChangeMedium( ::sd::DrawDocShell* pDocShell, SfxViewFrame* pViewFrame, const sal_Int32 eMedium )
{
if( !pDocShell )
return;
SdDrawDocument* pDoc = pDocShell->GetDoc();
if( !pDoc )
return;
// settings for the Outputmedium
Size aNewSize;
UINT32 nLeft = 0;
UINT32 nRight = 0;
UINT32 nLower = 0;
UINT32 nUpper = 0;
switch(eMedium)
{
case OUTPUT_PAGE:
case OUTPUT_OVERHEAD:
{
SfxPrinter* pPrinter = pDocShell->GetPrinter(TRUE);
if( pPrinter && pPrinter->IsValid())
{
// Der Printer gibt leider kein exaktes
// Format (z.B. A4) zurueck
Size aSize(pPrinter->GetPaperSize());
CWS-TOOLING: integrate CWS unifypaper01 2009-05-27 17:14:41 +0200 cmc r272362 : #i92819#, psprint moved into vcl 2009-05-19 15:45:46 +0200 cmc r272083 : #i92819# having difficultly in getting this right under windows 2009-05-18 18:04:22 +0200 cmc r272043 : #i92819# missing some export magic somewhere 2009-05-18 15:34:18 +0200 cmc r272028 : #i92819# get depends right 2009-05-18 11:50:43 +0200 cmc r272010 : ##i92819# fix import/export stuff 2009-05-18 10:07:00 +0200 cmc r272000 : #i92819# fix window imp name 2009-05-16 15:17:23 +0200 cmc r271975 : #i92819# fix win paper names 2009-05-16 11:11:29 +0200 cmc r271974 : #i92819# std::abs prolematic for msvc 2009-05-15 15:36:56 +0200 cmc r271941 : #i92819# handle missing setting, at least on mac 2009-05-15 10:13:44 +0200 cmc r271927 : #i92819# adjust for moved page dialog 2009-05-14 13:47:14 +0200 cmc r271887 : remove dead files that reappeared 2009-05-14 09:57:17 +0200 cmc r271872 : CWS-TOOLING: rebase CWS unifypaper01 to trunk@271830 (milestone: DEV300:m48) 2009-05-11 12:27:18 +0200 cmc r271763 : #i92819# check return value 2009-05-06 17:28:25 +0200 cmc r271602 : #i92819# these B4/B5s are the JIS ones according to their dimensions 2009-05-06 17:17:03 +0200 cmc r271601 : #i92819# micro-optimization 2009-05-03 18:20:48 +0200 cmc r271434 : #i92819# paper libs 2009-05-03 16:08:32 +0200 cmc r271433 : CWS-TOOLING: rebase CWS unifypaper01 to trunk@271427 (milestone: DEV300:m47) 2009-04-06 15:33:37 +0200 cmc r270556 : CWS-TOOLING: rebase CWS unifypaper01 to trunk@270033 (milestone: DEV300:m45) 2009-03-12 14:36:35 +0100 cmc r269415 : #i92819# merge paper utilities 2009-03-11 13:44:27 +0100 cmc r269328 : CWS-TOOLING: rebase CWS unifypaper01 to trunk@269297 (milestone: DEV300:m43) 2009-03-09 14:42:07 +0100 cmc r269190 : remove config_office from synced version 2009-03-09 14:34:50 +0100 cmc r269187 : CWS-TOOLING: rebase CWS unifypaper01 to trunk@268395 (milestone: DEV300:m42) 2009-03-09 12:11:29 +0100 cmc r269077 : CWS-TOOLING: rebase CWS unifypaper01 to trunk@265758 (milestone: DEV300:m38) 2009-03-06 17:17:39 +0100 cmc r269027 : #i92819# paper goo 2008-12-04 11:29:30 +0100 cmc r264826 : CWS-TOOLING: rebase CWS unifypaper01 to trunk@264807 (milestone: DEV300:m37) 2008-11-26 10:33:06 +0100 cmc r264357 : CWS-TOOLING: rebase CWS unifypaper01 to trunk@264325 (milestone: DEV300:m36) 2008-11-21 14:09:36 +0100 cmc r264138 : #i92819# paper consolidation
2009-06-12 04:36:34 -05:00
Paper ePaper = SvxPaperInfo::GetSvxPaper( aSize, MAP_100TH_MM, TRUE);
CWS-TOOLING: integrate CWS unifypaper01 2009-05-27 17:14:41 +0200 cmc r272362 : #i92819#, psprint moved into vcl 2009-05-19 15:45:46 +0200 cmc r272083 : #i92819# having difficultly in getting this right under windows 2009-05-18 18:04:22 +0200 cmc r272043 : #i92819# missing some export magic somewhere 2009-05-18 15:34:18 +0200 cmc r272028 : #i92819# get depends right 2009-05-18 11:50:43 +0200 cmc r272010 : ##i92819# fix import/export stuff 2009-05-18 10:07:00 +0200 cmc r272000 : #i92819# fix window imp name 2009-05-16 15:17:23 +0200 cmc r271975 : #i92819# fix win paper names 2009-05-16 11:11:29 +0200 cmc r271974 : #i92819# std::abs prolematic for msvc 2009-05-15 15:36:56 +0200 cmc r271941 : #i92819# handle missing setting, at least on mac 2009-05-15 10:13:44 +0200 cmc r271927 : #i92819# adjust for moved page dialog 2009-05-14 13:47:14 +0200 cmc r271887 : remove dead files that reappeared 2009-05-14 09:57:17 +0200 cmc r271872 : CWS-TOOLING: rebase CWS unifypaper01 to trunk@271830 (milestone: DEV300:m48) 2009-05-11 12:27:18 +0200 cmc r271763 : #i92819# check return value 2009-05-06 17:28:25 +0200 cmc r271602 : #i92819# these B4/B5s are the JIS ones according to their dimensions 2009-05-06 17:17:03 +0200 cmc r271601 : #i92819# micro-optimization 2009-05-03 18:20:48 +0200 cmc r271434 : #i92819# paper libs 2009-05-03 16:08:32 +0200 cmc r271433 : CWS-TOOLING: rebase CWS unifypaper01 to trunk@271427 (milestone: DEV300:m47) 2009-04-06 15:33:37 +0200 cmc r270556 : CWS-TOOLING: rebase CWS unifypaper01 to trunk@270033 (milestone: DEV300:m45) 2009-03-12 14:36:35 +0100 cmc r269415 : #i92819# merge paper utilities 2009-03-11 13:44:27 +0100 cmc r269328 : CWS-TOOLING: rebase CWS unifypaper01 to trunk@269297 (milestone: DEV300:m43) 2009-03-09 14:42:07 +0100 cmc r269190 : remove config_office from synced version 2009-03-09 14:34:50 +0100 cmc r269187 : CWS-TOOLING: rebase CWS unifypaper01 to trunk@268395 (milestone: DEV300:m42) 2009-03-09 12:11:29 +0100 cmc r269077 : CWS-TOOLING: rebase CWS unifypaper01 to trunk@265758 (milestone: DEV300:m38) 2009-03-06 17:17:39 +0100 cmc r269027 : #i92819# paper goo 2008-12-04 11:29:30 +0100 cmc r264826 : CWS-TOOLING: rebase CWS unifypaper01 to trunk@264807 (milestone: DEV300:m37) 2008-11-26 10:33:06 +0100 cmc r264357 : CWS-TOOLING: rebase CWS unifypaper01 to trunk@264325 (milestone: DEV300:m36) 2008-11-21 14:09:36 +0100 cmc r264138 : #i92819# paper consolidation
2009-06-12 04:36:34 -05:00
if (ePaper != PAPER_USER)
{
// Korrekte Size holen
aSize = SvxPaperInfo::GetPaperSize(ePaper, MAP_100TH_MM);
}
if (aSize.Height() > aSize.Width())
{
// Stets Querformat
aNewSize.Width() = aSize.Height();
aNewSize.Height() = aSize.Width();
}
else
{
aNewSize = aSize;
}
}
else
{
aNewSize=Size(29700, 21000);
}
if (eMedium == OUTPUT_PAGE)
{
nLeft =1000;
nRight=1000;
nUpper=1000;
nLower=1000;
}
else
{
nLeft =0;
nRight=0;
nUpper=0;
nLower=0;
}
}
break;
case OUTPUT_SLIDE:
{
aNewSize = Size(27000, 18000);
nLeft =0;
nRight=0;
nUpper=0;
nLower=0;
}
break;
case OUTPUT_PRESENTATION:
{
aNewSize = Size(28000, 21000);
nLeft =0;
nRight=0;
nUpper=0;
nLower=0;
}
break;
}
BOOL bScaleAll = TRUE;
USHORT nPageCnt = pDoc->GetMasterSdPageCount(PK_STANDARD);
USHORT i;
SdPage* pPage;
// master pages first
for (i = 0; i < nPageCnt; i++)
{
pPage = pDoc->GetMasterSdPage(i, PK_STANDARD);
if (pPage)
{
if(eMedium != OUTPUT_ORIGINAL)
{
Rectangle aBorderRect(nLeft, nUpper, nRight, nLower);
pPage->ScaleObjects(aNewSize, aBorderRect, bScaleAll);
pPage->SetSize(aNewSize);
pPage->SetBorder(nLeft, nUpper, nRight, nLower);
}
SdPage* pNotesPage = pDoc->GetMasterSdPage(i, PK_NOTES);
DBG_ASSERT( pNotesPage, "Wrong page ordering!" );
if( pNotesPage ) pNotesPage->CreateTitleAndLayout();
pPage->CreateTitleAndLayout();
}
}
nPageCnt = pDoc->GetSdPageCount(PK_STANDARD);
// then slides
for (i = 0; i < nPageCnt; i++)
{
pPage = pDoc->GetSdPage(i, PK_STANDARD);
if (pPage)
{
if(eMedium != OUTPUT_ORIGINAL)
{
Rectangle aBorderRect(nLeft, nUpper, nRight, nLower);
pPage->ScaleObjects(aNewSize, aBorderRect, bScaleAll);
pPage->SetSize(aNewSize);
pPage->SetBorder(nLeft, nUpper, nRight, nLower);
}
SdPage* pNotesPage = pDoc->GetSdPage(i, PK_NOTES);
DBG_ASSERT( pNotesPage, "Wrong page ordering!" );
if( pNotesPage ) pNotesPage->SetAutoLayout( pNotesPage->GetAutoLayout() );
pPage->SetAutoLayout( pPage->GetAutoLayout() );
}
}
SdPage* pHandoutPage = pDoc->GetSdPage(0, PK_HANDOUT);
pHandoutPage->CreateTitleAndLayout(TRUE);
if( (eMedium != OUTPUT_ORIGINAL) && pViewFrame && pViewFrame->GetDispatcher())
{
pViewFrame->GetDispatcher()->Execute(SID_SIZE_PAGE, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD);
}
}
//===== OutlineToImpressFinalize ==============================================
namespace {
OutlineToImpressFinalizer::OutlineToImpressFinalizer (
::sd::ViewShellBase& rBase,
SdDrawDocument& rDocument,
SvLockBytes& rBytes)
: mrBase(rBase),
mrDocument(rDocument),
mpStream()
{
// The given stream has a lifetime shorter than this new
// OutlineToImpressFinalizer object. Therefore a local copy of the
// stream is created.
const SvStream* pStream (rBytes.GetStream());
if (pStream != NULL)
{
// Create a memory stream and prepare to fill it with the content of
// the original stream.
mpStream.reset(new SvMemoryStream());
static const sal_Size nBufferSize = 4096;
::boost::scoped_array<sal_Int8> pBuffer (new sal_Int8[nBufferSize]);
sal_Size nReadPosition (0);
bool bLoop (true);
while (bLoop)
{
// Read the next part of the original stream.
sal_Size nReadByteCount (0);
const ErrCode nErrorCode (
rBytes.ReadAt(
nReadPosition,
reinterpret_cast<void*>(pBuffer.get()),
nBufferSize,
&nReadByteCount));
// Check the error code and stop copying the stream data when an
// error has occured.
switch (nErrorCode)
{
case ERRCODE_NONE:
if (nReadByteCount == 0)
bLoop = false;
break;
case ERRCODE_IO_PENDING:
break;
default:
bLoop = false;
nReadByteCount = 0;
break;
}
// Append the read bytes to the end of the memory stream.
if (nReadByteCount > 0)
{
mpStream->Write(reinterpret_cast<void*>(pBuffer.get()), nReadByteCount);
nReadPosition += nReadByteCount;
}
}
// Rewind the memory stream so that in the operator() method its
// content is properly read.
mpStream->Seek(STREAM_SEEK_TO_BEGIN);
}
}
void OutlineToImpressFinalizer::operator() (bool)
{
// Fetch the new outline view shell.
::sd::OutlineViewShell* pOutlineShell
= dynamic_cast<sd::OutlineViewShell*>(FrameworkHelper::Instance(mrBase)->GetViewShell(FrameworkHelper::msCenterPaneURL).get());
if (pOutlineShell != NULL && mpStream.get() != NULL)
{
sd::OutlineView* pView = static_cast<sd::OutlineView*>(pOutlineShell->GetView());
// mba: the stream can't contain any relative URLs, because we don't
// have any information about a BaseURL!
if ( pOutlineShell->Read(*mpStream, String(), EE_FORMAT_RTF) == 0 )
{
/*
sd::OutlineViewPageChangesGuard aGuard( pView );
// Remove the first empty pages
USHORT nPageCount = mrDocument.GetPageCount();
mrDocument.RemovePage( --nPageCount ); // notes page
mrDocument.RemovePage( --nPageCount ); // standard page
*/
}
// Call UpdatePreview once for every slide to resync the
// document with the outliner of the OutlineViewShell.
USHORT nPageCount (mrDocument.GetSdPageCount(PK_STANDARD));
for (USHORT nIndex=0; nIndex<nPageCount; nIndex++)
{
SdPage* pPage = mrDocument.GetSdPage(nIndex, PK_STANDARD);
// Make the page the actual page so that the
// following UpdatePreview() call accesses the
// correct paragraphs.
pView->SetActualPage(pPage);
pOutlineShell->UpdatePreview(pPage, true);
}
// Select the first slide.
SdPage* pPage = mrDocument.GetSdPage(0, PK_STANDARD);
pView->SetActualPage(pPage);
pOutlineShell->UpdatePreview(pPage, true);
}
// #97231# Undo-Stack needs to be cleared, else the user may remove the
// only drawpage and this is a state we cannot handle ATM.
::sd::DrawDocShell* pDocShell = mrDocument.GetDocSh();
if( pDocShell )
pDocShell->ClearUndoBuffer();
}
} // end of anonymous namespace