summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/appl/newhelp.cxx6
-rw-r--r--sfx2/source/appl/sfxpicklist.cxx4
-rw-r--r--sfx2/source/control/bindings.cxx5
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx14
-rw-r--r--sfx2/source/dialog/dockwin.cxx3
-rw-r--r--sfx2/source/dialog/filedlghelper.cxx4
-rw-r--r--sfx2/source/dialog/passwd.cxx28
-rw-r--r--sfx2/source/dialog/templdlg.cxx4
-rw-r--r--sfx2/source/doc/SfxDocumentMetaData.cxx68
-rw-r--r--sfx2/source/doc/docfile.cxx11
-rw-r--r--sfx2/source/doc/docvor.cxx6
-rw-r--r--sfx2/source/doc/makefile.mk8
-rw-r--r--sfx2/source/doc/objcont.cxx50
-rw-r--r--sfx2/source/doc/objmisc.cxx7
-rw-r--r--sfx2/source/doc/objserv.cxx16
-rw-r--r--sfx2/source/doc/objstor.cxx3
-rwxr-xr-xsfx2/source/doc/sfxacldetect.cxx108
-rw-r--r--sfx2/source/menu/mnuitem.cxx24
-rw-r--r--sfx2/source/menu/virtmenu.cxx26
-rw-r--r--sfx2/source/toolbox/imgmgr.cxx4
-rw-r--r--sfx2/source/toolbox/tbxitem.cxx6
-rw-r--r--sfx2/source/view/sfxbasecontroller.cxx24
-rw-r--r--sfx2/source/view/viewimp.hxx10
-rw-r--r--sfx2/source/view/viewsh.cxx53
24 files changed, 382 insertions, 110 deletions
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 9e0c8a1da3..786a8849e1 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -296,7 +296,7 @@ ContentListBox_Impl::ContentListBox_Impl( Window* pParent, const ResId& rResId )
aDocumentImage ( SfxResId( IMG_HELP_CONTENT_DOC ) )
{
- if ( GetSettings().GetStyleSettings().GetWindowColor().IsDark() )
+ if ( GetSettings().GetStyleSettings().GetHighContrastMode() )
{
aOpenBookImage = Image( SfxResId( IMG_HELP_CONTENT_BOOK_OPEN_HC ) );
aClosedBookImage = Image( SfxResId( IMG_HELP_CONTENT_BOOK_CLOSED_HC ) );
@@ -2178,7 +2178,7 @@ sal_Bool SfxHelpTextWindow_Impl::HasSelection() const
void SfxHelpTextWindow_Impl::InitToolBoxImages()
{
sal_Bool bLarge = SvtMiscOptions().AreCurrentSymbolsLarge();
- sal_Bool bHiContrast = GetBackground().GetColor().IsDark();
+ sal_Bool bHiContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
aIndexOnImage = Image( SfxResId(
bLarge ? bHiContrast ? IMG_HELP_TOOLBOX_HCL_INDEX_ON : IMG_HELP_TOOLBOX_L_INDEX_ON
@@ -2584,7 +2584,7 @@ long SfxHelpTextWindow_Impl::PreNotify( NotifyEvent& rNEvt )
if ( pCmdEvt->GetCommand() == COMMAND_CONTEXTMENU && pCmdWin != this && pCmdWin != &aToolBox )
{
- sal_Bool bHiContrast = GetSettings().GetStyleSettings().GetMenuColor().IsDark();
+ sal_Bool bHiContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
Point aPos;
if ( pCmdEvt->IsMouseEvent() )
aPos = pCmdEvt->GetMousePosPixel();
diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx
index c571b921b8..b96a5e7d03 100644
--- a/sfx2/source/appl/sfxpicklist.cxx
+++ b/sfx2/source/appl/sfxpicklist.cxx
@@ -43,8 +43,6 @@
#include <unotools/localfilehelper.hxx>
#include <cppuhelper/implbase1.hxx>
-#include <shell/systemshell.hxx>
-
// ----------------------------------------------------------------------------
#include <sfx2/app.hxx>
@@ -470,7 +468,7 @@ void SfxPickList::Notify( SfxBroadcaster&, const SfxHint& rHint )
pDocSh->Get_Impl()->bWaitingForPicklist = sal_False;
if ( aURL.GetProtocol() == INET_PROT_FILE )
- SystemShell::AddToRecentDocumentList( aURL.GetURLNoPass( INetURLObject::NO_DECODE ), (pFilter) ? pFilter->GetMimeType() : String() );
+ Application::AddToRecentDocumentList( aURL.GetURLNoPass( INetURLObject::NO_DECODE ), (pFilter) ? pFilter->GetMimeType() : String() );
}
break;
}
diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx
index 02efe0aeba..f66e60c814 100644
--- a/sfx2/source/control/bindings.cxx
+++ b/sfx2/source/control/bindings.cxx
@@ -1711,7 +1711,10 @@ IMPL_LINK( SfxBindings, NextJob_Impl, Timer *, pTimer )
// modifying the SfxObjectInterface-stack without SfxBindings => nothing to do
SfxViewFrame* pFrame = pDispatcher->GetFrame();
- if ( (pFrame && pFrame->GetObjectShell()->IsInModalMode()) || pSfxApp->IsDowning() || !pImp->pCaches->Count() )
+ //<!--Modified by PengYunQuan for Validity Cell Range Picker
+ //if ( (pFrame && pFrame->GetObjectShell()->IsInModalMode()) || pSfxApp->IsDowning() || !pImp->pCaches->Count() )
+ if ( (pFrame && !pFrame->GetObjectShell()->AcceptStateUpdate()) || pSfxApp->IsDowning() || !pImp->pCaches->Count() )
+ //-->Modified by PengYunQuan for Validity Cell Range Picker
{
DBG_PROFSTOP(SfxBindingsNextJob_Impl0);
return sal_True;
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index d59d36855c..b448392766 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -269,8 +269,12 @@ SfxDocumentInfoItem::SfxDocumentInfoItem( const String& rFile,
for ( sal_Int32 i = 0; i < nCount; ++i )
{
// "fix" property? => not a custom property => ignore it!
- if ( !(pProps[i].Attributes & ::com::sun::star::beans::PropertyAttribute::REMOVABLE) )
+ if (!(pProps[i].Attributes &
+ ::com::sun::star::beans::PropertyAttribute::REMOVABLE))
+ {
+ DBG_ASSERT(false, "non-removable user-defined property?");
continue;
+ }
uno::Any aValue = xSet->getPropertyValue(pProps[i].Name);
CustomProperty* pProp = new CustomProperty( pProps[i].Name, aValue );
@@ -424,7 +428,13 @@ void SfxDocumentInfoItem::UpdateDocumentInfo(
const beans::Property* pProps = lProps.getConstArray();
sal_Int32 nCount = lProps.getLength();
for ( sal_Int32 j = 0; j < nCount; ++j )
- xContainer->removeProperty( pProps[j].Name );
+ {
+ if ((pProps[j].Attributes &
+ ::com::sun::star::beans::PropertyAttribute::REMOVABLE))
+ {
+ xContainer->removeProperty( pProps[j].Name );
+ }
+ }
for ( sal_uInt32 k = 0; k < m_aCustomProperties.size(); ++k )
{
diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx
index b10283c849..89aaf2a240 100644
--- a/sfx2/source/dialog/dockwin.cxx
+++ b/sfx2/source/dialog/dockwin.cxx
@@ -236,7 +236,8 @@ SfxDockingWrapper::SfxDockingWrapper( Window* pParentWnd ,
}
Window* pContentWindow = VCLUnoHelper::GetWindow(xWindow);
- pContentWindow->SetStyle( pContentWindow->GetStyle() | WB_DIALOGCONTROL | WB_CHILDDLGCTRL );
+ if ( pContentWindow )
+ pContentWindow->SetStyle( pContentWindow->GetStyle() | WB_DIALOGCONTROL | WB_CHILDDLGCTRL );
pTitleDockWindow->SetWrappedWindow(pContentWindow);
}
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 4bf2a95cc4..e14d9118f0 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -2612,7 +2612,7 @@ Sequence< ::rtl::OUString > FileDialogHelper::GetSelectedFiles() const
if ( nFiles > 1 )
{
aResultSeq = Sequence< ::rtl::OUString >( nFiles-1 );
-
+
INetURLObject aPath( lFiles[0] );
aPath.setFinalSlash();
@@ -2629,7 +2629,7 @@ Sequence< ::rtl::OUString > FileDialogHelper::GetSelectedFiles() const
else
aResultSeq = lFiles;
}
-
+
return aResultSeq;
}
diff --git a/sfx2/source/dialog/passwd.cxx b/sfx2/source/dialog/passwd.cxx
index 628258eb13..23fe8c98ba 100644
--- a/sfx2/source/dialog/passwd.cxx
+++ b/sfx2/source/dialog/passwd.cxx
@@ -43,10 +43,35 @@
#include "dialog.hrc"
#include "passwd.hrc"
+#include "vcl/sound.hxx"
+
// -----------------------------------------------------------------------
IMPL_LINK_INLINE_START( SfxPasswordDialog, EditModifyHdl, Edit *, EMPTYARG )
{
+ if( mbAsciiOnly )
+ {
+ rtl::OUString aTest( maPasswordED.GetText() );
+ const sal_Unicode* pTest = aTest.getStr();
+ sal_Int32 nLen = aTest.getLength();
+ rtl::OUStringBuffer aFilter( nLen );
+ bool bReset = false;
+ for( sal_Int32 i = 0; i < nLen; i++ )
+ {
+ if( *pTest > 0x007f )
+ bReset = true;
+ else
+ aFilter.append( *pTest );
+ pTest++;
+ }
+ if( bReset )
+ {
+ Sound::Beep( SOUND_ERROR );
+ maPasswordED.SetSelection( Selection( 0, nLen ) );
+ maPasswordED.ReplaceSelected( aFilter.makeStringAndClear() );
+ }
+
+ }
maOKBtn.Enable( maPasswordED.GetText().Len() >= mnMinLen );
return 0;
}
@@ -88,7 +113,8 @@ SfxPasswordDialog::SfxPasswordDialog( Window* pParent, const String* pGroupText
maConfirmStr ( SfxResId( STR_PASSWD_CONFIRM ) ),
mnMinLen ( 5 ),
- mnExtras ( 0 )
+ mnExtras ( 0 ),
+ mbAsciiOnly ( false )
{
FreeResource();
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 2cc7b52d25..315e9ee437 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -2407,7 +2407,7 @@ void SfxTemplateDialog_Impl::updateFamilyImages()
return;
// let the families collection update the images
- sal_Bool bIsHighContrast = m_pFloat->GetDisplayBackground().GetColor().IsDark();
+ sal_Bool bIsHighContrast = m_pFloat->GetSettings().GetStyleSettings().GetHighContrastMode();
pStyleFamilies->updateImages( *m_pStyleFamiliesId, bIsHighContrast ? BMP_COLOR_HIGHCONTRAST : BMP_COLOR_NORMAL );
// and set the new images on our toolbox
@@ -2424,7 +2424,7 @@ void SfxTemplateDialog_Impl::updateFamilyImages()
void SfxTemplateDialog_Impl::updateNonFamilyImages()
{
m_aActionTbR.SetImageList( ImageList( SfxResId(
- m_pFloat->GetDisplayBackground().GetColor().IsDark() ? IMG_LST_STYLE_DESIGNER_HC
+ m_pFloat->GetSettings().GetStyleSettings().GetHighContrastMode() ? IMG_LST_STYLE_DESIGNER_HC
: DLG_STYLE_DESIGNER ) ) );
}
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx
index 93fbfa1a81..c30cbd4dbc 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -79,6 +79,7 @@
#include "comphelper/storagehelper.hxx"
#include "comphelper/mediadescriptor.hxx"
#include "comphelper/sequenceasvector.hxx"
+#include "comphelper/stlunosequence.hxx"
#include "sot/storage.hxx"
#include "sfx2/docfile.hxx"
#include "sax/tools/converter.hxx"
@@ -322,7 +323,7 @@ private:
/// standard meta data (multiple occurrences)
std::map< ::rtl::OUString,
std::vector<css::uno::Reference<css::xml::dom::XNode> > > m_metaList;
- /// user-defined meta data (meta:user-defined)
+ /// user-defined meta data (meta:user-defined) @ATTENTION may be null!
css::uno::Reference<css::beans::XPropertyContainer> m_xUserDefined;
// now for some meta-data attributes; these are not updated directly in the
// DOM because updates (detecting "empty" elements) would be quite messy
@@ -998,9 +999,12 @@ SfxDocumentMetaData::updateElement(const char *i_name,
void SAL_CALL SfxDocumentMetaData::updateUserDefinedAndAttributes()
{
createUserDefined();
- css::uno::Reference<css::beans::XPropertySet> xPSet(m_xUserDefined,css::uno::UNO_QUERY_THROW);
- std::pair<css::uno::Sequence< ::rtl::OUString>, AttrVector> udStringsAttrs = propsToStrings(xPSet);
- (void) setMetaList("meta:user-defined", udStringsAttrs.first,&udStringsAttrs.second);
+ const css::uno::Reference<css::beans::XPropertySet> xPSet(m_xUserDefined,
+ css::uno::UNO_QUERY_THROW);
+ const std::pair<css::uno::Sequence< ::rtl::OUString>, AttrVector>
+ udStringsAttrs( propsToStrings(xPSet) );
+ (void) setMetaList("meta:user-defined", udStringsAttrs.first,
+ &udStringsAttrs.second);
// update elements with attributes
std::vector<std::pair<const char *, ::rtl::OUString> > attributes;
@@ -1217,15 +1221,13 @@ void SAL_CALL SfxDocumentMetaData::init(
std::vector<css::uno::Reference<css::xml::dom::XNode> > & vec =
m_metaList[::rtl::OUString::createFromAscii("meta:user-defined")];
- // user-defined meta data: create PropertyBag which only accepts property
- // values of allowed types
+ m_xUserDefined.clear(); // #i105826#: reset (may be re-initialization)
if ( !vec.empty() )
{
createUserDefined();
}
// user-defined meta data: initialize PropertySet from DOM nodes
-
for (std::vector<css::uno::Reference<css::xml::dom::XNode> >::iterator
it = vec.begin(); it != vec.end(); ++it) {
css::uno::Reference<css::xml::dom::XElement> xElem(*it,
@@ -1301,10 +1303,14 @@ void SAL_CALL SfxDocumentMetaData::init(
////////////////////////////////////////////////////////////////////////////
SfxDocumentMetaData::SfxDocumentMetaData(
- css::uno::Reference< css::uno::XComponentContext > const & context) :
- BaseMutex(), SfxDocumentMetaData_Base(m_aMutex),
- m_xContext(context), m_NotifyListeners(m_aMutex),
- m_isInitialized(false), m_isModified(false)
+ css::uno::Reference< css::uno::XComponentContext > const & context)
+ : BaseMutex()
+ , SfxDocumentMetaData_Base(m_aMutex)
+ , m_xContext(context)
+ , m_NotifyListeners(m_aMutex)
+ , m_isInitialized(false)
+ , m_isModified(false)
+ , m_AutoloadSecs(0)
{
DBG_ASSERT(context.is(), "SfxDocumentMetaData: context is null");
DBG_ASSERT(context->getServiceManager().is(),
@@ -2168,7 +2174,7 @@ void SAL_CALL SfxDocumentMetaData::setModified( ::sal_Bool bModified )
::osl::MutexGuard g(m_aMutex);
checkInit();
m_isModified = bModified;
- if ( !bModified )
+ if ( !bModified && m_xUserDefined.is() )
{
xMB.set(m_xUserDefined, css::uno::UNO_QUERY);
DBG_ASSERT(xMB.is(),
@@ -2241,6 +2247,8 @@ void SAL_CALL SfxDocumentMetaData::serialize(
void SfxDocumentMetaData::createUserDefined()
{
+ // user-defined meta data: create PropertyBag which only accepts property
+ // values of allowed types
if ( !m_xUserDefined.is() )
{
css::uno::Sequence<css::uno::Type> types(10);
@@ -2258,29 +2266,37 @@ void SfxDocumentMetaData::createUserDefined()
args[0] <<= css::beans::NamedValue(
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AllowedTypes")),
css::uno::makeAny(types));
- // #i94175#: ODF 1.1 allows empty user-defined property names!
- args[1] <<= css::beans::NamedValue(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AllowEmptyPropertyName")),
+ // #i94175#: ODF allows empty user-defined property names!
+ args[1] <<= css::beans::NamedValue( ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("AllowEmptyPropertyName")),
css::uno::makeAny(sal_True));
- css::uno::Reference<css::lang::XMultiComponentFactory> xMsf (m_xContext->getServiceManager());
+ const css::uno::Reference<css::lang::XMultiComponentFactory> xMsf(
+ m_xContext->getServiceManager());
m_xUserDefined.set(
- xMsf->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.beans.PropertyBag")), m_xContext),
+ xMsf->createInstanceWithContext(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.beans.PropertyBag")), m_xContext),
css::uno::UNO_QUERY_THROW);
- css::uno::Reference<css::lang::XInitialization> xInit(m_xUserDefined,
- css::uno::UNO_QUERY);
+ const css::uno::Reference<css::lang::XInitialization> xInit(
+ m_xUserDefined, css::uno::UNO_QUERY);
if (xInit.is()) {
xInit->initialize(args);
}
- css::uno::Reference<css::util::XModifyBroadcaster> xMB(m_xUserDefined,css::uno::UNO_QUERY);
- if (xMB.is())
+ const css::uno::Reference<css::util::XModifyBroadcaster> xMB(
+ m_xUserDefined, css::uno::UNO_QUERY);
+ if (xMB.is())
{
- css::uno::Sequence< css::uno::Reference< css::uno::XInterface > > aListener = m_NotifyListeners.getElements();
- const css::uno::Reference< css::uno::XInterface >* pIter = aListener.getConstArray();
- const css::uno::Reference< css::uno::XInterface >* pEnd = pIter + aListener.getLength();
- for(;pIter != pEnd;++pIter )
- xMB->addModifyListener(css::uno::Reference< css::util::XModifyListener >(*pIter,css::uno::UNO_QUERY));
+ const css::uno::Sequence<css::uno::Reference<css::uno::XInterface> >
+ listeners(m_NotifyListeners.getElements());
+ for (css::uno::Reference< css::uno::XInterface > const * iter =
+ ::comphelper::stl_begin(listeners);
+ iter != ::comphelper::stl_end(listeners); ++iter) {
+ xMB->addModifyListener(
+ css::uno::Reference< css::util::XModifyListener >(*iter,
+ css::uno::UNO_QUERY));
+ }
}
}
}
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index f44ac7c3ec..445508e2e1 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -155,6 +155,8 @@ using namespace ::com::sun::star::io;
#define MAX_REDIRECT 5
+sal_Bool IsReadonlyAccordingACL( const sal_Unicode* pFilePath );
+
//==========================================================
namespace {
@@ -1145,6 +1147,15 @@ sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI )
}
catch( uno::Exception )
{}
+
+ if ( !bContentReadonly )
+ {
+ // the file is not readonly, check the ACL
+
+ String aPhysPath;
+ if ( ::utl::LocalFileHelper::ConvertURLToPhysicalName( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), aPhysPath ) )
+ bContentReadonly = IsReadonlyAccordingACL( aPhysPath.GetBuffer() );
+ }
}
// do further checks only if the file not readonly in fs
diff --git a/sfx2/source/doc/docvor.cxx b/sfx2/source/doc/docvor.cxx
index 830b27d900..28c0760ddf 100644
--- a/sfx2/source/doc/docvor.cxx
+++ b/sfx2/source/doc/docvor.cxx
@@ -1188,7 +1188,7 @@ void SfxOrganizeListBox_Impl::RequestingChilds( SvLBoxEntry* pEntry )
// einfuegen
BmpColorMode eColorMode = BMP_COLOR_NORMAL;
- if ( GetDisplayBackground().GetColor().IsDark() )
+ if ( GetSettings().GetStyleSettings().GetHighContrastMode() )
eColorMode = BMP_COLOR_HIGHCONTRAST;
@@ -1480,7 +1480,7 @@ const Image &SfxOrganizeListBox_Impl::GetClosedBmp(USHORT nLevel) const
*/
{
- BOOL bHC = GetBackground().GetColor().IsDark();
+ BOOL bHC = GetSettings().GetStyleSettings().GetHighContrastMode();
const Image* pRet = NULL;
switch( nLevel )
@@ -1514,7 +1514,7 @@ const Image &SfxOrganizeListBox_Impl::GetOpenedBmp(USHORT nLevel) const
*/
{
- BOOL bHC = GetBackground().GetColor().IsDark();
+ BOOL bHC = GetSettings().GetStyleSettings().GetHighContrastMode();
const Image* pRet = NULL;
switch( nLevel )
diff --git a/sfx2/source/doc/makefile.mk b/sfx2/source/doc/makefile.mk
index 1b42844491..66fd03175a 100644
--- a/sfx2/source/doc/makefile.mk
+++ b/sfx2/source/doc/makefile.mk
@@ -86,11 +86,19 @@ SLOFILES = \
$(SLO)$/DocumentMetadataAccess.obj \
$(SLO)$/Metadatable.obj \
$(SLO)$/sfxmodelfactory.obj \
+ $(SLO)$/sfxacldetect.obj \
$(SLO)$/docstoragemodifylistener.obj \
$(SLO)$/querytemplate.obj
# $(SLO)$/applet.obj \
+.IF "$(GUI)" == "WNT"
+
+#HACK TO DISABLE PCH
+NOOPTFILES= \
+ $(SLO)$/sfxacldetect.obj
+.ENDIF
+
# --- Tagets -------------------------------------------------------
diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx
index 8398679302..d63d1fc17e 100644
--- a/sfx2/source/doc/objcont.cxx
+++ b/sfx2/source/doc/objcont.cxx
@@ -1423,31 +1423,35 @@ sal_Bool SfxObjectShell::IsHelpDocument() const
void SfxObjectShell::ResetFromTemplate( const String& rTemplateName, const String& rFileName )
{
- uno::Reference<document::XDocumentProperties> xDocProps(getDocProperties());
- xDocProps->setTemplateURL( ::rtl::OUString() );
- xDocProps->setTemplateName( ::rtl::OUString() );
- xDocProps->setTemplateDate( util::DateTime() );
- xDocProps->resetUserData( ::rtl::OUString() );
-
- // TODO/REFACTOR:
- // Title?
-
- if( ::utl::LocalFileHelper::IsLocalFile( rFileName ) )
+ // only care about reseting this data for openoffice formats otherwise
+ if ( IsOwnStorageFormat_Impl( *GetMedium()) )
{
- String aFoundName;
- if( SFX_APP()->Get_Impl()->GetDocumentTemplates()->GetFull( String(), rTemplateName, aFoundName ) )
+ uno::Reference<document::XDocumentProperties> xDocProps(getDocProperties());
+ xDocProps->setTemplateURL( ::rtl::OUString() );
+ xDocProps->setTemplateName( ::rtl::OUString() );
+ xDocProps->setTemplateDate( util::DateTime() );
+ xDocProps->resetUserData( ::rtl::OUString() );
+
+ // TODO/REFACTOR:
+ // Title?
+
+ if( ::utl::LocalFileHelper::IsLocalFile( rFileName ) )
{
- INetURLObject aObj( rFileName );
- xDocProps->setTemplateURL( aObj.GetMainURL(INetURLObject::DECODE_TO_IURI) );
- xDocProps->setTemplateName( rTemplateName );
-
- ::DateTime now;
- xDocProps->setTemplateDate( util::DateTime(
- now.Get100Sec(), now.GetSec(), now.GetMin(),
- now.GetHour(), now.GetDay(), now.GetMonth(),
- now.GetYear() ) );
-
- SetQueryLoadTemplate( sal_True );
+ String aFoundName;
+ if( SFX_APP()->Get_Impl()->GetDocumentTemplates()->GetFull( String(), rTemplateName, aFoundName ) )
+ {
+ INetURLObject aObj( rFileName );
+ xDocProps->setTemplateURL( aObj.GetMainURL(INetURLObject::DECODE_TO_IURI) );
+ xDocProps->setTemplateName( rTemplateName );
+
+ ::DateTime now;
+ xDocProps->setTemplateDate( util::DateTime(
+ now.Get100Sec(), now.GetSec(), now.GetMin(),
+ now.GetHour(), now.GetDay(), now.GetMonth(),
+ now.GetYear() ) );
+
+ SetQueryLoadTemplate( sal_True );
+ }
}
}
}
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index ff4ed98058..57f6aab335 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -491,6 +491,13 @@ sal_Bool SfxObjectShell::IsInModalMode() const
return pImp->bModalMode || pImp->bRunningMacro;
}
+//<!--Added by PengYunQuan for Validity Cell Range Picker
+sal_Bool SfxObjectShell::AcceptStateUpdate() const
+{
+ return !IsInModalMode();
+}
+//-->Added by PengYunQuan for Validity Cell Range Picker
+
//-------------------------------------------------------------------------
sal_Bool SfxObjectShell::HasModalViews() const
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 8cf35d3533..20ea6dfa77 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -1512,3 +1512,19 @@ void SfxObjectShell::SignScriptingContent()
ImplSign( TRUE );
}
+// static
+const uno::Sequence<sal_Int8>& SfxObjectShell::getUnoTunnelId()
+{
+ static uno::Sequence<sal_Int8> * pSeq = 0;
+ if( !pSeq )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if( !pSeq )
+ {
+ static uno::Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ pSeq = &aSeq;
+ }
+ }
+ return *pSeq;
+}
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 6ab2bf2d81..e1a8c626b2 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -100,7 +100,6 @@
#include <sot/storinfo.hxx>
#include <sot/exchange.hxx>
#include <sot/formats.hxx>
-#include <shell/systemshell.hxx>
#include <comphelper/storagehelper.hxx>
#include <comphelper/seqstream.hxx>
#include <comphelper/documentconstants.hxx>
@@ -831,7 +830,7 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed )
if ( aUrl.GetProtocol() == INET_PROT_FILE )
{
const SfxFilter* pOrgFilter = pMedium->GetOrigFilter();
- SystemShell::AddToRecentDocumentList(
+ Application::AddToRecentDocumentList(
aUrl.GetURLNoPass( INetURLObject::NO_DECODE ),
(pOrgFilter) ? pOrgFilter->GetMimeType() : String() );
}
diff --git a/sfx2/source/doc/sfxacldetect.cxx b/sfx2/source/doc/sfxacldetect.cxx
new file mode 100755
index 0000000000..94370e9a1c
--- /dev/null
+++ b/sfx2/source/doc/sfxacldetect.cxx
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: shutdowniconw32.cxx,v $
+ * $Revision: 1.48 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#ifdef WNT
+
+// necessary to include system headers without warnings
+#ifdef _MSC_VER
+#pragma warning(disable:4668 4917)
+#endif
+
+#include <windows.h>
+#include <lmaccess.h>
+#include <sal/types.h>
+
+sal_Bool IsReadonlyAccordingACL( const sal_Unicode* pFilePath )
+{
+ sal_Bool bResult = sal_False;
+
+ sal_uInt32 nFDSize = 0;
+ GetFileSecurityW( pFilePath, DACL_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|OWNER_SECURITY_INFORMATION, NULL, 0, &nFDSize );
+ if ( nFDSize )
+ {
+ PSECURITY_DESCRIPTOR pFileDescr = reinterpret_cast< PSECURITY_DESCRIPTOR >( malloc( nFDSize ) );
+ if ( GetFileSecurityW( pFilePath, DACL_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|OWNER_SECURITY_INFORMATION, pFileDescr, nFDSize, &nFDSize ) )
+ {
+ HANDLE hToken = NULL;
+ if ( OpenThreadToken( GetCurrentThread(), TOKEN_DUPLICATE|TOKEN_QUERY, TRUE, &hToken )
+ || OpenProcessToken( GetCurrentProcess(), TOKEN_DUPLICATE|TOKEN_QUERY, &hToken) )
+ {
+ HANDLE hImpersonationToken = NULL;
+ if ( DuplicateToken( hToken, SecurityImpersonation, &hImpersonationToken) )
+ {
+ sal_uInt32 nDesiredAccess = ACCESS_WRITE;
+ GENERIC_MAPPING aGenericMapping = { ACCESS_READ, ACCESS_WRITE, 0, ACCESS_READ | ACCESS_WRITE };
+ MapGenericMask( &nDesiredAccess, &aGenericMapping );
+
+ PRIVILEGE_SET aPrivilegeSet;
+ sal_uInt32 nPrivilegeSetSize = sizeof( PRIVILEGE_SET );
+
+ sal_uInt32 nGrantedAccess;
+ BOOL bAccessible = TRUE;
+ if ( AccessCheck( pFileDescr,
+ hImpersonationToken,
+ nDesiredAccess,
+ &aGenericMapping,
+ &aPrivilegeSet,
+ &nPrivilegeSetSize,
+ &nGrantedAccess,
+ &bAccessible ) )
+ {
+ bResult = !bAccessible;
+ }
+
+ CloseHandle( hImpersonationToken );
+ }
+
+ CloseHandle( hToken );
+ }
+ }
+
+ free( pFileDescr );
+ }
+
+ return bResult;
+}
+
+#else // this is UNX
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sfx2.hxx"
+
+
+#include <sal/types.h>
+
+sal_Bool IsReadonlyAccordingACL( const sal_Unicode* )
+{
+ // to be implemented
+ return sal_False;
+}
+
+#endif
+
diff --git a/sfx2/source/menu/mnuitem.cxx b/sfx2/source/menu/mnuitem.cxx
index 1974c4e59a..8c1e42a44e 100644
--- a/sfx2/source/menu/mnuitem.cxx
+++ b/sfx2/source/menu/mnuitem.cxx
@@ -451,7 +451,7 @@ SfxAppMenuControl_Impl::SfxAppMenuControl_Impl(
// Determine the current background color setting for menus
const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
m_nSymbolsStyle = rSettings.GetSymbolsStyle();
- m_bWasHiContrastMode = rSettings.GetMenuColor().IsDark();
+ m_bWasHiContrastMode = rSettings.GetHighContrastMode();
m_bShowMenuImages = rSettings.GetUseImagesInMenus();
Reference<com::sun::star::lang::XMultiServiceFactory> aXMultiServiceFactory(::comphelper::getProcessServiceFactory());
@@ -477,7 +477,7 @@ IMPL_LINK( SfxAppMenuControl_Impl, Activate, Menu *, pActMenu )
{
const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
ULONG nSymbolsStyle = rSettings.GetSymbolsStyle();
- BOOL bIsHiContrastMode = rSettings.GetMenuColor().IsDark();
+ BOOL bIsHiContrastMode = rSettings.GetHighContrastMode();
BOOL bShowMenuImages = rSettings.GetUseImagesInMenus();
if (( nSymbolsStyle != m_nSymbolsStyle ) ||
@@ -542,6 +542,13 @@ SfxUnoMenuControl* SfxMenuControl::CreateControl( const String& rCmd,
return new SfxUnoMenuControl( rCmd, nId, rMenu, rBindings, pVirt );
}
+SfxUnoMenuControl* SfxMenuControl::CreateControl( const String& rCmd,
+ USHORT nId, Menu& rMenu, const String& sItemText, const String& sHelpText,
+ SfxBindings& rBindings, SfxVirtualMenu* pVirt)
+{
+ return new SfxUnoMenuControl( rCmd, nId, rMenu, sItemText, sHelpText, rBindings, pVirt);
+}
+
SfxUnoMenuControl::SfxUnoMenuControl( const String& rCmd, USHORT nSlotId,
Menu& rMenu, SfxBindings& rBindings, SfxVirtualMenu* pVirt )
: SfxMenuControl( nSlotId, rBindings )
@@ -554,6 +561,19 @@ SfxUnoMenuControl::SfxUnoMenuControl( const String& rCmd, USHORT nSlotId,
pUnoCtrl->GetNewDispatch();
}
+SfxUnoMenuControl::SfxUnoMenuControl(
+ const String& rCmd, USHORT nSlotId, Menu& /*rMenu*/,
+ const String& rItemText, const String& rHelpText,
+ SfxBindings& rBindings, SfxVirtualMenu* pVirt)
+ : SfxMenuControl( nSlotId, rBindings )
+{
+ Bind( pVirt, nSlotId, rItemText, rHelpText, rBindings);
+ UnBind();
+ pUnoCtrl = new SfxUnoControllerItem( this, rBindings, rCmd );
+ pUnoCtrl->acquire();
+ pUnoCtrl->GetNewDispatch();
+}
+
SfxUnoMenuControl::~SfxUnoMenuControl()
{
pUnoCtrl->UnBind();
diff --git a/sfx2/source/menu/virtmenu.cxx b/sfx2/source/menu/virtmenu.cxx
index 5c42c0ef42..b1eb2bd3d8 100644
--- a/sfx2/source/menu/virtmenu.cxx
+++ b/sfx2/source/menu/virtmenu.cxx
@@ -336,11 +336,7 @@ SfxVirtualMenu::~SfxVirtualMenu()
BOOL SfxVirtualMenu::IsHiContrastMode() const
{
const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
- Color aMenuColor = rSettings.GetMenuColor();
- if ( aMenuColor.IsDark() )
- return TRUE;
- else
- return FALSE;
+ return rSettings.GetHighContrastMode();
}
//--------------------------------------------------------------------
@@ -421,8 +417,12 @@ void SfxVirtualMenu::CreateFromSVMenu()
DELETEZ( pPopup );
}
+ const String sItemText = pSVMenu->GetItemText(nSlotId);
+ const String sHelpText = pSVMenu->GetHelpText(nSlotId);
+
if ( pPopup )
{
+
SfxMenuControl *pMnuCtrl =
SfxMenuControl::CreateControl(nSlotId, *pPopup, *pBindings);
@@ -438,10 +438,8 @@ void SfxVirtualMenu::CreateFromSVMenu()
SfxMenuCtrlArr_Impl &rCtrlArr = GetAppCtrl_Impl();
rCtrlArr.C40_INSERT( SfxMenuControl, pMnuCtrl, rCtrlArr.Count() );
- (pItems+nPos)->Bind( 0, nSlotId, pSVMenu->GetItemText(nSlotId),
- pSVMenu->GetHelpText(nSlotId), *pBindings);
- pMnuCtrl->Bind( this, nSlotId, pSVMenu->GetItemText(nSlotId),
- pSVMenu->GetHelpText(nSlotId), *pBindings);
+ (pItems+nPos)->Bind( 0, nSlotId, sItemText, sHelpText, *pBindings);
+ pMnuCtrl->Bind( this, nSlotId, sItemText, sHelpText, *pBindings);
if ( Application::GetSettings().GetStyleSettings().GetUseImagesInMenus() )
{
@@ -477,7 +475,7 @@ void SfxVirtualMenu::CreateFromSVMenu()
{
pMnuCtrl->Bind( this, nSlotId,
*new SfxVirtualMenu(nSlotId, this, *pPopup, bHelpInitialized, *pBindings, bOLE, bResCtor),
- pSVMenu->GetItemText(nSlotId), pSVMenu->GetHelpText(nSlotId),
+ sItemText, sHelpText,
*pBindings );
}
}
@@ -514,12 +512,12 @@ void SfxVirtualMenu::CreateFromSVMenu()
if ( aCmd.Len() && (( nSlotId < SID_SFX_START ) || ( nSlotId > SHRT_MAX )) )
{
// try to create control via comand name
- pMnuCtrl = SfxMenuControl::CreateControl( aCmd, nSlotId, *pSVMenu, *pBindings, this );
+ pMnuCtrl = SfxMenuControl::CreateControl( aCmd, nSlotId, *pSVMenu, sItemText, sHelpText, *pBindings, this );
if ( pMnuCtrl )
{
SfxMenuCtrlArr_Impl &rCtrlArr = GetAppCtrl_Impl();
rCtrlArr.C40_INSERT( SfxMenuControl, pMnuCtrl, rCtrlArr.Count());
- (pItems+nPos)->Bind( 0, nSlotId, pSVMenu->GetItemText(nSlotId), pSVMenu->GetHelpText(nSlotId), *pBindings);
+ (pItems+nPos)->Bind( 0, nSlotId, sItemText, sHelpText, *pBindings);
}
}
@@ -531,13 +529,13 @@ void SfxVirtualMenu::CreateFromSVMenu()
{
SfxMenuCtrlArr_Impl &rCtrlArr = GetAppCtrl_Impl();
rCtrlArr.C40_INSERT( SfxMenuControl, pMnuCtrl, rCtrlArr.Count());
- (pItems+nPos)->Bind( 0, nSlotId, pSVMenu->GetItemText(nSlotId), pSVMenu->GetHelpText(nSlotId), *pBindings);
+ (pItems+nPos)->Bind( 0, nSlotId, sItemText, sHelpText, *pBindings);
}
else
// take default control
pMnuCtrl = (pItems+nPos);
- pMnuCtrl->Bind( this, nSlotId, pSVMenu->GetItemText(nSlotId), pSVMenu->GetHelpText(nSlotId), *pBindings);
+ pMnuCtrl->Bind( this, nSlotId, sItemText, sHelpText, *pBindings);
}
if ( Application::GetSettings().GetStyleSettings().GetUseImagesInMenus() )
diff --git a/sfx2/source/toolbox/imgmgr.cxx b/sfx2/source/toolbox/imgmgr.cxx
index f69afa02fc..c634009ed3 100644
--- a/sfx2/source/toolbox/imgmgr.cxx
+++ b/sfx2/source/toolbox/imgmgr.cxx
@@ -229,7 +229,7 @@ void SfxImageManager_Impl::SetSymbolsSize_Impl( sal_Int16 nNewSymbolsSize )
if ( pInf->nFlags & SFX_TOOLBOX_CHANGESYMBOLSET )
{
ToolBox *pBox = pInf->pToolBox;
- BOOL bHiContrast = pBox->GetBackground().GetColor().IsDark();
+ BOOL bHiContrast = pBox->GetSettings().GetStyleSettings().GetHighContrastMode();
USHORT nCount = pBox->GetItemCount();
for ( USHORT nPos=0; nPos<nCount; nPos++ )
{
@@ -424,6 +424,6 @@ void SfxImageManager::SetImagesForceSize( ToolBox& rToolBox, BOOL bHiContrast, B
void SfxImageManager::SetImages( ToolBox& rToolBox )
{
BOOL bLarge = ( pImp->m_nSymbolsSize == SFX_SYMBOLS_SIZE_LARGE );
- BOOL bHiContrast = rToolBox.GetBackground().GetColor().IsDark();
+ BOOL bHiContrast = rToolBox.GetSettings().GetStyleSettings().GetHighContrastMode();
SetImagesForceSize( rToolBox, bHiContrast, bLarge );
}
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index f0efa2da90..417ec9bf44 100644
--- a/sfx2/source/toolbox/tbxitem.cxx
+++ b/sfx2/source/toolbox/tbxitem.cxx
@@ -1529,7 +1529,7 @@ SfxAppToolBoxControl_Impl::SfxAppToolBoxControl_Impl( USHORT nSlotId, USHORT nId
// Determine the current background color of the menus
const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
m_nSymbolsStyle = rSettings.GetSymbolsStyle();
- m_bWasHiContrastMode = rSettings.GetMenuColor().IsDark();
+ m_bWasHiContrastMode = rSettings.GetHighContrastMode();
m_bShowMenuImages = rSettings.GetUseImagesInMenus();
SetImage( String() );
@@ -1654,7 +1654,7 @@ void SfxAppToolBoxControl_Impl::SetImage( const String &rURL )
aURL = sFallback;
BOOL bBig = SvtMiscOptions().AreCurrentSymbolsLarge();
- BOOL bHC = GetToolBox().GetBackground().GetColor().IsDark();
+ BOOL bHC = GetToolBox().GetSettings().GetStyleSettings().GetHighContrastMode();
Image aImage = SvFileInformationManager::GetImageNoDefault( INetURLObject( aURL ), bBig, bHC );
if ( !aImage )
aImage = !!aMenuImage ? aMenuImage :
@@ -1805,7 +1805,7 @@ IMPL_LINK( SfxAppToolBoxControl_Impl, Activate, Menu *, pActMenu )
{
const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
ULONG nSymbolsStyle = rSettings.GetSymbolsStyle();
- BOOL bIsHiContrastMode = rSettings.GetMenuColor().IsDark();
+ BOOL bIsHiContrastMode = rSettings.GetHighContrastMode();
BOOL bShowMenuImages = rSettings.GetUseImagesInMenus();
if (( nSymbolsStyle != m_nSymbolsStyle ) ||
diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx
index 5a64421423..c4b9e49aef 100644
--- a/sfx2/source/view/sfxbasecontroller.cxx
+++ b/sfx2/source/view/sfxbasecontroller.cxx
@@ -81,6 +81,7 @@
#include <vos/mutex.hxx>
#include <osl/mutex.hxx>
+#include <tools/diagnose_ex.h>
#include <comphelper/sequence.hxx>
#include <rtl/ustrbuf.hxx>
#include <toolkit/helper/convert.hxx>
@@ -706,6 +707,29 @@ void SAL_CALL SfxBaseController::attachFrame( const REFERENCE< XFRAME >& xFrame
SfxViewFrame* pActFrame = m_pData->m_pViewShell->GetFrame() ;
pActFrame->Enable( TRUE );
pActFrame->GetDispatcher()->Lock( FALSE );
+
+ if ( ( m_pData->m_pViewShell->GetObjectShell() != NULL )
+ && ( m_pData->m_pViewShell->GetObjectShell()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
+ )
+ {
+ SfxViewFrame* pViewFrm = m_pData->m_pViewShell->GetViewFrame();
+ if ( !pViewFrm->GetFrame()->IsInPlace() )
+ {
+ // for outplace embedded objects, we want the layout manager to keep the content window
+ // size constant, if possible
+ try
+ {
+ uno::Reference< beans::XPropertySet > xFrameProps( m_pData->m_xFrame, uno::UNO_QUERY_THROW );
+ uno::Reference< beans::XPropertySet > xLayouterProps(
+ xFrameProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ) ) ), uno::UNO_QUERY_THROW );
+ xLayouterProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PreserveContentSize" ) ), uno::makeAny( sal_True ) );
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
}
}
}
diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx
index 81809c8980..6b0c77071c 100644
--- a/sfx2/source/view/viewimp.hxx
+++ b/sfx2/source/view/viewimp.hxx
@@ -45,6 +45,8 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <svtools/acceleratorexecute.hxx>
+#include <rtl/ref.hxx>
+
#include <queue>
// forward ---------------------------------------------------------------
@@ -71,6 +73,8 @@ public:
void AddRequest( SfxRequest& rReq );
};
+class SfxClipboardChangeListener;
+
struct SfxViewShell_Impl
{
::osl::Mutex aMutex;
@@ -96,11 +100,9 @@ struct SfxViewShell_Impl
::svt::AcceleratorExecute* pAccExec;
SfxAsyncPrintExec_Impl* pPrinterCommandQueue;
com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aPrintOpts;
+ ::rtl::Reference< SfxClipboardChangeListener > xClipboardListener;
- SfxViewShell_Impl()
- : aInterceptorContainer( aMutex )
- , pAccExec(0)
- {}
+ SfxViewShell_Impl();
};
#endif
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 7d41d2bfa0..a16439698e 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -131,6 +131,8 @@ class SfxClipboardChangeListener : public ::cppu::WeakImplHelper1<
public:
SfxClipboardChangeListener( SfxViewShell* pView );
virtual ~SfxClipboardChangeListener();
+
+ void DisconnectViewShell() { pViewShell = NULL; }
};
SfxClipboardChangeListener::SfxClipboardChangeListener( SfxViewShell* pView )
@@ -241,7 +243,12 @@ static ::rtl::OUString RetrieveLabelFromCommand(
}
//=========================================================================
+SfxViewShell_Impl::SfxViewShell_Impl()
+: aInterceptorContainer( aMutex )
+, pAccExec(0)
+{}
+//=========================================================================
SFX_IMPL_INTERFACE(SfxViewShell,SfxShell,SfxResId(0))
{
SFX_CHILDWINDOW_REGISTRATION( SID_MAIL_CHILDWIN );
@@ -1297,21 +1304,27 @@ SfxViewShell::~SfxViewShell()
SfxViewShellArr_Impl &rViewArr = SFX_APP()->GetViewShells_Impl();
rViewArr.Remove( rViewArr.GetPos(pThis) );
+ if ( pImp->xClipboardListener.is() )
+ {
+ pImp->xClipboardListener->DisconnectViewShell();
+ pImp->xClipboardListener = NULL;
+ }
+
if ( pImp->pController )
{
pImp->pController->ReleaseShell_Impl();
pImp->pController->release();
+ pImp->pController = NULL;
}
if (pImp->pAccExec)
{
- delete pImp->pAccExec;
- pImp->pAccExec = 0;
+ DELETEZ( pImp->pAccExec );
}
- delete pImp->pPrinterCommandQueue;
- delete pImp;
- delete pIPClientList;
+ DELETEZ( pImp->pPrinterCommandQueue );
+ DELETEZ( pImp );
+ DELETEZ( pIPClientList );
}
//--------------------------------------------------------------------
@@ -1996,8 +2009,13 @@ void SfxViewShell::SetController( SfxBaseController* pController )
pImp->pController = pController;
pImp->pController->acquire();
pImp->bControllerSet = TRUE;
+
+ // there should be no old listener, but if there is one, it should be disconnected
+ if ( pImp->xClipboardListener.is() )
+ pImp->xClipboardListener->DisconnectViewShell();
- AddRemoveClipboardListener( new SfxClipboardChangeListener( this ), TRUE );
+ pImp->xClipboardListener = new SfxClipboardChangeListener( this );
+ AddRemoveClipboardListener( pImp->xClipboardListener.get(), TRUE );
}
Reference < XController > SfxViewShell::GetController()
@@ -2205,17 +2223,20 @@ void SfxViewShell::AddRemoveClipboardListener( const uno::Reference < datatransf
{
try
{
- uno::Reference< datatransfer::clipboard::XClipboard > xClipboard( GetViewFrame()->GetWindow().GetClipboard() );
- if( !xClipboard.is() )
- return;
-
- uno::Reference< datatransfer::clipboard::XClipboardNotifier > xClpbrdNtfr( xClipboard, uno::UNO_QUERY );
- if( xClpbrdNtfr.is() )
+ if ( GetViewFrame() )
{
- if( bAdd )
- xClpbrdNtfr->addClipboardListener( rClp );
- else
- xClpbrdNtfr->removeClipboardListener( rClp );
+ uno::Reference< datatransfer::clipboard::XClipboard > xClipboard( GetViewFrame()->GetWindow().GetClipboard() );
+ if( xClipboard.is() )
+ {
+ uno::Reference< datatransfer::clipboard::XClipboardNotifier > xClpbrdNtfr( xClipboard, uno::UNO_QUERY );
+ if( xClpbrdNtfr.is() )
+ {
+ if( bAdd )
+ xClpbrdNtfr->addClipboardListener( rClp );
+ else
+ xClpbrdNtfr->removeClipboardListener( rClp );
+ }
+ }
}
}
catch( const uno::Exception& )