summaryrefslogtreecommitdiff
path: root/sfx2/source/view
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2/source/view')
-rw-r--r--sfx2/source/view/frame.cxx4
-rw-r--r--sfx2/source/view/frame2.cxx12
-rw-r--r--sfx2/source/view/frmload.cxx68
-rw-r--r--sfx2/source/view/ipclient.cxx6
-rw-r--r--sfx2/source/view/makefile.mk65
-rw-r--r--sfx2/source/view/orgmgr.cxx2
-rw-r--r--sfx2/source/view/printer.cxx316
-rw-r--r--sfx2/source/view/prnmon.cxx488
-rw-r--r--sfx2/source/view/sfxbasecontroller.cxx24
-rw-r--r--sfx2/source/view/view.hrc6
-rw-r--r--sfx2/source/view/viewfac.cxx2
-rw-r--r--sfx2/source/view/viewfrm.cxx24
-rw-r--r--sfx2/source/view/viewfrm2.cxx2
-rw-r--r--sfx2/source/view/viewimp.hxx31
-rw-r--r--sfx2/source/view/viewprn.cxx137
-rw-r--r--sfx2/source/view/viewsh.cxx1008
16 files changed, 648 insertions, 1547 deletions
diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx
index 41452da24c..5fcf521f4b 100644
--- a/sfx2/source/view/frame.cxx
+++ b/sfx2/source/view/frame.cxx
@@ -5,7 +5,7 @@
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
- * OpenOffice.org - a multi-platform office productivity suite
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* This file is part of OpenOffice.org.
*
@@ -224,7 +224,7 @@ sal_uInt16 SfxFrame::PrepareClose_Impl( sal_Bool bUI, sal_Bool bForBrowsing )
bOther = ( &pFrame->GetFrame() != this );
}
- SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_PREPARECLOSEVIEW, GlobalEventConfig::GetEventName( STR_EVENT_PREPARECLOSEVIEW ), pCur) );
+ SFX_APP()->NotifyEvent( SfxViewEventHint(SFX_EVENT_PREPARECLOSEVIEW, GlobalEventConfig::GetEventName( STR_EVENT_PREPARECLOSEVIEW ), pCur, GetController() ) );
if ( bOther )
// if there are other views only the current view of this frame must be asked
diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx
index 8778427429..c462a1ebae 100644
--- a/sfx2/source/view/frame2.cxx
+++ b/sfx2/source/view/frame2.cxx
@@ -31,7 +31,7 @@
#include "impframe.hxx"
#include "objshimp.hxx"
-#include "sfxhelp.hxx"
+#include "sfx2/sfxhelp.hxx"
#include "workwin.hxx"
#include "sfx2/app.hxx"
@@ -128,15 +128,15 @@ long SfxFrameWindow_Impl::Notify( NotifyEvent& rNEvt )
// TODO/LATER: do we still need this code?
Window* pWindow = rNEvt.GetWindow();
- ULONG nHelpId = 0;
- while ( !nHelpId && pWindow )
+ rtl::OString sHelpId;
+ while ( !sHelpId.getLength() && pWindow )
{
- nHelpId = pWindow->GetHelpId();
+ sHelpId = pWindow->GetHelpId();
pWindow = pWindow->GetParent();
}
- if ( nHelpId )
- SfxHelp::OpenHelpAgent( pFrame, nHelpId );
+ if ( sHelpId.getLength() )
+ SfxHelp::OpenHelpAgent( pFrame, sHelpId );
// if focus was on an external window, the clipboard content might have been changed
pView->GetBindings().Invalidate( SID_PASTE );
diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx
index b9e593d7f3..4e4a6bc236 100644
--- a/sfx2/source/view/frmload.cxx
+++ b/sfx2/source/view/frmload.cxx
@@ -58,7 +58,6 @@
#include <com/sun/star/document/XViewDataSupplier.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
/** === end UNO includes === **/
-
#include <comphelper/interaction.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/sequenceashashmap.hxx>
@@ -73,11 +72,12 @@
#include <unotools/moduleoptions.hxx>
#include <svtools/sfxecode.hxx>
#include <svl/stritem.hxx>
-#include <toolkit/helper/vclunohelper.hxx>
#include <tools/diagnose_ex.h>
-#include <ucbhelper/simpleinteractionrequest.hxx>
-#include <osl/mutex.hxx>
-
+#include <comphelper/namedvaluecollection.hxx>
+#include <comphelper/sequenceashashmap.hxx>
+#include <cppuhelper/exc_hlp.hxx>
+#include <framework/interaction.hxx>
+#include <unotools/moduleoptions.hxx>
/** === begin UNO using === **/
using ::com::sun::star::beans::PropertyValue;
using ::com::sun::star::container::XContainerQuery;
@@ -107,6 +107,13 @@ using ::com::sun::star::frame::XController2;
using ::com::sun::star::frame::XController;
using ::com::sun::star::frame::XModel2;
/** === end UNO using === **/
+using ::com::sun::star::util::XCloseable;
+using ::com::sun::star::document::XViewDataSupplier;
+using ::com::sun::star::container::XIndexAccess;
+using ::com::sun::star::frame::XController2;
+using ::com::sun::star::frame::XController;
+using ::com::sun::star::frame::XModel2;
+/** === end UNO using === **/
SfxFrameLoader_Impl::SfxFrameLoader_Impl( const Reference< XMultiServiceFactory >& _rxFactory )
:m_aContext( _rxFactory )
@@ -218,11 +225,10 @@ const SfxFilter* SfxFrameLoader_Impl::impl_getFilterFromServiceName_nothrow( con
::rtl::OUString sFilterName;
try
{
- ::framework::RequestFilterSelect* pRequest = new ::framework::RequestFilterSelect( i_rDocumentURL );
- Reference< XInteractionRequest > xRequest ( pRequest );
- i_rxHandler->handle( xRequest );
- if( !pRequest->isAbort() )
- sFilterName = pRequest->getFilter();
+ ::framework::RequestFilterSelect aRequest( i_rDocumentURL );
+ i_rxHandler->handle( aRequest.GetRequest() );
+ if( !aRequest.isAbort() )
+ sFilterName = aRequest.getFilter();
}
catch( const Exception& )
{
@@ -255,17 +261,6 @@ namespace
}
// --------------------------------------------------------------------------------------------------------------------
-sal_Bool SfxFrameLoader_Impl::impl_createNewDocWithSlotParam( const USHORT _nSlotID, const Reference< XFrame >& i_rxFrame,
- const bool i_bHidden )
-{
- SfxRequest aRequest( _nSlotID, SFX_CALLMODE_SYNCHRON, SFX_APP()->GetPool() );
- aRequest.AppendItem( SfxUnoFrameItem( SID_FILLFRAME, i_rxFrame ) );
- if ( i_bHidden )
- aRequest.AppendItem( SfxBoolItem( SID_HIDDEN, TRUE ) );
- return lcl_getDispatchResult( SFX_APP()->ExecuteSlot( aRequest ) );
-}
-
-// --------------------------------------------------------------------------------------------------------------------
void SfxFrameLoader_Impl::impl_lockHiddenDocument( SfxObjectShell& i_rDocument, const ::comphelper::NamedValueCollection& i_rDescriptor ) const
{
const sal_Bool bHidden = i_rDescriptor.getOrDefault( "Hidden", sal_False );
@@ -285,6 +280,17 @@ void SfxFrameLoader_Impl::impl_lockHiddenDocument( SfxObjectShell& i_rDocument,
}
// --------------------------------------------------------------------------------------------------------------------
+sal_Bool SfxFrameLoader_Impl::impl_createNewDocWithSlotParam( const USHORT _nSlotID, const Reference< XFrame >& i_rxFrame,
+ const bool i_bHidden )
+{
+ SfxRequest aRequest( _nSlotID, SFX_CALLMODE_SYNCHRON, SFX_APP()->GetPool() );
+ aRequest.AppendItem( SfxUnoFrameItem( SID_FILLFRAME, i_rxFrame ) );
+ if ( i_bHidden )
+ aRequest.AppendItem( SfxBoolItem( SID_HIDDEN, TRUE ) );
+ return lcl_getDispatchResult( SFX_APP()->ExecuteSlot( aRequest ) );
+}
+
+// --------------------------------------------------------------------------------------------------------------------
void SfxFrameLoader_Impl::impl_determineFilter( ::comphelper::NamedValueCollection& io_rDescriptor ) const
{
const ::rtl::OUString sURL = io_rDescriptor.getOrDefault( "URL", ::rtl::OUString() );
@@ -334,7 +340,7 @@ void SfxFrameLoader_Impl::impl_determineFilter( ::comphelper::NamedValueCollecti
}
// --------------------------------------------------------------------------------------------------------------------
-SfxObjectShellLock SfxFrameLoader_Impl::impl_findObjectShell( const Reference< XModel2 >& i_rxDocument ) const
+SfxObjectShellRef SfxFrameLoader_Impl::impl_findObjectShell( const Reference< XModel2 >& i_rxDocument ) const
{
for ( SfxObjectShell* pDoc = SfxObjectShell::GetFirst( NULL, FALSE ); pDoc; pDoc = SfxObjectShell::GetNext( *pDoc, NULL, FALSE ) )
{
@@ -460,7 +466,7 @@ void SfxFrameLoader_Impl::impl_removeLoaderArguments( ::comphelper::NamedValueCo
};
::comphelper::NamedValueCollection aViewArgs;
- for ( size_t i=0; i < SAL_N_ELEMENTS( pKnownViewArgs ); ++i )
+ for ( size_t i=0; i < sizeof( pKnownViewArgs ) / sizeof( pKnownViewArgs[0] ); ++i )
{
if ( io_rDescriptor.has( pKnownViewArgs[i] ) )
{
@@ -546,7 +552,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA
{
ENSURE_OR_THROW( _rTargetFrame.is(), "illegal NULL frame" );
- SolarMutexGuard aGuard;
+ SolarMutexGuard aGuard();
RTL_LOGFILE_CONTEXT( aLog, "sfx2 (mb93783) ::SfxFrameLoader::load" );
@@ -646,7 +652,9 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA
}
// get the SfxObjectShell (still needed at the moment)
- const SfxObjectShellLock xDoc = impl_findObjectShell( xModel );
+ // SfxObjectShellRef is used here ( instead of ...Lock ) since the model is closed below if necessary
+ // SfxObjectShellLock would be even dangerous here, since the lifetime control should be done outside in case of success
+ const SfxObjectShellRef xDoc = impl_findObjectShell( xModel );
ENSURE_OR_THROW( xDoc.Is(), "no SfxObjectShell for the given model" );
// ensure the ID of the to-be-created view is in the descriptor, if possible
@@ -654,16 +662,6 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA
const sal_Int16 nViewNo = xDoc->GetFactory().GetViewNo_Impl( nViewId, 0 );
const ::rtl::OUString sViewName( xDoc->GetFactory().GetViewFactory( nViewNo ).GetAPIViewName() );
- // if the document is created hidden, prevent it from being deleted until it is shown or disposed
- impl_lockHiddenDocument( *xDoc, aDescriptor );
- // TODO; if we wouldn't use a SfxObjectShellLock instance for xDoc, but a simple SfxObjectShellRef,
- // then this would not be necessary, /me thinks. That is, the *Lock classes inc/dec a "Lock" counter
- // (additional to the ref counter) in their ctor/dtor, and if the lock counter goes to 0, the
- // object is closed (DoClose). The impl_lockHiddenDocument is to prevent exactly that premature
- // closing. However, a *Ref object wouldn't close, anyway. And in case of unsuccessfull loading, the
- // code at the very end of this method cares for closing the XModel, which should also close the
- // ObjectShell.
-
// plug the document into the frame
impl_createDocumentView( xModel, _rTargetFrame, aViewCreationArgs, sViewName );
bLoadSuccess = sal_True;
diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx
index 62c3957718..6c9d4fd658 100644
--- a/sfx2/source/view/ipclient.cxx
+++ b/sfx2/source/view/ipclient.cxx
@@ -221,6 +221,7 @@ void SAL_CALL SfxInPlaceClient_Impl::notifyEvent( const document::EventObject& a
if ( m_pClient && aEvent.EventName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("OnVisAreaChanged")) && m_nAspect != embed::Aspects::MSOLE_ICON )
{
+ m_pClient->FormatChanged(); // for Writer when format of the object is changed with the area
m_pClient->ViewChanged();
m_pClient->Invalidate();
}
@@ -1083,6 +1084,11 @@ void SfxInPlaceClient::MakeVisible()
// dummy implementation
}
+void SfxInPlaceClient::FormatChanged()
+{
+ // dummy implementation
+}
+
void SfxInPlaceClient::DeactivateObject()
{
if ( GetObject().is() )
diff --git a/sfx2/source/view/makefile.mk b/sfx2/source/view/makefile.mk
deleted file mode 100644
index 9c257f4c9f..0000000000
--- a/sfx2/source/view/makefile.mk
+++ /dev/null
@@ -1,65 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# 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.
-#
-# 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).
-#
-# 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.
-#
-#*************************************************************************
-
-
-
-PRJ=..$/..
-
-PRJNAME= sfx2
-TARGET= view
-ENABLE_EXCEPTIONS= TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-.INCLUDE : $(PRJ)$/util$/makefile.pmk
-
-# --- Files --------------------------------------------------------
-
-SRS1NAME=$(TARGET)
-SRC1FILES = \
- view.src
-
-SLOFILES = \
- $(SLO)$/ipclient.obj \
- $(SLO)$/viewsh.obj \
- $(SLO)$/frmload.obj \
- $(SLO)$/frame.obj \
- $(SLO)$/frame2.obj \
- $(SLO)$/printer.obj \
- $(SLO)$/viewprn.obj \
- $(SLO)$/viewfac.obj \
- $(SLO)$/orgmgr.obj \
- $(SLO)$/viewfrm.obj \
- $(SLO)$/viewfrm2.obj \
- $(SLO)$/sfxbasecontroller.obj \
- $(SLO)$/userinputinterception.obj
-
-# --- Targets -------------------------------------------------------
-
-.INCLUDE : target.mk
-
diff --git a/sfx2/source/view/orgmgr.cxx b/sfx2/source/view/orgmgr.cxx
index c10d000e2e..4263db3b7f 100644
--- a/sfx2/source/view/orgmgr.cxx
+++ b/sfx2/source/view/orgmgr.cxx
@@ -48,7 +48,7 @@
#include "docvor.hxx"
#include "orgmgr.hxx"
#include "sfxtypes.hxx"
-#include "sfxresid.hxx"
+#include "sfx2/sfxresid.hxx"
#include "view.hrc"
#include <sfx2/docfilt.hxx>
#include "fltfnc.hxx"
diff --git a/sfx2/source/view/printer.cxx b/sfx2/source/view/printer.cxx
index d3c56d535c..1db73a4d29 100644
--- a/sfx2/source/view/printer.cxx
+++ b/sfx2/source/view/printer.cxx
@@ -31,7 +31,6 @@
#include <vcl/virdev.hxx>
#include <vcl/metric.hxx>
#include <vcl/msgbox.hxx>
-#include <svtools/printdlg.hxx>
#include <unotools/printwarningoptions.hxx>
#include <svtools/printoptions.hxx>
#include <vector>
@@ -42,57 +41,26 @@
#include <sfx2/prnmon.hxx>
#include <sfx2/viewsh.hxx>
#include <sfx2/tabdlg.hxx>
-#include "sfxresid.hxx"
+#include "sfx2/sfxresid.hxx"
#include "view.hrc"
-#ifdef MSC
-// der ist buggy
-#define NEW_OBJECTS(Class, nCount) ((Class*) new char[ sizeof(Class) * (nCount) ])
-#else
-#define NEW_OBJECTS(Class, nCount) (new Class[nCount])
-#endif
-
-
-USHORT SfxFontSizeInfo::pStaticSizes[] =
-{
- 60,
- 80,
- 100,
- 120,
- 140,
- 180,
- 240,
- 360,
- 480,
- 600,
- 720
-};
-
-//--------------------------------------------------------------------
-
-SV_DECL_PTRARR_DEL(SfxFontArr_Impl,SfxFont*,10,5)
-
// struct SfxPrinter_Impl ------------------------------------------------
struct SfxPrinter_Impl
{
- SfxFontArr_Impl* mpFonts;
BOOL mbAll;
BOOL mbSelection;
BOOL mbFromTo;
BOOL mbRange;
SfxPrinter_Impl() :
- mpFonts ( NULL ),
mbAll ( TRUE ),
mbSelection ( TRUE ),
mbFromTo ( TRUE ),
mbRange ( TRUE ) {}
- ~SfxPrinter_Impl() { delete mpFonts; }
+ ~SfxPrinter_Impl() {}
};
-#define FONTS() pImpl->mpFonts
-
struct SfxPrintOptDlg_Impl
{
sal_Bool mbHelpDisabled;
@@ -101,98 +69,6 @@ struct SfxPrintOptDlg_Impl
mbHelpDisabled ( sal_False ) {}
};
-//--------------------------------------------------------------------
-
-SfxFontSizeInfo::SfxFontSizeInfo( const SfxFont &rFont,
- const OutputDevice &rDevice ) :
-
- pSizes(0),
- nSizes(0),
- bScalable(TRUE)
-
-{
- if ( 0 == rDevice.GetDevFontCount() )
- bScalable = FALSE;
- else
- {
- OutputDevice &rDev = (OutputDevice&) rDevice;
- Font aFont(rFont.GetName(), Size(0,12));
- aFont.SetFamily(rFont.GetFamily());
- aFont.SetPitch(rFont.GetPitch());
- aFont.SetCharSet(rFont.GetCharSet());
-
- // verfuegbare Groessen in die Liste eintragen, Groesse in 10tel Punkt
- int nSizeCount = rDev.GetDevFontSizeCount(aFont);
- pSizes = NEW_OBJECTS(Size, nSizeCount);
- const MapMode aOldMapMode = rDev.GetMapMode();
- MapMode aMap(aOldMapMode);
- aMap.SetMapUnit(MAP_POINT);
- const Fraction aTen(1, 10);
- aMap.SetScaleX(aTen);
- aMap.SetScaleY(aTen);
- rDev.SetMapMode(aMap);
-
- // Es gibt Fonts mit Bitmaps und skalierbaren Groessen
- // In diesem Fall wird der Fonts als skalierbar behandelt.
- BOOL bFoundScalable = FALSE;
- for ( int i = 0; i < nSizeCount; ++i )
- {
- const Size aSize( rDev.GetDevFontSize(aFont, i) );
- if ( aSize.Height() != 0 )
- pSizes[nSizes++] = aSize;
- else
- bFoundScalable |= TRUE;
- }
- if( !bFoundScalable )
- bScalable = FALSE;
- else
- {
- // statische Font-Sizes verwenden
- delete [] pSizes;
- nSizes = 0;
- }
- rDev.SetMapMode(aOldMapMode);
- }
-
- if ( 0 == nSizes )
- {
- nSizes = sizeof(pStaticSizes) / sizeof(USHORT);
- pSizes = NEW_OBJECTS(Size, nSizes);
- for ( USHORT nPos = 0; nPos <nSizes; ++nPos )
- pSizes[nPos] = Size( 0, pStaticSizes[nPos] );
- }
-}
-
-//--------------------------------------------------------------------
-
-SfxFontSizeInfo::~SfxFontSizeInfo()
-{
- delete [] pSizes;
-}
-
-//--------------------------------------------------------------------
-
-BOOL SfxFontSizeInfo::HasSize(const Size &rSize) const
-{
- if ( bScalable )
- return TRUE;
- for ( USHORT i = 0; i < nSizes; ++i)
- if ( pSizes[i] == rSize )
- return TRUE;
- return FALSE;
-}
-
-//--------------------------------------------------------------------
-
-SfxFont::SfxFont( const FontFamily eFontFamily, const String& aFontName,
- const FontPitch eFontPitch, const CharSet eFontCharSet ):
- aName( aFontName ),
- eFamily( eFontFamily ),
- ePitch( eFontPitch ),
- eCharSet( eFontCharSet )
-{
-}
-
// class SfxPrinter ------------------------------------------------------
SfxPrinter* SfxPrinter::Create( SvStream& rStream, SfxItemSet* pOptions )
@@ -333,194 +209,6 @@ void SfxPrinter::SetOptions( const SfxItemSet &rNewOptions )
//--------------------------------------------------------------------
-void SfxPrinter::EnableRange( USHORT nRange )
-{
- PrintDialogRange eRange = (PrintDialogRange)nRange;
-
- if ( eRange == PRINTDIALOG_ALL )
- pImpl->mbAll = TRUE;
- else if ( eRange == PRINTDIALOG_SELECTION )
- pImpl->mbSelection = TRUE;
- else if ( eRange == PRINTDIALOG_FROMTO )
- pImpl->mbFromTo = TRUE;
- else if ( eRange == PRINTDIALOG_RANGE )
- pImpl->mbRange = TRUE;
-}
-
-//--------------------------------------------------------------------
-
-void SfxPrinter::DisableRange( USHORT nRange )
-{
- PrintDialogRange eRange = (PrintDialogRange)nRange;
-
- if ( eRange == PRINTDIALOG_ALL )
- pImpl->mbAll = FALSE;
- else if ( eRange == PRINTDIALOG_SELECTION )
- pImpl->mbSelection = FALSE;
- else if ( eRange == PRINTDIALOG_FROMTO )
- pImpl->mbFromTo = FALSE;
- else if ( eRange == PRINTDIALOG_RANGE )
- pImpl->mbRange = FALSE;
-}
-
-//--------------------------------------------------------------------
-
-BOOL SfxPrinter::IsRangeEnabled( USHORT nRange ) const
-{
- PrintDialogRange eRange = (PrintDialogRange)nRange;
- BOOL bRet = FALSE;
-
- if ( eRange == PRINTDIALOG_ALL )
- bRet = pImpl->mbAll;
- else if ( eRange == PRINTDIALOG_SELECTION )
- bRet = pImpl->mbSelection;
- else if ( eRange == PRINTDIALOG_FROMTO )
- bRet = pImpl->mbFromTo;
- else if ( eRange == PRINTDIALOG_RANGE )
- bRet = pImpl->mbRange;
-
- return bRet;
-}
-
-//--------------------------------------------------------------------
-
-SV_IMPL_PTRARR(SfxFontArr_Impl,SfxFont*)
-
-//--------------------------------------------------------------------
-
-const SfxFont* SfxFindFont_Impl( const SfxFontArr_Impl& rArr,
- const String& rName )
-{
- const USHORT nCount = rArr.Count();
- for ( USHORT i = 0; i < nCount; ++i )
- {
- const SfxFont *pFont = rArr[i];
- if ( pFont->GetName() == rName )
- return pFont;
- }
- return NULL;
-}
-
-//--------------------------------------------------------------------
-
-void SfxPrinter::UpdateFonts_Impl()
-{
- VirtualDevice *pVirDev = 0;
- const OutputDevice *pOut = this;
-
- // falls kein Drucker gefunden werden konnte, ein
- // temp. Device erzeugen fuer das Erfragen der Fonts
- if( !IsValid() )
- pOut = pVirDev = new VirtualDevice;
-
- int nCount = pOut->GetDevFontCount();
- FONTS() = new SfxFontArr_Impl((BYTE)nCount);
-
- std::vector< Font > aNonRegularFonts;
- for(int i = 0;i < nCount;++i)
- {
- Font aFont(pOut->GetDevFont(i));
- if ( (aFont.GetItalic() != ITALIC_NONE) ||
- (aFont.GetWeight() != WEIGHT_MEDIUM) )
- {
- // First: Don't add non-regular fonts. The font name is not unique so we have
- // to filter the device font list.
- aNonRegularFonts.push_back( aFont );
- }
- else if ( FONTS()->Count() == 0 ||
- (*FONTS())[FONTS()->Count()-1]->GetName() != aFont.GetName() )
- {
- DBG_ASSERT(0 == SfxFindFont_Impl(*FONTS(), aFont.GetName()), "Doppelte Fonts vom SV-Device!");
- SfxFont* pTmp = new SfxFont( aFont.GetFamily(), aFont.GetName(),
- aFont.GetPitch(), aFont.GetCharSet() );
- FONTS()->C40_INSERT(SfxFont, pTmp, FONTS()->Count());
- }
- }
- delete pVirDev;
-
- // Try to add all non-regular fonts. It could be that there was no regular font
- // with the same name added.
- std::vector< Font >::const_iterator pIter;
- for ( pIter = aNonRegularFonts.begin(); pIter != aNonRegularFonts.end(); ++pIter )
- {
- if ( SfxFindFont_Impl( *FONTS(), pIter->GetName() ) == 0 )
- {
- SfxFont* pTmp = new SfxFont( pIter->GetFamily(), pIter->GetName(),
- pIter->GetPitch(), pIter->GetCharSet() );
- FONTS()->C40_INSERT( SfxFont, pTmp, FONTS()->Count() );
- }
- }
-}
-
-//--------------------------------------------------------------------
-
-USHORT SfxPrinter::GetFontCount()
-{
- if ( !FONTS() )
- UpdateFonts_Impl();
- return FONTS()->Count();
-}
-
-//--------------------------------------------------------------------
-
-const SfxFont* SfxPrinter::GetFont( USHORT nNo ) const
-{
- DBG_ASSERT( FONTS(), "bitte erst GetFontCount() abfragen!" );
- return (*FONTS())[ nNo ];
-}
-
-//--------------------------------------------------------------------
-
-const SfxFont* SfxPrinter::GetFontByName( const String &rFontName )
-{
- if ( !FONTS() )
- UpdateFonts_Impl();
- return SfxFindFont_Impl(*FONTS(), rFontName);
-}
-
-//--------------------------------------------------------------------
-
-BOOL SfxPrinter::InitJob( Window* pUIParent, BOOL bAskAboutTransparentObjects )
-{
- const SvtPrinterOptions aPrinterOpt;
- const SvtPrintFileOptions aPrintFileOpt;
- const SvtBasePrintOptions* pPrinterOpt = &aPrinterOpt;
- const SvtBasePrintOptions* pPrintFileOpt = &aPrintFileOpt;
- PrinterOptions aNewPrinterOptions;
- BOOL bRet = TRUE;
-
- ( ( IsPrintFileEnabled() && GetPrintFile().Len() ) ? pPrintFileOpt : pPrinterOpt )->GetPrinterOptions( aNewPrinterOptions );
-
- if( bAskAboutTransparentObjects && !aNewPrinterOptions.IsReduceTransparency() )
- {
- if ( !Application::IsHeadlessModeEnabled() )
- {
- SvtPrintWarningOptions aWarnOpt;
-
- if( aWarnOpt.IsTransparency() )
- {
- TransparencyPrintWarningBox aWarnBox( pUIParent );
- const USHORT nRet = aWarnBox.Execute();
-
- if( nRet == RET_CANCEL )
- bRet = FALSE;
- else
- {
- aNewPrinterOptions.SetReduceTransparency( nRet != RET_NO );
- aWarnOpt.SetTransparency( !aWarnBox.IsNoWarningChecked() );
- }
- }
- }
- }
-
- if( bRet )
- SetPrinterOptions( aNewPrinterOptions );
-
- return bRet;
-}
-
-//--------------------------------------------------------------------
-
SfxPrintOptionsDialog::SfxPrintOptionsDialog( Window *pParent,
SfxViewShell *pViewShell,
const SfxItemSet *pSet ) :
diff --git a/sfx2/source/view/prnmon.cxx b/sfx2/source/view/prnmon.cxx
deleted file mode 100644
index 6bab763dc1..0000000000
--- a/sfx2/source/view/prnmon.cxx
+++ /dev/null
@@ -1,488 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sfx2.hxx"
-#include <com/sun/star/view/PrintableState.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
-#include <com/sun/star/util/XCloseBroadcaster.hpp>
-#include <com/sun/star/util/XCloseListener.hpp>
-#include <com/sun/star/util/CloseVetoException.hpp>
-#include <vcl/fixed.hxx>
-#include <vcl/msgbox.hxx>
-#include <svtools/asynclink.hxx>
-
-#include <unotools/printwarningoptions.hxx>
-#include <svl/eitem.hxx>
-
-#include <sfx2/prnmon.hxx>
-#include <sfx2/viewsh.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <sfx2/objsh.hxx>
-#include <sfx2/docfile.hxx>
-#include "sfxtypes.hxx"
-#include <sfx2/progress.hxx>
-#include <sfx2/bindings.hxx>
-#include "sfxresid.hxx"
-#include <sfx2/event.hxx>
-#include <sfx2/request.hxx>
-#include <sfx2/app.hxx>
-
-#include "view.hrc"
-
-//------------------------------------------------------------------------
-
-#define SFX_TITLE_MAXLEN_PRINTMONITOR 22
-
-//------------------------------------------------------------------------
-
-struct SfxPrintMonitor_Impl: public ModelessDialog
-{
-
- SfxPrintMonitor_Impl( Window *pParent, SfxViewShell *rpViewShell );
- virtual BOOL Close();
-
- SfxViewShell* pViewShell;
- FixedText aDocName;
- FixedText aPrinting;
- FixedText aPrinter;
- FixedText aPrintInfo;
- CancelButton aCancel;
-};
-
-//-------------------------------------------------------------------------
-
-struct SfxPrintProgress_Impl : public SfxListener
-{
- SfxPrintMonitor_Impl* pMonitor;
- SfxViewShell* pViewShell;
- SfxPrinter* pPrinter;
- SfxPrinter* pOldPrinter;
- USHORT nLastPage;
- BOOL bRunning;
- BOOL bCancel;
- BOOL bDeleteOnEndPrint;
- BOOL bShow;
- BOOL bCallbacks;
- BOOL bOldEnablePrintFile;
- BOOL bOldFlag;
- BOOL bRestoreFlag;
- BOOL bAborted;
- svtools::AsynchronLink aDeleteLink;
- Link aCancelHdl;
-
-private:
- DECL_LINK( CancelHdl, Button * );
- DECL_STATIC_LINK( SfxPrintProgress_Impl, DeleteHdl, SfxPrintProgress * );
-
-public:
- SfxPrintProgress_Impl( SfxViewShell* pTheViewShell, SfxPrinter* pThePrinter );
- ~SfxPrintProgress_Impl();
-
- void Delete( SfxPrintProgress* pAntiImpl ) { aDeleteLink.Call( pAntiImpl ); }
- SfxViewShell* GetViewShell() const { return pViewShell; }
- BOOL SetPage( USHORT nPage, const String &rPage );
- void CreateMonitor();
- virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
-};
-
-void SfxPrintProgress_Impl::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
-{
- SfxPrintingHint* pPrintHint = PTR_CAST( SfxPrintingHint, &rHint );
- if ( pPrintHint )
- {
- if ( pPrintHint->GetWhich() == -2 )
- CancelHdl(0);
- }
-}
-
-//------------------------------------------------------------------------
-
-SfxPrintMonitor_Impl::SfxPrintMonitor_Impl( Window* pParent, SfxViewShell* rpViewShell ) :
- ModelessDialog( pParent, SfxResId( DLG_PRINTMONITOR ) ),
- pViewShell ( rpViewShell ),
- aDocName ( this, SfxResId( FT_DOCNAME ) ),
- aPrinting ( this, SfxResId( FT_PRINTING ) ),
- aPrinter ( this, SfxResId( FT_PRINTER ) ),
- aPrintInfo ( this, SfxResId( FT_PRINTINFO ) ),
- aCancel ( this, SfxResId( PB_CANCELPRNMON ) )
-{
- if( rpViewShell->GetPrinter()->GetCapabilities( PRINTER_CAPABILITIES_EXTERNALDIALOG ) != 0 )
- {
- String aPrep( SfxResId( STR_FT_PREPARATION ) );
- aPrinting.SetText( aPrep );
- aPrinter.Show( FALSE );
- }
- FreeResource();
-}
-
-//------------------------------------------------------------------------
-
-IMPL_STATIC_LINK_NOINSTANCE( SfxPrintProgress_Impl, DeleteHdl, SfxPrintProgress*, pAntiImpl )
-{
- delete pAntiImpl;
- return 0;
-}
-
-void actualizePrintCancelState(CancelButton& rButton, const SfxObjectShell* pShell)
-{
- sal_Bool bEnableCancelButton = sal_True;
- if (pShell)
- bEnableCancelButton = pShell->Stamp_GetPrintCancelState();
-
- if (!bEnableCancelButton)
- rButton.Disable();
- else
- rButton.Enable();
-}
-
-//------------------------------------------------------------------------
-
-SfxPrintProgress_Impl::SfxPrintProgress_Impl( SfxViewShell* pTheViewShell,
- SfxPrinter* pThePrinter ) :
-
- pMonitor ( 0 ),
- pViewShell ( pTheViewShell ),
- pPrinter ( pThePrinter ),
- pOldPrinter ( NULL ),
- nLastPage ( 0 ),
- bRunning ( TRUE ),
- bCancel ( FALSE ),
- bDeleteOnEndPrint ( FALSE ),
- bShow ( FALSE ),
- bCallbacks ( FALSE ),
- bOldEnablePrintFile ( FALSE ),
- bOldFlag ( TRUE ),
- bRestoreFlag ( FALSE ),
- bAborted ( FALSE ),
- aDeleteLink ( STATIC_LINK( this, SfxPrintProgress_Impl, DeleteHdl ) )
-{
- StartListening( *pViewShell->GetObjectShell() );
-}
-
-void SfxPrintProgress_Impl::CreateMonitor()
-{
- // mark monitor to been shown in first status indication
- bShow = TRUE;
-
- if ( !pMonitor )
- {
- Window* pParent = pViewShell->GetWindow();
- pMonitor = new SfxPrintMonitor_Impl( pParent, pViewShell );
- pMonitor->aDocName.SetText( pViewShell->GetObjectShell()->GetTitle( SFX_TITLE_MAXLEN_PRINTMONITOR ) );
- pMonitor->aPrinter.SetText( pViewShell->GetPrinter()->GetName() );
-
- // Stampit enable/dsiable cancel button
- actualizePrintCancelState( pMonitor->aCancel, pViewShell->GetObjectShell() );
- pMonitor->aCancel.SetClickHdl( LINK( this, SfxPrintProgress_Impl, CancelHdl ) );
- }
-}
-
-//------------------------------------------------------------------------
-
-SfxPrintProgress_Impl::~SfxPrintProgress_Impl()
-{
-}
-
-//------------------------------------------------------------------------
-
-BOOL SfxPrintProgress_Impl::SetPage( USHORT nPage, const String &rPage )
-{
- // wurde der Druckauftrag abgebrochen?
- if ( bCancel || !pMonitor )
- return FALSE;
-
- // Stampit enable/dsiable cancel button
- actualizePrintCancelState(pMonitor->aCancel, pViewShell->GetObjectShell());
-
- nLastPage = nPage;
- String aStrPrintInfo = String( SfxResId( STR_PAGE ) );
- if ( !rPage.Len() )
- aStrPrintInfo += String::CreateFromInt32( nLastPage );
- else
- aStrPrintInfo += rPage;
- pMonitor->aPrintInfo.SetText( aStrPrintInfo );
- pMonitor->Update();
- return TRUE;
-}
-
-//------------------------------------------------------------------------
-
-IMPL_LINK( SfxPrintProgress_Impl, CancelHdl, Button *, EMPTYARG )
-{
- if ( !pViewShell->GetPrinter()->IsJobActive() && pViewShell->GetPrinter()->IsPrinting() )
- // we are still in StartJob, cancelling now might lead to a crash
- return 0;
-
- if ( pMonitor )
- pMonitor->Hide();
-
- pViewShell->GetObjectShell()->Broadcast( SfxPrintingHint( com::sun::star::view::PrintableState_JOB_ABORTED, NULL, NULL ) );
- pViewShell->GetPrinter()->AbortJob();
- bCancel = TRUE;
-
- if ( aCancelHdl.IsSet() )
- aCancelHdl.Call( this );
-
- bAborted = TRUE;
- return 0;
-}
-
-BOOL SfxPrintMonitor_Impl::Close()
-{
- BOOL bAgree = pViewShell ? pViewShell->GetObjectShell()->Stamp_GetPrintCancelState() : TRUE;
- if (!bAgree)
- return FALSE;
- else
- return ModelessDialog::Close();
-}
-
-//--------------------------------------------------------------------
-
-SfxPrintProgress::SfxPrintProgress( SfxViewShell* pViewSh, bool bShow )
-: SfxProgress( pViewSh->GetViewFrame()->GetObjectShell(),
- String(SfxResId(STR_PRINTING)), 1, FALSE ),
- pImp( new SfxPrintProgress_Impl( pViewSh, pViewSh->GetPrinter() ) )
-{
- SfxObjectShell* pDoc = pViewSh->GetObjectShell();
- SFX_ITEMSET_ARG( pDoc->GetMedium()->GetItemSet(), pItem, SfxBoolItem, SID_HIDDEN, FALSE );
- if ( pItem && pItem->GetValue() )
- bShow = FALSE;
-
- if ( bShow )
- pImp->CreateMonitor();
-
- Lock();
- if ( !SvtPrintWarningOptions().IsModifyDocumentOnPrintingAllowed() )
- {
- pImp->bRestoreFlag = TRUE;
- pImp->bOldFlag = pDoc->IsEnableSetModified();
- if ( pImp->bOldFlag )
- pDoc->EnableSetModified( FALSE );
- }
-}
-
-//--------------------------------------------------------------------
-
-SfxPrintProgress::~SfxPrintProgress()
-{
- // k"onnte auch schon weg sein (in EndPrintNotify)
- DELETEZ(pImp->pMonitor);
-
- // ggf. Callbacks entfermen
- if ( pImp->bCallbacks )
- {
- // pImp->pPrinter->SetEndPrintHdl( Link() );
- pImp->pPrinter->SetErrorHdl( Link() );
- pImp->bCallbacks = FALSE;
- }
-
- // ggf. vorherigen Drucker wieder einsetzen
- if ( pImp->pOldPrinter )
- pImp->pViewShell->SetPrinter( pImp->pOldPrinter, SFX_PRINTER_PRINTER );
- else
- // ggf. vorherigen Print-To-File-Status zuruecksetzen
- pImp->pViewShell->GetPrinter()->EnablePrintFile( pImp->bOldEnablePrintFile );
-
- // EndPrint-Notification an Frame
- //pImp->pViewShell->GetViewFrame()->GetFrame().Lock_Impl(FALSE);
- pImp->EndListening( *(pImp->pViewShell->GetObjectShell()) );
-
- // the following call might destroy the view or even the document
- pImp->pViewShell->CheckOwnerShip_Impl();
- delete pImp;
-}
-
-//--------------------------------------------------------------------
-
-BOOL SfxPrintProgress::SetState( ULONG nValue, ULONG nNewRange )
-{
- if ( pImp->bShow )
- {
- pImp->bShow = FALSE;
- if ( pImp->pMonitor )
- {
- pImp->pMonitor->Show();
- pImp->pMonitor->Update();
- }
- }
-
- return pImp->SetPage( (USHORT)nValue, GetStateText_Impl() ) &&
- SfxProgress::SetState( nValue, nNewRange );
-}
-
-//--------------------------------------------------------------------
-
-void SfxPrintProgress::SetText( const String& rText )
-{
- if ( pImp->pMonitor )
- {
- pImp->pMonitor->SetText( rText );
- pImp->pMonitor->Update();
- }
- SfxProgress::SetText( rText );
-}
-
-//------------------------------------------------------------------------
-
-IMPL_LINK_INLINE_START( SfxPrintProgress, PrintErrorNotify, void *, EMPTYARG )
-{
- if ( pImp->pMonitor )
- pImp->pMonitor->Hide();
- // AbortJob calls EndPrint hdl, so do not delete pImp just now
- BOOL bWasDeleteOnEndPrint = pImp->bDeleteOnEndPrint;
- pImp->bDeleteOnEndPrint = FALSE;
- pImp->pPrinter->AbortJob();
- InfoBox( pImp->GetViewShell()->GetWindow(),
- String( SfxResId(STR_ERROR_PRINT) ) ).Execute();
- if ( pImp->bRestoreFlag && pImp->pViewShell->GetObjectShell()->IsEnableSetModified() != pImp->bOldFlag )
- pImp->pViewShell->GetObjectShell()->EnableSetModified( pImp->bOldFlag );
- pImp->GetViewShell()->GetObjectShell()->Broadcast( SfxPrintingHint( com::sun::star::view::PrintableState_JOB_FAILED, NULL, NULL ) );
- // now we can clean up like normally EndPrint hdl does
- if( bWasDeleteOnEndPrint )
- {
- DELETEZ(pImp->pMonitor);
- delete this;
- }
- return 0;
-}
-IMPL_LINK_INLINE_END( SfxPrintProgress, PrintErrorNotify, void *, EMPTYARG )
-
-//------------------------------------------------------------------------
-
-IMPL_LINK( SfxPrintProgress, StartPrintNotify, void *, EMPTYARG )
-{
- SfxObjectShell *pObjShell = pImp->pViewShell->GetObjectShell();
- SFX_APP()->NotifyEvent(SfxEventHint(SFX_EVENT_PRINTDOC, GlobalEventConfig::GetEventName( STR_EVENT_PRINTDOC ), pObjShell));
- pObjShell->Broadcast( SfxPrintingHint( com::sun::star::view::PrintableState_JOB_STARTED, NULL, NULL ) );
- return 0;
-}
-
-IMPL_LINK( SfxPrintProgress, EndPrintNotify, void *, EMPTYARG )
-{
- if ( pImp->pMonitor )
- pImp->pMonitor->Hide();
-
- SfxViewShell* pViewShell = pImp->pViewShell;
-
- // Slots enablen
- pViewShell->Invalidate( SID_PRINTDOC );
- pViewShell->Invalidate( SID_PRINTDOCDIRECT );
- pViewShell->Invalidate( SID_SETUPPRINTER );
-
- // . . . falls der Printer im System umgestellt wurde, hier Aenderung
- // nachziehen.
- //! if( pMDI->IsPrinterChanged() ) pMDI->Changed( 0L );
-
- // Callbacks rausnehmen
- // pImp->pPrinter->SetEndPrintHdl( Link() );
- pImp->pPrinter->SetErrorHdl( Link() );
- pImp->bCallbacks = FALSE;
-
- // ggf. alten Printer wieder einsetzen
- if ( pImp->pOldPrinter )
- {
- // Fix #59613#: niemals den aktuellen Printer synchron abschiessen !
- // Da sowieso immer bDeleteOnEndPrint gesetzt wird, wird der der Drucker im
- // dtor vom Printprogress ( dann aber asynchron !! ) zur"uckgesetzt.
-/*
- pImp->pViewShell->SetPrinter( pImp->pOldPrinter, SFX_PRINTER_PRINTER );
- pImp->pOldPrinter = 0;
- pImp->pPrinter = 0;
- */
- }
- else
- // ggf. vorherigen Print-To-File-Status zuruecksetzen
- pViewShell->GetPrinter()->EnablePrintFile( pImp->bOldEnablePrintFile );
-
- // it is possible that after printing the document or view is deleted (because the VieShell got the ownership)
- // so first clean up
- if ( pImp->bRestoreFlag && pViewShell->GetObjectShell()->IsEnableSetModified() != pImp->bOldFlag )
- pViewShell->GetObjectShell()->EnableSetModified( TRUE );
-
- pViewShell->GetObjectShell()->Broadcast( SfxPrintingHint( com::sun::star::view::PrintableState_JOB_COMPLETED, NULL, NULL ) );
- if ( pImp->bDeleteOnEndPrint )
- {
- DELETEZ(pImp->pMonitor);
- delete this;
- }
- else
- {
- DBG_ASSERT( !pImp->pOldPrinter, "Unable to restore printer!" );
- pImp->bRunning = FALSE;
- }
-
- return 0;
-}
-
-//------------------------------------------------------------------------
-
-void SfxPrintProgress::DeleteOnEndPrint()
-{
- UnLock(); // jetzt schon, wg. Drucken im Thread
-#ifndef WNT
- // da das Drucken im 'Thread' unter Windows zu undefiniert ist bleibt der
- // Print-Monitor dort stehen, auf den anderen Plattformen kann man dann
- // weiterarbeiten, also kommt das Teil weg
- DELETEZ( pImp->pMonitor );
-#endif
-
- pImp->bDeleteOnEndPrint = TRUE;
- if ( !pImp->bRunning )
- delete this;
-}
-
-//------------------------------------------------------------------------
-
-void SfxPrintProgress::RestoreOnEndPrint( SfxPrinter *pOldPrinter,
- BOOL bOldEnablePrintFile )
-{
- pImp->pOldPrinter = pOldPrinter;
- pImp->bOldEnablePrintFile = bOldEnablePrintFile;
-}
-
-//------------------------------------------------------------------------
-
-void SfxPrintProgress::RestoreOnEndPrint( SfxPrinter *pOldPrinter )
-{
- RestoreOnEndPrint( pOldPrinter, FALSE );
-}
-
-//------------------------------------------------------------------------
-
-void SfxPrintProgress::SetCancelHdl( const Link& aCancelHdl )
-{
- pImp->aCancelHdl = aCancelHdl;
-}
-
-BOOL SfxPrintProgress::IsAborted() const
-{
- return pImp->bAborted;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx
index f641a4a1b4..c231e44247 100644
--- a/sfx2/source/view/sfxbasecontroller.cxx
+++ b/sfx2/source/view/sfxbasecontroller.cxx
@@ -82,7 +82,7 @@
#include <sfx2/objface.hxx>
#include <osl/mutex.hxx>
-#include <osl/mutex.hxx>
+#include <tools/diagnose_ex.h>
#include <tools/diagnose_ex.h>
#include <comphelper/sequence.hxx>
#include <rtl/ustrbuf.hxx>
@@ -94,7 +94,7 @@
#include <hash_map>
#include <sfx2/event.hxx>
-#include "viewfac.hxx"
+#include "sfx2/viewfac.hxx"
#define OMULTITYPEINTERFACECONTAINERHELPER ::cppu::OMultiTypeInterfaceContainerHelper
#define OINTERFACECONTAINERHELPER ::cppu::OInterfaceContainerHelper
@@ -640,7 +640,7 @@ void SAL_CALL SfxBaseController::attachFrame( const REFERENCE< XFRAME >& xFrame
ConnectSfxFrame_Impl( E_CONNECT );
// attaching the frame to the controller is the last step in the creation of a new view, so notify this
- SfxEventHint aHint( SFX_EVENT_VIEWCREATED, GlobalEventConfig::GetEventName( STR_EVENT_VIEWCREATED ), m_pData->m_pViewShell->GetObjectShell() );
+ SfxViewEventHint aHint( SFX_EVENT_VIEWCREATED, GlobalEventConfig::GetEventName( STR_EVENT_VIEWCREATED ), m_pData->m_pViewShell->GetObjectShell(), uno::Reference< frame::XController2 >( this ) );
SFX_APP()->NotifyEvent( aHint );
}
}
@@ -735,7 +735,7 @@ ANY SfxBaseController::getViewData() throw( ::com::sun::star::uno::RuntimeExcept
if ( m_pData->m_pViewShell )
{
m_pData->m_pViewShell->WriteUserData( sData1 ) ;
- OUSTRING sData( sData1 );
+ ::rtl::OUString sData( sData1 );
aAny <<= sData ;
}
@@ -751,7 +751,7 @@ void SAL_CALL SfxBaseController::restoreViewData( const ANY& aValue ) throw( ::c
SolarMutexGuard aGuard;
if ( m_pData->m_pViewShell )
{
- OUSTRING sData;
+ ::rtl::OUString sData;
aValue >>= sData ;
m_pData->m_pViewShell->ReadUserData( sData ) ;
}
@@ -782,7 +782,7 @@ REFERENCE< XMODEL > SAL_CALL SfxBaseController::getModel() throw( ::com::sun::st
//________________________________________________________________________________________________________
REFERENCE< XDISPATCH > SAL_CALL SfxBaseController::queryDispatch( const UNOURL& aURL ,
- const OUSTRING& sTargetFrameName,
+ const ::rtl::OUString& sTargetFrameName,
sal_Int32 eSearchFlags ) throw( RUNTIMEEXCEPTION )
{
SolarMutexGuard aGuard;
@@ -939,12 +939,12 @@ REFERENCE< XDISPATCH > SAL_CALL SfxBaseController::queryDispatch( const UNOURL&
// SfxBaseController -> XDispatchProvider
//________________________________________________________________________________________________________
-SEQUENCE< REFERENCE< XDISPATCH > > SAL_CALL SfxBaseController::queryDispatches( const SEQUENCE< DISPATCHDESCRIPTOR >& seqDescripts ) throw( ::com::sun::star::uno::RuntimeException )
+uno::Sequence< REFERENCE< XDISPATCH > > SAL_CALL SfxBaseController::queryDispatches( const uno::Sequence< DISPATCHDESCRIPTOR >& seqDescripts ) throw( ::com::sun::star::uno::RuntimeException )
{
// Create return list - which must have same size then the given descriptor
// It's not allowed to pack it!
sal_Int32 nCount = seqDescripts.getLength();
- SEQUENCE< REFERENCE< XDISPATCH > > lDispatcher( nCount );
+ uno::Sequence< REFERENCE< XDISPATCH > > lDispatcher( nCount );
for( sal_Int32 i=0; i<nCount; ++i )
{
@@ -1053,7 +1053,7 @@ void SAL_CALL SfxBaseController::dispose() throw( ::com::sun::star::uno::Runtime
if ( pFrame && pFrame->GetViewShell() == m_pData->m_pViewShell )
pFrame->GetFrame().SetIsClosing_Impl();
m_pData->m_pViewShell->DiscardClients_Impl();
- m_pData->m_pViewShell->pImp->bControllerSet = sal_False ;
+ m_pData->m_pViewShell->pImp->m_bControllerSet = false;
if ( pFrame )
{
@@ -1070,7 +1070,7 @@ void SAL_CALL SfxBaseController::dispose() throw( ::com::sun::star::uno::Runtime
pView = SfxViewFrame::GetNext( *pView, pDoc );
}
- SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_CLOSEVIEW, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEVIEW ), pDoc ) );
+ SFX_APP()->NotifyEvent( SfxViewEventHint(SFX_EVENT_CLOSEVIEW, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEVIEW ), pDoc, uno::Reference< frame::XController2 >( this ) ) );
if ( !pView )
SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_CLOSEDOC, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ), pDoc) );
@@ -1439,11 +1439,11 @@ void SfxBaseController::ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect )
try
{
Reference< XViewDataSupplier > xViewDataSupplier( getModel(), UNO_QUERY_THROW );
- Reference< XIndexAccess > xViewData( xViewDataSupplier->getViewData(), UNO_SET_THROW );
+ Reference< XIndexAccess > xViewData( xViewDataSupplier->getViewData() );
// find the view data item whose ViewId matches the ID of the view we're just connecting to
const SfxObjectFactory& rDocFactory( rDoc.GetFactory() );
- const sal_Int32 nCount = xViewData->getCount();
+ const sal_Int32 nCount = xViewData.is() ? xViewData->getCount() : 0;
sal_Int32 nViewDataIndex = 0;
for ( sal_Int32 i=0; i<nCount; ++i )
{
diff --git a/sfx2/source/view/view.hrc b/sfx2/source/view/view.hrc
index 167566555c..cdeba10cc3 100644
--- a/sfx2/source/view/view.hrc
+++ b/sfx2/source/view/view.hrc
@@ -41,12 +41,6 @@
#define STR_NOSTARTPRINTER (RID_SFX_VIEW_START+ 9)
#define STR_PRINTING (RID_SFX_VIEW_START+10)
-#ifndef STR_UNDO
-#define STR_UNDO (RID_SFX_VIEW_START+11)
-#define STR_REDO (RID_SFX_VIEW_START+12)
-#define STR_REPEAT (RID_SFX_VIEW_START+13)
-#endif
-
#define DLG_PRINTMONITOR (RID_SFX_VIEW_START)
#define FT_DOCNAME 1
#define FT_PRINTING 2
diff --git a/sfx2/source/view/viewfac.cxx b/sfx2/source/view/viewfac.cxx
index a770ad2976..60d8c6bb62 100644
--- a/sfx2/source/view/viewfac.cxx
+++ b/sfx2/source/view/viewfac.cxx
@@ -31,8 +31,8 @@
// INCLUDE ---------------------------------------------------------------
#include <sfx2/app.hxx>
+#include "sfx2/viewfac.hxx"
#include <rtl/ustrbuf.hxx>
-#include "viewfac.hxx"
// STATIC DATA -----------------------------------------------------------
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 93a951d144..5857ac6389 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -94,6 +94,8 @@
#include <comphelper/storagehelper.hxx>
#include <svtools/asynclink.hxx>
#include <svl/sharecontrolfile.hxx>
+#include <svtools/svtools.hrc>
+#include <svtools/svtdata.hxx>
#include <framework/framelistanalyzer.hxx>
#include <boost/optional.hpp>
@@ -125,10 +127,10 @@ namespace css = ::com::sun::star;
#include <sfx2/request.hxx>
#include <sfx2/docfac.hxx>
#include <sfx2/ipclient.hxx>
-#include "sfxresid.hxx"
+#include "sfx2/sfxresid.hxx"
#include "appbas.hxx"
#include <sfx2/objitem.hxx>
-#include "viewfac.hxx"
+#include "sfx2/viewfac.hxx"
#include <sfx2/event.hxx>
#include "fltfnc.hxx"
#include <sfx2/docfile.hxx>
@@ -145,7 +147,7 @@ namespace css = ::com::sun::star;
#include "workwin.hxx"
#include "helper.hxx"
#include "macro.hxx"
-#include "minfitem.hxx"
+#include "sfx2/minfitem.hxx"
#include "../appl/app.hrc"
#include "impviewframe.hxx"
@@ -1023,8 +1025,8 @@ void SfxViewFrame::StateHistory_Impl( SfxItemSet &rSet )
if ( pShUndoMgr && pShUndoMgr->GetUndoActionCount() )
{
- String aTmp( SfxResId( STR_UNDO ) );
- aTmp += pShUndoMgr->GetUndoActionComment(0);
+ String aTmp( SvtResId( STR_UNDO ) );
+ aTmp+= pShUndoMgr->GetUndoActionComment(0);
rSet.Put( SfxStringItem( SID_UNDO, aTmp ) );
}
else
@@ -1032,7 +1034,7 @@ void SfxViewFrame::StateHistory_Impl( SfxItemSet &rSet )
if ( pShUndoMgr && pShUndoMgr->GetRedoActionCount() )
{
- String aTmp( SfxResId(STR_REDO) );
+ String aTmp( SvtResId(STR_REDO) );
aTmp += pShUndoMgr->GetRedoActionComment(0);
rSet.Put( SfxStringItem( SID_REDO, aTmp ) );
}
@@ -1042,7 +1044,7 @@ void SfxViewFrame::StateHistory_Impl( SfxItemSet &rSet )
if ( pShUndoMgr && pTarget && pShUndoMgr->GetRepeatActionCount() &&
pShUndoMgr->CanRepeat(*pTarget, 0) )
{
- String aTmp( SfxResId(STR_REPEAT) );
+ String aTmp( SvtResId(STR_REPEAT) );
aTmp += pShUndoMgr->GetRepeatActionComment(*pTarget, 0);
rSet.Put( SfxStringItem( SID_REPEAT, aTmp ) );
}
@@ -1177,10 +1179,6 @@ void SfxViewFrame::DoActivate( sal_Bool bUI, SfxViewFrame* pOldFrame )
DBG_CHKTHIS(SfxViewFrame, 0);
SFX_APP();
-#ifdef WIN
- pSfxApp->TestFreeResources_Impl();
-#endif
-
pDispatcher->DoActivate_Impl( bUI, pOldFrame );
// Wenn ich einen parent habe und dieser ist kein parent des alten
@@ -1245,9 +1243,6 @@ void SfxViewFrame::DoDeactivate(sal_Bool bUI, SfxViewFrame* pNewFrame )
pFrame = pFrame->GetParentViewFrame();
}
}
-#ifdef WIN
- pSfxApp->TestFreeResources_Impl();
-#endif
}
//------------------------------------------------------------------------
@@ -2252,6 +2247,7 @@ SfxViewFrame* SfxViewFrame::Get( const Reference< XController>& i_rController, c
if ( pViewFrame->GetViewShell()->GetController() == i_rController )
break;
}
+ OSL_ENSURE( !sNewViewName.Equals( sCurrentViewName ), "SfxViewFrame::SaveCurrentViewData_Impl: suspicious: new and old view name are identical!" );
return pViewFrame;
}
diff --git a/sfx2/source/view/viewfrm2.cxx b/sfx2/source/view/viewfrm2.cxx
index 0affb3b591..d339a24523 100644
--- a/sfx2/source/view/viewfrm2.cxx
+++ b/sfx2/source/view/viewfrm2.cxx
@@ -31,7 +31,7 @@
#include "impviewframe.hxx"
#include "statcach.hxx"
-#include "viewfac.hxx"
+#include "sfx2/viewfac.hxx"
#include "workwin.hxx"
#include "sfx2/app.hxx"
diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx
index d0fe5db6b8..7645e4b1dc 100644
--- a/sfx2/source/view/viewimp.hxx
+++ b/sfx2/source/view/viewimp.hxx
@@ -26,8 +26,8 @@
*
************************************************************************/
-#ifndef _VIEWIMP_HXX
-#define _VIEWIMP_HXX
+#ifndef SFX_VIEWIMP_HXX
+#define SFX_VIEWIMP_HXX
// include ---------------------------------------------------------------
@@ -57,28 +57,27 @@ struct SfxViewShell_Impl
{
::osl::Mutex aMutex;
::cppu::OInterfaceContainerHelper aInterceptorContainer;
- BOOL bControllerSet;
+ bool m_bControllerSet;
SfxShellArr_Impl aArr;
SvBorder aBorder;
Size aOptimalSize;
Size aMargin;
- USHORT nPrinterLocks;
- BOOL bCanPrint;
- BOOL bHasPrintOptions;
- BOOL bPlugInsActive;
- BOOL bIsShowView;
- BOOL bOwnsMenu;
- BOOL bGotOwnerShip;
- BOOL bGotFrameOwnerShip;
- SfxScrollingMode eScroll;
- USHORT nFamily;
- SfxBaseController* pController;
- ::svt::AcceleratorExecute* pAccExec;
+ USHORT m_nPrinterLocks;
+ bool m_bCanPrint;
+ bool m_bHasPrintOptions;
+ bool m_bPlugInsActive;
+ bool m_bIsShowView;
+ bool m_bGotOwnership;
+ bool m_bGotFrameOwnership;
+ SfxScrollingMode m_eScroll;
+ USHORT m_nFamily;
+ ::rtl::Reference<SfxBaseController> m_pController;
+ ::std::auto_ptr< ::svt::AcceleratorExecute > m_pAccExec;
com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aPrintOpts;
::rtl::Reference< SfxClipboardChangeListener > xClipboardListener;
::boost::shared_ptr< vcl::PrinterController > m_pPrinterController;
- SfxViewShell_Impl();
+ SfxViewShell_Impl(USHORT const nFlags);
};
#endif
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index 533bb91ebf..81ac946b67 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -35,7 +35,6 @@
#include <svl/itempool.hxx>
#include <vcl/msgbox.hxx>
-#include <svtools/printdlg.hxx>
#include <svtools/prnsetup.hxx>
#include <svl/flagitem.hxx>
#include <svl/stritem.hxx>
@@ -51,7 +50,7 @@
#include "viewimp.hxx"
#include <sfx2/viewfrm.hxx>
#include <sfx2/prnmon.hxx>
-#include "sfxresid.hxx"
+#include "sfx2/sfxresid.hxx"
#include <sfx2/request.hxx>
#include <sfx2/objsh.hxx>
#include "sfxtypes.hxx"
@@ -353,30 +352,6 @@ void SfxPrinterController::jobFinished( com::sun::star::view::PrintableState nSt
}
}
-// -----------------------------------------------------------------------
-
-void DisableRanges( PrintDialog& rDlg, SfxPrinter* pPrinter )
-
-/* [Beschreibung]
-
- Mit dieser Funktion werden die nicht verf"ugbaren Ranges
- vom Printer zum PrintDialog geforwarded.
-*/
-
-{
- if ( !pPrinter )
- return;
-
- if ( !pPrinter->IsRangeEnabled( PRINTDIALOG_ALL ) )
- rDlg.DisableRange( PRINTDIALOG_ALL );
- if ( !pPrinter->IsRangeEnabled( PRINTDIALOG_SELECTION ) )
- rDlg.DisableRange( PRINTDIALOG_SELECTION );
- if ( !pPrinter->IsRangeEnabled( PRINTDIALOG_FROMTO ) )
- rDlg.DisableRange( PRINTDIALOG_FROMTO );
- if ( !pPrinter->IsRangeEnabled( PRINTDIALOG_RANGE ) )
- rDlg.DisableRange( PRINTDIALOG_RANGE );
-}
-
//====================================================================
class SfxDialogExecutor_Impl
@@ -393,7 +368,6 @@ class SfxDialogExecutor_Impl
{
private:
SfxViewShell* _pViewSh;
- PrintDialog* _pPrintParent;
PrinterSetupDialog* _pSetupParent;
SfxItemSet* _pOptions;
sal_Bool _bModified;
@@ -402,7 +376,6 @@ private:
DECL_LINK( Execute, void * );
public:
- SfxDialogExecutor_Impl( SfxViewShell* pViewSh, PrintDialog* pParent );
SfxDialogExecutor_Impl( SfxViewShell* pViewSh, PrinterSetupDialog* pParent );
~SfxDialogExecutor_Impl() { delete _pOptions; }
@@ -413,22 +386,9 @@ public:
//--------------------------------------------------------------------
-SfxDialogExecutor_Impl::SfxDialogExecutor_Impl( SfxViewShell* pViewSh, PrintDialog* pParent ) :
-
- _pViewSh ( pViewSh ),
- _pPrintParent ( pParent ),
- _pSetupParent ( NULL ),
- _pOptions ( NULL ),
- _bModified ( sal_False ),
- _bHelpDisabled ( sal_False )
-
-{
-}
-
SfxDialogExecutor_Impl::SfxDialogExecutor_Impl( SfxViewShell* pViewSh, PrinterSetupDialog* pParent ) :
_pViewSh ( pViewSh ),
- _pPrintParent ( NULL ),
_pSetupParent ( pParent ),
_pOptions ( NULL ),
_bModified ( sal_False ),
@@ -444,27 +404,13 @@ IMPL_LINK( SfxDialogExecutor_Impl, Execute, void *, EMPTYARG )
// Options lokal merken
if ( !_pOptions )
{
- DBG_ASSERT( _pPrintParent || _pSetupParent, "no dialog parent" );
- if( _pPrintParent )
- _pOptions = ( (SfxPrinter*)_pPrintParent->GetPrinter() )->GetOptions().Clone();
- else if( _pSetupParent )
+ DBG_ASSERT( _pSetupParent, "no dialog parent" );
+ if( _pSetupParent )
_pOptions = ( (SfxPrinter*)_pSetupParent->GetPrinter() )->GetOptions().Clone();
}
- if ( _pOptions && _pPrintParent && _pPrintParent->IsSheetRangeAvailable() )
- {
- SfxItemState eState = _pOptions->GetItemState( SID_PRINT_SELECTEDSHEET );
- if ( eState != SFX_ITEM_UNKNOWN )
- {
- PrintSheetRange eRange = _pPrintParent->GetCheckedSheetRange();
- BOOL bValue = ( PRINTSHEETS_ALL != eRange );
- _pOptions->Put( SfxBoolItem( SID_PRINT_SELECTEDSHEET, bValue ) );
- }
- }
-
// Dialog ausf"uhren
- SfxPrintOptionsDialog* pDlg = new SfxPrintOptionsDialog( _pPrintParent ? static_cast<Window*>(_pPrintParent)
- : static_cast<Window*>(_pSetupParent),
+ SfxPrintOptionsDialog* pDlg = new SfxPrintOptionsDialog( static_cast<Window*>(_pSetupParent),
_pViewSh, _pOptions );
if ( _bHelpDisabled )
pDlg->DisableHelp();
@@ -473,15 +419,6 @@ IMPL_LINK( SfxDialogExecutor_Impl, Execute, void *, EMPTYARG )
delete _pOptions;
_pOptions = pDlg->GetOptions().Clone();
- if ( _pOptions && _pPrintParent && _pPrintParent->IsSheetRangeAvailable() )
- {
- const SfxPoolItem* pItem;
- if ( SFX_ITEM_SET == _pOptions->GetItemState( SID_PRINT_SELECTEDSHEET, FALSE , &pItem ) )
- {
- _pPrintParent->CheckSheetRange( ( (const SfxBoolItem*)pItem )->GetValue()
- ? PRINTSHEETS_SELECTED_SHEETS : PRINTSHEETS_ALL );
- }
- }
}
delete pDlg;
@@ -660,7 +597,6 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
USHORT nDialogRet = RET_CANCEL;
// BOOL bCollate=FALSE;
SfxPrinter* pPrinter = 0;
- PrintDialog* pPrintDlg = 0;
SfxDialogExecutor_Impl* pExecutor = 0;
bool bSilent = false;
BOOL bIsAPI = rReq.GetArgs() && rReq.GetArgs()->Count();
@@ -797,6 +733,8 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
}
// FIXME: printer isn't used for printing anymore!
+ break;
+ // FIXME: printer isn't used for printing anymore!
if( pPrinter->IsPrinting() )
{
// if printer is busy, abort printing
@@ -816,7 +754,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
// execute PrinterSetupDialog
PrinterSetupDialog* pPrintSetupDlg = new PrinterSetupDialog( GetWindow() );
- if ( pImp->bHasPrintOptions )
+ if (pImp->m_bHasPrintOptions)
{
// additional controls for dialog
pExecutor = new SfxDialogExecutor_Impl( this, pPrintSetupDlg );
@@ -865,28 +803,20 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
// forget new printer, it was taken over (as pPrinter) or deleted
pDlgPrinter = NULL;
- /* Now lets reset the Dialog printer, since its freed */
- if (pPrintDlg)
- pPrintDlg->SetPrinter (pPrinter);
}
else
{
// PrinterDialog is used to transfer information on printing,
// so it will only be deleted here if dialog was cancelled
DELETEZ( pDlgPrinter );
- DELETEZ( pPrintDlg );
rReq.Ignore();
if ( SID_PRINTDOC == nId )
rReq.SetReturnValue(SfxBoolItem(0,FALSE));
- if ( nId == SID_SETUPPRINTER )
- {
- rReq.AppendItem( SfxBoolItem( SID_DIALOG_RETURN, FALSE ) );
- }
}
}
}
-
- break;
+
+ break;
}
}
@@ -897,41 +827,9 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
//--------------------------------------------------------------------
-PrintDialog* SfxViewShell::CreatePrintDialog( Window* /*pParent*/ )
-
-/* [Beschreibung]
-
- Diese Methode kann "uberladen werden, um einen speziellen PrintDialog
- zu erzeugen. Dies ist z.B. notwendig wenn spezielle <StarView> Features
- wie drucken von Seitenbereichen.
-*/
-
-{
- return NULL;
-}
-
-//--------------------------------------------------------------------
-
-void SfxViewShell::PreparePrint( PrintDialog * )
-{
-}
-
-//--------------------------------------------------------------------
-
-
-ErrCode SfxViewShell::DoPrint( SfxPrinter* /*pPrinter*/,
- PrintDialog* /*pPrintDlg*/,
- BOOL /*bSilent*/, BOOL /*bIsAPI*/ )
-{
- DBG_ERROR( "DoPrint called, dead code !" );
- return ERRCODE_IO_NOTSUPPORTED;
-}
-
-//--------------------------------------------------------------------
-
BOOL SfxViewShell::IsPrinterLocked() const
{
- return pImp->nPrinterLocks > 0;
+ return pImp->m_nPrinterLocks > 0;
}
//--------------------------------------------------------------------
@@ -940,9 +838,13 @@ void SfxViewShell::LockPrinter( BOOL bLock)
{
BOOL bChanged = FALSE;
if ( bLock )
- bChanged = 1 == ++pImp->nPrinterLocks;
+ {
+ bChanged = 1 == ++pImp->m_nPrinterLocks;
+ }
else
- bChanged = 0 == --pImp->nPrinterLocks;
+ {
+ bChanged = 0 == --pImp->m_nPrinterLocks;
+ }
if ( bChanged )
{
@@ -954,13 +856,6 @@ void SfxViewShell::LockPrinter( BOOL bLock)
//--------------------------------------------------------------------
-USHORT SfxViewShell::Print( SfxProgress& /*rProgress*/, BOOL /*bIsAPI*/, PrintDialog* /*pDlg*/ )
-{
- return 0;
-}
-
-//--------------------------------------------------------------------
-
SfxPrinter* SfxViewShell::GetPrinter( BOOL /*bCreate*/ )
{
return 0;
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 428a5db02e..0baa5425b7 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -5,7 +5,7 @@
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
- * OpenOffice.org - a multi-platform office productivity suite
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* This file is part of OpenOffice.org.
*
@@ -45,7 +45,6 @@
#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
#include <com/sun/star/container/XContainerQuery.hpp>
#include <com/sun/star/frame/XStorable.hpp>
-#include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp>
#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
#include <cppuhelper/implbase1.hxx>
@@ -71,7 +70,7 @@
#include "view.hrc"
#include <sfx2/viewsh.hxx>
#include "viewimp.hxx"
-#include "sfxresid.hxx"
+#include "sfx2/sfxresid.hxx"
#include <sfx2/request.hxx>
#include <sfx2/templdlg.hxx>
#include <sfx2/printer.hxx>
@@ -82,8 +81,8 @@
#include "view.hrc"
#include "sfxlocal.hrc"
#include <sfx2/sfxbasecontroller.hxx>
+#include "sfx2/mailmodelapi.hxx"
#include <sfx2/viewfrm.hxx>
-#include "mailmodelapi.hxx"
#include <sfx2/event.hxx>
#include <sfx2/fcontnr.hxx>
#include <sfx2/ipclient.hxx>
@@ -114,7 +113,9 @@ DBG_NAME(SfxViewShell)
class SfxClipboardChangeListener : public ::cppu::WeakImplHelper1<
datatransfer::clipboard::XClipboardListener >
{
- SfxViewShell* pViewShell;
+public:
+ SfxClipboardChangeListener( SfxViewShell* pView, const uno::Reference< datatransfer::clipboard::XClipboardNotifier >& xClpbrdNtfr );
+ virtual ~SfxClipboardChangeListener();
// XEventListener
virtual void SAL_CALL disposing( const lang::EventObject& rEventObject )
@@ -124,21 +125,46 @@ class SfxClipboardChangeListener : public ::cppu::WeakImplHelper1<
virtual void SAL_CALL changedContents( const datatransfer::clipboard::ClipboardEvent& rEventObject )
throw ( uno::RuntimeException );
-public:
- SfxClipboardChangeListener( SfxViewShell* pView );
- virtual ~SfxClipboardChangeListener();
+ void DisconnectViewShell() { m_pViewShell = NULL; }
+ void ChangedContents();
- void DisconnectViewShell() { pViewShell = NULL; }
+ enum AsyncExecuteCmd
+ {
+ ASYNCEXECUTE_CMD_DISPOSING,
+ ASYNCEXECUTE_CMD_CHANGEDCONTENTS
+ };
+
+ struct AsyncExecuteInfo
+ {
+ AsyncExecuteInfo( AsyncExecuteCmd eCmd, uno::Reference< datatransfer::clipboard::XClipboardListener > xThis, SfxClipboardChangeListener* pListener ) :
+ m_eCmd( eCmd ), m_xThis( xThis ), m_pListener( pListener ) {}
+
+ AsyncExecuteCmd m_eCmd;
+ uno::Reference< datatransfer::clipboard::XClipboardListener > m_xThis;
+ SfxClipboardChangeListener* m_pListener;
+ };
+
+private:
+ SfxViewShell* m_pViewShell;
+ uno::Reference< datatransfer::clipboard::XClipboardNotifier > m_xClpbrdNtfr;
+ uno::Reference< lang::XComponent > m_xCtrl;
+
+ DECL_STATIC_LINK( SfxClipboardChangeListener, AsyncExecuteHdl_Impl, AsyncExecuteInfo* );
};
-SfxClipboardChangeListener::SfxClipboardChangeListener( SfxViewShell* pView )
-: pViewShell( 0 )
+SfxClipboardChangeListener::SfxClipboardChangeListener( SfxViewShell* pView, const uno::Reference< datatransfer::clipboard::XClipboardNotifier >& xClpbrdNtfr )
+ : m_pViewShell( 0 ), m_xClpbrdNtfr( xClpbrdNtfr )
{
- uno::Reference < lang::XComponent > xCtrl( pView->GetController(), uno::UNO_QUERY );
- if ( xCtrl.is() )
+ m_xCtrl = uno::Reference < lang::XComponent >( pView->GetController(), uno::UNO_QUERY );
+ if ( m_xCtrl.is() )
+ {
+ m_xCtrl->addEventListener( uno::Reference < lang::XEventListener > ( static_cast < lang::XEventListener* >( this ) ) );
+ m_pViewShell = pView;
+ }
+ if ( m_xClpbrdNtfr.is() )
{
- xCtrl->addEventListener( uno::Reference < lang::XEventListener > ( static_cast < lang::XEventListener* >( this ) ) );
- pViewShell = pView;
+ m_xClpbrdNtfr->addClipboardListener( uno::Reference< datatransfer::clipboard::XClipboardListener >(
+ static_cast< datatransfer::clipboard::XClipboardListener* >( this )));
}
}
@@ -146,34 +172,68 @@ SfxClipboardChangeListener::~SfxClipboardChangeListener()
{
}
-void SAL_CALL SfxClipboardChangeListener::disposing( const lang::EventObject& /*rEventObject*/ )
-throw ( uno::RuntimeException )
+void SfxClipboardChangeListener::ChangedContents()
{
- // either clipboard or ViewShell is going to be destroyed -> no interest in listening anymore
const SolarMutexGuard aGuard;
- if ( pViewShell )
+ if( m_pViewShell )
{
- uno::Reference < lang::XComponent > xCtrl( pViewShell->GetController(), uno::UNO_QUERY );
- if ( xCtrl.is() )
- xCtrl->removeEventListener( uno::Reference < lang::XEventListener > ( static_cast < lang::XEventListener* >( this ) ) );
- pViewShell->AddRemoveClipboardListener( uno::Reference < datatransfer::clipboard::XClipboardListener > (this), FALSE );
- pViewShell = 0;
+ SfxBindings& rBind = m_pViewShell->GetViewFrame()->GetBindings();
+ rBind.Invalidate( SID_PASTE );
+ rBind.Invalidate( SID_PASTE_SPECIAL );
+ rBind.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS );
}
}
-void SAL_CALL SfxClipboardChangeListener::changedContents( const datatransfer::clipboard::ClipboardEvent& )
- throw ( RuntimeException )
+IMPL_STATIC_LINK_NOINSTANCE( SfxClipboardChangeListener, AsyncExecuteHdl_Impl, AsyncExecuteInfo*, pAsyncExecuteInfo )
{
- const SolarMutexGuard aGuard;
- if( pViewShell )
+ if ( pAsyncExecuteInfo )
{
- SfxBindings& rBind = pViewShell->GetViewFrame()->GetBindings();
- rBind.Invalidate( SID_PASTE );
- rBind.Invalidate( SID_PASTE_SPECIAL );
- rBind.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS );
+ uno::Reference< datatransfer::clipboard::XClipboardListener > xThis( pAsyncExecuteInfo->m_xThis );
+ if ( pAsyncExecuteInfo->m_pListener )
+ {
+ if ( pAsyncExecuteInfo->m_eCmd == ASYNCEXECUTE_CMD_DISPOSING )
+ pAsyncExecuteInfo->m_pListener->DisconnectViewShell();
+ else if ( pAsyncExecuteInfo->m_eCmd == ASYNCEXECUTE_CMD_CHANGEDCONTENTS )
+ pAsyncExecuteInfo->m_pListener->ChangedContents();
+ }
}
+ delete pAsyncExecuteInfo;
+
+ return 0;
+}
+
+void SAL_CALL SfxClipboardChangeListener::disposing( const lang::EventObject& /*rEventObject*/ )
+throw ( uno::RuntimeException )
+{
+ // Either clipboard or ViewShell is going to be destroyed -> no interest in listening anymore
+ uno::Reference< lang::XComponent > xCtrl( m_xCtrl );
+ uno::Reference< datatransfer::clipboard::XClipboardNotifier > xNotify( m_xClpbrdNtfr );
+
+ uno::Reference< datatransfer::clipboard::XClipboardListener > xThis( static_cast< datatransfer::clipboard::XClipboardListener* >( this ));
+ if ( xCtrl.is() )
+ xCtrl->removeEventListener( uno::Reference < lang::XEventListener > ( static_cast < lang::XEventListener* >( this )));
+ if ( xNotify.is() )
+ xNotify->removeClipboardListener( xThis );
+
+ // Make asynchronous call to avoid locking SolarMutex which is the
+ // root for many deadlocks, especially in conjuction with the "Windows"
+ // based single thread apartment clipboard code!
+ AsyncExecuteInfo* pInfo = new AsyncExecuteInfo( ASYNCEXECUTE_CMD_DISPOSING, xThis, this );
+ Application::PostUserEvent( STATIC_LINK( 0, SfxClipboardChangeListener, AsyncExecuteHdl_Impl ), pInfo );
+}
+
+void SAL_CALL SfxClipboardChangeListener::changedContents( const datatransfer::clipboard::ClipboardEvent& )
+ throw ( RuntimeException )
+{
+ const SolarMutexGuard aGuard;
+ // root for many deadlocks, especially in conjuction with the "Windows"
+ // based single thread apartment clipboard code!
+ uno::Reference< datatransfer::clipboard::XClipboardListener > xThis( static_cast< datatransfer::clipboard::XClipboardListener* >( this ));
+ AsyncExecuteInfo* pInfo = new AsyncExecuteInfo( ASYNCEXECUTE_CMD_CHANGEDCONTENTS, xThis, this );
+ Application::PostUserEvent( STATIC_LINK( 0, SfxClipboardChangeListener, AsyncExecuteHdl_Impl ), pInfo );
}
+//=========================================================================
static ::rtl::OUString RetrieveLabelFromCommand(
const ::rtl::OUString& rCommandURL,
@@ -239,15 +299,27 @@ static ::rtl::OUString RetrieveLabelFromCommand(
}
//=========================================================================
-SfxViewShell_Impl::SfxViewShell_Impl()
+SfxViewShell_Impl::SfxViewShell_Impl(USHORT const nFlags)
: aInterceptorContainer( aMutex )
-, pAccExec(0)
+, m_bControllerSet(false)
+, m_nPrinterLocks(0)
+, m_bCanPrint(SFX_VIEW_CAN_PRINT == (nFlags & SFX_VIEW_CAN_PRINT))
+, m_bHasPrintOptions(
+ SFX_VIEW_HAS_PRINTOPTIONS == (nFlags & SFX_VIEW_HAS_PRINTOPTIONS))
+, m_bPlugInsActive(true)
+, m_bIsShowView(SFX_VIEW_NO_SHOW != (nFlags & SFX_VIEW_NO_SHOW))
+, m_bGotOwnership(false)
+, m_bGotFrameOwnership(false)
+, m_eScroll(SCROLLING_DEFAULT)
+, m_nFamily(0xFFFF) // undefined, default set by TemplateDialog
+, m_pController(0)
+, m_pAccExec(0)
{}
//=========================================================================
SFX_IMPL_INTERFACE(SfxViewShell,SfxShell,SfxResId(0))
{
- SFX_CHILDWINDOW_REGISTRATION( SID_MAIL_CHILDWIN );
+ SFX_CHILDWINDOW_REGISTRATION( SID_MAIL_CHILDWIN );
}
TYPEINIT2(SfxViewShell,SfxShell,SfxListener);
@@ -384,25 +456,27 @@ SAL_DLLPRIVATE void SfxViewShell::IPClientGone_Impl( SfxInPlaceClient *pIPClient
void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq )
{
- const USHORT nId = rReq.GetSlot();
- switch( nId )
- {
- case SID_STYLE_FAMILY :
+ const USHORT nId = rReq.GetSlot();
+ switch( nId )
{
- SFX_REQUEST_ARG(rReq, pItem, SfxUInt16Item, nId, FALSE);
- if (pItem)
- pImp->nFamily = pItem->GetValue();
- break;
- }
+ case SID_STYLE_FAMILY :
+ {
+ SFX_REQUEST_ARG(rReq, pItem, SfxUInt16Item, nId, FALSE);
+ if (pItem)
+ {
+ pImp->m_nFamily = pItem->GetValue();
+ }
+ break;
+ }
- case SID_STYLE_CATALOG:
- {
- SfxTemplateCatalog aCatalog(
- SFX_APP()->GetTopWindow(), &GetViewFrame()->GetBindings());
- aCatalog.Execute();
+ case SID_STYLE_CATALOG:
+ {
+ SfxTemplateCatalog aCatalog(
+ SFX_APP()->GetTopWindow(), &GetViewFrame()->GetBindings());
+ aCatalog.Execute();
rReq.Ignore();
- break;
- }
+ break;
+ }
case SID_ACTIVATE_STYLE_APPLY:
{
com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xFrame(
@@ -462,85 +536,85 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq )
rReq.Done();
}
break;
- // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- case SID_MAIL_SENDDOCASMS:
- case SID_MAIL_SENDDOCASOOO:
- case SID_MAIL_SENDDOCASPDF:
- case SID_MAIL_SENDDOC:
+ case SID_MAIL_SENDDOCASMS:
+ case SID_MAIL_SENDDOCASOOO:
+ case SID_MAIL_SENDDOCASPDF:
+ case SID_MAIL_SENDDOC:
case SID_MAIL_SENDDOCASFORMAT:
- {
- SfxObjectShell* pDoc = GetObjectShell();
- if ( pDoc && pDoc->QueryHiddenInformation(
- WhenSaving, &GetViewFrame()->GetWindow() ) != RET_YES )
- break;
+ {
+ SfxObjectShell* pDoc = GetObjectShell();
+ if ( pDoc && pDoc->QueryHiddenInformation(
+ WhenSaving, &GetViewFrame()->GetWindow() ) != RET_YES )
+ break;
- if ( SvtInternalOptions().MailUIEnabled() )
+ if ( SvtInternalOptions().MailUIEnabled() )
{
GetViewFrame()->SetChildWindow( SID_MAIL_CHILDWIN, TRUE );
}
else
{
- SfxMailModel aModel;
+ SfxMailModel aModel;
rtl::OUString aDocType;
- SFX_REQUEST_ARG(rReq, pMailSubject, SfxStringItem, SID_MAIL_SUBJECT, FALSE );
- if ( pMailSubject )
- aModel.SetSubject( pMailSubject->GetValue() );
+ SFX_REQUEST_ARG(rReq, pMailSubject, SfxStringItem, SID_MAIL_SUBJECT, FALSE );
+ if ( pMailSubject )
+ aModel.SetSubject( pMailSubject->GetValue() );
- SFX_REQUEST_ARG(rReq, pMailRecipient, SfxStringItem, SID_MAIL_RECIPIENT, FALSE );
- if ( pMailRecipient )
- {
- String aRecipient( pMailRecipient->GetValue() );
- String aMailToStr( String::CreateFromAscii( "mailto:" ));
+ SFX_REQUEST_ARG(rReq, pMailRecipient, SfxStringItem, SID_MAIL_RECIPIENT, FALSE );
+ if ( pMailRecipient )
+ {
+ String aRecipient( pMailRecipient->GetValue() );
+ String aMailToStr( String::CreateFromAscii( "mailto:" ));
- if ( aRecipient.Search( aMailToStr ) == 0 )
- aRecipient = aRecipient.Erase( 0, aMailToStr.Len() );
- aModel.AddAddress( aRecipient, SfxMailModel::ROLE_TO );
- }
+ if ( aRecipient.Search( aMailToStr ) == 0 )
+ aRecipient = aRecipient.Erase( 0, aMailToStr.Len() );
+ aModel.AddAddress( aRecipient, SfxMailModel::ROLE_TO );
+ }
SFX_REQUEST_ARG(rReq, pMailDocType, SfxStringItem, SID_TYPE_NAME, FALSE );
if ( pMailDocType )
aDocType = pMailDocType->GetValue();
uno::Reference < frame::XFrame > xFrame( pFrame->GetFrame().GetFrameInterface() );
- SfxMailModel::SendMailResult eResult = SfxMailModel::SEND_MAIL_ERROR;
+ SfxMailModel::SendMailResult eResult = SfxMailModel::SEND_MAIL_ERROR;
if ( nId == SID_MAIL_SENDDOC )
- eResult = aModel.SaveAndSend( xFrame, rtl::OUString() );
- else
- if ( nId == SID_MAIL_SENDDOCASPDF )
+ eResult = aModel.SaveAndSend( xFrame, rtl::OUString() );
+ else
+ if ( nId == SID_MAIL_SENDDOCASPDF )
eResult = aModel.SaveAndSend( xFrame, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "pdf_Portable_Document_Format" )));
else
- if ( nId == SID_MAIL_SENDDOCASMS )
+ if ( nId == SID_MAIL_SENDDOCASMS )
{
aDocType = impl_searchFormatTypeForApp(xFrame, E_MS_DOC);
if (aDocType.getLength() > 0)
eResult = aModel.SaveAndSend( xFrame, aDocType );
}
else
- if ( nId == SID_MAIL_SENDDOCASOOO )
+ if ( nId == SID_MAIL_SENDDOCASOOO )
{
aDocType = impl_searchFormatTypeForApp(xFrame, E_OOO_DOC);
if (aDocType.getLength() > 0)
eResult = aModel.SaveAndSend( xFrame, aDocType );
}
- if ( eResult == SfxMailModel::SEND_MAIL_ERROR )
- {
- InfoBox aBox( SFX_APP()->GetTopWindow(), SfxResId( MSG_ERROR_SEND_MAIL ));
- aBox.Execute();
+ if ( eResult == SfxMailModel::SEND_MAIL_ERROR )
+ {
+ InfoBox aBox( SFX_APP()->GetTopWindow(), SfxResId( MSG_ERROR_SEND_MAIL ));
+ aBox.Execute();
rReq.Ignore();
- }
+ }
else
rReq.Done();
- }
+ }
- break;
- }
+ break;
+ }
- // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- case SID_WEBHTML:
- {
+ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ case SID_WEBHTML:
+ {
static const char HTML_DOCUMENT_TYPE[] = "writer_web_HTML";
static const char HTML_GRAPHIC_TYPE[] = "graphic_HTML";
const sal_Int32 FILTERFLAG_EXPORT = 0x00000002;
@@ -660,25 +734,25 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq )
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.system.SystemShellExecute"))),
css::uno::UNO_QUERY );
- BOOL bRet( TRUE );
+ BOOL bRet( TRUE );
if ( xSystemShellExecute.is() )
{
try
{
- xSystemShellExecute->execute(
- aFileURL, ::rtl::OUString(), SystemShellExecuteFlags::DEFAULTS );
+ xSystemShellExecute->execute(
+ aFileURL, ::rtl::OUString(), SystemShellExecuteFlags::DEFAULTS );
}
catch ( uno::Exception& )
{
SolarMutexGuard aGuard;
Window *pParent = SFX_APP()->GetTopWindow();
- ErrorBox( pParent, SfxResId( MSG_ERROR_NO_WEBBROWSER_FOUND )).Execute();
+ ErrorBox( pParent, SfxResId( MSG_ERROR_NO_WEBBROWSER_FOUND )).Execute();
bRet = FALSE;
}
}
rReq.Done(bRet);
- break;
+ break;
}
else
{
@@ -688,95 +762,97 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq )
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- case SID_PLUGINS_ACTIVE:
- {
- SFX_REQUEST_ARG(rReq, pShowItem, SfxBoolItem, nId, FALSE);
- BOOL bActive = pShowItem ? pShowItem->GetValue() : !pImp->bPlugInsActive;
- // ggf. recorden
- if ( !rReq.IsAPI() )
- rReq.AppendItem( SfxBoolItem( nId, bActive ) );
-
- // Jetzt schon DONE aufrufen, da die Argumente evtl. einen Pool
- // benutzen, der demn"achst weg ist
- rReq.Done(TRUE);
-
- // ausfuehren
- if ( !pShowItem || bActive != pImp->bPlugInsActive )
- {
- SfxFrame* pTopFrame = &GetFrame()->GetTopFrame();
- if ( pTopFrame != &GetFrame()->GetFrame() )
- {
- // FramesetDocument
- SfxViewShell *pShell = pTopFrame->GetCurrentViewFrame()->GetViewShell();
- if ( pShell->GetInterface()->GetSlot( nId ) )
- pShell->ExecuteSlot( rReq );
- break;
- }
-
- SfxFrameIterator aIter( *pTopFrame );
- while ( pTopFrame )
+ case SID_PLUGINS_ACTIVE:
{
- if ( pTopFrame->GetCurrentViewFrame() )
- {
- SfxViewShell *pView = pTopFrame->GetCurrentViewFrame()->GetViewShell();
- if ( pView )
+ SFX_REQUEST_ARG(rReq, pShowItem, SfxBoolItem, nId, FALSE);
+ bool const bActive = (pShowItem)
+ ? pShowItem->GetValue()
+ : !pImp->m_bPlugInsActive;
+ // ggf. recorden
+ if ( !rReq.IsAPI() )
+ rReq.AppendItem( SfxBoolItem( nId, bActive ) );
+
+ // Jetzt schon DONE aufrufen, da die Argumente evtl. einen Pool
+ // benutzen, der demn"achst weg ist
+ rReq.Done(TRUE);
+
+ // ausfuehren
+ if (!pShowItem || (bActive != pImp->m_bPlugInsActive))
{
- pView->pImp->bPlugInsActive = bActive;
+ SfxFrame* pTopFrame = &GetFrame()->GetTopFrame();
+ if ( pTopFrame != &GetFrame()->GetFrame() )
+ {
+ // FramesetDocument
+ SfxViewShell *pShell = pTopFrame->GetCurrentViewFrame()->GetViewShell();
+ if ( pShell->GetInterface()->GetSlot( nId ) )
+ pShell->ExecuteSlot( rReq );
+ break;
+ }
+
+ SfxFrameIterator aIter( *pTopFrame );
+ while ( pTopFrame )
+ {
+ if ( pTopFrame->GetCurrentViewFrame() )
+ {
+ SfxViewShell *pView = pTopFrame->GetCurrentViewFrame()->GetViewShell();
+ if ( pView )
+ {
+ pView->pImp->m_bPlugInsActive = bActive;
Rectangle aVisArea = GetObjectShell()->GetVisArea();
VisAreaChanged(aVisArea);
- // the plugins might need change in their state
- SfxInPlaceClientList *pClients = pView->GetIPClientList_Impl(FALSE);
- if ( pClients )
- {
+ // the plugins might need change in their state
+ SfxInPlaceClientList *pClients = pView->GetIPClientList_Impl(FALSE);
+ if ( pClients )
+ {
for ( size_t n = 0; n < pClients->size(); n++)
- {
+ {
SfxInPlaceClient* pIPClient = pClients->at( n );
- if ( pIPClient )
- pView->CheckIPClient_Impl( pIPClient, aVisArea );
+ if ( pIPClient )
+ pView->CheckIPClient_Impl( pIPClient, aVisArea );
+ }
+ }
+ }
+ }
+
+ if ( !pTopFrame->GetParentFrame() )
+ pTopFrame = aIter.FirstFrame();
+ else
+ pTopFrame = aIter.NextFrame( *pTopFrame );
}
- }
}
- }
- if ( !pTopFrame->GetParentFrame() )
- pTopFrame = aIter.FirstFrame();
- else
- pTopFrame = aIter.NextFrame( *pTopFrame );
+ break;
}
- }
-
- break;
}
- }
}
//--------------------------------------------------------------------
void SfxViewShell::GetState_Impl( SfxItemSet &rSet )
{
- DBG_CHKTHIS(SfxViewShell, 0);
+ DBG_CHKTHIS(SfxViewShell, 0);
- SfxWhichIter aIter( rSet );
- for ( USHORT nSID = aIter.FirstWhich(); nSID; nSID = aIter.NextWhich() )
- {
- switch ( nSID )
+ SfxWhichIter aIter( rSet );
+ for ( USHORT nSID = aIter.FirstWhich(); nSID; nSID = aIter.NextWhich() )
{
- case SID_STYLE_CATALOG:
- {
+ switch ( nSID )
+ {
+ case SID_STYLE_CATALOG:
+ {
if ( !GetViewFrame()->KnowsChildWindow( SID_STYLE_DESIGNER ) )
- rSet.DisableItem( nSID );
- break;
- }
+ rSet.DisableItem( nSID );
+ break;
+ }
- // Printer-Funktionen
- case SID_PRINTDOC:
- case SID_PRINTDOCDIRECT:
- case SID_SETUPPRINTER:
- case SID_PRINTER_NAME:
- {
- BOOL bEnabled = pImp->bCanPrint && !pImp->nPrinterLocks;
- bEnabled = bEnabled && !Application::GetSettings().GetMiscSettings().GetDisablePrinting();
+ // Printer-Funktionen
+ case SID_PRINTDOC:
+ case SID_PRINTDOCDIRECT:
+ case SID_SETUPPRINTER:
+ case SID_PRINTER_NAME:
+ {
+ bool bEnabled = pImp->m_bCanPrint && !pImp->m_nPrinterLocks;
+ bEnabled = bEnabled && !Application::GetSettings().GetMiscSettings().GetDisablePrinting();
if ( bEnabled )
{
SfxPrinter *pPrinter = GetPrinter(FALSE);
@@ -805,67 +881,68 @@ void SfxViewShell::GetState_Impl( SfxItemSet &rSet )
}
bEnabled = !pPrinter || !pPrinter->IsPrinting();
}
- if ( !bEnabled )
- {
- // will now be handled by requeing the request
- /* rSet.DisableItem( SID_PRINTDOC );
- rSet.DisableItem( SID_PRINTDOCDIRECT );
- rSet.DisableItem( SID_SETUPPRINTER ); */
- }
- break;
- }
+ if ( !bEnabled )
+ {
+ // will now be handled by requeing the request
+ /* rSet.DisableItem( SID_PRINTDOC );
+ rSet.DisableItem( SID_PRINTDOCDIRECT );
+ rSet.DisableItem( SID_SETUPPRINTER ); */
+ }
+ break;
+ }
- // Mail-Funktionen
- case SID_MAIL_SENDDOCASPDF:
- case SID_MAIL_SENDDOC:
+ // Mail-Funktionen
+ case SID_MAIL_SENDDOCASPDF:
+ case SID_MAIL_SENDDOC:
case SID_MAIL_SENDDOCASFORMAT:
- {
+ {
BOOL bEnable = !GetViewFrame()->HasChildWindow( SID_MAIL_CHILDWIN );
- if ( !bEnable )
- rSet.DisableItem( nSID );
- break;
- }
+ if ( !bEnable )
+ rSet.DisableItem( nSID );
+ break;
+ }
- // PlugIns running
- case SID_PLUGINS_ACTIVE:
- {
- rSet.Put( SfxBoolItem( SID_PLUGINS_ACTIVE, !pImp->bPlugInsActive) );
- break;
- }
+ // PlugIns running
+ case SID_PLUGINS_ACTIVE:
+ {
+ rSet.Put( SfxBoolItem( SID_PLUGINS_ACTIVE,
+ !pImp->m_bPlugInsActive) );
+ break;
+ }
/*
- // SelectionText
- case SID_SELECTION_TEXT:
- {
- rSet.Put( SfxStringItem( SID_SELECTION_TEXT, GetSelectionText() ) );
- break;
- }
+ // SelectionText
+ case SID_SELECTION_TEXT:
+ {
+ rSet.Put( SfxStringItem( SID_SELECTION_TEXT, GetSelectionText() ) );
+ break;
+ }
- // SelectionTextExt
- case SID_SELECTION_TEXT_EXT:
- {
- rSet.Put( SfxStringItem( SID_SELECTION_TEXT_EXT, GetSelectionText(TRUE) ) );
- break;
- }
+ // SelectionTextExt
+ case SID_SELECTION_TEXT_EXT:
+ {
+ rSet.Put( SfxStringItem( SID_SELECTION_TEXT_EXT, GetSelectionText(TRUE) ) );
+ break;
+ }
*/
- case SID_STYLE_FAMILY :
- {
- rSet.Put( SfxUInt16Item( SID_STYLE_FAMILY, pImp->nFamily ) );
- break;
- }
+ case SID_STYLE_FAMILY :
+ {
+ rSet.Put( SfxUInt16Item( SID_STYLE_FAMILY, pImp->m_nFamily ) );
+ break;
+ }
+ }
}
- }
}
//--------------------------------------------------------------------
void SfxViewShell::SetZoomFactor( const Fraction &rZoomX,
- const Fraction &rZoomY )
+ const Fraction &rZoomY )
{
- DBG_ASSERT( GetWindow(), "no window" );
- MapMode aMap( GetWindow()->GetMapMode() );
- aMap.SetScaleX( rZoomX );
- aMap.SetScaleY( rZoomY );
- GetWindow()->SetMapMode( aMap );
+ DBG_ASSERT( GetWindow(), "no window" );
+ MapMode aMap( GetWindow()->GetMapMode() );
+ aMap.SetScaleX( rZoomX );
+ aMap.SetScaleY( rZoomY );
+ GetWindow()->SetMapMode( aMap );
}
//--------------------------------------------------------------------
@@ -873,21 +950,21 @@ ErrCode SfxViewShell::DoVerb(long /*nVerb*/)
/* [Beschreibung]
- Virtuelle Methode, um am selektierten Objekt ein Verb auszuf"uhren.
+ Virtuelle Methode, um am selektierten Objekt ein Verb auszuf"uhren.
Da dieses Objekt nur den abgeleiteten Klassen bekannt ist, muss DoVerb
dort "uberschrieben werden.
*/
{
- return ERRCODE_SO_NOVERBS;
+ return ERRCODE_SO_NOVERBS;
}
//--------------------------------------------------------------------
void SfxViewShell::OutplaceActivated( sal_Bool bActive, SfxInPlaceClient* /*pClient*/ )
{
- if ( !bActive )
+ if ( !bActive )
GetFrame()->GetFrame().Appear();
}
@@ -895,15 +972,15 @@ void SfxViewShell::OutplaceActivated( sal_Bool bActive, SfxInPlaceClient* /*pCli
void SfxViewShell::InplaceActivating( SfxInPlaceClient* /*pClient*/ )
{
- // TODO/LATER: painting of the bitmap can be stopped, it is required if CLIPCHILDREN problem #i25788# is not solved,
- // but may be the bug will not affect the real office vcl windows, then it is not required
+ // TODO/LATER: painting of the bitmap can be stopped, it is required if CLIPCHILDREN problem #i25788# is not solved,
+ // but may be the bug will not affect the real office vcl windows, then it is not required
}
//--------------------------------------------------------------------
void SfxViewShell::InplaceDeactivated( SfxInPlaceClient* /*pClient*/ )
{
- // TODO/LATER: paint the replacement image in normal way if the painting was stopped
+ // TODO/LATER: paint the replacement image in normal way if the painting was stopped
}
//--------------------------------------------------------------------
@@ -943,26 +1020,26 @@ SfxInPlaceClient* SfxViewShell::FindIPClient
) const
{
SfxInPlaceClientList *pClients = GetIPClientList_Impl(FALSE);
- if ( !pClients )
- return 0;
+ if ( !pClients )
+ return 0;
- if( !pObjParentWin )
- pObjParentWin = GetWindow();
+ if( !pObjParentWin )
+ pObjParentWin = GetWindow();
for ( size_t n = 0; n < pClients->size(); n++)
- {
+ {
SfxInPlaceClient *pIPClient = (SfxInPlaceClient*) pClients->at( n );
if ( pIPClient->GetObject() == xObj && pIPClient->GetEditWin() == pObjParentWin )
- return pIPClient;
- }
+ return pIPClient;
+ }
- return 0;
+ return 0;
}
//--------------------------------------------------------------------
SfxInPlaceClient* SfxViewShell::GetIPClient() const
{
- return GetUIActiveClient();
+ return GetUIActiveClient();
}
//--------------------------------------------------------------------
@@ -971,15 +1048,15 @@ SfxInPlaceClient* SfxViewShell::GetUIActiveIPClient_Impl() const
{
// this method is needed as long as SFX still manages the border space for ChildWindows (see SfxFrame::Resize)
SfxInPlaceClientList *pClients = GetIPClientList_Impl(FALSE);
- if ( !pClients )
- return 0;
+ if ( !pClients )
+ return 0;
for ( size_t n = 0; n < pClients->size(); n++)
- {
+ {
SfxInPlaceClient* pIPClient = pClients->at( n );
if ( pIPClient->IsUIActive() )
return pIPClient;
- }
+ }
return NULL;
}
@@ -987,15 +1064,15 @@ SfxInPlaceClient* SfxViewShell::GetUIActiveIPClient_Impl() const
SfxInPlaceClient* SfxViewShell::GetUIActiveClient() const
{
SfxInPlaceClientList *pClients = GetIPClientList_Impl(FALSE);
- if ( !pClients )
- return 0;
+ if ( !pClients )
+ return 0;
for ( size_t n = 0; n < pClients->size(); n++)
- {
+ {
SfxInPlaceClient* pIPClient = pClients->at( n );
if ( pIPClient->IsObjectUIActive() )
return pIPClient;
- }
+ }
return NULL;
}
@@ -1004,34 +1081,34 @@ SfxInPlaceClient* SfxViewShell::GetUIActiveClient() const
void SfxViewShell::Activate( BOOL bMDI )
{
- DBG_CHKTHIS(SfxViewShell, 0);
- if ( bMDI )
- {
- SfxObjectShell *pSh = GetViewFrame()->GetObjectShell();
- if ( pSh->GetModel().is() )
+ DBG_CHKTHIS(SfxViewShell, 0);
+ if ( bMDI )
+ {
+ SfxObjectShell *pSh = GetViewFrame()->GetObjectShell();
+ if ( pSh->GetModel().is() )
pSh->GetModel()->setCurrentController( GetViewFrame()->GetFrame().GetController() );
SetCurrentDocument();
- }
+ }
}
//--------------------------------------------------------------------
void SfxViewShell::Deactivate(BOOL /*bMDI*/)
{
- DBG_CHKTHIS(SfxViewShell, 0);
+ DBG_CHKTHIS(SfxViewShell, 0);
}
//--------------------------------------------------------------------
void SfxViewShell::AdjustPosSizePixel
(
- const Point& /*rToolOffset*/,// linke obere Ecke der Tools im Frame-Window
- const Size& /*rSize*/ // gesamte zur Verf"ugung stehende Gr"o\se
+ const Point& /*rToolOffset*/,// linke obere Ecke der Tools im Frame-Window
+ const Size& /*rSize*/ // gesamte zur Verf"ugung stehende Gr"o\se
)
{
- DBG_CHKTHIS(SfxViewShell, 0);
+ DBG_CHKTHIS(SfxViewShell, 0);
}
//--------------------------------------------------------------------
@@ -1040,18 +1117,18 @@ void SfxViewShell::Move()
/* [Beschreibung]
- Diese virtuelle Methode wird gerufen, wenn das Fenster, in dem die
- SfxViewShell dargestellt wird eine StarView-Move() Nachricht erh"alt.
+ Diese virtuelle Methode wird gerufen, wenn das Fenster, in dem die
+ SfxViewShell dargestellt wird eine StarView-Move() Nachricht erh"alt.
- Die Basisimplementierung braucht nicht gerufen zu werden.
+ Die Basisimplementierung braucht nicht gerufen zu werden.
- [Anmerkung]
+ [Anmerkung]
- Diese Methode kann dazu verwendet werden, eine Selektion abzubrechen,
- um durch das Moven des Fensters erzeugte Maus-Bewegungen anzufangen.
+ Diese Methode kann dazu verwendet werden, eine Selektion abzubrechen,
+ um durch das Moven des Fensters erzeugte Maus-Bewegungen anzufangen.
- Zur Zeit funktioniert die Benachrichtigung nicht In-Place.
+ Zur Zeit funktioniert die Benachrichtigung nicht In-Place.
*/
{
@@ -1061,102 +1138,102 @@ void SfxViewShell::Move()
void SfxViewShell::OuterResizePixel
(
- const Point& /*rToolOffset*/,// linke obere Ecke der Tools im Frame-Window
- const Size& /*rSize*/ // gesamte zur Verf"ugung stehende Gr"o\se
+ const Point& /*rToolOffset*/,// linke obere Ecke der Tools im Frame-Window
+ const Size& /*rSize*/ // gesamte zur Verf"ugung stehende Gr"o\se
)
/* [Beschreibung]
Diese Methode muss ueberladen werden, um auf "Anderungen der Groesse
- der View zu reagieren. Dabei definieren wir die View als das Edit-Window
- zuz"uglich der um das Edit-Window angeordnenten Tools (z.B. Lineale).
+ der View zu reagieren. Dabei definieren wir die View als das Edit-Window
+ zuz"uglich der um das Edit-Window angeordnenten Tools (z.B. Lineale).
- Das Edit-Window darf weder in Gr"o\se noch Position ver"andert werden.
+ Das Edit-Window darf weder in Gr"o\se noch Position ver"andert werden.
- Die Vis-Area der SfxObjectShell, dessen Skalierung und Position
- d"urfen hier ver"andert werden. Der Hauptanwendungsfall ist dabei,
- das Ver"andern der Gr"o\se der Vis-Area.
+ Die Vis-Area der SfxObjectShell, dessen Skalierung und Position
+ d"urfen hier ver"andert werden. Der Hauptanwendungsfall ist dabei,
+ das Ver"andern der Gr"o\se der Vis-Area.
- "Andert sich durch die neue Berechnung der Border, so mu\s dieser
- mit <SfxViewShell::SetBorderPixel(const SvBorder&)> gesetzt werden.
- Erst nach Aufruf von 'SetBorderPixel' ist das Positionieren von
- Tools erlaubt.
+ "Andert sich durch die neue Berechnung der Border, so mu\s dieser
+ mit <SfxViewShell::SetBorderPixel(const SvBorder&)> gesetzt werden.
+ Erst nach Aufruf von 'SetBorderPixel' ist das Positionieren von
+ Tools erlaubt.
- [Beispiel]
+ [Beispiel]
- void AppViewSh::OuterViewResizePixel( const Point &rOfs, const Size &rSz )
- {
- // Tool-Positionen und Gr"o\sen von au\sen berechnen, NICHT setzen!
- // (wegen folgender Border-Berechnung)
- Point aHLinPos...; Size aHLinSz...;
- ...
-
- // Border f"ur Tools passend zu rSize berechnen und setzen
- SvBorder aBorder...
- SetBorderPixel( aBorder ); // ab jetzt sind Positionierungen erlaubt
-
- // Tools anordnen
- pHLin->SetPosSizePixel( aHLinPos, aHLinSz );
- ...
- }
+ void AppViewSh::OuterViewResizePixel( const Point &rOfs, const Size &rSz )
+ {
+ // Tool-Positionen und Gr"o\sen von au\sen berechnen, NICHT setzen!
+ // (wegen folgender Border-Berechnung)
+ Point aHLinPos...; Size aHLinSz...;
+ ...
+
+ // Border f"ur Tools passend zu rSize berechnen und setzen
+ SvBorder aBorder...
+ SetBorderPixel( aBorder ); // ab jetzt sind Positionierungen erlaubt
+
+ // Tools anordnen
+ pHLin->SetPosSizePixel( aHLinPos, aHLinSz );
+ ...
+ }
- [Querverweise]
+ [Querverweise]
- <SfxViewShell::InnerResizePixel(const Point&,const Size& rSize)>
+ <SfxViewShell::InnerResizePixel(const Point&,const Size& rSize)>
*/
{
- DBG_CHKTHIS(SfxViewShell, 0);
- SetBorderPixel( SvBorder() );
+ DBG_CHKTHIS(SfxViewShell, 0);
+ SetBorderPixel( SvBorder() );
}
//--------------------------------------------------------------------
void SfxViewShell::InnerResizePixel
(
- const Point& /*rToolOffset*/,// linke obere Ecke der Tools im Frame-Window
- const Size& /*rSize*/ // dem Edit-Win zur Verf"ugung stehende Gr"o\se
+ const Point& /*rToolOffset*/,// linke obere Ecke der Tools im Frame-Window
+ const Size& /*rSize*/ // dem Edit-Win zur Verf"ugung stehende Gr"o\se
)
/* [Beschreibung]
Diese Methode muss ueberladen werden, um auf "Anderungen der Groesse
- des Edit-Windows zu reagieren.
+ des Edit-Windows zu reagieren.
- Das Edit-Window darf weder in Gr"o\se noch Position ver"andert werden.
- Weder die Vis-Area der SfxObjectShell noch dessen Skalierung oder
- Position d"urfen ver"andert werden.
+ Das Edit-Window darf weder in Gr"o\se noch Position ver"andert werden.
+ Weder die Vis-Area der SfxObjectShell noch dessen Skalierung oder
+ Position d"urfen ver"andert werden.
- "Andert sich durch die neue Berechnung der Border, so mu\s dieser
- mit <SfxViewShell::SetBorderPixel(const SvBorder&)> gesetzt werden.
- Erst nach Aufruf von 'SetBorderPixel' ist das Positionieren von
- Tools erlaubt.
+ "Andert sich durch die neue Berechnung der Border, so mu\s dieser
+ mit <SfxViewShell::SetBorderPixel(const SvBorder&)> gesetzt werden.
+ Erst nach Aufruf von 'SetBorderPixel' ist das Positionieren von
+ Tools erlaubt.
- [Beispiel]
+ [Beispiel]
- void AppViewSh::InnerViewResizePixel( const Point &rOfs, const Size &rSz )
- {
- // Tool-Positionen und Gr"o\sen von innen berechnen, NICHT setzen!
- // (wegen folgender Border-Berechnung)
- Point aHLinPos...; Size aHLinSz...;
- ...
-
- // Border f"ur Tools passend zu rSz berechnen und setzen
- SvBorder aBorder...
- SetBorderPixel( aBorder ); // ab jetzt sind Positionierungen erlaubt
-
- // Tools anordnen
- pHLin->SetPosSizePixel( aHLinPos, aHLinSz );
- ...
- }
+ void AppViewSh::InnerViewResizePixel( const Point &rOfs, const Size &rSz )
+ {
+ // Tool-Positionen und Gr"o\sen von innen berechnen, NICHT setzen!
+ // (wegen folgender Border-Berechnung)
+ Point aHLinPos...; Size aHLinSz...;
+ ...
+
+ // Border f"ur Tools passend zu rSz berechnen und setzen
+ SvBorder aBorder...
+ SetBorderPixel( aBorder ); // ab jetzt sind Positionierungen erlaubt
+
+ // Tools anordnen
+ pHLin->SetPosSizePixel( aHLinPos, aHLinSz );
+ ...
+ }
- [Querverweise]
+ [Querverweise]
- <SfxViewShell::OuterResizePixel(const Point&,const Size& rSize)>
+ <SfxViewShell::OuterResizePixel(const Point&,const Size& rSize)>
*/
{
@@ -1172,8 +1249,10 @@ void SfxViewShell::InvalidateBorder()
DBG_ASSERT( GetViewFrame(), "SfxViewShell without SfxViewFrame" );
GetViewFrame()->InvalidateBorderImpl( this );
- if ( pImp->pController )
- pImp->pController->BorderWidthsChanged_Impl();
+ if (pImp->m_pController.is())
+ {
+ pImp->m_pController->BorderWidthsChanged_Impl();
+ }
}
//--------------------------------------------------------------------
@@ -1188,8 +1267,10 @@ void SfxViewShell::SetBorderPixel( const SvBorder &rBorder )
GetViewFrame()->SetBorderPixelImpl( this, rBorder );
// notify related controller that border size is changed
- if ( pImp->pController )
- pImp->pController->BorderWidthsChanged_Impl();
+ if (pImp->m_pController.is())
+ {
+ pImp->m_pController->BorderWidthsChanged_Impl();
+ }
}
}
@@ -1212,11 +1293,11 @@ void SfxViewShell::SetWindow
/* [Beschreibung]
- Mit dieser Methode wird der SfxViewShell das Datenfenster mitgeteilt.
- Dieses wird f"ur den In-Place-Container und f"ur das korrekte
- Wiederherstellen des Focus ben"otigt.
+ Mit dieser Methode wird der SfxViewShell das Datenfenster mitgeteilt.
+ Dieses wird f"ur den In-Place-Container und f"ur das korrekte
+ Wiederherstellen des Focus ben"otigt.
- Selbst In-Place-aktiv ist das Umsetzen des ViewPort-Windows verboten.
+ Selbst In-Place-aktiv ist das Umsetzen des ViewPort-Windows verboten.
*/
{
@@ -1241,9 +1322,9 @@ void SfxViewShell::SetWindow
if ( bHadFocus && pWindow )
pWindow->GrabFocus();
- //TODO/CLEANUP
- //brauchen wir die Methode doch noch?!
- //SFX_APP()->GrabFocus( pWindow );
+ //TODO/CLEANUP
+ //brauchen wir die Methode doch noch?!
+ //SFX_APP()->GrabFocus( pWindow );
}
//--------------------------------------------------------------------
@@ -1258,38 +1339,27 @@ Size SfxViewShell::GetOptimalSizePixel() const
SfxViewShell::SfxViewShell
(
- SfxViewFrame* pViewFrame, /* <SfxViewFrame>, in dem diese View
- dargestellt wird */
+ SfxViewFrame* pViewFrame, /* <SfxViewFrame>, in dem diese View dargestellt wird */
USHORT nFlags /* siehe <SfxViewShell-Flags> */
)
: SfxShell(this)
- ,pImp( new SfxViewShell_Impl )
- ,pIPClientList( 0 )
- ,pFrame(pViewFrame)
- ,pSubShell(0)
- ,pWindow(0)
- ,bNoNewWindow( 0 != (nFlags & SFX_VIEW_NO_NEWWINDOW) )
+, pImp( new SfxViewShell_Impl(nFlags) )
+ ,pIPClientList( 0 )
+ ,pFrame(pViewFrame)
+ ,pSubShell(0)
+ ,pWindow(0)
+ ,bNoNewWindow( 0 != (nFlags & SFX_VIEW_NO_NEWWINDOW) )
{
DBG_CTOR(SfxViewShell, 0);
//pImp->pPrinterCommandQueue = new SfxAsyncPrintExec_Impl( this );
- pImp->pController = 0;
- pImp->bIsShowView =
- !(SFX_VIEW_NO_SHOW == (nFlags & SFX_VIEW_NO_SHOW));
-
- pImp->bCanPrint = SFX_VIEW_CAN_PRINT == (nFlags & SFX_VIEW_CAN_PRINT);
- pImp->bHasPrintOptions =
- SFX_VIEW_HAS_PRINTOPTIONS == (nFlags & SFX_VIEW_HAS_PRINTOPTIONS);
- pImp->bPlugInsActive = TRUE;
- pImp->bGotOwnerShip = FALSE;
- pImp->bGotFrameOwnerShip = FALSE;
+
if ( pViewFrame->GetParentViewFrame() )
- pImp->bPlugInsActive = pViewFrame->GetParentViewFrame()->GetViewShell()->pImp->bPlugInsActive;
- pImp->eScroll = SCROLLING_DEFAULT;
- pImp->nPrinterLocks = 0;
- pImp->bControllerSet = FALSE;
- pImp->nFamily = 0xFFFF; // undefined, default set by TemplateDialog
+ {
+ pImp->m_bPlugInsActive = pViewFrame->GetParentViewFrame()
+ ->GetViewShell()->pImp->m_bPlugInsActive;
+ }
SetMargin( pViewFrame->GetMargin_Impl() );
SetPool( &pViewFrame->GetObjectShell()->GetPool() );
@@ -1318,16 +1388,10 @@ SfxViewShell::~SfxViewShell()
pImp->xClipboardListener = NULL;
}
- if ( pImp->pController )
- {
- pImp->pController->ReleaseShell_Impl();
- pImp->pController->release();
- pImp->pController = NULL;
- }
-
- if (pImp->pAccExec)
+ if (pImp->m_pController.is())
{
- DELETEZ( pImp->pAccExec );
+ pImp->m_pController->ReleaseShell_Impl();
+ pImp->m_pController.clear();
}
//DELETEZ( pImp->pPrinterCommandQueue );
@@ -1394,12 +1458,12 @@ SfxViewShell* SfxViewShell::Get( const Reference< XController>& i_rController )
SdrView* SfxViewShell::GetDrawView() const
-/* [Beschreibung]
+/* [Beschreibung]
- Diese virtuelle Methode mu\s von den Subklassen "uberladen werden, wenn
- der Property-Editor zur Verf"ugung stehen soll.
+ Diese virtuelle Methode mu\s von den Subklassen "uberladen werden, wenn
+ der Property-Editor zur Verf"ugung stehen soll.
- Die Default-Implementierung liefert immer 0.
+ Die Default-Implementierung liefert immer 0.
*/
{
@@ -1410,27 +1474,27 @@ SdrView* SfxViewShell::GetDrawView() const
String SfxViewShell::GetSelectionText
(
- BOOL /*bCompleteWords*/ /* FALSE (default)
- Nur der tats"achlich selektierte Text wird
- zur"uckgegeben.
-
- TRUE
- Der selektierte Text wird soweit erweitert,
- da\s nur ganze W"orter zur"uckgegeben werden.
- Als Worttrenner gelten White-Spaces und die
+ BOOL /*bCompleteWords*/ /* FALSE (default)
+ Nur der tats"achlich selektierte Text wird
+ zur"uckgegeben.
+
+ TRUE
+ Der selektierte Text wird soweit erweitert,
+ da\s nur ganze W"orter zur"uckgegeben werden.
+ Als Worttrenner gelten White-Spaces und die
Satzzeichen ".,;" sowie einfache und doppelte
- Anf"uhrungszeichen.
- */
+ Anf"uhrungszeichen.
+ */
)
/* [Beschreibung]
- Diese Methode kann von Anwendungsprogrammierer "uberladen werden,
- um einen Text zur"uckzuliefern, der in der aktuellen Selektion
- steht. Dieser wird z.B. beim Versenden (email) verwendet.
+ Diese Methode kann von Anwendungsprogrammierer "uberladen werden,
+ um einen Text zur"uckzuliefern, der in der aktuellen Selektion
+ steht. Dieser wird z.B. beim Versenden (email) verwendet.
Mit "CompleteWords == TRUE" ger"ufen, reicht z.B. auch der Cursor,
- der in einer URL steht, um die gesamte URL zu liefern.
+ der in einer URL steht, um die gesamte URL zu liefern.
*/
{
@@ -1443,9 +1507,9 @@ BOOL SfxViewShell::HasSelection( BOOL ) const
/* [Beschreibung]
- Mit dieser virtuellen Methode kann z.B. ein Dialog abfragen, ob in der
- aktuellen View etwas selektiert ist. Wenn der Parameter <BOOL> TRUE ist,
- wird abgefragt, ob Text selektiert ist.
+ Mit dieser virtuellen Methode kann z.B. ein Dialog abfragen, ob in der
+ aktuellen View etwas selektiert ist. Wenn der Parameter <BOOL> TRUE ist,
+ wird abgefragt, ob Text selektiert ist.
*/
{
@@ -1458,16 +1522,16 @@ void SfxViewShell::SetSubShell( SfxShell *pShell )
/* [Beschreibung]
- Mit dieser Methode kann eine Selektions- oder Cursor-Shell angemeldet
- werden, die automatisch unmittelbar nach der SfxViewShell auf den
- SfxDispatcher gepusht wird, und automatisch umittelbar vor ihr
- gepoppt wird.
+ Mit dieser Methode kann eine Selektions- oder Cursor-Shell angemeldet
+ werden, die automatisch unmittelbar nach der SfxViewShell auf den
+ SfxDispatcher gepusht wird, und automatisch umittelbar vor ihr
+ gepoppt wird.
- Ist die SfxViewShell-Instanz bereits gepusht, dann wird pShell
- sofort ebenfalls gepusht. Wird mit SetSubShell eine andere SfxShell
- Instanz angemeldet, als vorher angemeldet war, wird die zuvor angemeldete
- ggf. automatisch gepoppt. Mit pShell==0 kann daher die aktuelle
- Sub-Shell abgemeldet werden.
+ Ist die SfxViewShell-Instanz bereits gepusht, dann wird pShell
+ sofort ebenfalls gepusht. Wird mit SetSubShell eine andere SfxShell
+ Instanz angemeldet, als vorher angemeldet war, wird die zuvor angemeldete
+ ggf. automatisch gepoppt. Mit pShell==0 kann daher die aktuelle
+ Sub-Shell abgemeldet werden.
*/
{
@@ -1569,6 +1633,7 @@ void SfxViewShell::ReadUserData(const String&, BOOL )
void SfxViewShell::ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool )
{
}
+
void SfxViewShell::WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool )
{
}
@@ -1579,8 +1644,8 @@ void SfxViewShell::WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::c
SfxViewShell* SfxViewShell::GetFirst
(
- const TypeId* pType,
- BOOL bOnlyVisible
+ const TypeId* pType,
+ BOOL bOnlyVisible
)
{
// search for a SfxViewShell of the specified type
@@ -1616,9 +1681,9 @@ SfxViewShell* SfxViewShell::GetFirst
SfxViewShell* SfxViewShell::GetNext
(
- const SfxViewShell& rPrev,
- const TypeId* pType,
- BOOL bOnlyVisible
+ const SfxViewShell& rPrev,
+ const TypeId* pType,
+ BOOL bOnlyVisible
)
{
SfxViewShellArr_Impl &rShells = SFX_APP()->GetViewShells_Impl();
@@ -1677,7 +1742,8 @@ void SfxViewShell::Notify( SfxBroadcaster& rBC,
SFX_ITEMSET_ARG( pSet, pItem, SfxUnoAnyItem, SID_VIEW_DATA, sal_False );
if ( pItem )
{
- pImp->pController->restoreViewData( pItem->GetValue() );
+ pImp->m_pController->restoreViewData(
+ pItem->GetValue() );
pSet->ClearItem( SID_VIEW_DATA );
}
@@ -1696,13 +1762,15 @@ void SfxViewShell::Notify( SfxBroadcaster& rBC,
BOOL SfxViewShell::ExecKey_Impl(const KeyEvent& aKey)
{
- if (!pImp->pAccExec)
+ if (!pImp->m_pAccExec.get())
{
- pImp->pAccExec = ::svt::AcceleratorExecute::createAcceleratorHelper();
- pImp->pAccExec->init(::comphelper::getProcessServiceFactory(), pFrame->GetFrame().GetFrameInterface());
+ pImp->m_pAccExec.reset(
+ ::svt::AcceleratorExecute::createAcceleratorHelper() );
+ pImp->m_pAccExec->init(::comphelper::getProcessServiceFactory(),
+ pFrame->GetFrame().GetFrameInterface());
}
- return pImp->pAccExec->execute(aKey.GetKeyCode());
+ return pImp->m_pAccExec->execute(aKey.GetKeyCode());
}
//--------------------------------------------------------------------
@@ -1711,24 +1779,24 @@ bool SfxViewShell::KeyInput( const KeyEvent &rKeyEvent )
/* [Beschreibung]
- Diese Methode f"uhrt das KeyEvent 'rKeyEvent' "uber die an dieser
- SfxViewShell direkt oder indirekt (z.B. via Applikation) konfigurierten
- Tasten (Accelerator) aus.
+ Diese Methode f"uhrt das KeyEvent 'rKeyEvent' "uber die an dieser
+ SfxViewShell direkt oder indirekt (z.B. via Applikation) konfigurierten
+ Tasten (Accelerator) aus.
- [R"uckgabewert]
+ [R"uckgabewert]
bool TRUE
- die Taste ist konfiguriert, der betreffende
- Handler wurde gerufen
+ die Taste ist konfiguriert, der betreffende
+ Handler wurde gerufen
- FALSE
- die Taste ist nicht konfiguriert, es konnte
- also kein Handler gerufen werden
+ FALSE
+ die Taste ist nicht konfiguriert, es konnte
+ also kein Handler gerufen werden
- [Querverweise]
- <SfxApplication::KeyInput(const KeyEvent&)>
+ [Querverweise]
+ <SfxApplication::KeyInput(const KeyEvent&)>
*/
{
return ExecKey_Impl(rKeyEvent);
@@ -1745,9 +1813,9 @@ void SfxViewShell::ShowCursor( bool /*bOn*/ )
/* [Beschreibung]
- Diese Methode mu\s von Subklassen "uberladen werden, damit vom SFx
- aus der Cursor ein- und ausgeschaltet werden kann. Dies geschieht
- z.B. bei laufendem <SfxProgress>.
+ Diese Methode mu\s von Subklassen "uberladen werden, damit vom SFx
+ aus der Cursor ein- und ausgeschaltet werden kann. Dies geschieht
+ z.B. bei laufendem <SfxProgress>.
*/
{
@@ -1759,15 +1827,15 @@ void SfxViewShell::GotFocus() const
/* [Beschreibung]
- Diese Methode mu\s vom Applikationsentwickler gerufen werden, wenn
- das Edit-Window den Focus erhalten hat. Der SFx hat so z.B. die
- M"oglichkeit, den Accelerator einzuschalten.
+ Diese Methode mu\s vom Applikationsentwickler gerufen werden, wenn
+ das Edit-Window den Focus erhalten hat. Der SFx hat so z.B. die
+ M"oglichkeit, den Accelerator einzuschalten.
- [Anmerkung]
+ [Anmerkung]
- <StarView> liefert leider keine M"oglichkeit, solche Events
- 'von der Seite' einzuh"angen.
+ <StarView> liefert leider keine M"oglichkeit, solche Events
+ 'von der Seite' einzuh"angen.
*/
{
@@ -1845,12 +1913,12 @@ void SfxViewShell::CheckIPClient_Impl( SfxInPlaceClient *pIPClient, const Rectan
( ( pIPClient->GetObjectMiscStatus() & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE ) != 0 );
// this method is called when either a client is created or the "Edit/Plugins" checkbox is checked
- if ( !pIPClient->IsObjectInPlaceActive() && pImp->bPlugInsActive )
+ if ( !pIPClient->IsObjectInPlaceActive() && pImp->m_bPlugInsActive )
{
- // object in client is currently not active
- // check if the object wants to be activated always or when it becomes at least partially visible
- // TODO/LATER: maybe we should use the scaled area instead of the ObjArea?!
- if ( bAlwaysActive || (bActiveWhenVisible && rVisArea.IsOver(pIPClient->GetObjArea())) )
+ // object in client is currently not active
+ // check if the object wants to be activated always or when it becomes at least partially visible
+ // TODO/LATER: maybe we should use the scaled area instead of the ObjArea?!
+ if ( bAlwaysActive || (bActiveWhenVisible && rVisArea.IsOver(pIPClient->GetObjArea())) )
{
try
{
@@ -1861,13 +1929,13 @@ void SfxViewShell::CheckIPClient_Impl( SfxInPlaceClient *pIPClient, const Rectan
}
}
}
- else if ( !pImp->bPlugInsActive )
+ else if (!pImp->m_bPlugInsActive)
{
- // object in client is currently active and "Edit/Plugins" checkbox is selected
- // check if the object wants to be activated always or when it becomes at least partially visible
+ // object in client is currently active and "Edit/Plugins" checkbox is selected
+ // check if the object wants to be activated always or when it becomes at least partially visible
// in this case selecting of the "Edit/Plugin" checkbox should let such objects deactivate
- if ( bAlwaysActive || bActiveWhenVisible )
- pIPClient->GetObject()->changeState( embed::EmbedStates::RUNNING );
+ if ( bAlwaysActive || bActiveWhenVisible )
+ pIPClient->GetObject()->changeState( embed::EmbedStates::RUNNING );
}
}
@@ -1875,7 +1943,7 @@ void SfxViewShell::CheckIPClient_Impl( SfxInPlaceClient *pIPClient, const Rectan
BOOL SfxViewShell::PlugInsActive() const
{
- return pImp->bPlugInsActive;
+ return pImp->m_bPlugInsActive;
}
//--------------------------------------------------------------------
@@ -1883,9 +1951,9 @@ void SfxViewShell::DiscardClients_Impl()
/* [Beschreibung]
- Diese Methode dient dazu, vor dem Schlie\sen eines Dokuments das
- Speichern der Objekte zu verhindern, wenn der Benutzer Schlie\en ohne
- Speichern gew"ahlt hatte.
+ Diese Methode dient dazu, vor dem Schlie\sen eines Dokuments das
+ Speichern der Objekte zu verhindern, wenn der Benutzer Schlie\en ohne
+ Speichern gew"ahlt hatte.
*/
{
@@ -1901,14 +1969,14 @@ void SfxViewShell::DiscardClients_Impl()
SfxScrollingMode SfxViewShell::GetScrollingMode() const
{
- return pImp->eScroll;
+ return pImp->m_eScroll;
}
//--------------------------------------------------------------------
void SfxViewShell::SetScrollingMode( SfxScrollingMode eMode )
{
- pImp->eScroll = eMode;
+ pImp->m_eScroll = eMode;
}
//--------------------------------------------------------------------
@@ -1975,7 +2043,7 @@ void SfxViewShell::MarginChanged()
BOOL SfxViewShell::IsShowView_Impl() const
{
- return pImp->bIsShowView;
+ return pImp->m_bIsShowView;
}
//--------------------------------------------------------------------
@@ -1991,9 +2059,9 @@ void SfxViewShell::JumpToMark( const String& rMark )
{
SfxStringItem aMarkItem( SID_JUMPTOMARK, rMark );
GetViewFrame()->GetDispatcher()->Execute(
- SID_JUMPTOMARK,
- SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD,
- &aMarkItem, 0L );
+ SID_JUMPTOMARK,
+ SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD,
+ &aMarkItem, 0L );
}
//------------------------------------------------------------------------
@@ -2007,26 +2075,24 @@ SfxInPlaceClientList* SfxViewShell::GetIPClientList_Impl( BOOL bCreate ) const
void SfxViewShell::SetController( SfxBaseController* pController )
{
- pImp->pController = pController;
- pImp->pController->acquire();
- pImp->bControllerSet = TRUE;
+ pImp->m_pController = pController;
+ pImp->m_bControllerSet = true;
// there should be no old listener, but if there is one, it should be disconnected
if ( pImp->xClipboardListener.is() )
pImp->xClipboardListener->DisconnectViewShell();
- pImp->xClipboardListener = new SfxClipboardChangeListener( this );
- AddRemoveClipboardListener( pImp->xClipboardListener.get(), TRUE );
+ pImp->xClipboardListener = new SfxClipboardChangeListener( this, GetClipboardNotifier() );
}
Reference < XController > SfxViewShell::GetController()
{
- return pImp->pController;
+ return pImp->m_pController.get();
}
SfxBaseController* SfxViewShell::GetBaseController_Impl() const
{
- return pImp->pController;
+ return pImp->m_pController.get();
}
void SfxViewShell::AddContextMenuInterceptor_Impl( const REFERENCE< XCONTEXTMENUINTERCEPTOR >& xInterceptor )
@@ -2071,6 +2137,7 @@ void Change( Menu* pMenu, SfxViewShell* pView )
if ( pSlot )
{
pMenu->InsertItem( pSlot->GetSlotId(), pMenu->GetItemText( nId ), pMenu->GetItemBits( nId ), nPos );
+ pMenu->SetItemCommand( pSlot->GetSlotId(), aCmd );
pMenu->RemoveItem( nPos+1 );
break;
}
@@ -2081,19 +2148,19 @@ void Change( Menu* pMenu, SfxViewShell* pView )
}
-BOOL SfxViewShell::TryContextMenuInterception( Menu& rIn, const ::rtl::OUString& rMenuIdentifier, Menu*& rpOut, ::com::sun::star::ui::ContextMenuExecuteEvent aEvent )
+BOOL SfxViewShell::TryContextMenuInterception( Menu& rIn, const ::rtl::OUString& rMenuIdentifier, Menu*& rpOut, ui::ContextMenuExecuteEvent aEvent )
{
rpOut = NULL;
BOOL bModified = FALSE;
// create container from menu
- // #110897#
+ // #110897#
// aEvent.ActionTriggerContainer = ::framework::ActionTriggerHelper::CreateActionTriggerContainerFromMenu( &rIn );
aEvent.ActionTriggerContainer = ::framework::ActionTriggerHelper::CreateActionTriggerContainerFromMenu(
::comphelper::getProcessServiceFactory(), &rIn, &rMenuIdentifier );
// get selection from controller
- aEvent.Selection = ::com::sun::star::uno::Reference < ::com::sun::star::view::XSelectionSupplier > ( GetController(), ::com::sun::star::uno::UNO_QUERY );
+ aEvent.Selection = uno::Reference < view::XSelectionSupplier > ( GetController(), uno::UNO_QUERY );
// call interceptors
::cppu::OInterfaceIteratorHelper aIt( pImp->aInterceptorContainer );
@@ -2101,22 +2168,22 @@ BOOL SfxViewShell::TryContextMenuInterception( Menu& rIn, const ::rtl::OUString&
{
try
{
- ::com::sun::star::ui::ContextMenuInterceptorAction eAction =
- ((::com::sun::star::ui::XContextMenuInterceptor*)aIt.next())->notifyContextMenuExecute( aEvent );
+ ui::ContextMenuInterceptorAction eAction =
+ ((ui::XContextMenuInterceptor*)aIt.next())->notifyContextMenuExecute( aEvent );
switch ( eAction )
{
- case ::com::sun::star::ui::ContextMenuInterceptorAction_CANCELLED :
+ case ui::ContextMenuInterceptorAction_CANCELLED :
// interceptor does not want execution
return FALSE;
- case ::com::sun::star::ui::ContextMenuInterceptorAction_EXECUTE_MODIFIED :
+ case ui::ContextMenuInterceptorAction_EXECUTE_MODIFIED :
// interceptor wants his modified menu to be executed
bModified = TRUE;
break;
- case ::com::sun::star::ui::ContextMenuInterceptorAction_CONTINUE_MODIFIED :
+ case ui::ContextMenuInterceptorAction_CONTINUE_MODIFIED :
// interceptor has modified menu, but allows for calling other interceptors
bModified = TRUE;
continue;
- case ::com::sun::star::ui::ContextMenuInterceptorAction_IGNORED :
+ case ui::ContextMenuInterceptorAction_IGNORED :
// interceptor is indifferent
continue;
default:
@@ -2124,7 +2191,7 @@ BOOL SfxViewShell::TryContextMenuInterception( Menu& rIn, const ::rtl::OUString&
continue;
}
}
- catch( ::com::sun::star::uno::RuntimeException& )
+ catch( uno::RuntimeException& )
{
aIt.remove();
}
@@ -2148,23 +2215,23 @@ void SfxViewShell::TakeOwnerShip_Impl()
{
// currently there is only one reason to take OwnerShip: a hidden frame is printed
// so the ViewShell will check this on EndPrint (->prnmon.cxx)
- pImp->bGotOwnerShip = TRUE;
+ pImp->m_bGotOwnership = true;
}
void SfxViewShell::TakeFrameOwnerShip_Impl()
{
// currently there is only one reason to take OwnerShip: a hidden frame is printed
// so the ViewShell will check this on EndPrint (->prnmon.cxx)
- pImp->bGotFrameOwnerShip = TRUE;
+ pImp->m_bGotFrameOwnership = true;
}
void SfxViewShell::CheckOwnerShip_Impl()
{
BOOL bSuccess = FALSE;
- if( pImp->bGotOwnerShip )
+ if (pImp->m_bGotOwnership)
{
- com::sun::star::uno::Reference < com::sun::star::util::XCloseable > xModel(
- GetObjectShell()->GetModel(), com::sun::star::uno::UNO_QUERY );
+ uno::Reference < util::XCloseable > xModel(
+ GetObjectShell()->GetModel(), uno::UNO_QUERY );
if ( xModel.is() )
{
try
@@ -2173,16 +2240,16 @@ void SfxViewShell::CheckOwnerShip_Impl()
xModel->close( sal_True );
bSuccess = TRUE;
}
- catch ( com::sun::star::util::CloseVetoException& )
+ catch ( util::CloseVetoException& )
{
}
}
}
- if( !bSuccess && pImp->bGotFrameOwnerShip )
+ if (!bSuccess && pImp->m_bGotFrameOwnership)
{
// document couldn't be closed or it shouldn't, now try at least to close the frame
- com::sun::star::uno::Reference < com::sun::star::util::XCloseable > xFrame(
+ uno::Reference < util::XCloseable > xFrame(
GetViewFrame()->GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY );
if ( xFrame.is() )
{
@@ -2190,7 +2257,7 @@ void SfxViewShell::CheckOwnerShip_Impl()
{
xFrame->close( sal_True );
}
- catch ( com::sun::star::util::CloseVetoException& )
+ catch ( util::CloseVetoException& )
{
}
}
@@ -2199,19 +2266,21 @@ void SfxViewShell::CheckOwnerShip_Impl()
long SfxViewShell::HandleNotifyEvent_Impl( NotifyEvent& rEvent )
{
- if ( pImp->pController )
- return pImp->pController->HandleEvent_Impl( rEvent );
+ if (pImp->m_pController.is())
+ return pImp->m_pController->HandleEvent_Impl( rEvent );
return 0;
}
BOOL SfxViewShell::HasKeyListeners_Impl()
{
- return pImp->pController ? pImp->pController->HasKeyListeners_Impl() : FALSE;
+ return (pImp->m_pController.is())
+ ? pImp->m_pController->HasKeyListeners_Impl() : FALSE;
}
BOOL SfxViewShell::HasMouseClickListeners_Impl()
{
- return pImp->pController ? pImp->pController->HasMouseClickListeners_Impl() : FALSE;
+ return (pImp->m_pController.is())
+ ? pImp->m_pController->HasMouseClickListeners_Impl() : FALSE;
}
void SfxViewShell::SetAdditionalPrintOptions( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& rOpts )
@@ -2233,11 +2302,20 @@ Reference< view::XRenderable > SfxViewShell::GetRenderable()
{
Reference< frame::XModel > xModel( pObj->GetModel() );
if( xModel.is() )
- xRender = Reference< view::XRenderable >( xModel, UNO_QUERY );
+ xRender = Reference< view::XRenderable >( xModel, UNO_QUERY );
}
return xRender;
}
+uno::Reference< datatransfer::clipboard::XClipboardNotifier > SfxViewShell::GetClipboardNotifier()
+{
+ uno::Reference< datatransfer::clipboard::XClipboardNotifier > xClipboardNotifier;
+ if ( GetViewFrame() )
+ xClipboardNotifier = uno::Reference< datatransfer::clipboard::XClipboardNotifier >( GetViewFrame()->GetWindow().GetClipboard(), uno::UNO_QUERY );
+
+ return xClipboardNotifier;
+}
+
void SfxViewShell::AddRemoveClipboardListener( const uno::Reference < datatransfer::clipboard::XClipboardListener >& rClp, BOOL bAdd )
{
try