From 3a93b09b046b34701749e403c45b921cb61bd80c Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Wed, 25 Nov 2009 16:49:51 +0000 Subject: #i51258# thesaurus for right click context menu --- sfx2/source/menu/makefile.mk | 5 +- sfx2/source/menu/menu.hrc | 4 + sfx2/source/menu/menu.src | 15 +++ sfx2/source/menu/mnumgr.cxx | 83 +++++++++++- sfx2/source/menu/thessubmenu.cxx | 274 +++++++++++++++++++++++++++++++++++++++ sfx2/source/menu/thessubmenu.hxx | 103 +++++++++++++++ 6 files changed, 481 insertions(+), 3 deletions(-) create mode 100755 sfx2/source/menu/thessubmenu.cxx create mode 100755 sfx2/source/menu/thessubmenu.hxx (limited to 'sfx2/source') diff --git a/sfx2/source/menu/makefile.mk b/sfx2/source/menu/makefile.mk index 57a02ceef9f9..aa622be7502c 100644 --- a/sfx2/source/menu/makefile.mk +++ b/sfx2/source/menu/makefile.mk @@ -47,10 +47,11 @@ SRS1NAME=$(TARGET) SRC1FILES = menu.src SLOFILES = \ + $(SLO)$/mnuitem.obj \ $(SLO)$/mnumgr.obj \ - $(SLO)$/virtmenu.obj \ $(SLO)$/objmnctl.obj \ - $(SLO)$/mnuitem.obj + $(SLO)$/thessubmenu.obj \ + $(SLO)$/virtmenu.obj # --- Tagets ------------------------------------------------------- diff --git a/sfx2/source/menu/menu.hrc b/sfx2/source/menu/menu.hrc index f339f07f247a..0a5e4b63bf1d 100644 --- a/sfx2/source/menu/menu.hrc +++ b/sfx2/source/menu/menu.hrc @@ -67,6 +67,10 @@ #define STR_MENU_ADDONS RID_SFX_MENU_START+2 #define STR_MENU_ADDONHELP RID_SFX_MENU_START+3 +#define STR_MENU_SYNONYMS (RID_SFX_MENU_START+11) +#define STR_MENU_NO_SYNONYM_FOUND (RID_SFX_MENU_START+12) +#define STR_MENU_THESAURUS (RID_SFX_MENU_START+13) + #define MN_CLIPBOARDFUNCS RID_SFX_MENU_START+1 #endif diff --git a/sfx2/source/menu/menu.src b/sfx2/source/menu/menu.src index a2ca838cd722..757d6b94da28 100644 --- a/sfx2/source/menu/menu.src +++ b/sfx2/source/menu/menu.src @@ -75,6 +75,21 @@ String STR_MENU_ADDONHELP Text [ en-US ] = "Add-~On Help" ; }; +String STR_MENU_SYNONYMS +{ + Text [ en-US ] = "Synonyms" ; +}; + +String STR_MENU_NO_SYNONYM_FOUND +{ + Text [ en-US ] = "(none)" ; +}; + +String STR_MENU_THESAURUS +{ + Text [ en-US ] = "~Thesaurus..." ; +}; + // ******************************************************************* EOF diff --git a/sfx2/source/menu/mnumgr.cxx b/sfx2/source/menu/mnumgr.cxx index f0bb48b54261..a8f74c254869 100644 --- a/sfx2/source/menu/mnumgr.cxx +++ b/sfx2/source/menu/mnumgr.cxx @@ -55,6 +55,7 @@ #include #include #include +#include #include #include @@ -79,10 +80,15 @@ #include #include #include +#include "thessubmenu.hxx" + static const USHORT nCompatVersion = 4; static const USHORT nVersion = 5; +// static member initialization +PopupMenu * SfxPopupMenuManager::pStaticThesSubMenu = NULL; + using namespace com::sun::star; //========================================================================= @@ -169,6 +175,70 @@ void InsertVerbs_Impl( SfxBindings* pBindings, const com::sun::star::uno::Sequen } +//-------------------------------------------------------------------- + +PopupMenu* InsertThesaurusSubmenu_Impl( SfxBindings* pBindings, Menu* pSVMenu ) +{ + // + // build thesaurus sub menu if look-up string is available + // + PopupMenu* pThesSubMenu = 0; + SfxPoolItem *pItem = 0; + pBindings->QueryState( SID_THES, pItem ); + String aThesLookUpStr; + SfxStringItem *pStrItem = dynamic_cast< SfxStringItem * >(pItem); + xub_StrLen nDelimPos = STRING_LEN; + if (pStrItem) + { + aThesLookUpStr = pStrItem->GetValue(); + nDelimPos = aThesLookUpStr.SearchBackward( '#' ); + } + if (aThesLookUpStr.Len() > 0 && nDelimPos != STRING_NOTFOUND) + { + // get synonym list for sub menu + std::vector< ::rtl::OUString > aSynonyms; + SfxThesSubMenuHelper aHelper; + ::rtl::OUString aText( aHelper.GetText( aThesLookUpStr, nDelimPos ) ); + lang::Locale aLocale; + aHelper.GetLocale( aLocale, aThesLookUpStr, nDelimPos ); + const bool bHasMoreSynonyms = aHelper.GetMeanings( aSynonyms, aText, aLocale, 7 /*max number of synonyms to retrieve*/ ); + (void) bHasMoreSynonyms; + + pThesSubMenu = new PopupMenu; + pThesSubMenu->SetMenuFlags(MENU_FLAG_NOAUTOMNEMONICS); + const size_t nNumSynonyms = aSynonyms.size(); + if (nNumSynonyms > 0) + { + for (USHORT i = 0; (size_t)i < nNumSynonyms; ++i) + { + //! item ids should start with values > 0, since 0 has special meaning + const USHORT nId = i + 1; + String aItemText( GetThesaurusReplaceText_Impl( aSynonyms[i] ) ); + pThesSubMenu->InsertItem( nId, aItemText ); + ::rtl::OUString aCmd( ::rtl::OUString::createFromAscii( ".uno:ThesaurusFromContext?WordReplace:string=" ) ); + aCmd += aItemText; + pThesSubMenu->SetItemCommand( nId, aCmd ); + } + } + else // nNumSynonyms == 0 + { + const String aItemText( SfxResId( STR_MENU_NO_SYNONYM_FOUND ) ); + pThesSubMenu->InsertItem( 1, aItemText, MIB_NOSELECT ); + } + pThesSubMenu->InsertSeparator(); + const String sThesaurus( SfxResId( STR_MENU_THESAURUS ) ); + pThesSubMenu->InsertItem( 100, sThesaurus ); + pThesSubMenu->SetItemCommand( 100, ::rtl::OUString::createFromAscii( ".uno:ThesaurusDialog" ) ); + + pSVMenu->InsertSeparator(); + const String sSynonyms( SfxResId( STR_MENU_SYNONYMS ) ); + pSVMenu->InsertItem( SID_THES, sSynonyms ); + pSVMenu->SetPopupMenu( SID_THES, pThesSubMenu ); + } + + return pThesSubMenu; +} + //-------------------------------------------------------------------- @@ -308,7 +378,9 @@ void SfxPopupMenuManager::RemoveDisabledEntries() USHORT SfxPopupMenuManager::Execute( const Point& rPos, Window* pWindow ) { DBG_MEMTEST(); - return ( (PopupMenu*) GetMenu()->GetSVMenu() )->Execute( pWindow, rPos ); + USHORT nVal = ( (PopupMenu*) GetMenu()->GetSVMenu() )->Execute( pWindow, rPos ); + delete pStaticThesSubMenu; pStaticThesSubMenu = NULL; + return nVal; } //-------------------------------------------------------------------- @@ -432,6 +504,10 @@ SfxPopupMenuManager* SfxPopupMenuManager::Popup( const ResId& rResId, SfxViewFra break; } + PopupMenu* pThesSubMenu = InsertThesaurusSubmenu_Impl( &pFrame->GetBindings(), pSVMenu ); + // #i107205# (see comment in header file) + pStaticThesSubMenu = pThesSubMenu; + if ( n == nCount ) { PopupMenu aPop( SfxResId( MN_CLIPBOARDFUNCS ) ); @@ -464,6 +540,7 @@ SfxPopupMenuManager* SfxPopupMenuManager::Popup( const ResId& rResId, SfxViewFra aMgr->RemoveDisabledEntries(); return aMgr; } + return 0; } @@ -478,6 +555,8 @@ void SfxPopupMenuManager::ExecutePopup( const ResId& rResId, SfxViewFrame* pFram break; } + PopupMenu* pThesSubMenu = InsertThesaurusSubmenu_Impl( &pFrame->GetBindings(), pSVMenu ); + if ( n == nCount ) { PopupMenu aPop( SfxResId( MN_CLIPBOARDFUNCS ) ); @@ -510,6 +589,8 @@ void SfxPopupMenuManager::ExecutePopup( const ResId& rResId, SfxViewFrame* pFram aPop.RemoveDisabledEntries(); aPop.Execute( rPoint, pWindow ); } + + delete pThesSubMenu; } Menu* SfxPopupMenuManager::GetSVMenu() diff --git a/sfx2/source/menu/thessubmenu.cxx b/sfx2/source/menu/thessubmenu.cxx new file mode 100755 index 000000000000..b11462fb1c71 --- /dev/null +++ b/sfx2/source/menu/thessubmenu.cxx @@ -0,0 +1,274 @@ +/************************************************************************* + * + * 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: thessubmenu.cxx,v $ + * $Revision: 1.0 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sfx2.hxx" + +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include "thessubmenu.hxx" + + +using namespace ::com::sun::star; +using ::rtl::OUString; + + +// STATIC DATA ----------------------------------------------------------- + +SFX_IMPL_MENU_CONTROL(SfxThesSubMenuControl, SfxStringItem); + +//////////////////////////////////////////////////////////// + +String GetThesaurusReplaceText_Impl( const ::rtl::OUString &rText ) +{ + // The strings returned by the thesaurus sometimes have some + // explanation text put in between '(' and ')' or a trailing '*'. + // These parts should not be put in the ReplaceEdit Text that may get + // inserted into the document. Thus we strip them from the text. + + String aText( rText ); + + xub_StrLen nPos = aText.Search( sal_Unicode('(') ); + while (STRING_NOTFOUND != nPos) + { + xub_StrLen nEnd = aText.Search( sal_Unicode(')'), nPos ); + if (STRING_NOTFOUND != nEnd) + aText.Erase( nPos, nEnd-nPos+1 ); + else + break; + nPos = aText.Search( sal_Unicode('(') ); + } + + nPos = aText.Search( sal_Unicode('*') ); + if (STRING_NOTFOUND != nPos) + aText.Erase( nPos ); + + // remove any possible remaining ' ' that may confuse the thesaurus + // when it gets called with the text + aText.EraseLeadingAndTrailingChars( sal_Unicode(' ') ); + + return aText; +} + +//////////////////////////////////////////////////////////// + + +/* + Ctor; setzt Select-Handler am Menu und traegt Menu + in seinen Parent ein. + */ +SfxThesSubMenuControl::SfxThesSubMenuControl( USHORT nSlotId, Menu &rMenu, SfxBindings &rBindings ) + : SfxMenuControl( nSlotId, rBindings ), + pMenu(new PopupMenu), + rParent(rMenu) +{ + rMenu.SetPopupMenu(nSlotId, pMenu); + pMenu->SetSelectHdl(LINK(this, SfxThesSubMenuControl, MenuSelect)); + FillMenu(); +} + + +SfxThesSubMenuControl::~SfxThesSubMenuControl() +{ + delete pMenu; +} + + +/* + Fuellt das Menu mit den aktuellen Verben aus der ViewShell. + */ +void SfxThesSubMenuControl::FillMenu() +{ + pMenu->Clear(); + pMenu->SetMenuFlags(MENU_FLAG_NOAUTOMNEMONICS); + SfxViewShell *pView = GetBindings().GetDispatcher()->GetFrame()->GetViewShell(); + if (pView) + { + pMenu->InsertItem( 1, String::CreateFromAscii("bla blub") ); + + } + + rParent.EnableItem( GetId(), (BOOL)pMenu->GetItemCount() ); +} + + +/* + Statusbenachrichtigung; + fuellt gfs. das Menu mit den aktuellen Verben aus der ViewShell. + der DocumentShell. + Ist die Funktionalit"at disabled, wird der entsprechende + Menueeintrag im Parentmenu disabled, andernfalls wird er enabled. + */ +void SfxThesSubMenuControl::StateChanged( + USHORT /*nSID*/, + SfxItemState eState, + const SfxPoolItem* /*pState*/ ) +{ + rParent.EnableItem(GetId(), SFX_ITEM_AVAILABLE == eState ); + if ( SFX_ITEM_AVAILABLE == eState ) + FillMenu(); +} + + +/* + Select-Handler des Menus; + das selektierte Verb mit ausgef"uhrt, + */ +IMPL_LINK_INLINE_START( SfxThesSubMenuControl, MenuSelect, Menu *, pSelMenu ) +{ + const USHORT nSlotId = pSelMenu->GetCurItemId(); + if( nSlotId ) + GetBindings().Execute(nSlotId); + return 1; +} +IMPL_LINK_INLINE_END( SfxThesSubMenuControl, MenuSelect, Menu *, pSelMenu ) + + +PopupMenu* SfxThesSubMenuControl::GetPopup() const +{ + return pMenu; +} + + +//////////////////////////////////////////////////////////// + +OUString SfxThesSubMenuHelper::GetText( + const String &rLookUpString, + xub_StrLen nDelimPos ) +{ + return OUString( rLookUpString.Copy( 0, nDelimPos ) ); +} + + +void SfxThesSubMenuHelper::GetLocale( + lang::Locale /*out */ &rLocale, + const String &rLookUpString, + xub_StrLen nDelimPos ) +{ + String aIsoLang( rLookUpString.Copy( nDelimPos + 1) ); + const xub_StrLen nPos = aIsoLang.Search( '-' ); + if (nPos != STRING_NOTFOUND) + { + rLocale.Language = aIsoLang.Copy( 0, nPos ); + rLocale.Country = aIsoLang.Copy( nPos + 1 ); + rLocale.Variant = String::EmptyString(); + } +} + + +SfxThesSubMenuHelper::SfxThesSubMenuHelper() +{ + try + { + uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); + m_xThesarus = uno::Reference< linguistic2::XThesaurus > ( xMSF->createInstance( + OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.linguistic2.Thesaurus" ) ) ), uno::UNO_QUERY_THROW ) ; + } + catch (uno::Exception &e) + { + (void) e; + DBG_ASSERT( 0, "failed to get thesaurus" ); + } +} + + +SfxThesSubMenuHelper::~SfxThesSubMenuHelper() +{ +} + + +bool SfxThesSubMenuHelper::IsSupportedLocale( const lang::Locale & rLocale ) const +{ + return m_xThesarus.is() && m_xThesarus->hasLocale( rLocale ); +} + + +bool SfxThesSubMenuHelper::GetMeanings( + std::vector< OUString > & rSynonyms, + const OUString & rWord, + const lang::Locale & rLocale, + sal_Int16 nMaxSynonms ) +{ + bool bHasMoreSynonyms = false; + rSynonyms.clear(); + if (IsSupportedLocale( rLocale ) && rWord.getLength() && nMaxSynonms > 0) + { + try + { + // get all meannings + const uno::Sequence< uno::Reference< linguistic2::XMeaning > > aMeaningSeq( + m_xThesarus->queryMeanings( rWord, rLocale, uno::Sequence< beans::PropertyValue >() )); + const uno::Reference< linguistic2::XMeaning > *pxMeaning = aMeaningSeq.getConstArray(); + const sal_Int32 nMeanings = aMeaningSeq.getLength(); + + // iterate over all meanings until nMaxSynonms are found or all meanings are processed + sal_Int32 nCount = 0; + sal_Int32 i = 0; + for ( ; i < nMeanings && nCount < nMaxSynonms; ++i) + { + const uno::Sequence< OUString > aSynonymSeq( pxMeaning[i]->querySynonyms() ); + const OUString *pSynonyms = aSynonymSeq.getConstArray(); + const sal_Int32 nSynonyms = aSynonymSeq.getLength(); + sal_Int32 k = 0; + for ( ; k < nSynonyms && nCount < nMaxSynonms; ++k) + { + rSynonyms.push_back( pSynonyms[k] ); + ++nCount; + } + bHasMoreSynonyms = k < nSynonyms; // any synonym from this meaning skipped? + } + + bHasMoreSynonyms |= i < nMeanings; // any meaning skipped? + } + catch (uno::Exception &e) + { + (void) e; + DBG_ASSERT( 0, "failed to get synonyms" ); + } + } + return bHasMoreSynonyms; +} + + +//////////////////////////////////////////////////////////// + + diff --git a/sfx2/source/menu/thessubmenu.hxx b/sfx2/source/menu/thessubmenu.hxx new file mode 100755 index 000000000000..845594f4ba6a --- /dev/null +++ b/sfx2/source/menu/thessubmenu.hxx @@ -0,0 +1,103 @@ +/************************************************************************* + * + * 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: thessubmenu.hxx,v $ + * $Revision: 1.0 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef _THESSUBMENU_HXX_ +#define _THESSUBMENU_HXX_ + +#include + +#include +#include + +class SfxBindings; +class PopupMenu; +class Menu; + +namespace css = ::com::sun::star; + +//////////////////////////////////////////////////////////// + +String GetThesaurusReplaceText_Impl( const ::rtl::OUString &rText ); + +//////////////////////////////////////////////////////////// + +class SfxThesSubMenuControl : public SfxMenuControl +{ + PopupMenu* pMenu; + Menu& rParent; + +private: + void FillMenu(); + virtual void StateChanged( USHORT, SfxItemState, const SfxPoolItem* pState ); + DECL_LINK( MenuSelect, Menu * ); + +public: + SfxThesSubMenuControl(USHORT, Menu&, SfxBindings&); + ~SfxThesSubMenuControl(); + + virtual PopupMenu* GetPopup() const; + + SFX_DECL_MENU_CONTROL(); +}; + +//////////////////////////////////////////////////////////// + +class SfxThesSubMenuHelper +{ + css::uno::Reference< css::linguistic2::XThesaurus > m_xThesarus; + +private: + + // don't use copy c-tor and assignment operator + SfxThesSubMenuHelper( const SfxThesSubMenuHelper & ); + SfxThesSubMenuHelper & operator = ( const SfxThesSubMenuHelper & ); + +public: + SfxThesSubMenuHelper(); + ~SfxThesSubMenuHelper(); + + static ::rtl::OUString GetText( const String &rLookUpString, xub_StrLen nDelimPos ); + + // returns the Locale to be used for the selected text when the thesaurus is to be called + static void GetLocale( css::lang::Locale /*out */ &rLocale, const String &rLookUpString, xub_StrLen nDelimPos ); + + // returns true if the locale is upported by the theasaurus + bool IsSupportedLocale( const css::lang::Locale & rLocale ) const; + + // get the first nMax Synonym entries, even if different meanings need to be evaluated + bool GetMeanings( std::vector< ::rtl::OUString > & rSynonyms, const ::rtl::OUString & rWord, const css::lang::Locale & rLocale, sal_Int16 nMaxSynonms ); +}; + +//////////////////////////////////////////////////////////// + +#endif + + -- cgit From 1b800a71b5eee336abc70ed1c4469aab774575d1 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Mon, 11 Jan 2010 14:09:46 +0100 Subject: cws tl74: wrong include --- sfx2/source/menu/thessubmenu.cxx | 532 +++++++++++++++++++-------------------- 1 file changed, 266 insertions(+), 266 deletions(-) mode change 100755 => 100644 sfx2/source/menu/thessubmenu.cxx (limited to 'sfx2/source') diff --git a/sfx2/source/menu/thessubmenu.cxx b/sfx2/source/menu/thessubmenu.cxx old mode 100755 new mode 100644 index b11462fb1c71..192562817199 --- a/sfx2/source/menu/thessubmenu.cxx +++ b/sfx2/source/menu/thessubmenu.cxx @@ -1,274 +1,274 @@ -/************************************************************************* - * - * 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: thessubmenu.cxx,v $ - * $Revision: 1.0 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sfx2.hxx" - -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include -#include -#include "thessubmenu.hxx" - - -using namespace ::com::sun::star; -using ::rtl::OUString; - - -// STATIC DATA ----------------------------------------------------------- - -SFX_IMPL_MENU_CONTROL(SfxThesSubMenuControl, SfxStringItem); - -//////////////////////////////////////////////////////////// +/************************************************************************* + * + * 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: thessubmenu.cxx,v $ + * $Revision: 1.0 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sfx2.hxx" + +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include "thessubmenu.hxx" + + +using namespace ::com::sun::star; +using ::rtl::OUString; + + +// STATIC DATA ----------------------------------------------------------- + +SFX_IMPL_MENU_CONTROL(SfxThesSubMenuControl, SfxStringItem); + +//////////////////////////////////////////////////////////// String GetThesaurusReplaceText_Impl( const ::rtl::OUString &rText ) { - // The strings returned by the thesaurus sometimes have some - // explanation text put in between '(' and ')' or a trailing '*'. - // These parts should not be put in the ReplaceEdit Text that may get - // inserted into the document. Thus we strip them from the text. + // The strings returned by the thesaurus sometimes have some + // explanation text put in between '(' and ')' or a trailing '*'. + // These parts should not be put in the ReplaceEdit Text that may get + // inserted into the document. Thus we strip them from the text. String aText( rText ); - xub_StrLen nPos = aText.Search( sal_Unicode('(') ); - while (STRING_NOTFOUND != nPos) - { - xub_StrLen nEnd = aText.Search( sal_Unicode(')'), nPos ); - if (STRING_NOTFOUND != nEnd) - aText.Erase( nPos, nEnd-nPos+1 ); - else - break; - nPos = aText.Search( sal_Unicode('(') ); - } - - nPos = aText.Search( sal_Unicode('*') ); - if (STRING_NOTFOUND != nPos) - aText.Erase( nPos ); - - // remove any possible remaining ' ' that may confuse the thesaurus - // when it gets called with the text - aText.EraseLeadingAndTrailingChars( sal_Unicode(' ') ); - - return aText; + xub_StrLen nPos = aText.Search( sal_Unicode('(') ); + while (STRING_NOTFOUND != nPos) + { + xub_StrLen nEnd = aText.Search( sal_Unicode(')'), nPos ); + if (STRING_NOTFOUND != nEnd) + aText.Erase( nPos, nEnd-nPos+1 ); + else + break; + nPos = aText.Search( sal_Unicode('(') ); + } + + nPos = aText.Search( sal_Unicode('*') ); + if (STRING_NOTFOUND != nPos) + aText.Erase( nPos ); + + // remove any possible remaining ' ' that may confuse the thesaurus + // when it gets called with the text + aText.EraseLeadingAndTrailingChars( sal_Unicode(' ') ); + + return aText; +} + +//////////////////////////////////////////////////////////// + + +/* + Ctor; setzt Select-Handler am Menu und traegt Menu + in seinen Parent ein. + */ +SfxThesSubMenuControl::SfxThesSubMenuControl( USHORT nSlotId, Menu &rMenu, SfxBindings &rBindings ) + : SfxMenuControl( nSlotId, rBindings ), + pMenu(new PopupMenu), + rParent(rMenu) +{ + rMenu.SetPopupMenu(nSlotId, pMenu); + pMenu->SetSelectHdl(LINK(this, SfxThesSubMenuControl, MenuSelect)); + FillMenu(); +} + + +SfxThesSubMenuControl::~SfxThesSubMenuControl() +{ + delete pMenu; +} + + +/* + Fuellt das Menu mit den aktuellen Verben aus der ViewShell. + */ +void SfxThesSubMenuControl::FillMenu() +{ + pMenu->Clear(); + pMenu->SetMenuFlags(MENU_FLAG_NOAUTOMNEMONICS); + SfxViewShell *pView = GetBindings().GetDispatcher()->GetFrame()->GetViewShell(); + if (pView) + { + pMenu->InsertItem( 1, String::CreateFromAscii("bla blub") ); + + } + + rParent.EnableItem( GetId(), (BOOL)pMenu->GetItemCount() ); } -//////////////////////////////////////////////////////////// - - -/* - Ctor; setzt Select-Handler am Menu und traegt Menu - in seinen Parent ein. - */ -SfxThesSubMenuControl::SfxThesSubMenuControl( USHORT nSlotId, Menu &rMenu, SfxBindings &rBindings ) - : SfxMenuControl( nSlotId, rBindings ), - pMenu(new PopupMenu), - rParent(rMenu) -{ - rMenu.SetPopupMenu(nSlotId, pMenu); - pMenu->SetSelectHdl(LINK(this, SfxThesSubMenuControl, MenuSelect)); - FillMenu(); -} - - -SfxThesSubMenuControl::~SfxThesSubMenuControl() -{ - delete pMenu; -} - - -/* - Fuellt das Menu mit den aktuellen Verben aus der ViewShell. - */ -void SfxThesSubMenuControl::FillMenu() -{ - pMenu->Clear(); - pMenu->SetMenuFlags(MENU_FLAG_NOAUTOMNEMONICS); - SfxViewShell *pView = GetBindings().GetDispatcher()->GetFrame()->GetViewShell(); - if (pView) - { - pMenu->InsertItem( 1, String::CreateFromAscii("bla blub") ); - - } - - rParent.EnableItem( GetId(), (BOOL)pMenu->GetItemCount() ); -} - - -/* - Statusbenachrichtigung; - fuellt gfs. das Menu mit den aktuellen Verben aus der ViewShell. - der DocumentShell. - Ist die Funktionalit"at disabled, wird der entsprechende - Menueeintrag im Parentmenu disabled, andernfalls wird er enabled. - */ -void SfxThesSubMenuControl::StateChanged( - USHORT /*nSID*/, - SfxItemState eState, - const SfxPoolItem* /*pState*/ ) -{ - rParent.EnableItem(GetId(), SFX_ITEM_AVAILABLE == eState ); - if ( SFX_ITEM_AVAILABLE == eState ) - FillMenu(); -} - - -/* - Select-Handler des Menus; - das selektierte Verb mit ausgef"uhrt, - */ -IMPL_LINK_INLINE_START( SfxThesSubMenuControl, MenuSelect, Menu *, pSelMenu ) -{ - const USHORT nSlotId = pSelMenu->GetCurItemId(); - if( nSlotId ) - GetBindings().Execute(nSlotId); - return 1; -} -IMPL_LINK_INLINE_END( SfxThesSubMenuControl, MenuSelect, Menu *, pSelMenu ) - - -PopupMenu* SfxThesSubMenuControl::GetPopup() const -{ - return pMenu; -} - - -//////////////////////////////////////////////////////////// - -OUString SfxThesSubMenuHelper::GetText( - const String &rLookUpString, - xub_StrLen nDelimPos ) -{ - return OUString( rLookUpString.Copy( 0, nDelimPos ) ); -} - - -void SfxThesSubMenuHelper::GetLocale( - lang::Locale /*out */ &rLocale, - const String &rLookUpString, - xub_StrLen nDelimPos ) -{ - String aIsoLang( rLookUpString.Copy( nDelimPos + 1) ); - const xub_StrLen nPos = aIsoLang.Search( '-' ); - if (nPos != STRING_NOTFOUND) - { - rLocale.Language = aIsoLang.Copy( 0, nPos ); - rLocale.Country = aIsoLang.Copy( nPos + 1 ); - rLocale.Variant = String::EmptyString(); - } -} - - -SfxThesSubMenuHelper::SfxThesSubMenuHelper() -{ - try - { - uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); - m_xThesarus = uno::Reference< linguistic2::XThesaurus > ( xMSF->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.linguistic2.Thesaurus" ) ) ), uno::UNO_QUERY_THROW ) ; - } - catch (uno::Exception &e) - { - (void) e; - DBG_ASSERT( 0, "failed to get thesaurus" ); - } -} - - -SfxThesSubMenuHelper::~SfxThesSubMenuHelper() -{ -} - - -bool SfxThesSubMenuHelper::IsSupportedLocale( const lang::Locale & rLocale ) const -{ - return m_xThesarus.is() && m_xThesarus->hasLocale( rLocale ); -} - - -bool SfxThesSubMenuHelper::GetMeanings( - std::vector< OUString > & rSynonyms, - const OUString & rWord, - const lang::Locale & rLocale, - sal_Int16 nMaxSynonms ) -{ - bool bHasMoreSynonyms = false; - rSynonyms.clear(); - if (IsSupportedLocale( rLocale ) && rWord.getLength() && nMaxSynonms > 0) - { - try - { - // get all meannings - const uno::Sequence< uno::Reference< linguistic2::XMeaning > > aMeaningSeq( - m_xThesarus->queryMeanings( rWord, rLocale, uno::Sequence< beans::PropertyValue >() )); - const uno::Reference< linguistic2::XMeaning > *pxMeaning = aMeaningSeq.getConstArray(); - const sal_Int32 nMeanings = aMeaningSeq.getLength(); - - // iterate over all meanings until nMaxSynonms are found or all meanings are processed - sal_Int32 nCount = 0; - sal_Int32 i = 0; - for ( ; i < nMeanings && nCount < nMaxSynonms; ++i) - { - const uno::Sequence< OUString > aSynonymSeq( pxMeaning[i]->querySynonyms() ); - const OUString *pSynonyms = aSynonymSeq.getConstArray(); - const sal_Int32 nSynonyms = aSynonymSeq.getLength(); - sal_Int32 k = 0; - for ( ; k < nSynonyms && nCount < nMaxSynonms; ++k) - { - rSynonyms.push_back( pSynonyms[k] ); - ++nCount; - } - bHasMoreSynonyms = k < nSynonyms; // any synonym from this meaning skipped? - } - - bHasMoreSynonyms |= i < nMeanings; // any meaning skipped? - } - catch (uno::Exception &e) - { - (void) e; - DBG_ASSERT( 0, "failed to get synonyms" ); - } - } - return bHasMoreSynonyms; -} - - -//////////////////////////////////////////////////////////// - - + +/* + Statusbenachrichtigung; + fuellt gfs. das Menu mit den aktuellen Verben aus der ViewShell. + der DocumentShell. + Ist die Funktionalit"at disabled, wird der entsprechende + Menueeintrag im Parentmenu disabled, andernfalls wird er enabled. + */ +void SfxThesSubMenuControl::StateChanged( + USHORT /*nSID*/, + SfxItemState eState, + const SfxPoolItem* /*pState*/ ) +{ + rParent.EnableItem(GetId(), SFX_ITEM_AVAILABLE == eState ); + if ( SFX_ITEM_AVAILABLE == eState ) + FillMenu(); +} + + +/* + Select-Handler des Menus; + das selektierte Verb mit ausgef"uhrt, + */ +IMPL_LINK_INLINE_START( SfxThesSubMenuControl, MenuSelect, Menu *, pSelMenu ) +{ + const USHORT nSlotId = pSelMenu->GetCurItemId(); + if( nSlotId ) + GetBindings().Execute(nSlotId); + return 1; +} +IMPL_LINK_INLINE_END( SfxThesSubMenuControl, MenuSelect, Menu *, pSelMenu ) + + +PopupMenu* SfxThesSubMenuControl::GetPopup() const +{ + return pMenu; +} + + +//////////////////////////////////////////////////////////// + +OUString SfxThesSubMenuHelper::GetText( + const String &rLookUpString, + xub_StrLen nDelimPos ) +{ + return OUString( rLookUpString.Copy( 0, nDelimPos ) ); +} + + +void SfxThesSubMenuHelper::GetLocale( + lang::Locale /*out */ &rLocale, + const String &rLookUpString, + xub_StrLen nDelimPos ) +{ + String aIsoLang( rLookUpString.Copy( nDelimPos + 1) ); + const xub_StrLen nPos = aIsoLang.Search( '-' ); + if (nPos != STRING_NOTFOUND) + { + rLocale.Language = aIsoLang.Copy( 0, nPos ); + rLocale.Country = aIsoLang.Copy( nPos + 1 ); + rLocale.Variant = String::EmptyString(); + } +} + + +SfxThesSubMenuHelper::SfxThesSubMenuHelper() +{ + try + { + uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); + m_xThesarus = uno::Reference< linguistic2::XThesaurus > ( xMSF->createInstance( + OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.linguistic2.Thesaurus" ) ) ), uno::UNO_QUERY_THROW ) ; + } + catch (uno::Exception &e) + { + (void) e; + DBG_ASSERT( 0, "failed to get thesaurus" ); + } +} + + +SfxThesSubMenuHelper::~SfxThesSubMenuHelper() +{ +} + + +bool SfxThesSubMenuHelper::IsSupportedLocale( const lang::Locale & rLocale ) const +{ + return m_xThesarus.is() && m_xThesarus->hasLocale( rLocale ); +} + + +bool SfxThesSubMenuHelper::GetMeanings( + std::vector< OUString > & rSynonyms, + const OUString & rWord, + const lang::Locale & rLocale, + sal_Int16 nMaxSynonms ) +{ + bool bHasMoreSynonyms = false; + rSynonyms.clear(); + if (IsSupportedLocale( rLocale ) && rWord.getLength() && nMaxSynonms > 0) + { + try + { + // get all meannings + const uno::Sequence< uno::Reference< linguistic2::XMeaning > > aMeaningSeq( + m_xThesarus->queryMeanings( rWord, rLocale, uno::Sequence< beans::PropertyValue >() )); + const uno::Reference< linguistic2::XMeaning > *pxMeaning = aMeaningSeq.getConstArray(); + const sal_Int32 nMeanings = aMeaningSeq.getLength(); + + // iterate over all meanings until nMaxSynonms are found or all meanings are processed + sal_Int32 nCount = 0; + sal_Int32 i = 0; + for ( ; i < nMeanings && nCount < nMaxSynonms; ++i) + { + const uno::Sequence< OUString > aSynonymSeq( pxMeaning[i]->querySynonyms() ); + const OUString *pSynonyms = aSynonymSeq.getConstArray(); + const sal_Int32 nSynonyms = aSynonymSeq.getLength(); + sal_Int32 k = 0; + for ( ; k < nSynonyms && nCount < nMaxSynonms; ++k) + { + rSynonyms.push_back( pSynonyms[k] ); + ++nCount; + } + bHasMoreSynonyms = k < nSynonyms; // any synonym from this meaning skipped? + } + + bHasMoreSynonyms |= i < nMeanings; // any meaning skipped? + } + catch (uno::Exception &e) + { + (void) e; + DBG_ASSERT( 0, "failed to get synonyms" ); + } + } + return bHasMoreSynonyms; +} + + +//////////////////////////////////////////////////////////// + + -- cgit From 68493b03eee03e7cab5ddabe24e673329c7fd09d Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Tue, 16 Feb 2010 11:18:37 +0100 Subject: cws ppp02: #i109321#: return correct IsBusy property in XPrintable::getPrinter() call --- sfx2/source/doc/printhelper.cxx | 20 +++++++++++++------- sfx2/source/view/viewimp.hxx | 26 ++------------------------ sfx2/source/view/viewprn.cxx | 10 ++++++++++ 3 files changed, 25 insertions(+), 31 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index 103dcf505846..ff21de94ae59 100755 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -269,17 +269,23 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxPrintHelper::getPrinter() thro // object already disposed? ::vos::OGuard aGuard( Application::GetSolarMutex() ); - // Printer beschaffen - SfxViewFrame *pViewFrm = m_pData->m_pObjectShell.Is() ? - SfxViewFrame::GetFirst( m_pData->m_pObjectShell, 0, sal_False ) : 0; - if ( !pViewFrm ) - return uno::Sequence< beans::PropertyValue >(); + // search for any view of this document that is currently printing + const Printer *pPrinter = NULL; + SfxViewFrame *pViewFrm = m_pData->m_pObjectShell.Is() ? SfxViewFrame::GetFirst( m_pData->m_pObjectShell, 0, sal_False ) : 0; + SfxViewFrame* pFirst = pViewFrm; + while ( pViewFrm && !pPrinter ) + { + pPrinter = pViewFrm->GetViewShell()->GetActivePrinter(); + pViewFrm = SfxViewFrame::GetNext( *pViewFrm, m_pData->m_pObjectShell, 0, sal_False ); + } + + // if no view is printing currently, use the permanent SfxPrinter instance + if ( !pPrinter && pFirst ) + pPrinter = pFirst->GetViewShell()->GetPrinter(sal_True); - const SfxPrinter *pPrinter = pViewFrm->GetViewShell()->GetPrinter(sal_True); if ( !pPrinter ) return uno::Sequence< beans::PropertyValue >(); - // Printer Eigenschaften uebertragen uno::Sequence< beans::PropertyValue > aPrinter(8); aPrinter.getArray()[7].Name = DEFINE_CONST_UNICODE( "CanSetPaperSize" ); diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx index 9e3791340daa..e3e0085c52d1 100644 --- a/sfx2/source/view/viewimp.hxx +++ b/sfx2/source/view/viewimp.hxx @@ -33,20 +33,16 @@ // include --------------------------------------------------------------- -#ifndef __SBX_SBXOBJ_HXX #include -#endif #include #include // SvBorder #include #include - #include #include #include - #include - +#include #include // forward --------------------------------------------------------------- @@ -57,24 +53,6 @@ class SfxBaseController; typedef SfxShell* SfxShellPtr_Impl; SV_DECL_PTRARR( SfxShellArr_Impl, SfxShellPtr_Impl, 4, 4 ) -// struct SfxViewShell_Impl ---------------------------------------------- -#if 0 -class SfxAsyncPrintExec_Impl : public SfxListener -{ - SfxViewShell* pView; - ::std::queue < SfxRequest*> aReqs; - - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - -public: - SfxAsyncPrintExec_Impl( SfxViewShell* pShell) - : pView( pShell ) - {} - - void AddRequest( SfxRequest& rReq ); -}; -#endif - class SfxClipboardChangeListener; struct SfxViewShell_Impl @@ -100,9 +78,9 @@ struct SfxViewShell_Impl USHORT nFamily; SfxBaseController* pController; ::svt::AcceleratorExecute* pAccExec; -// SfxAsyncPrintExec_Impl* pPrinterCommandQueue; com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aPrintOpts; ::rtl::Reference< SfxClipboardChangeListener > xClipboardListener; + vcl::PrinterController* pPrinterController; SfxViewShell_Impl(); }; diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index 24d31337a662..afb2b46edf47 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -332,6 +332,9 @@ void SfxPrinterController::jobFinished( com::sun::star::view::PrintableState nSt if ( m_bNeedsChange ) mpObjectShell->EnableSetModified( m_bOrigStatus ); + + if ( mpViewShell ) + mpViewShell->pImp->pPrinterController = 0; } } @@ -642,6 +645,8 @@ void SfxViewShell::ExecPrint( const uno::Sequence < beans::PropertyValue >& rPro this, rProps ) ); + pImp->pPrinterController = pController.get(); + SfxObjectShell *pObjShell = GetObjectShell(); pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobName" ) ), makeAny( rtl::OUString( pObjShell->GetTitle(0) ) ) ); @@ -656,6 +661,11 @@ void SfxViewShell::ExecPrint( const uno::Sequence < beans::PropertyValue >& rPro Printer::PrintJob( pController, aJobSetup ); } +Printer* SfxViewShell::GetActivePrinter() const +{ + return pImp->pPrinterController ? pImp->pPrinterController->getPrinter().get() : 0; +} + void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) { // USHORT nCopies=1; -- cgit From 4d192b537074cc1f23b11107653a352f610d5b25 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Thu, 11 Mar 2010 07:21:46 +0100 Subject: dtardon02: #i108506# remove empty file in sfx2 --- sfx2/source/view/view.hxx | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 sfx2/source/view/view.hxx (limited to 'sfx2/source') diff --git a/sfx2/source/view/view.hxx b/sfx2/source/view/view.hxx deleted file mode 100644 index 20e542d90bc7..000000000000 --- a/sfx2/source/view/view.hxx +++ /dev/null @@ -1,27 +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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -- cgit From a22ce943407b6a925baa626a067b438b2e58724f Mon Sep 17 00:00:00 2001 From: David Tardon Date: Thu, 11 Mar 2010 07:48:51 +0100 Subject: dtardon02: #i110035# remove unused files in sfx2 --- sfx2/source/doc/commitlistener.cxx | 81 ---- sfx2/source/doc/commitlistener.hxx | 57 --- sfx2/source/doc/opostponedtruncationstream.cxx | 491 ------------------------- sfx2/source/doc/opostponedtruncationstream.hxx | 122 ------ 4 files changed, 751 deletions(-) delete mode 100644 sfx2/source/doc/commitlistener.cxx delete mode 100644 sfx2/source/doc/commitlistener.hxx delete mode 100644 sfx2/source/doc/opostponedtruncationstream.cxx delete mode 100644 sfx2/source/doc/opostponedtruncationstream.hxx (limited to 'sfx2/source') diff --git a/sfx2/source/doc/commitlistener.cxx b/sfx2/source/doc/commitlistener.cxx deleted file mode 100644 index 9ca11a9eef82..000000000000 --- a/sfx2/source/doc/commitlistener.cxx +++ /dev/null @@ -1,81 +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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sfx2.hxx" - -#include "commitlistener.hxx" - -using namespace ::com::sun::star; - -OChildCommitListen_Impl::OChildCommitListen_Impl( SfxBaseModel& aModel ) -: m_pModel( &aModel ) -{} - -OChildCommitListen_Impl::~OChildCommitListen_Impl() -{} - -void OChildCommitListen_Impl::OwnerIsDisposed() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - m_pModel = NULL; -} - -void SAL_CALL OChildCommitListen_Impl::preCommit( const ::com::sun::star::lang::EventObject& ) - throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) -{ - // not interesting -} - -void SAL_CALL OChildCommitListen_Impl::commited( const ::com::sun::star::lang::EventObject& /*aEvent*/ ) - throw (::com::sun::star::uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - // StorageIsModified_Impl must not contain any locking! - if ( m_pModel ) - m_pModel->StorageIsModified_Impl(); -} - -void SAL_CALL OChildCommitListen_Impl::preRevert( const ::com::sun::star::lang::EventObject& ) - throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) -{ - // not interesting -} - -void SAL_CALL OChildCommitListen_Impl::reverted( const ::com::sun::star::lang::EventObject& ) - throw (::com::sun::star::uno::RuntimeException) -{ - // not interesting -} - - -void SAL_CALL OChildCommitListen_Impl::disposing( const lang::EventObject& ) - throw ( uno::RuntimeException ) -{ - // not interesting -} - diff --git a/sfx2/source/doc/commitlistener.hxx b/sfx2/source/doc/commitlistener.hxx deleted file mode 100644 index 572da034cef1..000000000000 --- a/sfx2/source/doc/commitlistener.hxx +++ /dev/null @@ -1,57 +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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __COMMITLISTENER_HXX_ -#define __COMMITLISTENER_HXX_ - -#include -#include -#include - -#include - -class OChildCommitListen_Impl : public ::cppu::WeakImplHelper1 < ::com::sun::star::embed::XTransactionListener > -{ - ::osl::Mutex m_aMutex; - SfxBaseModel* m_pModel; - -public: - OChildCommitListen_Impl( SfxBaseModel& aStorage ); - virtual ~OChildCommitListen_Impl(); - - void OwnerIsDisposed(); - - virtual void SAL_CALL preCommit( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL commited( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL preRevert( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL reverted( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); - - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); -}; - -#endif - diff --git a/sfx2/source/doc/opostponedtruncationstream.cxx b/sfx2/source/doc/opostponedtruncationstream.cxx deleted file mode 100644 index 84b1d6a3906a..000000000000 --- a/sfx2/source/doc/opostponedtruncationstream.cxx +++ /dev/null @@ -1,491 +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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sfx2.hxx" -#include - -#include - -using namespace ::com::sun::star; - -// ======================================================================== -struct PTFStreamData_Impl -{ - uno::Reference< ucb::XSimpleFileAccess > m_xFileAccess; - sal_Bool m_bDelete; - ::rtl::OUString m_aURL; - - // the streams below are not visible from outside so there is no need to remember position - - // original stream related members - uno::Reference< io::XStream > m_xOrigStream; - uno::Reference< io::XTruncate > m_xOrigTruncate; - uno::Reference< io::XSeekable > m_xOrigSeekable; - uno::Reference< io::XInputStream > m_xOrigInStream; - uno::Reference< io::XOutputStream > m_xOrigOutStream; - - sal_Bool m_bInOpen; - sal_Bool m_bOutOpen; - - sal_Bool m_bPostponedTruncate; - - - PTFStreamData_Impl( - const uno::Reference< ucb::XSimpleFileAccess >& xFileAccess, - sal_Bool bDelete, - const ::rtl::OUString& aURL, - const uno::Reference< io::XStream >& xOrigStream, - const uno::Reference< io::XTruncate >& xOrigTruncate, - const uno::Reference< io::XSeekable >& xOrigSeekable, - const uno::Reference< io::XInputStream >& xOrigInStream, - const uno::Reference< io::XOutputStream >& xOrigOutStream ) - : m_xFileAccess( xFileAccess ) - , m_bDelete( bDelete ) - , m_aURL( aURL ) - , m_xOrigStream( xOrigStream ) - , m_xOrigTruncate( xOrigTruncate ) - , m_xOrigSeekable( xOrigSeekable ) - , m_xOrigInStream( xOrigInStream ) - , m_xOrigOutStream( xOrigOutStream ) - , m_bInOpen( sal_False ) - , m_bOutOpen( sal_False ) - , m_bPostponedTruncate( sal_True ) - {} - - void NoPostponing() - { - m_bDelete = sal_False; - m_bPostponedTruncate = sal_False; - } -}; - -// ======================================================================== -// ------------------------------------------------------------------------ -OPostponedTruncationFileStream::OPostponedTruncationFileStream( - const ::rtl::OUString& aURL, - const uno::Reference< lang::XMultiServiceFactory >& /*xFactory*/, - const uno::Reference< ucb::XSimpleFileAccess >& xFileAccess, - const uno::Reference< io::XStream >& xOrigStream, - sal_Bool bDelete ) -: m_pStreamData( NULL ) -{ - if ( !xFileAccess.is() || !xOrigStream.is() ) - throw uno::RuntimeException(); - - uno::Reference< io::XTruncate > xOrigTruncate( xOrigStream, uno::UNO_QUERY_THROW ); - uno::Reference< io::XSeekable > xOrigSeekable( xOrigStream, uno::UNO_QUERY_THROW ); - uno::Reference< io::XInputStream > xOrigInStream = xOrigStream->getInputStream(); - uno::Reference< io::XOutputStream > xOrigOutStream = xOrigStream->getOutputStream(); - if ( !xOrigInStream.is() || !xOrigOutStream.is() ) - throw uno::RuntimeException(); - - m_pStreamData = new PTFStreamData_Impl( xFileAccess, bDelete, aURL, - xOrigStream, xOrigTruncate, xOrigSeekable, xOrigInStream, xOrigOutStream ); -} - -// ------------------------------------------------------------------------ -OPostponedTruncationFileStream::~OPostponedTruncationFileStream() -{ - CloseAll_Impl(); -} - -// ------------------------------------------------------------------------ -void OPostponedTruncationFileStream::CloseAll_Impl() -{ - if ( m_pStreamData ) - { - sal_Bool bDelete = m_pStreamData->m_bDelete; - ::rtl::OUString aURL = m_pStreamData->m_aURL; - uno::Reference< ucb::XSimpleFileAccess > xFileAccess = m_pStreamData->m_xFileAccess; - - delete m_pStreamData; - m_pStreamData = NULL; - - if ( bDelete && xFileAccess.is() && aURL.getLength() ) - { - // delete the file - try - { - xFileAccess->kill( aURL ); - } catch( uno::Exception& ) - { - OSL_ENSURE( sal_False, "Could not remove the file!" ); - } - } - } -} - -// ------------------------------------------------------------------------ -void OPostponedTruncationFileStream::CheckScheduledTruncation_Impl() -{ - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigTruncate.is() ) - throw uno::RuntimeException(); - - m_pStreamData->m_xOrigTruncate->truncate(); - m_pStreamData->NoPostponing(); - } -} - -// com::sun::star::io::XStream -// ------------------------------------------------------------------------ -uno::Reference< io::XInputStream > SAL_CALL OPostponedTruncationFileStream::getInputStream( ) - throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_pStreamData ) - m_pStreamData->m_bInOpen = sal_True; - return static_cast< io::XInputStream* >( this ); -} - - -// ------------------------------------------------------------------------ -uno::Reference< io::XOutputStream > SAL_CALL OPostponedTruncationFileStream::getOutputStream( ) - throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_pStreamData ) - m_pStreamData->m_bOutOpen = sal_True; - return static_cast< io::XOutputStream* >( this ); -} - - - -// com::sun::star::io::XInputStream -// ------------------------------------------------------------------------ -::sal_Int32 SAL_CALL OPostponedTruncationFileStream::readBytes( uno::Sequence< ::sal_Int8 >& aData, ::sal_Int32 nBytesToRead ) - throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - { - // the stream must behave as truncated one - aData.realloc( 0 ); - return 0; - } - else - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigInStream.is() ) - throw uno::RuntimeException(); - - return m_pStreamData->m_xOrigInStream->readBytes( aData, nBytesToRead ); - } -} - - -// ------------------------------------------------------------------------ -::sal_Int32 SAL_CALL OPostponedTruncationFileStream::readSomeBytes( uno::Sequence< ::sal_Int8 >& aData, ::sal_Int32 nMaxBytesToRead ) - throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - { - // the stream must behave as truncated one - aData.realloc( 0 ); - return 0; - } - else - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigInStream.is() ) - throw uno::RuntimeException(); - - return m_pStreamData->m_xOrigInStream->readBytes( aData, nMaxBytesToRead ); - } -} - -// ------------------------------------------------------------------------ -void SAL_CALL OPostponedTruncationFileStream::skipBytes( ::sal_Int32 nBytesToSkip ) - throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - { - // the stream must behave as truncated one - if ( nBytesToSkip > 0 ) - throw io::BufferSizeExceededException(); - - return; - } - else - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigInStream.is() ) - throw uno::RuntimeException(); - - m_pStreamData->m_xOrigInStream->skipBytes( nBytesToSkip ); - } -} - - -// ------------------------------------------------------------------------ -::sal_Int32 SAL_CALL OPostponedTruncationFileStream::available( ) - throw (io::NotConnectedException, io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - { - // the stream must behave as truncated one - return 0; - } - else - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigInStream.is() ) - throw uno::RuntimeException(); - - return m_pStreamData->m_xOrigInStream->available(); - } -} - - -// ------------------------------------------------------------------------ -void SAL_CALL OPostponedTruncationFileStream::closeInput() - throw (io::NotConnectedException, io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - m_pStreamData->m_bInOpen = sal_False; - if ( !m_pStreamData->m_bOutOpen ) - CloseAll_Impl(); -} - - - -// com::sun::star::io::XOutputStream -// ------------------------------------------------------------------------ -void SAL_CALL OPostponedTruncationFileStream::writeBytes( const uno::Sequence< ::sal_Int8 >& aData ) - throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - // writing method must check the truncation - CheckScheduledTruncation_Impl(); - - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigOutStream.is() ) - throw uno::RuntimeException(); - - m_pStreamData->m_xOrigOutStream->writeBytes( aData ); -} - - -// ------------------------------------------------------------------------ -void SAL_CALL OPostponedTruncationFileStream::flush( ) - throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - { - OSL_ENSURE( sal_False, "flush() call on closed stream!\n" ); - return; - // in future throw exception, for now some code might call flush() on closed stream - // since file ucp implementation allows it - // throw io::NotConnectedException(); - } - - if ( m_pStreamData->m_bPostponedTruncate ) - { - // it is no writing call, thus must be ignored - return; - } - else - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigOutStream.is() ) - throw uno::RuntimeException(); - - m_pStreamData->m_xOrigOutStream->flush(); - } -} - - -// ------------------------------------------------------------------------ -void SAL_CALL OPostponedTruncationFileStream::closeOutput( ) - throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - m_pStreamData->m_bOutOpen = sal_False; - if ( !m_pStreamData->m_bInOpen ) - CloseAll_Impl(); -} - - - -// com::sun::star::io::XTruncate -// ------------------------------------------------------------------------ -void SAL_CALL OPostponedTruncationFileStream::truncate( ) - throw (io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - { - // the truncation is already scheduled, ignore - return; - } - else - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigTruncate.is() ) - throw uno::RuntimeException(); - - m_pStreamData->m_xOrigTruncate->truncate(); - } -} - - - -// com::sun::star::io::XSeekable -// ------------------------------------------------------------------------ -void SAL_CALL OPostponedTruncationFileStream::seek( ::sal_Int64 location ) - throw (lang::IllegalArgumentException, io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - { - if ( location > 0 ) - throw lang::IllegalArgumentException(); - - return; - } - else - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigSeekable.is() ) - throw uno::RuntimeException(); - - m_pStreamData->m_xOrigSeekable->seek( location ); - } -} - - -// ------------------------------------------------------------------------ -::sal_Int64 SAL_CALL OPostponedTruncationFileStream::getPosition( ) - throw (io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - { - return 0; - } - else - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigSeekable.is() ) - throw uno::RuntimeException(); - - return m_pStreamData->m_xOrigSeekable->getPosition(); - } -} - - -// ------------------------------------------------------------------------ -::sal_Int64 SAL_CALL OPostponedTruncationFileStream::getLength( ) - throw (io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - { - return 0; - } - else - { - // the original stream data should be provided - if ( !m_pStreamData->m_xOrigSeekable.is() ) - throw uno::RuntimeException(); - - return m_pStreamData->m_xOrigSeekable->getLength(); - } -} - -// ------------------------------------------------------------------------ -void SAL_CALL OPostponedTruncationFileStream::waitForCompletion() - throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) -{ - if ( !m_pStreamData ) - throw io::NotConnectedException(); - - if ( m_pStreamData->m_bPostponedTruncate ) - return; - - uno::Reference< io::XAsyncOutputMonitor > asyncOutputMonitor( m_pStreamData->m_xOrigOutStream, uno::UNO_QUERY ); - if ( asyncOutputMonitor.is() ) - asyncOutputMonitor->waitForCompletion(); -} - diff --git a/sfx2/source/doc/opostponedtruncationstream.hxx b/sfx2/source/doc/opostponedtruncationstream.hxx deleted file mode 100644 index fe67319fbbe0..000000000000 --- a/sfx2/source/doc/opostponedtruncationstream.hxx +++ /dev/null @@ -1,122 +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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFX_OPOSTPONEDTRUNCATIONFILESTREAM_HXX -#define _SFX_OPOSTPONEDTRUNCATIONFILESTREAM_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "sfx2/dllapi.h" - -//================================================================== -// OPostponedTruncationFileStream -// -// Allows to get stream access to a file, where the first truncation -// of the file is postponed till the first writing. If no writing happens -// after the first truncation/creation, it has no effect. ( The postponing of -// the creation can be switched off during initialization. Here the postponing -// of the creation means that the file will be created immediatelly, but -// if nothing is written into it, it will be removed during destruction -// of the object. ) -// -// On creation of this object the target file is scheduled for -// creation/truncation. But the action happens only during the first -// write access. After the first write access the object behaves -// itself as the original stream. -//================================================================== - -struct PTFStreamData_Impl; -class SFX2_DLLPUBLIC OPostponedTruncationFileStream - : public ::cppu::WeakImplHelper6 < - ::com::sun::star::io::XStream, - ::com::sun::star::io::XInputStream, - ::com::sun::star::io::XOutputStream, - ::com::sun::star::io::XTruncate, - ::com::sun::star::io::XSeekable, - ::com::sun::star::io::XAsyncOutputMonitor > -{ - ::osl::Mutex m_aMutex; - PTFStreamData_Impl* m_pStreamData; - - void CloseAll_Impl(); - - void CheckScheduledTruncation_Impl(); - -public: - - OPostponedTruncationFileStream( - const ::rtl::OUString& aURL, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory, - const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xFileAccess, - const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xStream, - sal_Bool bDelete ); - - ~OPostponedTruncationFileStream(); - -// com::sun::star::io::XStream - virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getInputStream( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > SAL_CALL getOutputStream( ) throw (::com::sun::star::uno::RuntimeException); - -// com::sun::star::io::XInputStream - virtual ::sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< ::sal_Int8 >& aData, ::sal_Int32 nBytesToRead ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< ::sal_Int8 >& aData, ::sal_Int32 nMaxBytesToRead ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL skipBytes( ::sal_Int32 nBytesToSkip ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL available( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL closeInput( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - -// com::sun::star::io::XOutputStream - virtual void SAL_CALL writeBytes( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aData ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL flush( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL closeOutput( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - -// com::sun::star::io::XTruncate - virtual void SAL_CALL truncate( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - -// com::sun::star::io::XSeekable - virtual void SAL_CALL seek( ::sal_Int64 location ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual ::sal_Int64 SAL_CALL getPosition( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual ::sal_Int64 SAL_CALL getLength( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::io::XAsyncOutputMonitor - virtual void SAL_CALL waitForCompletion( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - -}; - -#endif //_SFX_OPOSTPONEDTRUNCATIONFILESTREAM_HXX - - -- cgit From bbcce61e3561c9f6afb2e320928bf49b7e6fb417 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Fri, 12 Mar 2010 13:16:09 +0100 Subject: dtardon02: #i108503# #i108505# #i108507# #i108508# #i110035# clean up makefiles and #includes --- sfx2/source/doc/docfile.cxx | 1 - sfx2/source/doc/makefile.mk | 1 - 2 files changed, 2 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 0b535088b0bd..c12e63025e47 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -133,7 +133,6 @@ using namespace ::com::sun::star::io; #include #include -#include "opostponedtruncationstream.hxx" #include "helper.hxx" #include // SFX_ITEMSET_SET #include // GetFilterMatcher diff --git a/sfx2/source/doc/makefile.mk b/sfx2/source/doc/makefile.mk index 7da456ebaa36..b766921e346b 100644 --- a/sfx2/source/doc/makefile.mk +++ b/sfx2/source/doc/makefile.mk @@ -75,7 +75,6 @@ SLOFILES = \ $(SLO)$/objembed.obj\ $(SLO)$/graphhelp.obj \ $(SLO)$/QuerySaveDocument.obj \ - $(SLO)$/opostponedtruncationstream.obj \ $(SLO)$/docinsert.obj \ $(SLO)$/docmacromode.obj \ $(SLO)$/SfxDocumentMetaData.obj \ -- cgit From 89af58843bff4f6e17b267542c90ed682ff5363b Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 18 Mar 2010 14:21:16 +0100 Subject: sw321bf01: #i109015# to not use the old base URL --- sfx2/source/doc/objstor.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sfx2/source') diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 6d8deb85b687..6e1d89f2a8cd 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -2548,6 +2548,7 @@ sal_Bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs ) // is a new medium "from scratch", so no version should be stored into it SfxItemSet* pSet = new SfxAllItemSet(*pRetrMedium->GetItemSet()); pSet->ClearItem( SID_VERSION ); + pSet->ClearItem( SID_DOC_BASEURL ); // create a medium as a copy; this medium is only for writingm, because it uses the same name as the original one // writing is done through a copy, that will be transferred to the target ( of course after calling HandsOff ) @@ -2833,6 +2834,7 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl pMergedParams->ClearItem( SID_STREAM ); pMergedParams->ClearItem( SID_CONTENT ); pMergedParams->ClearItem( SID_DOC_READONLY ); + pMergedParams->ClearItem( SID_DOC_BASEURL ); pMergedParams->ClearItem( SID_REPAIRPACKAGE ); -- cgit From 233f8693159884407027678e229805867274d63f Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Tue, 23 Mar 2010 14:51:17 +0100 Subject: sw321bf01: #i109363# Fix crash with quickstarter and OOo file dialogs --- sfx2/source/appl/shutdownicon.cxx | 23 +++++++++++++++++++++-- sfx2/source/appl/shutdownicon.hxx | 1 + 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index 1d85552e47ae..3fce25e7e0d6 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -33,6 +33,7 @@ #include #include #include +#include // #include #include #include @@ -235,6 +236,7 @@ ShutdownIcon::ShutdownIcon( Reference< XMultiServiceFactory > aSMgr ) : ShutdownIconServiceBase( m_aMutex ), m_bVeto ( false ), m_bListenForTermination ( false ), + m_bSystemDialogs( false ), m_pResMgr( NULL ), m_pFileDlg( NULL ), m_xServiceManager( aSMgr ), @@ -243,6 +245,7 @@ ShutdownIcon::ShutdownIcon( Reference< XMultiServiceFactory > aSMgr ) : m_pPlugin( 0 ), m_bInitialized( false ) { + m_bSystemDialogs = SvtMiscOptions().UseSystemFileDialog(); } ShutdownIcon::~ShutdownIcon() @@ -376,6 +379,16 @@ void ShutdownIcon::StartFileDialog() { ::vos::OGuard aGuard( Application::GetSolarMutex() ); + bool bDirty = ( m_bSystemDialogs != static_cast(SvtMiscOptions().UseSystemFileDialog()) ); + + if ( m_pFileDlg && bDirty ) + { + // Destroy instance as changing the system file dialog setting + // forces us to create a new FileDialogHelper instance! + delete m_pFileDlg; + m_pFileDlg = NULL; + } + if ( !m_pFileDlg ) m_pFileDlg = new FileDialogHelper( WB_OPEN | SFXWB_MULTISELECTION, String() ); m_pFileDlg->StartExecuteModal( STATIC_LINK( this, ShutdownIcon, DialogClosedHdl_Impl ) ); @@ -512,8 +525,14 @@ IMPL_STATIC_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, EMPTYAR #ifdef WNT // #103346 Destroy dialog to prevent problems with custom controls - delete pThis->m_pFileDlg; - pThis->m_pFileDlg = NULL; + // This fix is dependent on the dialog settings. Destroying the dialog here will + // crash the non-native dialog implementation! Therefore make this dependent on + // the settings. + if ( SvtMiscOptions().UseSystemFileDialog() ) + { + delete pThis->m_pFileDlg; + pThis->m_pFileDlg = NULL; + } #endif LeaveModalMode(); diff --git a/sfx2/source/appl/shutdownicon.hxx b/sfx2/source/appl/shutdownicon.hxx index 4e7cc6ecc247..d702f2a50977 100644 --- a/sfx2/source/appl/shutdownicon.hxx +++ b/sfx2/source/appl/shutdownicon.hxx @@ -52,6 +52,7 @@ class SFX2_DLLPUBLIC ShutdownIcon : public ShutdownIconServiceBase ::osl::Mutex m_aMutex; bool m_bVeto; bool m_bListenForTermination; + bool m_bSystemDialogs; ResMgr* m_pResMgr; sfx2::FileDialogHelper* m_pFileDlg; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; -- cgit From e6823163e3aa6117f6ee87954b238be2b0e4fa22 Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 27 Jan 2010 16:23:59 +0100 Subject: sb118: changed tools/debug to never fall back from writing to shell to writing to file, and read DBGSV_INIT from rtl::Bootstrap; the latter causes problems if tools/debug is called from static code executing before SAL_MAIN has called osl_setCommandArgs -> removed statics from code and added assertions to osl/process; various improvements to smoketests.cxx (incl. passing an appropriate dbgsv.ini for non-pro builds) --- sfx2/source/appl/appuno.cxx | 292 +++++++++++++++++++++---------------------- sfx2/source/appl/sfxhelp.cxx | 15 +-- 2 files changed, 152 insertions(+), 155 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index 7fb6ef35167f..e14a65290a16 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -147,54 +147,54 @@ using namespace ::com::sun::star::io; #define FRAMELOADER_SERVICENAME "com.sun.star.frame.FrameLoader" #define PROTOCOLHANDLER_SERVICENAME "com.sun.star.frame.ProtocolHandler" -static const String sTemplateRegionName = String::CreateFromAscii( "TemplateRegionName" ); -static const String sTemplateName = String::CreateFromAscii( "TemplateName" ); -static const String sAsTemplate = String::CreateFromAscii( "AsTemplate" ); -static const String sOpenNewView = String::CreateFromAscii( "OpenNewView" ); -static const String sViewId = String::CreateFromAscii( "ViewId" ); -static const String sPluginMode = String::CreateFromAscii( "PluginMode" ); -static const String sReadOnly = String::CreateFromAscii( "ReadOnly" ); -static const String sStartPresentation = String::CreateFromAscii( "StartPresentation" ); -static const String sFrameName = String::CreateFromAscii( "FrameName" ); -static const String sMediaType = String::CreateFromAscii( "MediaType" ); -static const String sPostData = String::CreateFromAscii( "PostData" ); -static const String sCharacterSet = String::CreateFromAscii( "CharacterSet" ); -static const String sInputStream = String::CreateFromAscii( "InputStream" ); -static const String sStream = String::CreateFromAscii( "Stream" ); -static const String sOutputStream = String::CreateFromAscii( "OutputStream" ); -static const String sHidden = String::CreateFromAscii( "Hidden" ); -static const String sPreview = String::CreateFromAscii( "Preview" ); -static const String sViewOnly = String::CreateFromAscii( "ViewOnly" ); -static const String sDontEdit = String::CreateFromAscii( "DontEdit" ); -static const String sSilent = String::CreateFromAscii( "Silent" ); -static const String sJumpMark = String::CreateFromAscii( "JumpMark" ); -static const String sFileName = String::CreateFromAscii( "FileName" ); -static const String sSalvageURL = String::CreateFromAscii( "SalvagedFile" ); -static const String sStatusInd = String::CreateFromAscii( "StatusIndicator" ); -static const String sModel = String::CreateFromAscii( "Model" ); -static const String sFrame = String::CreateFromAscii( "Frame" ); -static const String sViewData = String::CreateFromAscii( "ViewData" ); -static const String sFilterData = String::CreateFromAscii( "FilterData" ); -static const String sSelectionOnly = String::CreateFromAscii( "SelectionOnly" ); -static const String sFilterFlags = String::CreateFromAscii( "FilterFlags" ); -static const String sMacroExecMode = String::CreateFromAscii( "MacroExecutionMode" ); -static const String sUpdateDocMode = String::CreateFromAscii( "UpdateDocMode" ); -static const String sMinimized = String::CreateFromAscii( "Minimized" ); -static const String sInteractionHdl = String::CreateFromAscii( "InteractionHandler" ); -static const String sWindowState = String::CreateFromAscii( "WindowState" ); -static const String sUCBContent = String::CreateFromAscii( "UCBContent" ); -static const String sRepairPackage = String::CreateFromAscii( "RepairPackage" ); -static const String sDocumentTitle = String::CreateFromAscii( "DocumentTitle" ); -static const String sComponentData = String::CreateFromAscii( "ComponentData" ); -static const String sComponentContext = String::CreateFromAscii( "ComponentContext" ); -static const String sDocumentBaseURL = String::CreateFromAscii( "DocumentBaseURL" ); -static const String sHierarchicalDocumentName = String::CreateFromAscii( "HierarchicalDocumentName" ); -static const String sCopyStreamIfPossible = String::CreateFromAscii( "CopyStreamIfPossible" ); -static const String sNoAutoSave = String::CreateFromAscii( "NoAutoSave" ); -static const String sFolderName = String::CreateFromAscii( "FolderName" ); -static const String sUseSystemDialog = String::CreateFromAscii( "UseSystemDialog" ); -static const String sStandardDir = String::CreateFromAscii( "StandardDir" ); -static const String sBlackList = String::CreateFromAscii( "BlackList" ); +static char const sTemplateRegionName[] = "TemplateRegionName"; +static char const sTemplateName[] = "TemplateName"; +static char const sAsTemplate[] = "AsTemplate"; +static char const sOpenNewView[] = "OpenNewView"; +static char const sViewId[] = "ViewId"; +static char const sPluginMode[] = "PluginMode"; +static char const sReadOnly[] = "ReadOnly"; +static char const sStartPresentation[] = "StartPresentation"; +static char const sFrameName[] = "FrameName"; +static char const sMediaType[] = "MediaType"; +static char const sPostData[] = "PostData"; +static char const sCharacterSet[] = "CharacterSet"; +static char const sInputStream[] = "InputStream"; +static char const sStream[] = "Stream"; +static char const sOutputStream[] = "OutputStream"; +static char const sHidden[] = "Hidden"; +static char const sPreview[] = "Preview"; +static char const sViewOnly[] = "ViewOnly"; +static char const sDontEdit[] = "DontEdit"; +static char const sSilent[] = "Silent"; +static char const sJumpMark[] = "JumpMark"; +static char const sFileName[] = "FileName"; +static char const sSalvageURL[] = "SalvagedFile"; +static char const sStatusInd[] = "StatusIndicator"; +static char const sModel[] = "Model"; +static char const sFrame[] = "Frame"; +static char const sViewData[] = "ViewData"; +static char const sFilterData[] = "FilterData"; +static char const sSelectionOnly[] = "SelectionOnly"; +static char const sFilterFlags[] = "FilterFlags"; +static char const sMacroExecMode[] = "MacroExecutionMode"; +static char const sUpdateDocMode[] = "UpdateDocMode"; +static char const sMinimized[] = "Minimized"; +static char const sInteractionHdl[] = "InteractionHandler"; +static char const sWindowState[] = "WindowState"; +static char const sUCBContent[] = "UCBContent"; +static char const sRepairPackage[] = "RepairPackage"; +static char const sDocumentTitle[] = "DocumentTitle"; +static char const sComponentData[] = "ComponentData"; +static char const sComponentContext[] = "ComponentContext"; +static char const sDocumentBaseURL[] = "DocumentBaseURL"; +static char const sHierarchicalDocumentName[] = "HierarchicalDocumentName"; +static char const sCopyStreamIfPossible[] = "CopyStreamIfPossible"; +static char const sNoAutoSave[] = "NoAutoSave"; +static char const sFolderName[] = "FolderName"; +static char const sUseSystemDialog[] = "UseSystemDialog"; +static char const sStandardDir[] = "StandardDir"; +static char const sBlackList[] = "BlackList"; void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs, SfxAllItemSet& rSet, const SfxSlot* pSlot ) { @@ -469,11 +469,11 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque for ( sal_uInt16 n=0; n>= bVal) @@ -490,18 +490,18 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque ++nFoundArgs; #endif const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n]; - String aName = rProp.Name; - if ( aName == sModel ) + rtl::OUString aName = rProp.Name; + if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sModel)) ) rSet.Put( SfxUnoAnyItem( SID_DOCUMENT, rProp.Value ) ); - else if ( aName == sComponentData ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sComponentData)) ) { rSet.Put( SfxUnoAnyItem( SID_COMPONENTDATA, rProp.Value ) ); } - else if ( aName == sComponentContext ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sComponentContext)) ) { rSet.Put( SfxUnoAnyItem( SID_COMPONENTCONTEXT, rProp.Value ) ); } - else if ( aName == sStatusInd ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sStatusInd)) ) { Reference< ::com::sun::star::task::XStatusIndicator > xVal; sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is()); @@ -509,7 +509,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUnoAnyItem( SID_PROGRESS_STATUSBAR_CONTROL, rProp.Value ) ); } - else if ( aName == sInteractionHdl ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sInteractionHdl)) ) { Reference< ::com::sun::star::task::XInteractionHandler > xVal; sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is()); @@ -517,11 +517,11 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUnoAnyItem( SID_INTERACTIONHANDLER, rProp.Value ) ); } - else if ( aName == sViewData ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sViewData)) ) rSet.Put( SfxUnoAnyItem( SID_VIEW_DATA, rProp.Value ) ); - else if ( aName == sFilterData ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFilterData)) ) rSet.Put( SfxUnoAnyItem( SID_FILTER_DATA, rProp.Value ) ); - else if ( aName == sInputStream ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sInputStream)) ) { Reference< XInputStream > xVal; sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is()); @@ -529,7 +529,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUnoAnyItem( SID_INPUTSTREAM, rProp.Value ) ); } - else if ( aName == sStream ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sStream)) ) { Reference< XInputStream > xVal; sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is()); @@ -537,7 +537,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUnoAnyItem( SID_STREAM, rProp.Value ) ); } - else if ( aName == sUCBContent ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sUCBContent)) ) { Reference< XContent > xVal; sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is()); @@ -545,7 +545,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUnoAnyItem( SID_CONTENT, rProp.Value ) ); } - else if ( aName == sOutputStream ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sOutputStream)) ) { Reference< XOutputStream > xVal; sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is()); @@ -553,7 +553,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUnoAnyItem( SID_OUTPUTSTREAM, rProp.Value ) ); } - else if ( aName == sPostData ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sPostData)) ) { Reference< XInputStream > xVal; sal_Bool bOK = (rProp.Value >>= xVal); @@ -561,7 +561,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUnoAnyItem( SID_POSTDATA, rProp.Value ) ); } - else if ( aName == sFrame ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFrame)) ) { Reference< XFrame > xVal; sal_Bool bOK = (rProp.Value >>= xVal); @@ -569,7 +569,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUnoAnyItem( SID_FILLFRAME, rProp.Value ) ); } - else if ( aName == sAsTemplate ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sAsTemplate)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -577,7 +577,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_TEMPLATE, bVal ) ); } - else if ( aName == sOpenNewView ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sOpenNewView)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -585,7 +585,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_OPEN_NEW_VIEW, bVal ) ); } - else if ( aName == sViewId ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sViewId)) ) { sal_Int16 nVal = -1; sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1)); @@ -593,7 +593,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUInt16Item( SID_VIEW_ID, nVal ) ); } - else if ( aName == sPluginMode ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sPluginMode)) ) { sal_Int16 nVal = -1; sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1)); @@ -601,7 +601,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUInt16Item( SID_PLUGIN_MODE, nVal ) ); } - else if ( aName == sReadOnly ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sReadOnly)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -609,7 +609,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_DOC_READONLY, bVal ) ); } - else if ( aName == sStartPresentation ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sStartPresentation)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -617,7 +617,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_DOC_STARTPRESENTATION, bVal ) ); } - else if ( aName == sSelectionOnly ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSelectionOnly)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -625,7 +625,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_SELECTION, bVal ) ); } - else if ( aName == sHidden ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sHidden)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -633,7 +633,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) ); } - else if ( aName == sMinimized ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sMinimized)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -641,7 +641,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_MINIMIZED, bVal ) ); } - else if ( aName == sSilent ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSilent)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -649,7 +649,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_SILENT, bVal ) ); } - else if ( aName == sPreview ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sPreview)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -657,7 +657,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_PREVIEW, bVal ) ); } - else if ( aName == sViewOnly ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sViewOnly)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -665,7 +665,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_VIEWONLY, bVal ) ); } - else if ( aName == sDontEdit ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sDontEdit)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -673,7 +673,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_EDITDOC, !bVal ) ); } - else if ( aName == sUseSystemDialog ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sUseSystemDialog)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -681,7 +681,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_FILE_DIALOG, bVal ) ); } - else if ( aName == sStandardDir ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sStandardDir)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -689,7 +689,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_STANDARD_DIR, sVal ) ); } - else if ( aName == sBlackList ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sBlackList)) ) { ::com::sun::star::uno::Sequence< ::rtl::OUString > xVal; sal_Bool bOK = (rProp.Value >>= xVal); @@ -701,7 +701,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque rSet.Put( stringList ); } } - else if ( aName == sFileName ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFileName)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -709,7 +709,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_FILE_NAME, sVal ) ); } - else if ( aName == sSalvageURL ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSalvageURL)) ) { ::rtl::OUString sVal; sal_Bool bOK = (rProp.Value >>= sVal); @@ -717,7 +717,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_DOC_SALVAGE, sVal ) ); } - else if ( aName == sFolderName ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFolderName)) ) { ::rtl::OUString sVal; sal_Bool bOK = (rProp.Value >>= sVal); @@ -725,7 +725,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_PATH, sVal ) ); } - else if ( aName == sFrameName ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFrameName)) ) { ::rtl::OUString sVal; sal_Bool bOK = (rProp.Value >>= sVal); @@ -733,7 +733,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK && sVal.getLength()) rSet.Put( SfxStringItem( SID_TARGETNAME, sVal ) ); } - else if ( aName == sMediaType ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sMediaType)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -741,7 +741,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_CONTENTTYPE, sVal ) ); } - else if ( aName == sWindowState ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sWindowState)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -749,7 +749,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_WIN_POSSIZE, sVal ) ); } - else if ( aName == sTemplateName ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sTemplateName)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -757,7 +757,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_TEMPLATE_NAME, sVal ) ); } - else if ( aName == sTemplateRegionName ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sTemplateRegionName)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -765,7 +765,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_TEMPLATE_REGIONNAME, sVal ) ); } - else if ( aName == sJumpMark ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sJumpMark)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -773,7 +773,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_JUMPMARK, sVal ) ); } - else if ( aName == sCharacterSet ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sCharacterSet)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -781,7 +781,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_CHARSET, sVal ) ); } - else if ( aName == sFilterFlags ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFilterFlags)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -789,7 +789,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_FILE_FILTEROPTIONS, sVal ) ); } - else if ( aName == sMacroExecMode ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sMacroExecMode)) ) { sal_Int16 nVal =-1; sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1)); @@ -797,7 +797,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUInt16Item( SID_MACROEXECMODE, nVal ) ); } - else if ( aName == sUpdateDocMode ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sUpdateDocMode)) ) { sal_Int16 nVal =-1; sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1)); @@ -805,7 +805,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxUInt16Item( SID_UPDATEDOCMODE, nVal ) ); } - else if ( aName == sRepairPackage ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sRepairPackage)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -813,7 +813,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_REPAIRPACKAGE, bVal ) ); } - else if ( aName == sDocumentTitle ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sDocumentTitle)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -821,7 +821,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_DOCINFO_TITLE, sVal ) ); } - else if ( aName == sDocumentBaseURL ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sDocumentBaseURL)) ) { ::rtl::OUString sVal; // the base url can be set to empty ( for embedded objects for example ) @@ -830,7 +830,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_DOC_BASEURL, sVal ) ); } - else if ( aName == sHierarchicalDocumentName ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sHierarchicalDocumentName)) ) { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); @@ -838,7 +838,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_DOC_HIERARCHICALNAME, sVal ) ); } - else if ( aName == sCopyStreamIfPossible ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sCopyStreamIfPossible)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -846,7 +846,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_COPY_STREAM_IF_POSSIBLE, bVal ) ); } - else if ( aName == sNoAutoSave ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sNoAutoSave)) ) { sal_Bool bVal = sal_False; sal_Bool bOK = (rProp.Value >>= bVal); @@ -1334,147 +1334,147 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta const SfxPoolItem *pItem=0; if ( rSet.GetItemState( SID_COMPONENTDATA, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sComponentData; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sComponentData)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_COMPONENTCONTEXT, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sComponentContext; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sComponentContext)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_PROGRESS_STATUSBAR_CONTROL, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sStatusInd; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sStatusInd)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_INTERACTIONHANDLER, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sInteractionHdl; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sInteractionHdl)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_VIEW_DATA, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sViewData; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sViewData)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_FILTER_DATA, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sFilterData; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFilterData)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_DOCUMENT, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sModel; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sModel)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_CONTENT, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sUCBContent; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sUCBContent)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_INPUTSTREAM, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sInputStream; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sInputStream)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_STREAM, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sStream; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sStream)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_OUTPUTSTREAM, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sOutputStream; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sOutputStream)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_POSTDATA, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sPostData; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sPostData)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_FILLFRAME, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sFrame; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFrame)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_TEMPLATE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sAsTemplate; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sAsTemplate)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_OPEN_NEW_VIEW, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sOpenNewView; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sOpenNewView)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_VIEW_ID, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sViewId; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sViewId)); pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_PLUGIN_MODE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sPluginMode; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sPluginMode)); pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_DOC_READONLY, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sReadOnly; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sReadOnly)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sStartPresentation; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sStartPresentation)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_SELECTION, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sSelectionOnly; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSelectionOnly)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_HIDDEN, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sHidden; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sHidden)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_MINIMIZED, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sMinimized; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sMinimized)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_SILENT, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sSilent; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSilent)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_PREVIEW, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sPreview; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sPreview)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_VIEWONLY, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sViewOnly; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sViewOnly)); pValue[nActProp++].Value <<= (sal_Bool) (( ((SfxBoolItem*)pItem)->GetValue() )); } if ( rSet.GetItemState( SID_EDITDOC, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sDontEdit; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sDontEdit)); pValue[nActProp++].Value <<= (sal_Bool) (!( ((SfxBoolItem*)pItem)->GetValue() )); } if ( rSet.GetItemState( SID_FILE_DIALOG, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sUseSystemDialog; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sUseSystemDialog)); pValue[nActProp++].Value <<= (sal_Bool) ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_STANDARD_DIR, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sStandardDir; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sStandardDir)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_BLACK_LIST, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sBlackList; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sBlackList)); com::sun::star::uno::Sequence< rtl::OUString > aList; ((SfxStringListItem*)pItem)->GetStringList( aList ); @@ -1482,42 +1482,42 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta } if ( rSet.GetItemState( SID_TARGETNAME, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sFrameName; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFrameName)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_DOC_SALVAGE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sSalvageURL; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSalvageURL)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_PATH, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sFolderName; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFolderName)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_CONTENTTYPE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sMediaType; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sMediaType)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_WIN_POSSIZE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sWindowState; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sWindowState)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_TEMPLATE_NAME, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sTemplateName; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sTemplateName)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_TEMPLATE_REGIONNAME, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sTemplateRegionName; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sTemplateRegionName)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_JUMPMARK, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sJumpMark; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sJumpMark)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } @@ -1529,47 +1529,47 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta if ( rSet.GetItemState( SID_CHARSET, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sCharacterSet; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sCharacterSet)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_MACROEXECMODE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sMacroExecMode; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sMacroExecMode)); pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_UPDATEDOCMODE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sUpdateDocMode; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sUpdateDocMode)); pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_REPAIRPACKAGE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sRepairPackage; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sRepairPackage)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_DOCINFO_TITLE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sDocumentTitle; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sDocumentTitle)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_DOC_BASEURL, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sDocumentBaseURL; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sDocumentBaseURL)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_DOC_HIERARCHICALNAME, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sHierarchicalDocumentName; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sHierarchicalDocumentName)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_COPY_STREAM_IF_POSSIBLE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sCopyStreamIfPossible; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sCopyStreamIfPossible)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } if ( rSet.GetItemState( SID_NOAUTOSAVE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = sNoAutoSave; + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sNoAutoSave)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 491de2138917..b24322b09447 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -721,9 +721,6 @@ String SfxHelp::CreateHelpURL_Impl( const String& aCommandURL, const String& rM return aHelpURL; } -static ::rtl::OUString OFFICE_HELP_TASK = ::rtl::OUString(DEFINE_CONST_UNICODE("OFFICE_HELP_TASK")); -static ::rtl::OUString OFFICE_HELP = ::rtl::OUString(DEFINE_CONST_UNICODE("OFFICE_HELP" )); - SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame >& rHelpTask , Reference< XFrame >& rHelpContent) { @@ -732,7 +729,7 @@ SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame >& rHelpTask , // otherwhise - create new help task Reference< XFrame > xHelpTask = xDesktop->findFrame( - OFFICE_HELP_TASK, + ::rtl::OUString(DEFINE_CONST_UNICODE("OFFICE_HELP_TASK")), FrameSearchFlag::TASKS | FrameSearchFlag::CREATE); if (!xHelpTask.is()) return 0; @@ -747,7 +744,7 @@ SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame >& rHelpTask , if (xHelpTask->setComponent( xHelpWindow, Reference< XController >() )) { // Customize UI ... - xHelpTask->setName( OFFICE_HELP_TASK ); + xHelpTask->setName( ::rtl::OUString(DEFINE_CONST_UNICODE("OFFICE_HELP_TASK")) ); Reference< XPropertySet > xProps(xHelpTask, UNO_QUERY); if (xProps.is()) @@ -761,13 +758,13 @@ SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame >& rHelpTask , // This sub frame is created internaly (if we called new SfxHelpWindow_Impl() ...) // It should exist :-) - xHelpContent = xHelpTask->findFrame(OFFICE_HELP, FrameSearchFlag::CHILDREN); + xHelpContent = xHelpTask->findFrame(::rtl::OUString(DEFINE_CONST_UNICODE("OFFICE_HELP")), FrameSearchFlag::CHILDREN); } if (!xHelpContent.is()) delete pHelpWindow; - xHelpContent->setName(OFFICE_HELP); + xHelpContent->setName(::rtl::OUString(DEFINE_CONST_UNICODE("OFFICE_HELP"))); rHelpTask = xHelpTask; rHelpContent = xHelpContent; @@ -837,10 +834,10 @@ BOOL SfxHelp::Start( const String& rURL, const Window* pWindow ) // in both cases)! Reference< XFrame > xHelp = xDesktop->findFrame( - OFFICE_HELP_TASK, + ::rtl::OUString(DEFINE_CONST_UNICODE("OFFICE_HELP_TASK")), FrameSearchFlag::CHILDREN); Reference< XFrame > xHelpContent = xDesktop->findFrame( - OFFICE_HELP, + ::rtl::OUString(DEFINE_CONST_UNICODE("OFFICE_HELP")), FrameSearchFlag::CHILDREN); SfxHelpWindow_Impl* pHelpWindow = 0; -- cgit From 4c8c50fdc10ef9afb826a826c4de23781a70bf43 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Fri, 5 Feb 2010 13:45:10 +0100 Subject: #161586# allowing for thesaurus vendor images --- sfx2/source/menu/mnumgr.cxx | 38 ++++++++++++++ sfx2/source/menu/thessubmenu.cxx | 105 +++++++++++++++++++++++++++++---------- sfx2/source/menu/thessubmenu.hxx | 20 +++++++- 3 files changed, 136 insertions(+), 27 deletions(-) mode change 100644 => 100755 sfx2/source/menu/mnumgr.cxx mode change 100644 => 100755 sfx2/source/menu/thessubmenu.cxx (limited to 'sfx2/source') diff --git a/sfx2/source/menu/mnumgr.cxx b/sfx2/source/menu/mnumgr.cxx old mode 100644 new mode 100755 index 3244bbabb934..7cb599f858c0 --- a/sfx2/source/menu/mnumgr.cxx +++ b/sfx2/source/menu/mnumgr.cxx @@ -30,8 +30,10 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" + #include #include +#include #ifdef SOLARIS // HACK: prevent conflict between STLPORT and Workshop headers on Solaris 8 @@ -53,10 +55,15 @@ #include #include #include +#include #include #include #include #include +#include +#include +#include +#include #include @@ -177,6 +184,24 @@ void InsertVerbs_Impl( SfxBindings* pBindings, const com::sun::star::uno::Sequen //-------------------------------------------------------------------- + +static Image lcl_GetImageFromPngUrl( const ::rtl::OUString &rFileUrl ) +{ + Image aRes; + + ::rtl::OUString aTmp; + osl::FileBase::getSystemPathFromFileURL( rFileUrl, aTmp ); + + Graphic aGraphic; + const String aFilterName( RTL_CONSTASCII_USTRINGPARAM( IMP_PNG ) ); + if( GRFILTER_OK == lcl_LoadGraphic( aTmp, aFilterName, aGraphic ) ) + { + aRes = Image( aGraphic.GetBitmapEx() ); + } + return aRes; +} + + PopupMenu* InsertThesaurusSubmenu_Impl( SfxBindings* pBindings, Menu* pSVMenu ) { // @@ -209,15 +234,28 @@ PopupMenu* InsertThesaurusSubmenu_Impl( SfxBindings* pBindings, Menu* pSVMenu ) const size_t nNumSynonyms = aSynonyms.size(); if (nNumSynonyms > 0) { + SvtLinguConfig aCfg; + const bool bHC = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); + + Image aImage; + String sThesImplName( aHelper.GetThesImplName( aLocale ) ); + ::rtl::OUString aSynonymsImageUrl( aCfg.GetSynonymsContextImage( sThesImplName, bHC ) ); + if (sThesImplName.Len() > 0 && aSynonymsImageUrl.getLength() > 0) + aImage = Image( lcl_GetImageFromPngUrl( aSynonymsImageUrl ) ); + for (USHORT i = 0; (size_t)i < nNumSynonyms; ++i) { //! item ids should start with values > 0, since 0 has special meaning const USHORT nId = i + 1; + String aItemText( GetThesaurusReplaceText_Impl( aSynonyms[i] ) ); pThesSubMenu->InsertItem( nId, aItemText ); ::rtl::OUString aCmd( ::rtl::OUString::createFromAscii( ".uno:ThesaurusFromContext?WordReplace:string=" ) ); aCmd += aItemText; pThesSubMenu->SetItemCommand( nId, aCmd ); + + if (aSynonymsImageUrl.getLength() > 0) + pThesSubMenu->SetItemImage( nId, aImage ); } } else // nNumSynonyms == 0 diff --git a/sfx2/source/menu/thessubmenu.cxx b/sfx2/source/menu/thessubmenu.cxx old mode 100644 new mode 100755 index 192562817199..4a6d7cd26bc6 --- a/sfx2/source/menu/thessubmenu.cxx +++ b/sfx2/source/menu/thessubmenu.cxx @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -102,7 +103,8 @@ SfxThesSubMenuControl::SfxThesSubMenuControl( USHORT nSlotId, Menu &rMenu, SfxBi { rMenu.SetPopupMenu(nSlotId, pMenu); pMenu->SetSelectHdl(LINK(this, SfxThesSubMenuControl, MenuSelect)); - FillMenu(); + pMenu->Clear(); + rParent.EnableItem( GetId(), FALSE ); } @@ -112,28 +114,8 @@ SfxThesSubMenuControl::~SfxThesSubMenuControl() } -/* - Fuellt das Menu mit den aktuellen Verben aus der ViewShell. - */ -void SfxThesSubMenuControl::FillMenu() -{ - pMenu->Clear(); - pMenu->SetMenuFlags(MENU_FLAG_NOAUTOMNEMONICS); - SfxViewShell *pView = GetBindings().GetDispatcher()->GetFrame()->GetViewShell(); - if (pView) - { - pMenu->InsertItem( 1, String::CreateFromAscii("bla blub") ); - - } - - rParent.EnableItem( GetId(), (BOOL)pMenu->GetItemCount() ); -} - - /* Statusbenachrichtigung; - fuellt gfs. das Menu mit den aktuellen Verben aus der ViewShell. - der DocumentShell. Ist die Funktionalit"at disabled, wird der entsprechende Menueeintrag im Parentmenu disabled, andernfalls wird er enabled. */ @@ -143,8 +125,6 @@ void SfxThesSubMenuControl::StateChanged( const SfxPoolItem* /*pState*/ ) { rParent.EnableItem(GetId(), SFX_ITEM_AVAILABLE == eState ); - if ( SFX_ITEM_AVAILABLE == eState ) - FillMenu(); } @@ -199,9 +179,10 @@ SfxThesSubMenuHelper::SfxThesSubMenuHelper() try { uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); - m_xThesarus = uno::Reference< linguistic2::XThesaurus > ( xMSF->createInstance( + m_xLngMgr = uno::Reference< linguistic2::XLinguServiceManager >( xMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.linguistic2.Thesaurus" ) ) ), uno::UNO_QUERY_THROW ) ; + "com.sun.star.linguistic2.LinguServiceManager" ))), uno::UNO_QUERY_THROW ); + m_xThesarus = m_xLngMgr->getThesaurus(); } catch (uno::Exception &e) { @@ -269,6 +250,80 @@ bool SfxThesSubMenuHelper::GetMeanings( } +String SfxThesSubMenuHelper::GetThesImplName( const lang::Locale &rLocale ) const +{ + String aRes; + DBG_ASSERT( m_xLngMgr.is(), "LinguServiceManager missing" ); + if (m_xLngMgr.is()) + { + uno::Sequence< OUString > aServiceNames = m_xLngMgr->getConfiguredServices( + OUString::createFromAscii("com.sun.star.linguistic2.Thesaurus"), rLocale ); + // there should be at most one thesaurus configured for each language + DBG_ASSERT( aServiceNames.getLength() <= 1, "more than one thesaurus found. Should not be possible" ); + if (aServiceNames.getLength() == 1) + aRes = aServiceNames[0]; + } + return aRes; +} + //////////////////////////////////////////////////////////// +//!! temporary implement locally: +//!! once MBAs latest CWS is integrated this functions are available in svtools +//!! under a slightly different name + +#include + +#define IMPGRF_INIKEY_ASLINK "ImportGraphicAsLink" +#define IMPGRF_INIKEY_PREVIEW "ImportGraphicPreview" +#define IMPGRF_CONFIGNAME String(DEFINE_CONST_UNICODE("ImportGraphicDialog")) + +GraphicFilter* lcl_GetGrfFilter() +{ + return GraphicFilter::GetGraphicFilter(); +} + +// ----------------------------------------------------------------------- + +int lcl_LoadGraphic( const String &rPath, const String &rFilterName, + Graphic& rGraphic, GraphicFilter* pFilter, + USHORT* pDeterminedFormat ) +{ + if ( !pFilter ) + pFilter = ::lcl_GetGrfFilter(); + + const USHORT nFilter = rFilterName.Len() && pFilter->GetImportFormatCount() + ? pFilter->GetImportFormatNumber( rFilterName ) + : GRFILTER_FORMAT_DONTKNOW; + + SfxMedium* pMed = 0; + + // dann teste mal auf File-Protokoll: + SvStream* pStream = NULL; + INetURLObject aURL( rPath ); + + if ( aURL.HasError() || INET_PROT_NOT_VALID == aURL.GetProtocol() ) + { + aURL.SetSmartProtocol( INET_PROT_FILE ); + aURL.SetSmartURL( rPath ); + } + else if ( INET_PROT_FILE != aURL.GetProtocol() ) + { + // z.Z. nur auf die aktuelle DocShell + pMed = new SfxMedium( rPath, STREAM_READ, TRUE ); + pMed->DownLoad(); + pStream = pMed->GetInStream(); + } + int nRes = GRFILTER_OK; + + if ( !pStream ) + nRes = pFilter->ImportGraphic( rGraphic, aURL, nFilter, pDeterminedFormat ); + else + nRes = pFilter->ImportGraphic( rGraphic, rPath, *pStream, + nFilter, pDeterminedFormat ); + if ( pMed ) + delete pMed; + return nRes; +} + diff --git a/sfx2/source/menu/thessubmenu.hxx b/sfx2/source/menu/thessubmenu.hxx index 845594f4ba6a..60d877a13495 100755 --- a/sfx2/source/menu/thessubmenu.hxx +++ b/sfx2/source/menu/thessubmenu.hxx @@ -33,6 +33,7 @@ #define _THESSUBMENU_HXX_ #include +#include #include #include @@ -55,7 +56,6 @@ class SfxThesSubMenuControl : public SfxMenuControl Menu& rParent; private: - void FillMenu(); virtual void StateChanged( USHORT, SfxItemState, const SfxPoolItem* pState ); DECL_LINK( MenuSelect, Menu * ); @@ -72,7 +72,8 @@ public: class SfxThesSubMenuHelper { - css::uno::Reference< css::linguistic2::XThesaurus > m_xThesarus; + css::uno::Reference< css::linguistic2::XLinguServiceManager > m_xLngMgr; + css::uno::Reference< css::linguistic2::XThesaurus > m_xThesarus; private: @@ -94,9 +95,24 @@ public: // get the first nMax Synonym entries, even if different meanings need to be evaluated bool GetMeanings( std::vector< ::rtl::OUString > & rSynonyms, const ::rtl::OUString & rWord, const css::lang::Locale & rLocale, sal_Int16 nMaxSynonms ); + + String GetThesImplName( const css::lang::Locale &rLocale ) const; }; //////////////////////////////////////////////////////////// + + +#include + +//!! temporary implemented locally: +//!! once MBAs latest CWS is integrated this functions are available in svtools +//!! under a slightly different name +GraphicFilter* lcl_GetGrfFilter(); +int lcl_LoadGraphic( const String& rPath, const String& rFilter, + Graphic& rGraphic, + GraphicFilter* pFilter = NULL, + USHORT* pDeterminedFormat = NULL ); + #endif -- cgit From 89246e3b483b26859b105902f9042ca9fdefe374 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Thu, 11 Feb 2010 10:11:09 +0100 Subject: cws tl74: #i51258# thesaurus context menu --- sfx2/source/menu/mnumgr.cxx | 1 - sfx2/source/menu/thessubmenu.cxx | 3 +++ sfx2/source/menu/thessubmenu.hxx | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/menu/mnumgr.cxx b/sfx2/source/menu/mnumgr.cxx index 7cb599f858c0..321bbf44c7b6 100755 --- a/sfx2/source/menu/mnumgr.cxx +++ b/sfx2/source/menu/mnumgr.cxx @@ -63,7 +63,6 @@ #include #include #include -#include #include diff --git a/sfx2/source/menu/thessubmenu.cxx b/sfx2/source/menu/thessubmenu.cxx index 4a6d7cd26bc6..2e1dec33c09e 100755 --- a/sfx2/source/menu/thessubmenu.cxx +++ b/sfx2/source/menu/thessubmenu.cxx @@ -39,6 +39,9 @@ #include #include #include +#include +#include + #include diff --git a/sfx2/source/menu/thessubmenu.hxx b/sfx2/source/menu/thessubmenu.hxx index 60d877a13495..0569161c5c7f 100755 --- a/sfx2/source/menu/thessubmenu.hxx +++ b/sfx2/source/menu/thessubmenu.hxx @@ -102,11 +102,13 @@ public: //////////////////////////////////////////////////////////// -#include +// taken from #include : //!! temporary implemented locally: //!! once MBAs latest CWS is integrated this functions are available in svtools //!! under a slightly different name +class GraphicFilter; +class Graphic; GraphicFilter* lcl_GetGrfFilter(); int lcl_LoadGraphic( const String& rPath, const String& rFilter, Graphic& rGraphic, -- cgit From ef28bb3801a3970169c5b86f8ced32ef59ce1379 Mon Sep 17 00:00:00 2001 From: npower Developer Date: Mon, 1 Mar 2010 12:29:56 +0000 Subject: npower14miscfixes: #i109699# --- sfx2/source/doc/objmisc.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 1cb88e98f59f..5c6bc72e9707 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -1690,7 +1690,7 @@ namespace } ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptContext, const ::rtl::OUString& _rScriptURL, - const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam ) + const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam, bool bRaiseError ) { OSL_TRACE( "in CallXScript" ); ErrCode nErr = ERRCODE_NONE; @@ -1731,7 +1731,7 @@ ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptCon nErr = ERRCODE_BASIC_INTERNAL_ERROR; } - if ( bCaughtException ) + if ( bCaughtException && bRaiseError ) { ::std::auto_ptr< VclAbstractDialog > pScriptErrDlg; SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); @@ -1754,8 +1754,8 @@ ErrCode SfxObjectShell::CallXScript( const String& rScriptURL, aParams, ::com::sun::star::uno::Any& aRet, ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex, - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& - aOutParam) + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam + , bool bRaiseError ) { return CallXScript( GetModel(), rScriptURL, aParams, aRet, aOutParamIndex, aOutParam ); } -- cgit From 92f22b7636d7c18c6830e7da1298a5aa93537fa1 Mon Sep 17 00:00:00 2001 From: npower Developer Date: Thu, 4 Mar 2010 23:07:14 +0000 Subject: npower14miscfixes: wae removal --- sfx2/source/doc/objmisc.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sfx2/source') diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 5c6bc72e9707..259bf2699825 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -1757,7 +1757,7 @@ ErrCode SfxObjectShell::CallXScript( const String& rScriptURL, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam , bool bRaiseError ) { - return CallXScript( GetModel(), rScriptURL, aParams, aRet, aOutParamIndex, aOutParam ); + return CallXScript( GetModel(), rScriptURL, aParams, aRet, aOutParamIndex, aOutParam, bRaiseError ); } //------------------------------------------------------------------------- -- cgit From 880c875024df2b8cd73056a7f91258f27b91c674 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 15 Mar 2010 12:53:14 +0100 Subject: odfmetadata4: sfx2::Metadatable: split CreateUndo() into 2 methods --- sfx2/source/doc/Metadatable.cxx | 60 ++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 28 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/doc/Metadatable.cxx b/sfx2/source/doc/Metadatable.cxx index b1b69e5ac74f..b220182d21f1 100644 --- a/sfx2/source/doc/Metadatable.cxx +++ b/sfx2/source/doc/Metadatable.cxx @@ -1488,8 +1488,7 @@ Metadatable::RegisterAsCopyOf(Metadatable const & i_rSource, } } -::boost::shared_ptr Metadatable::CreateUndo( - const bool i_isDelete) +::boost::shared_ptr Metadatable::CreateUndo() const { OSL_ENSURE(!IsInUndo(), "CreateUndo called for object in undo?"); OSL_ENSURE(!IsInClipboard(), "CreateUndo called for object in clipboard?"); @@ -1503,11 +1502,6 @@ Metadatable::RegisterAsCopyOf(Metadatable const & i_rSource, pRegDoc->CreateUndo(*this) ); pRegDoc->RegisterCopy(*this, *pUndo, false); pUndo->m_pReg = pRegDoc; - - if (i_isDelete) - { - RemoveMetadataReference(); - } return pUndo; } } @@ -1518,6 +1512,13 @@ Metadatable::RegisterAsCopyOf(Metadatable const & i_rSource, return ::boost::shared_ptr(); } +::boost::shared_ptr Metadatable::CreateUndoForDelete() +{ + ::boost::shared_ptr const pUndo( CreateUndo() ); + RemoveMetadataReference(); + return pUndo; +} + void Metadatable::RestoreMetadata( ::boost::shared_ptr const& i_pUndo) { @@ -1624,15 +1625,16 @@ MetadatableMixin::getMetadataReference() throw (uno::RuntimeException) { ::vos::OGuard aGuard( Application::GetSolarMutex() ); - Metadatable* pObject( GetCoreObject() ); - if (pObject) - { - return pObject->GetMetadataReference(); - } - else + + Metadatable *const pObject( GetCoreObject() ); + if (!pObject) { - throw uno::RuntimeException(); + throw uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "MetadatableMixin: cannot get core object; not inserted?")), + *this); } + return pObject->GetMetadataReference(); } void SAL_CALL @@ -1641,30 +1643,32 @@ MetadatableMixin::setMetadataReference( throw (uno::RuntimeException, lang::IllegalArgumentException) { ::vos::OGuard aGuard( Application::GetSolarMutex() ); - Metadatable* pObject( GetCoreObject() ); - if (pObject) - { - return pObject->SetMetadataReference(i_rReference); - } - else + + Metadatable *const pObject( GetCoreObject() ); + if (!pObject) { - throw uno::RuntimeException(); + throw uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "MetadatableMixin: cannot get core object; not inserted?")), + *this); } + return pObject->SetMetadataReference(i_rReference); } void SAL_CALL MetadatableMixin::ensureMetadataReference() throw (uno::RuntimeException) { ::vos::OGuard aGuard( Application::GetSolarMutex() ); - Metadatable* pObject( GetCoreObject() ); - if (pObject) - { - return pObject->EnsureMetadataReference(); - } - else + + Metadatable *const pObject( GetCoreObject() ); + if (!pObject) { - throw uno::RuntimeException(); + throw uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "MetadatableMixin: cannot get core object; not inserted?")), + *this); } + return pObject->EnsureMetadataReference(); } } // namespace sfx2 -- cgit From b164e350dec6d682834e997cf8aae6471ec6afee Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 15 Mar 2010 12:53:14 +0100 Subject: odfmetadata4: Metadatable: improve generation of xml:ids: replace rand(), which only produces 0..2^31 on solaris, with a rtlRandomPool. --- sfx2/source/doc/Metadatable.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/doc/Metadatable.cxx b/sfx2/source/doc/Metadatable.cxx index b220182d21f1..1a51bee5024f 100644 --- a/sfx2/source/doc/Metadatable.cxx +++ b/sfx2/source/doc/Metadatable.cxx @@ -33,6 +33,8 @@ #include #include // solarmutex +#include + #include #include @@ -401,14 +403,16 @@ template< typename T > /*static*/ ::rtl::OUString create_id(const ::std::hash_map< ::rtl::OUString, T, ::rtl::OUStringHash > & i_rXmlIdMap) { + static rtlRandomPool s_Pool( rtl_random_createPool() ); const ::rtl::OUString prefix( ::rtl::OUString::createFromAscii(s_prefix) ); typename ::std::hash_map< ::rtl::OUString, T, ::rtl::OUStringHash > ::const_iterator iter; ::rtl::OUString id; do { - const int n( rand() ); - id = prefix + ::rtl::OUString::valueOf(static_cast(n)); + sal_Int32 n; + rtl_random_getBytes(s_Pool, & n, sizeof(n)); + id = prefix + ::rtl::OUString::valueOf(static_cast(abs(n))); iter = i_rXmlIdMap.find(id); } while (iter != i_rXmlIdMap.end()); -- cgit From 5b84b9f616734dca66bce10eac11e62462fcf26a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 16 Mar 2010 23:15:08 +0100 Subject: slidecopy: minor edit ... let GetImage/ByURL take a 'const Reference&', not a 'Reference&' --- sfx2/source/appl/imagemgr.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sfx2/source') diff --git a/sfx2/source/appl/imagemgr.cxx b/sfx2/source/appl/imagemgr.cxx index 6f226bad8040..3978153a48f0 100644 --- a/sfx2/source/appl/imagemgr.cxx +++ b/sfx2/source/appl/imagemgr.cxx @@ -74,7 +74,7 @@ static WeakReference< XModuleUIConfigurationManagerSupplier > m_xModuleCfgMgrSup static WeakReference< XURLTransformer > m_xURLTransformer; static ModuleIdToImagegMgr m_aModuleIdToImageMgrMap; -Image SAL_CALL GetImage( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL, BOOL bBig, BOOL bHiContrast ) +Image SAL_CALL GetImage( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL, BOOL bBig, BOOL bHiContrast ) { // TODO/LATeR: shouldn't this become a method at SfxViewFrame?! That would save the UnoTunnel if ( !rFrame.is() ) -- cgit From fbf42f650eca6002756deb47d051257a4672c680 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Wed, 17 Mar 2010 11:59:34 +0100 Subject: #i109668# let the default filter be used for export --- sfx2/source/doc/guisaveas.cxx | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index cbd269b41516..6ee4d7f78e17 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -836,9 +836,16 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, ::rtl::OUString aAdjustToType; - // bSetStandardName == true means that user agreed to store document in the default (default default ;-)) format - if ( !(( nStoreMode & EXPORT_REQUESTED ) && !( nStoreMode & WIDEEXPORT_REQUESTED )) && - ( bSetStandardName || GetStorable()->hasLocation() )) + if ( ( nStoreMode & EXPORT_REQUESTED ) && !( nStoreMode & WIDEEXPORT_REQUESTED ) ) + { + // it is export, set the preselected filter + ::rtl::OUString aFilterUIName = aPreselectedFilterPropsHM.getUnpackedValueOrDefault( + ::rtl::OUString::createFromAscii( "UIName" ), + ::rtl::OUString() ); + pFileDlg->SetCurrentFilter( aFilterUIName ); + } + // it is no export, bSetStandardName == true means that user agreed to store document in the default (default default ;-)) format + else if ( bSetStandardName || GetStorable()->hasLocation() ) { uno::Sequence< beans::PropertyValue > aOldFilterProps; ::rtl::OUString aOldFilterName = GetDocProps().getUnpackedValueOrDefault( @@ -1570,8 +1577,10 @@ uno::Sequence< beans::PropertyValue > SfxStoringHelper::SearchForFilter( uno::Reference< container::XEnumeration > xFilterEnum = xFilterQuery->createSubSetEnumerationByProperties( aSearchRequest ); - // use the first filter that is found + // the first default filter will be taken, + // if there is no filter with flag default the first acceptable filter will be taken if ( xFilterEnum.is() ) + { while ( xFilterEnum->hasMoreElements() ) { uno::Sequence< beans::PropertyValue > aProps; @@ -1582,11 +1591,17 @@ uno::Sequence< beans::PropertyValue > SfxStoringHelper::SearchForFilter( (sal_Int32)0 ); if ( ( ( nFlags & nMustFlags ) == nMustFlags ) && !( nFlags & nDontFlags ) ) { - aFilterProps = aProps; - break; + if ( ( nFlags & SFX_FILTER_DEFAULT ) == SFX_FILTER_DEFAULT ) + { + aFilterProps = aProps; + break; + } + else if ( !aFilterProps.getLength() ) + aFilterProps = aProps; } } } + } return aFilterProps; } -- cgit From 54499ed54bd760755e4d172417f0cc849fc47d1e Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Fri, 19 Mar 2010 11:13:29 +0100 Subject: cws tl79: #i110254# new 'Security' tab page --- sfx2/source/dialog/dinfdlg.cxx | 4 +- sfx2/source/dialog/dinfdlg.src | 11 +- sfx2/source/dialog/makefile.mk | 6 +- sfx2/source/dialog/securitypage.cxx | 379 ++++++++++++++++++++++++++++++++++++ sfx2/source/dialog/securitypage.hrc | 52 +++++ sfx2/source/dialog/securitypage.src | 156 +++++++++++++++ sfx2/source/inc/helpid.hrc | 1 + 7 files changed, 602 insertions(+), 7 deletions(-) mode change 100644 => 100755 sfx2/source/dialog/dinfdlg.cxx mode change 100644 => 100755 sfx2/source/dialog/dinfdlg.src mode change 100644 => 100755 sfx2/source/dialog/makefile.mk create mode 100755 sfx2/source/dialog/securitypage.cxx create mode 100755 sfx2/source/dialog/securitypage.hrc create mode 100755 sfx2/source/dialog/securitypage.src mode change 100644 => 100755 sfx2/source/inc/helpid.hrc (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx old mode 100644 new mode 100755 index 0f778a94f091..e592eae82b08 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -58,7 +58,8 @@ #include #include -#include +#include "sfx2/dinfdlg.hxx" +#include "sfx2/securitypage.hxx" #include "sfxresid.hxx" #include "dinfedt.hxx" #include @@ -1554,6 +1555,7 @@ SfxDocumentInfoDialog::SfxDocumentInfoDialog( Window* pParent, AddTabPage(TP_DOCINFODOC, SfxDocumentPage::Create, 0); AddTabPage(TP_CUSTOMPROPERTIES, SfxCustomPropertiesPage::Create, 0); AddTabPage(TP_DOCINFORELOAD, SfxInternetPage::Create, 0); + AddTabPage(TP_DOCINFOSECURITY, SfxSecurityPage::Create, 0); } // ----------------------------------------------------------------------- diff --git a/sfx2/source/dialog/dinfdlg.src b/sfx2/source/dialog/dinfdlg.src old mode 100644 new mode 100755 index eaa691fe3eff..f32bc768e846 --- a/sfx2/source/dialog/dinfdlg.src +++ b/sfx2/source/dialog/dinfdlg.src @@ -27,11 +27,11 @@ // include --------------------------------------------------------------- -#include +#include "sfx2/sfx.hrc" #include "helpid.hrc" #include "sfxlocal.hrc" #include "dinfdlg.hrc" -#include +#include "dialog.hrc" // TP_DOCINFODESC -------------------------------------------------------- String STR_SFX_NEWOFFICEDOC @@ -685,8 +685,6 @@ QueryBox SFX_QB_WRONG_TYPE Message [ en-US ] = "The value entered does not match the specified type.\nThe value will be stored as text." ; }; - // SID_DOCINFO ----------------------------------------------------------- - TabDialog SID_DOCINFO { OutputSize = TRUE ; @@ -718,6 +716,11 @@ TabDialog SID_DOCINFO Identifier = TP_DOCINFORELOAD ; Text [ en-US ] = "Internet" ; }; + PageItem + { + Identifier = TP_DOCINFOSECURITY ; + Text [ en-US ] = "Security" ; + }; }; }; }; diff --git a/sfx2/source/dialog/makefile.mk b/sfx2/source/dialog/makefile.mk old mode 100644 new mode 100755 index 87ef0f1a7af1..b344170fd39c --- a/sfx2/source/dialog/makefile.mk +++ b/sfx2/source/dialog/makefile.mk @@ -68,7 +68,8 @@ SLOFILES =\ $(SLO)$/tabdlg.obj \ $(SLO)$/tplcitem.obj \ $(SLO)$/tplpitem.obj \ - $(SLO)$/versdlg.obj + $(SLO)$/versdlg.obj \ + $(SLO)$/securitypage.obj SRS1NAME=$(TARGET) SRC1FILES =\ @@ -85,7 +86,8 @@ SRC1FILES =\ templdlg.src \ versdlg.src \ printopt.src \ - srchdlg.src + srchdlg.src \ + securitypage.src .IF "$(BUILD_VER_STRING)"!="" .IF "$(GUI)"=="UNX" diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx new file mode 100755 index 000000000000..affebc8615cb --- /dev/null +++ b/sfx2/source/dialog/securitypage.cxx @@ -0,0 +1,379 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sfx2.hxx" + +#include "sfx2/securitypage.hxx" +#include "sfx2/sfx.hrc" +#include "securitypage.hrc" +#include "sfxresid.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +////////////////////////////////////////////////////////////////////// + +namespace +{ + enum RedliningMode { RL_NONE, RL_WRITER, RL_CALC }; + + enum RedlineFunc { RF_ON, RF_PROTECT }; + + const SfxBoolItem* ExecuteRecordChangesFunc( RedliningMode _eMode, RedlineFunc _eFunc, BOOL _bVal, Window* _pParent = NULL ) + { + const SfxBoolItem* pRet = NULL; + + if (_eMode != RL_NONE) + { + USHORT nSlot; + if (_eMode == RL_WRITER) + nSlot = _eFunc == RF_ON ? FN_REDLINE_ON : FN_REDLINE_PROTECT; + else + nSlot = _eFunc == RF_ON ? FID_CHG_RECORD : SID_CHG_PROTECT; + + // execute + SfxViewShell* pViewSh = SfxViewShell::Current(); + if (pViewSh) + { + bool bNeedItem = _eMode == RL_WRITER || _eFunc != RF_ON; + SfxBoolItem* pItem = bNeedItem ? new SfxBoolItem( nSlot, _bVal ) : NULL; + SfxDispatcher* pDisp = pViewSh->GetDispatcher(); + if (_pParent) + { + XWindowItem aParentItem( SID_ATTR_XWINDOW, _pParent ); + pRet = static_cast< const SfxBoolItem* >( + pDisp->Execute( nSlot, SFX_CALLMODE_SYNCHRON, &aParentItem, pItem, 0L ) ); + } + else + pRet = static_cast< const SfxBoolItem* >( + pDisp->Execute( nSlot, SFX_CALLMODE_SYNCHRON, pItem, 0L ) ); + delete pItem; + } + } + + return pRet; + } + + bool QueryState( USHORT _nSlot, bool& _rValue ) + { + bool bRet = false; + + SfxViewShell* pViewSh = SfxViewShell::Current(); + if (pViewSh) + { + const SfxPoolItem* pItem; + SfxDispatcher* pDisp = pViewSh->GetDispatcher(); + bRet = SFX_ITEM_AVAILABLE <= pDisp->QueryState( _nSlot, pItem ); + if (bRet) + _rValue = ( static_cast< const SfxBoolItem* >( pItem ) )->GetValue(); + } + + return bRet; + } + + bool QueryRecordChangesProtectionState( RedliningMode _eMode, bool& _rValue ) + { + bool bRet = false; + + if (_eMode != RL_NONE) + { + USHORT nSlot = _eMode == RL_WRITER ? FN_REDLINE_PROTECT : SID_CHG_PROTECT; + bRet = QueryState( nSlot, _rValue ); + } + + return bRet; + } + + bool QueryRecordChangesState( RedliningMode _eMode, bool& _rValue ) + { + bool bRet = false; + + if (_eMode != RL_NONE) + { + USHORT nSlot = _eMode == RL_WRITER ? FN_REDLINE_ON : FID_CHG_RECORD; + bRet = QueryState( nSlot, _rValue ); + } + + return bRet; + } +} + + +////////////////////////////////////////////////////////////////////// + + +struct SfxSecurityPage_Impl +{ + SfxSecurityPage & m_rDialog; + + FixedLine m_aPasswordToOpenFL; + FixedText m_aPasswordToOpenFT; + Edit m_aPasswordToOpenED; + FixedText m_aConfirmPasswordToOpenFT; + Edit m_aConfirmPasswordToOpenED; + FixedText m_aPasswordInfoFT; + + FixedLine m_aPasswordToModifyFL; + FixedText m_aPasswordToModifyFT; + Edit m_aPasswordToModifyED; + FixedText m_aConfirmPasswordToModifyFT; + Edit m_aConfirmPasswordToModifyED; + + FixedLine m_aOptionsFL; + CheckBox m_aOpenReadonlyCB; + CheckBox m_aRemoveInfoOnSavingCB; + CheckBox m_aRecordChangesCB; // for record changes + PushButton m_aChangeProtectionPB; // for record changes + String m_aProtectSTR; // for record changes + String m_aUnProtectSTR; // for record changes + RedliningMode m_eRedlingMode; // for record changes + + DECL_LINK( RecordChangesCBHdl, void* ); + DECL_LINK( ChangeProtectionPBHdl, void* ); + + SfxSecurityPage_Impl( SfxSecurityPage &rDlg, const SfxItemSet &rItemSet ); + ~SfxSecurityPage_Impl(); + + void CheckRecordChangesState( void ); + + BOOL FillItemSet_Impl( SfxItemSet & ); + void Reset_Impl( const SfxItemSet & ); +}; + + +SfxSecurityPage_Impl::SfxSecurityPage_Impl( SfxSecurityPage &rDlg, const SfxItemSet & ) : + m_rDialog (rDlg), + m_aPasswordToOpenFL (&rDlg, SfxResId( PASSWORD_TO_OPEN_FL ) ), + m_aPasswordToOpenFT (&rDlg, SfxResId( PASSWORD_TO_OPEN_FT ) ), + m_aPasswordToOpenED (&rDlg, SfxResId( PASSWORD_TO_OPEN_ED ) ), + m_aConfirmPasswordToOpenFT (&rDlg, SfxResId( CONFIRM_PASSWORD_TO_OPEN_FT ) ), + m_aConfirmPasswordToOpenED (&rDlg, SfxResId( CONFIRM_PASSWORD_TO_OPEN_ED ) ), + m_aPasswordInfoFT (&rDlg, SfxResId( PASSWORD_INFO_FT ) ), + m_aPasswordToModifyFL (&rDlg, SfxResId( PASSWORD_TO_MODIFY_FL ) ), + m_aPasswordToModifyFT (&rDlg, SfxResId( PASSWORD_TO_MODIFY_FT ) ), + m_aPasswordToModifyED (&rDlg, SfxResId( PASSWORD_TO_MODIFY_ED ) ), + m_aConfirmPasswordToModifyFT (&rDlg, SfxResId( CONFIRM_PASSWORD_TO_MODIFY_FT ) ), + m_aConfirmPasswordToModifyED (&rDlg, SfxResId( CONFIRM_PASSWORD_TO_MODIFY_ED ) ), + m_aOptionsFL (&rDlg, SfxResId( OPTIONS_FL ) ), + m_aOpenReadonlyCB (&rDlg, SfxResId( OPEN_READONLY_CB ) ), + m_aRemoveInfoOnSavingCB (&rDlg, SfxResId( REMOVE_INFO_ON_SAVING_CB ) ), + m_aRecordChangesCB (&rDlg, SfxResId( RECORD_CHANGES_CB ) ), + m_aChangeProtectionPB (&rDlg, SfxResId( CHANGE_PROTECTION_PB ) ), + m_aProtectSTR ( SfxResId( STR_PROTECT ) ), + m_aUnProtectSTR ( SfxResId( STR_UNPROTECT ) ), + m_eRedlingMode ( RL_NONE ) +{ + m_aChangeProtectionPB.SetText( m_aProtectSTR ); + // adjust button width if necessary + long nBtnTextWidth = 0; + long nTemp = m_aChangeProtectionPB.GetCtrlTextWidth( m_aChangeProtectionPB.GetText() ); + if (nTemp > nBtnTextWidth) + nBtnTextWidth = nTemp; + + m_aRecordChangesCB.SetClickHdl( LINK( this, SfxSecurityPage_Impl, RecordChangesCBHdl ) ); + m_aChangeProtectionPB.SetClickHdl( LINK( this, SfxSecurityPage_Impl, ChangeProtectionPBHdl ) ); +} + + +SfxSecurityPage_Impl::~SfxSecurityPage_Impl() +{ +} + + +void SfxSecurityPage_Impl::CheckRecordChangesState( void ) +{ + bool bVal; + if (QueryRecordChangesState( m_eRedlingMode, bVal )) + { + m_aRecordChangesCB.Enable(); + m_aRecordChangesCB.Check( bVal ); + } + else + m_aRecordChangesCB.Disable(); // because now we don't know the state! + + m_aChangeProtectionPB.Enable( QueryRecordChangesProtectionState( m_eRedlingMode, bVal ) ); +} + + +BOOL SfxSecurityPage_Impl::FillItemSet_Impl( SfxItemSet & ) +{ + BOOL bModified = FALSE; + + SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); + if (pCurDocShell) + { + if (pCurDocShell->HasSecurityOptOpenReadOnly()) + pCurDocShell->SetSecurityOptOpenReadOnly( m_aOpenReadonlyCB.IsChecked() ); + } + + return bModified; +} + + +void SfxSecurityPage_Impl::Reset_Impl( const SfxItemSet & ) +{ + SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); + + String sNewText = m_aProtectSTR; + if (!pCurDocShell) + { + // no doc -> hide document settings + m_aOpenReadonlyCB.Disable(); + m_aRecordChangesCB.Disable(); + m_aChangeProtectionPB.Disable(); + } + else + { + bool bIsHTMLDoc = false; + SfxViewShell* pViewSh = SfxViewShell::Current(); + if (pViewSh) + { + const SfxPoolItem* pItem; + SfxDispatcher* pDisp = pViewSh->GetDispatcher(); + if (SFX_ITEM_AVAILABLE <= pDisp->QueryState( SID_HTML_MODE, pItem )) + { + USHORT nMode = static_cast< const SfxUInt16Item* >( pItem )->GetValue(); + bIsHTMLDoc = ( ( nMode & HTMLMODE_ON ) != 0 ); + } + } + + sal_Bool bIsReadonly = pCurDocShell->IsReadOnly(); + if (pCurDocShell->HasSecurityOptOpenReadOnly() && !bIsHTMLDoc) + { + m_aOpenReadonlyCB.Check( pCurDocShell->IsSecurityOptOpenReadOnly() ); + m_aOpenReadonlyCB.Enable( !bIsReadonly ); + } + else + m_aOpenReadonlyCB.Disable(); + + bool bVal; + if (QueryRecordChangesState( RL_WRITER, bVal ) && !bIsHTMLDoc) + m_eRedlingMode = RL_WRITER; + else if (QueryRecordChangesState( RL_CALC, bVal )) + m_eRedlingMode = RL_CALC; + else + m_eRedlingMode = RL_NONE; + + if (m_eRedlingMode != RL_NONE) + { + m_aRecordChangesCB.Check( bVal ); + m_aRecordChangesCB.Enable( !bVal && !bIsReadonly ); + m_aChangeProtectionPB.Enable( + QueryRecordChangesProtectionState( m_eRedlingMode, bVal ) && !bIsReadonly ); + // set the right text + if (bVal) + sNewText = m_aUnProtectSTR; + } + } + + m_aChangeProtectionPB.SetText( sNewText ); +} + + +IMPL_LINK( SfxSecurityPage_Impl, RecordChangesCBHdl, void*, EMPTYARG ) +{ + ExecuteRecordChangesFunc( m_eRedlingMode, RF_ON, m_aRecordChangesCB.IsChecked(), &m_rDialog ); + CheckRecordChangesState(); + return 0; +} + + +IMPL_LINK( SfxSecurityPage_Impl, ChangeProtectionPBHdl, void*, EMPTYARG ) +{ + bool bProt; + QueryRecordChangesProtectionState( m_eRedlingMode, bProt ); + ExecuteRecordChangesFunc( m_eRedlingMode, RF_PROTECT, !bProt, &m_rDialog ); + CheckRecordChangesState(); + + if (QueryRecordChangesProtectionState( m_eRedlingMode, bProt )) + { + // RecordChangesCB is enabled if protection is off + m_aRecordChangesCB.Enable( !bProt ); + // toggle text of button "Protect" <-> "Unprotect" + String sNewText = bProt ? m_aUnProtectSTR : m_aProtectSTR; + m_aChangeProtectionPB.SetText( sNewText ); + } + return 0; +} + + +////////////////////////////////////////////////////////////////////// + + +SfxTabPage* SfxSecurityPage::Create( Window * pParent, const SfxItemSet & rItemSet ) +{ + return new SfxSecurityPage( pParent, rItemSet ); +} + + +SfxSecurityPage::SfxSecurityPage( Window* pParent, const SfxItemSet& rItemSet ) : + SfxTabPage( pParent, SfxResId( TP_DOCINFOSECURITY ), rItemSet ) +{ + m_pImpl = std::auto_ptr< SfxSecurityPage_Impl >(new SfxSecurityPage_Impl( *this, rItemSet )); + + FreeResource(); +} + + +SfxSecurityPage::~SfxSecurityPage() +{ +} + + +BOOL SfxSecurityPage::FillItemSet( SfxItemSet & rItemSet ) +{ + bool bModified = false; + DBG_ASSERT( m_pImpl.get(), "implementation pointer is 0. Still in c-tor?" ); + if (m_pImpl.get() != 0) + bModified = m_pImpl->FillItemSet_Impl( rItemSet ); + return bModified; +} + + +void SfxSecurityPage::Reset( const SfxItemSet & rItemSet ) +{ + DBG_ASSERT( m_pImpl.get(), "implementation pointer is 0. Still in c-tor?" ); + if (m_pImpl.get() != 0) + m_pImpl->Reset_Impl( rItemSet ); +} + + +////////////////////////////////////////////////////////////////////// + diff --git a/sfx2/source/dialog/securitypage.hrc b/sfx2/source/dialog/securitypage.hrc new file mode 100755 index 000000000000..820dab538b9f --- /dev/null +++ b/sfx2/source/dialog/securitypage.hrc @@ -0,0 +1,52 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SECURITYPAGE_HRC_ +#define _SECURITYPAGE_HRC_ + + +#define PASSWORD_TO_OPEN_FL 1 +#define PASSWORD_TO_OPEN_FT 2 +#define PASSWORD_TO_OPEN_ED 3 +#define CONFIRM_PASSWORD_TO_OPEN_FT 4 +#define CONFIRM_PASSWORD_TO_OPEN_ED 5 +#define PASSWORD_INFO_FT 6 +#define PASSWORD_TO_MODIFY_FL 7 +#define PASSWORD_TO_MODIFY_FT 8 +#define PASSWORD_TO_MODIFY_ED 9 +#define CONFIRM_PASSWORD_TO_MODIFY_FT 10 +#define CONFIRM_PASSWORD_TO_MODIFY_ED 11 +#define OPTIONS_FL 12 +#define OPEN_READONLY_CB 13 +#define REMOVE_INFO_ON_SAVING_CB 14 +#define RECORD_CHANGES_CB 15 +#define CHANGE_PROTECTION_PB 16 + +#define STR_PROTECT 101 +#define STR_UNPROTECT 102 + +#endif + diff --git a/sfx2/source/dialog/securitypage.src b/sfx2/source/dialog/securitypage.src new file mode 100755 index 000000000000..32f5fac704a4 --- /dev/null +++ b/sfx2/source/dialog/securitypage.src @@ -0,0 +1,156 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "sfx2/sfx.hrc" +#include "securitypage.hrc" +#include "helpid.hrc" +#include "dialog.hrc" +#include "sfxlocal.hrc" + +#include + + +TabPage TP_DOCINFOSECURITY +{ + HelpId = HID_DOCINFOSECURITY ; + Hide = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + + FixedLine PASSWORD_TO_OPEN_FL + { + Pos = MAP_APPFONT( 6, 6 ); + Size = MAP_APPFONT( 248, RSC_CD_FIXEDLINE_HEIGHT ); + Text [ en-US ] = "File encryption password"; + }; + FixedText PASSWORD_TO_OPEN_FT + { + Pos = MAP_APPFONT( 12, 20 ); + Size = MAP_APPFONT( 82, RSC_CD_FIXEDTEXT_HEIGHT ); + Text [ en-US ] = "~Enter password to open"; + }; + Edit PASSWORD_TO_OPEN_ED + { + Pos = MAP_APPFONT( 100, 18 ); + Size = MAP_APPFONT( 88, RSC_CD_TEXTBOX_HEIGHT ); + Border = TRUE; + PassWord = TRUE; + }; + FixedText CONFIRM_PASSWORD_TO_OPEN_FT + { + Pos = MAP_APPFONT( 12, 34 ); + Size = MAP_APPFONT( 82, RSC_CD_FIXEDTEXT_HEIGHT ); + Text [ en-US ] = "~Reenter password to open"; + }; + Edit CONFIRM_PASSWORD_TO_OPEN_ED + { + Pos = MAP_APPFONT( 100, 32 ); + Size = MAP_APPFONT( 88, RSC_CD_TEXTBOX_HEIGHT ); + Border = TRUE; + PassWord = TRUE; + }; + FixedText PASSWORD_INFO_FT + { + Pos = MAP_APPFONT( 12, 48 ); + Size = MAP_APPFONT( 236, 3 * RSC_CD_FIXEDTEXT_HEIGHT ); + Text [ en-US ] = "Note: If you lose or forget the password, it cannot be recovered."\ + "It is advisable to keep passwords in a safe place."\ + "Passwords are case-sensitive."; + WordBreak = TRUE; + }; + FixedLine PASSWORD_TO_MODIFY_FL + { + Pos = MAP_APPFONT( 6, 78 ); + Size = MAP_APPFONT( 248, RSC_CD_FIXEDLINE_HEIGHT ); + Text [ en-US ] = "File sharing password"; + }; + FixedText PASSWORD_TO_MODIFY_FT + { + Pos = MAP_APPFONT( 12, 92 ); + Size = MAP_APPFONT( 82, RSC_CD_FIXEDTEXT_HEIGHT ); + Text [ en-US ] = "Enter password to modify"; + }; + Edit PASSWORD_TO_MODIFY_ED + { + Pos = MAP_APPFONT( 100, 90 ); + Size = MAP_APPFONT( 88, RSC_CD_TEXTBOX_HEIGHT ); + Border = TRUE; + PassWord = TRUE; + }; + FixedText CONFIRM_PASSWORD_TO_MODIFY_FT + { + Pos = MAP_APPFONT( 12, 106 ); + Size = MAP_APPFONT( 82, RSC_CD_FIXEDTEXT_HEIGHT ); + Text [ en-US ] = "Reenter password to modify"; + }; + Edit CONFIRM_PASSWORD_TO_MODIFY_ED + { + Pos = MAP_APPFONT( 100, 104 ); + Size = MAP_APPFONT( 88, RSC_CD_TEXTBOX_HEIGHT ); + Border = TRUE; + PassWord = TRUE; + }; + FixedLine OPTIONS_FL + { + Pos = MAP_APPFONT( 6, 120 ); + Size = MAP_APPFONT( 248, RSC_CD_FIXEDLINE_HEIGHT ); + Text [ en-US ] = "File sharing options"; + }; + CheckBox OPEN_READONLY_CB + { + Pos = MAP_APPFONT( 12, 133 ); + Size = MAP_APPFONT( 176, RSC_CD_CHECKBOX_HEIGHT ); + Text [ en-US ] = "~Open file read-only"; + }; + CheckBox REMOVE_INFO_ON_SAVING_CB + { + Pos = MAP_APPFONT( 12, 147 ); + Size = MAP_APPFONT( 176, RSC_CD_CHECKBOX_HEIGHT ); + Text [ en-US ] = "Remove personal ~information on saving"; + }; + CheckBox RECORD_CHANGES_CB + { + Pos = MAP_APPFONT( 12, 162 ); + Size = MAP_APPFONT( 176, RSC_CD_CHECKBOX_HEIGHT ); + Text [ en-US ] = "Record ~changes"; + }; + PushButton CHANGE_PROTECTION_PB + { + Pos = MAP_APPFONT( 194, 160 ); + Size = MAP_APPFONT( 60, RSC_CD_PUSHBUTTON_HEIGHT ); + }; + String STR_PROTECT + { + Text [ en-US ] = "~Protect..."; + }; + String STR_UNPROTECT + { + Text [ en-US ] = "~Unprotect..."; + }; + +}; + + diff --git a/sfx2/source/inc/helpid.hrc b/sfx2/source/inc/helpid.hrc old mode 100644 new mode 100755 index 29ad461d18da..f09ac7e94ecc --- a/sfx2/source/inc/helpid.hrc +++ b/sfx2/source/inc/helpid.hrc @@ -46,6 +46,7 @@ #define HID_DOCINFODESC (HID_SFX_START + 8) #define HID_DOCINFODOC (HID_SFX_START + 9) #define HID_DOCINFOUSER (HID_SFX_START + 10) +#define HID_DOCINFOSECURITY (HID_SFX_START + 11) #define HID_BOOKMARKPROPS (HID_SFX_START + 14) #define HID_BOOKGROUPPROPS (HID_SFX_START + 15) #define HID_BOOKFILEPROPS (HID_SFX_START + 16) -- cgit From 212d8ff7d4f100c5d72893a59c1e37d11c9582ca Mon Sep 17 00:00:00 2001 From: Andreas Bregas Date: Mon, 22 Mar 2010 13:07:57 +0100 Subject: npower14miscfixes: crlf removed --- sfx2/source/doc/objmisc.cxx | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 sfx2/source/doc/objmisc.cxx (limited to 'sfx2/source') diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx old mode 100644 new mode 100755 -- cgit From 9ed2bd2cd955daefa3eed53466dc63e8ded60d17 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Fri, 26 Mar 2010 09:35:04 +0100 Subject: tl78: #i105076# add ENCRYPTION and PASSWORDTOMODIFY filter flags --- sfx2/source/dialog/filedlghelper.cxx | 46 ++++++++++++++++++++---------------- sfx2/source/doc/docfilt.cxx | 14 ----------- 2 files changed, 26 insertions(+), 34 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 5270eb5d4207..5e4e7d88258c 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -466,23 +466,14 @@ sal_Bool FileDialogHelper_Impl::isInOpenMode() const namespace { -bool lclCheckODFPasswordCapability( const SfxFilter* pFilter ) +sal_Bool lclCheckPasswordCapability( const SfxFilter* pFilter ) { - return pFilter && pFilter->IsOwnFormat() && pFilter->UsesStorage() && (pFilter->GetVersion() >= SOFFICE_FILEFORMAT_60); + return pFilter && ( pFilter->GetFilterFlags() & SFX_FILTER_ENCRYPTION ); } -bool lclCheckMSPasswordCapability( const SfxFilter* pFilter ) +sal_Bool lclCheckPasswordToModifyCapability( const SfxFilter* pFilter ) { - // TODO #i105076# this should be in the filter configuration!!! - return pFilter && CheckMSPasswordCapabilityForExport( pFilter->GetFilterName() ); -} - -bool lclCheckPasswordCapability( const SfxFilter* pFilter ) -{ - return - lclCheckODFPasswordCapability( pFilter ) || - // TODO #i105076# this should be in the filter configuration!!! - lclCheckMSPasswordCapability( pFilter ); + return pFilter && ( pFilter->GetFilterFlags() & SFX_FILTER_PASSWORDTOMODIFY ); } } @@ -546,7 +537,7 @@ void FileDialogHelper_Impl::updateSelectionBox() return; // Does the selection box exist? - bool bSelectionBoxFound = false; + sal_Bool bSelectionBoxFound = sal_False; uno::Reference< XControlInformation > xCtrlInfo( mxFileDlg, UNO_QUERY ); if ( xCtrlInfo.is() ) { @@ -555,7 +546,7 @@ void FileDialogHelper_Impl::updateSelectionBox() for ( sal_uInt32 nCtrl = 0; nCtrl < nCount; ++nCtrl ) if ( aCtrlList[ nCtrl ].equalsAscii("SelectionBox") ) { - bSelectionBoxFound = true; + bSelectionBoxFound = sal_False; break; } } @@ -1550,6 +1541,10 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, { SFX_ITEMSET_ARG( rpSet, pPassItem, SfxStringItem, SID_PASSWORD, FALSE ); mbPwdCheckBoxState = ( pPassItem != NULL ); + + // in case the document has password to modify, the dialog should be shown + SFX_ITEMSET_ARG( rpSet, pPassToModifyItem, SfxStringItem, SID_PASSWORDTOMODIFY, FALSE ); + mbPwdCheckBoxState |= ( pPassToModifyItem && pPassToModifyItem->GetValue() ); } SFX_ITEMSET_ARG( rpSet, pSelectItem, SfxBoolItem, SID_SELECTION, FALSE ); @@ -1560,6 +1555,9 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, // the password will be set in case user decide so rpSet->ClearItem( SID_PASSWORD ); + rpSet->ClearItem( SID_RECOMMENDREADONLY ); + rpSet->ClearItem( SID_PASSWORDTOMODIFY ); + } if ( mbHasPassword && !mbPwdCheckBoxState ) @@ -1656,18 +1654,26 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, if( xInteractionHandler.is() ) { // TODO: need a save way to distinguish MS filters from other filters - bool bMSType = CheckMSPasswordCapabilityForExport( rFilter ); + sal_Bool bMSType = CheckMSPasswordCapabilityForExport( rFilter ); ::comphelper::DocPasswordRequestType eType = bMSType ? ::comphelper::DocPasswordRequestType_MS : ::comphelper::DocPasswordRequestType_STANDARD; - ::comphelper::DocPasswordRequest* pPasswordRequest = new ::comphelper::DocPasswordRequest( - eType, ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)) ); + ::rtl::Reference< ::comphelper::DocPasswordRequest > pPasswordRequest( new ::comphelper::DocPasswordRequest( eType, ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)), lclCheckPasswordToModifyCapability( getCurentSfxFilter() ) ) ); uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pPasswordRequest ); xInteractionHandler->handle( rRequest ); - if ( pPasswordRequest->isPassword() ) - rpSet->Put( SfxStringItem( SID_PASSWORD, pPasswordRequest->getPassword() ) ); + if ( pPasswordRequest->isSelected() ) + { + if ( pPasswordRequest->isPassword() ) + rpSet->Put( SfxStringItem( SID_PASSWORD, pPasswordRequest->getPassword() ) ); + + if ( pPasswordRequest->isRecommendReadOnly() ) + rpSet->Put( SfxBoolItem( SID_RECOMMENDREADONLY, sal_True ) ); + + if ( pPasswordRequest->getPasswordToModify().getLength() ) + rpSet->Put( SfxStringItem( SID_PASSWORDTOMODIFY, pPasswordRequest->getPasswordToModify() ) ); + } else return ERRCODE_ABORT; } diff --git a/sfx2/source/doc/docfilt.cxx b/sfx2/source/doc/docfilt.cxx index e955c43af705..1219d30d7b27 100644 --- a/sfx2/source/doc/docfilt.cxx +++ b/sfx2/source/doc/docfilt.cxx @@ -49,20 +49,6 @@ using namespace ::com::sun::star; -namespace sfx2 { - -// TODO #i105076# this should be in the filter configuration!!! -bool CheckMSPasswordCapabilityForExport( const String& rFilterName ) -{ - return - rFilterName.EqualsAscii( "MS Word 97" ) || - rFilterName.EqualsAscii( "MS Word 97 Vorlage" ) || - rFilterName.EqualsAscii( "MS Excel 97" ) || - rFilterName.EqualsAscii( "MS Excel 97 Vorlage/Template" ); -} - -} // namespace sfx2 - // STATIC DATA ----------------------------------------------------------- DBG_NAME(SfxFilter) -- cgit From d160fd054bc4e8c02152d7ce55f7eddbd611e01f Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Tue, 30 Mar 2010 16:47:18 +0200 Subject: tl78: #i110383# support password to modify --- sfx2/source/dialog/filedlghelper.cxx | 51 ++++++++++++++-- sfx2/source/doc/guisaveas.cxx | 109 +++++++++++++++++++++++++++++++++++ sfx2/source/doc/objstor.cxx | 51 +--------------- 3 files changed, 156 insertions(+), 55 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 5e4e7d88258c..adca8cdb7922 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -80,6 +80,7 @@ #include #include #include +#include #include #include #include @@ -1543,7 +1544,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, mbPwdCheckBoxState = ( pPassItem != NULL ); // in case the document has password to modify, the dialog should be shown - SFX_ITEMSET_ARG( rpSet, pPassToModifyItem, SfxStringItem, SID_PASSWORDTOMODIFY, FALSE ); + SFX_ITEMSET_ARG( rpSet, pPassToModifyItem, SfxUInt16Item, SID_PASSWORDTOMODIFYHASH, FALSE ); mbPwdCheckBoxState |= ( pPassToModifyItem && pPassToModifyItem->GetValue() ); } @@ -1556,7 +1557,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, // the password will be set in case user decide so rpSet->ClearItem( SID_PASSWORD ); rpSet->ClearItem( SID_RECOMMENDREADONLY ); - rpSet->ClearItem( SID_PASSWORDTOMODIFY ); + rpSet->ClearItem( SID_PASSWORDTOMODIFYHASH ); } @@ -1634,8 +1635,10 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, // set the filter getRealFilter( rFilter ); + SfxFilter* pCurrentFilter = getCurentSfxFilter(); + // fill the rpURLList - implGetAndCacheFiles(mxFileDlg, rpURLList, getCurentSfxFilter()); + implGetAndCacheFiles( mxFileDlg, rpURLList, pCurrentFilter ); if ( rpURLList == NULL || rpURLList->GetObject(0) == NULL ) return ERRCODE_ABORT; @@ -1654,12 +1657,13 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, if( xInteractionHandler.is() ) { // TODO: need a save way to distinguish MS filters from other filters - sal_Bool bMSType = CheckMSPasswordCapabilityForExport( rFilter ); + // for now MS-filters are the only alien filters that support encryption + sal_Bool bMSType = !pCurrentFilter->isOwn(); ::comphelper::DocPasswordRequestType eType = bMSType ? ::comphelper::DocPasswordRequestType_MS : ::comphelper::DocPasswordRequestType_STANDARD; - ::rtl::Reference< ::comphelper::DocPasswordRequest > pPasswordRequest( new ::comphelper::DocPasswordRequest( eType, ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)), lclCheckPasswordToModifyCapability( getCurentSfxFilter() ) ) ); + ::rtl::Reference< ::comphelper::DocPasswordRequest > pPasswordRequest( new ::comphelper::DocPasswordRequest( eType, ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)), lclCheckPasswordToModifyCapability( pCurrentFilter ) ) ); uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pPasswordRequest ); xInteractionHandler->handle( rRequest ); @@ -1672,7 +1676,42 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, rpSet->Put( SfxBoolItem( SID_RECOMMENDREADONLY, sal_True ) ); if ( pPasswordRequest->getPasswordToModify().getLength() ) - rpSet->Put( SfxStringItem( SID_PASSWORDTOMODIFY, pPasswordRequest->getPasswordToModify() ) ); + { + rtl_TextEncoding nEncoding = RTL_TEXTENCOFING_UTF8; + if ( bMSType ) + { + // if the MS-filter should be used + // use the inconsistent algorithm to find the encoding specified by MS + nEncoding = rtl_getThreadTextEncoding(); + switch( nEncoding ) + { + case RTL_TEXTENCODING_ISO_8859_15: + case RTL_TEXTENCODING_MS_874: + case RTL_TEXTENCODING_MS_1250: + case RTL_TEXTENCODING_MS_1251: + case RTL_TEXTENCODING_MS_1252: + case RTL_TEXTENCODING_MS_1253: + case RTL_TEXTENCODING_MS_1254: + case RTL_TEXTENCODING_MS_1255: + case RTL_TEXTENCODING_MS_1256: + case RTL_TEXTENCODING_MS_1257: + case RTL_TEXTENCODING_MS_1258: + case RTL_TEXTENCODING_SHIFT_JIS: + case RTL_TEXTENCODING_GB_2312: + case RTL_TEXTENCODING_BIG5: + // in case the system uses an encoding from the list above, it should be used + break; + + default: + // in case other encoding is used, use one of the encodings from the list + nEncoding = RTL_TEXTENCODING_MS_1250; + break; + } + } + + sal_uInt16 nHash = ::comphelper::DocPasswordHelper::GetXLHashAsUINT16( pPasswordRequest->getPasswordToModify(), nEncoding ); + rpSet->Put( SfxUInt16Item( SID_PASSWORDTOMODIFYHASH, nHash ) ); + } } else return ERRCODE_ABORT; diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index cbd269b41516..4993e96b40bb 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -62,6 +62,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -80,6 +83,7 @@ #include #include #include +#include #include #include "alienwarn.hxx" @@ -108,6 +112,7 @@ const ::rtl::OUString aFilterFlagsString = ::rtl::OUString::createFromAscii( " using namespace ::com::sun::star; +namespace { //------------------------------------------------------------------------- static sal_uInt16 getSlotIDFromMode( sal_Int8 nStoreMode ) { @@ -167,6 +172,88 @@ static sal_Int32 getDontFlags( sal_Int8 nStoreMode ) | ( ( ( nStoreMode & EXPORT_REQUESTED ) && !( nStoreMode & WIDEEXPORT_REQUESTED ) ) ? SFX_FILTER_IMPORT : 0 ) ); } +//========================================================================= +// class DocumentSettingsGuard +//========================================================================= + +class DocumentSettingsGuard +{ + uno::Reference< beans::XPropertySet > m_xDocumentSettings; + sal_Bool m_bPreserveReadOnly; + sal_uInt16 m_nPreserveHash; + + sal_Bool m_bReadOnlySupported; + sal_Bool m_bModifyPasswordHashSupported; + + sal_Bool m_bRestoreSettings; +public: + DocumentSettingsGuard( const uno::Reference< frame::XModel >& xModel, sal_Bool bReadOnly, sal_uInt16 nHash, sal_Bool bRestore ) + : m_bPreserveReadOnly( sal_False ) + , m_nPreserveHash( 0 ) + , m_bReadOnlySupported( sal_False ) + , m_bModifyPasswordHashSupported( sal_False ) + , m_bRestoreSettings( bRestore ) + { + try + { + uno::Reference< lang::XMultiServiceFactory > xDocSettingsSupplier( xModel, uno::UNO_QUERY_THROW ); + m_xDocumentSettings.set( + xDocSettingsSupplier->createInstance( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.Settings" ) ) ), + uno::UNO_QUERY_THROW ); + + ::rtl::OUString aLoadReadonlyString( RTL_CONSTASCII_USTRINGPARAM( "LoadReadonly" ) ); + ::rtl::OUString aModifyPasswordHashString( RTL_CONSTASCII_USTRINGPARAM( "ModifyPasswordHash" ) ); + + try + { + m_xDocumentSettings->getPropertyValue( aLoadReadonlyString ) >>= m_bPreserveReadOnly; + m_xDocumentSettings->setPropertyValue( aLoadReadonlyString, uno::makeAny( bReadOnly ) ); + m_bReadOnlySupported = sal_True; + } + catch( uno::Exception& ) + {} + + try + { + m_xDocumentSettings->getPropertyValue( aModifyPasswordHashString ) >>= m_nPreserveHash; + m_xDocumentSettings->setPropertyValue( aModifyPasswordHashString, uno::makeAny( nHash ) ); + m_bModifyPasswordHashSupported = sal_True; + } + catch( uno::Exception& ) + {} + } + catch( uno::Exception& ) + {} + + if ( ( bReadOnly && !m_bReadOnlySupported ) || ( nHash && !m_bModifyPasswordHashSupported ) ) + throw uno::RuntimeException(); // the user could provide the data, so it must be stored + } + + ~DocumentSettingsGuard() + { + if ( m_bRestoreSettings ) + { + ::rtl::OUString aLoadReadonlyString( RTL_CONSTASCII_USTRINGPARAM( "LoadReadonly" ) ); + ::rtl::OUString aModifyPasswordHashString( RTL_CONSTASCII_USTRINGPARAM( "ModifyPasswordHash" ) ); + + try + { + if ( m_bReadOnlySupported ) + m_xDocumentSettings->setPropertyValue( aLoadReadonlyString, uno::makeAny( m_bPreserveReadOnly ) ); + + if ( m_bModifyPasswordHashSupported ) + m_xDocumentSettings->setPropertyValue( aModifyPasswordHashString, uno::makeAny( m_nPreserveHash ) ); + } + catch( uno::Exception& ) + { + OSL_ASSERT( "Unexpected exception!" ); + } + } + } +}; +} // anonymous namespace + //========================================================================= // class ModelData_Impl //========================================================================= @@ -184,6 +271,9 @@ class ModelData_Impl ::comphelper::SequenceAsHashMap m_aMediaDescrHM; + sal_Bool m_bRecommendReadOnly; + sal_uInt16 m_nPasswordToModifyHash; + public: ModelData_Impl( SfxStoringHelper& aOwner, const uno::Reference< frame::XModel >& xModel, @@ -200,6 +290,9 @@ public: ::comphelper::SequenceAsHashMap& GetMediaDescr() { return m_aMediaDescrHM; } + sal_Bool IsRecommendReadOnly() { return m_bRecommendReadOnly; } + sal_uInt16 GetPasswordToModifyHash() { return m_nPasswordToModifyHash; } + const ::comphelper::SequenceAsHashMap& GetDocProps(); ::rtl::OUString GetModuleName(); @@ -252,6 +345,9 @@ ModelData_Impl::ModelData_Impl( SfxStoringHelper& aOwner, , m_pDocumentPropsHM( NULL ) , m_pModulePropsHM( NULL ) , m_aMediaDescrHM( aMediaDescr ) +, m_bRecommendReadOnly( sal_False ) +, m_nPasswordToModifyHash( 0 ) + { CheckInteractionHandler(); } @@ -916,6 +1012,17 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, ::rtl::OUString aFilterName = aStringTypeFN; + // the following two arguments can not be converted in MediaDescriptor, + // so they should be removed from the ItemSet after retrieving + SFX_ITEMSET_ARG( pDialogParams, pRecommendReadOnly, SfxBoolItem, SID_RECOMMENDREADONLY, sal_False ); + m_bRecommendReadOnly = ( pRecommendReadOnly && pRecommendReadOnly->GetValue() ); + pDialogParams->ClearItem( SID_RECOMMENDREADONLY ); + + SFX_ITEMSET_ARG( pDialogParams, pPassToModifyItem, SfxUInt16Item, SID_PASSWORDTOMODIFYHASH, sal_False ); + if ( pPassToModifyItem ) + m_nPasswordToModifyHash = pPassToModifyItem->GetValue(); + pDialogParams->ClearItem( SID_PASSWORDTOMODIFYHASH ); + uno::Sequence< beans::PropertyValue > aPropsFromDialog; TransformItems( nSlotID, *pDialogParams, aPropsFromDialog, NULL ); GetMediaDescr() << aPropsFromDialog; @@ -1500,6 +1607,8 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& // store the document and handle it's docinfo SvtSaveOptions aOptions; + DocumentSettingsGuard aSettingsGuard( aModelData.GetModel(), aModelData.IsRecommendReadOnly(), aModelData.GetPasswordToModifyHash(), nStoreMode & EXPORT_REQUESTED ); + if ( aOptions.IsDocInfoSave() && ( !aModelData.GetStorable()->hasLocation() || INetURLObject( aModelData.GetStorable()->getLocation() ) != aURL ) ) diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 593de3d181f1..b710a4b0fbfe 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -1376,7 +1376,6 @@ sal_Bool SfxObjectShell::SaveTo_Impl { if ( pFilt->GetServiceName() != rMedium.GetFilter()->GetServiceName() ) { -//REMOVE rMedium.GetStorage()->SetClass( SvFactory::GetServerName( nFormat ), nFormat, pFilt->GetTypeName() ); datatransfer::DataFlavor aDataFlavor; SotExchange::GetFormatDataFlavor( nFormat, aDataFlavor ); @@ -2093,9 +2092,6 @@ sal_Bool SfxObjectShell::DoSaveCompleted( SfxMedium* pNewMed ) } else { -//REMOVE if( pFilter->UsesStorage() ) -//REMOVE pMedium->GetStorage(); -//REMOVE else if( pMedium->GetOpenMode() & STREAM_WRITE ) if( pMedium->GetOpenMode() & STREAM_WRITE ) pMedium->GetInStream(); xStorage = GetStorage(); @@ -2632,9 +2628,6 @@ sal_Bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs ) SetError(pMediumTmp->GetErrorCode(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); -//REMOVE if ( !IsHandsOff() ) -//REMOVE pMediumTmp->Close(); - sal_Bool bOpen( sal_False ); bOpen = DoSaveCompleted( pMediumTmp ); DBG_ASSERT(bOpen,"Fehlerbehandlung fuer DoSaveCompleted nicht implementiert"); @@ -2645,13 +2638,7 @@ sal_Bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs ) SetError( pMediumTmp->GetError(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); // reconnect to object storage -//REMOVE if ( IsHandsOff() ) -//REMOVE { -//REMOVE if ( !DoSaveCompleted( pRetrMedium ) ) -//REMOVE DBG_ERROR("Case not handled - no way to get a storage!"); -//REMOVE } -//REMOVE else - DoSaveCompleted( 0 ); + DoSaveCompleted( 0 ); if( pRetrMedium->GetItemSet() ) { @@ -2910,8 +2897,6 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl else pNewFile->SetFilter( GetFactory().GetFilterContainer()->GetAnyFilter( SFX_FILTER_IMPORT | SFX_FILTER_EXPORT ) ); -//REMOVE // saving is alway done using a temporary file -//REMOVE pNewFile->CreateTempFileNoCopy(); if ( pNewFile->GetErrorCode() != ERRCODE_NONE ) { // creating temporary file failed ( f.e. floppy disk not inserted! ) @@ -2948,18 +2933,8 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl SetError( pNewFile->GetErrorCode(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); // notify the document that saving was done successfully -//REMOVE if ( bCopyTo ) -//REMOVE { -//REMOVE if ( IsHandsOff() ) -//REMOVE bOk = DoSaveCompleted( pMedium ); -//REMOVE } -//REMOVE else if ( !bCopyTo ) { - // Muss !!! -//REMOVE if ( bToOwnFormat ) -//REMOVE SetFileName( pNewFile->GetPhysicalName() ); - bOk = DoSaveCompleted( pNewFile ); } else @@ -2991,31 +2966,12 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl // by the storage DELETEZ( pNewFile ); } - - // TODO/LATER: there is no need in the following code in case HandsOff is not used, - // hope we will not have to introduce it back -//REMOVE String aPasswd; -//REMOVE if ( IsOwnStorageFormat_Impl( *GetMedium() ) && GetPasswd_Impl( GetMedium()->GetItemSet(), aPasswd ) ) -//REMOVE { -//REMOVE try -//REMOVE { -//REMOVE // the following code must throw an exception in case of failure -//REMOVE ::comphelper::OStorageHelper::SetCommonStoragePassword( GetMedium->GetStorage(), aPasswd ); -//REMOVE } -//REMOVE catch( uno::Exception& ) -//REMOVE { -//REMOVE // TODO: handle the error -//REMOVE } -//REMOVE } } else { SetError( pNewFile->GetErrorCode(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); -//REMOVE // reconnect to the old storage -//REMOVE if ( IsHandsOff() ) -//REMOVE DoSaveCompleted( pMedium ); -//REMOVE else + // reconnect to the old storage DoSaveCompleted( 0 ); DELETEZ( pNewFile ); @@ -3196,9 +3152,6 @@ sal_Bool SfxObjectShell::LoadOwnFormat( SfxMedium& rMedium ) uno::Reference< embed::XStorage > xStorage = rMedium.GetStorage(); if ( xStorage.is() ) { -//REMOVE if ( rMedium.GetFileVersion() ) -//REMOVE xStor->SetVersion( rMedium.GetFileVersion() ); - // Password SFX_ITEMSET_ARG( rMedium.GetItemSet(), pPasswdItem, SfxStringItem, SID_PASSWORD, sal_False ); if ( pPasswdItem || ERRCODE_IO_ABORT != CheckPasswd_Impl( this, SFX_APP()->GetPool(), pMedium ) ) -- cgit From 0e95d8378a6f670993a3d408d3bfe313385379e8 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Tue, 30 Mar 2010 16:34:51 +0200 Subject: tl78: #i110383# support password to modify --- sfx2/source/dialog/filedlghelper.cxx | 16 ++++++++-------- sfx2/source/doc/objcont.cxx | 17 +++++++++++++++++ sfx2/source/doc/objxtor.cxx | 1 + sfx2/source/inc/objshimp.hxx | 2 ++ 4 files changed, 28 insertions(+), 8 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index adca8cdb7922..c1b9aaf7838d 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -1635,7 +1635,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, // set the filter getRealFilter( rFilter ); - SfxFilter* pCurrentFilter = getCurentSfxFilter(); + const SfxFilter* pCurrentFilter = getCurentSfxFilter(); // fill the rpURLList implGetAndCacheFiles( mxFileDlg, rpURLList, pCurrentFilter ); @@ -1658,31 +1658,31 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, { // TODO: need a save way to distinguish MS filters from other filters // for now MS-filters are the only alien filters that support encryption - sal_Bool bMSType = !pCurrentFilter->isOwn(); + sal_Bool bMSType = !pCurrentFilter->IsOwnFormat(); ::comphelper::DocPasswordRequestType eType = bMSType ? ::comphelper::DocPasswordRequestType_MS : ::comphelper::DocPasswordRequestType_STANDARD; ::rtl::Reference< ::comphelper::DocPasswordRequest > pPasswordRequest( new ::comphelper::DocPasswordRequest( eType, ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)), lclCheckPasswordToModifyCapability( pCurrentFilter ) ) ); - uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pPasswordRequest ); + uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pPasswordRequest.get() ); xInteractionHandler->handle( rRequest ); - if ( pPasswordRequest->isSelected() ) + if ( pPasswordRequest->isPassword() ) { - if ( pPasswordRequest->isPassword() ) + if ( pPasswordRequest->getPassword().getLength() ) rpSet->Put( SfxStringItem( SID_PASSWORD, pPasswordRequest->getPassword() ) ); - if ( pPasswordRequest->isRecommendReadOnly() ) + if ( pPasswordRequest->getRecommendReadOnly() ) rpSet->Put( SfxBoolItem( SID_RECOMMENDREADONLY, sal_True ) ); if ( pPasswordRequest->getPasswordToModify().getLength() ) { - rtl_TextEncoding nEncoding = RTL_TEXTENCOFING_UTF8; + rtl_TextEncoding nEncoding = RTL_TEXTENCODING_UTF8; if ( bMSType ) { // if the MS-filter should be used // use the inconsistent algorithm to find the encoding specified by MS - nEncoding = rtl_getThreadTextEncoding(); + nEncoding = osl_getThreadTextEncoding(); switch( nEncoding ) { case RTL_TEXTENCODING_ISO_8859_15: diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index 207a5096a89a..b1a5968b2b5a 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -1479,3 +1479,20 @@ void SfxObjectShell::SetSaveVersionOnClose( sal_Bool bNew ) pImp->bSaveVersionOnClose = bNew; } +sal_uInt16 SfxObjectShell::GetModifyPasswordHash() const +{ + return pImp->m_nModifyPasswordHash; +} + +sal_Bool SfxObjectShell::SetModifyPasswordHash( sal_uInt16 nHash ) +{ + if ( !IsReadOnly() && !IsReadOnlyUI() ) + { + // the hash can be changed only in editable documents, + pImp->m_nModifyPasswordHash = nHash; + return sal_True; + } + + return sal_False; +} + diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index e3e3a36505a5..0ed230dd9dd9 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -262,6 +262,7 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,m_xDocInfoListener() ,m_bIsInit( sal_False ) ,m_bIncomplEncrWarnShown( sal_False ) + ,m_nModifyPasswordHash( 0 ) { } diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx index e015058ae280..a97018e4b3f6 100644 --- a/sfx2/source/inc/objshimp.hxx +++ b/sfx2/source/inc/objshimp.hxx @@ -170,6 +170,8 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess sal_Bool m_bIncomplEncrWarnShown; + sal_uInt16 m_nModifyPasswordHash; + SfxObjectShell_Impl( SfxObjectShell& _rDocShell ); virtual ~SfxObjectShell_Impl(); -- cgit From 67d5e1f85b4681f14e501b34a12f13e4575ac310 Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Tue, 30 Mar 2010 16:44:06 +0200 Subject: nativea: #161787# Use folder icon from Windows shell library --- sfx2/source/appl/shutdowniconw32.cxx | 40 ++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 13 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/appl/shutdowniconw32.cxx b/sfx2/source/appl/shutdowniconw32.cxx index c334fd750fc6..d5d52a02fda5 100644 --- a/sfx2/source/appl/shutdowniconw32.cxx +++ b/sfx2/source/appl/shutdowniconw32.cxx @@ -109,7 +109,7 @@ using namespace ::osl; #define ICON_TEMPLATE 16 #define ICON_MACROLIBRARY 17 #define ICON_CONFIGURATION 18 -#define ICON_OPEN 19 +#define ICON_OPEN 5 // See index of open folder icon in shell32.dll #define ICON_SETUP 500 #define SFX_TASKBAR_NOTIFICATION WM_USER+1 @@ -124,6 +124,7 @@ static void OnDrawItem(HWND hwnd, LPDRAWITEMSTRUCT lpdis); typedef struct tagMYITEM { OUString text; + OUString module; UINT iconId; } MYITEM; @@ -152,7 +153,7 @@ static bool isNT() // ------------------------------- -static void addMenuItem( HMENU hMenu, UINT id, UINT iconId, const OUString& text, int& pos, int bOwnerdraw ) +static void addMenuItem( HMENU hMenu, UINT id, UINT iconId, const OUString& text, int& pos, int bOwnerdraw, const OUString& module ) { MENUITEMINFOW mi; memset( &mi, 0, sizeof( MENUITEMINFOW ) ); @@ -175,6 +176,7 @@ static void addMenuItem( HMENU hMenu, UINT id, UINT iconId, const OUString& text MYITEM *pMyItem = new MYITEM; pMyItem->text = text; pMyItem->iconId = iconId; + pMyItem->module = module; mi.dwItemData = (DWORD) pMyItem; } else @@ -245,6 +247,8 @@ static HMENU createSystrayMenu( ) { SvtModuleOptions::E_SMATH, IDM_MATH, ICON_MATH_DOCUMENT, MATH_URL }, }; + OUString aEmpty; + // insert the menu entries for launching the applications for ( size_t i = 0; i < sizeof( aMenuItems ) / sizeof( aMenuItems[0] ); ++i ) { @@ -260,19 +264,21 @@ static HMENU createSystrayMenu( ) continue; addMenuItem( hMenu, aMenuItems[i].nMenuItemID, aMenuItems[i].nMenuIconID, - pShutdownIcon->GetUrlDescription( sURL ), pos, true ); + pShutdownIcon->GetUrlDescription( sURL ), pos, true, aEmpty ); } + + // insert the remaining menu entries addMenuItem( hMenu, IDM_TEMPLATE, ICON_TEMPLATE, - pShutdownIcon->GetResString( STR_QUICKSTART_FROMTEMPLATE ), pos, true); - addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false ); - addMenuItem( hMenu, IDM_OPEN, ICON_OPEN, pShutdownIcon->GetResString( STR_QUICKSTART_FILEOPEN ), pos, true ); - addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false ); + pShutdownIcon->GetResString( STR_QUICKSTART_FROMTEMPLATE ), pos, true, aEmpty); + addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false, aEmpty ); + addMenuItem( hMenu, IDM_OPEN, ICON_OPEN, pShutdownIcon->GetResString( STR_QUICKSTART_FILEOPEN ), pos, true, OUString::createFromAscii( "shell32" )); + addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false, aEmpty ); #endif - addMenuItem( hMenu, IDM_INSTALL,0, pShutdownIcon->GetResString( STR_QUICKSTART_PRELAUNCH ), pos, false ); - addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false ); - addMenuItem( hMenu, IDM_EXIT, 0, pShutdownIcon->GetResString( STR_QUICKSTART_EXIT ), pos, false ); + addMenuItem( hMenu, IDM_INSTALL,0, pShutdownIcon->GetResString( STR_QUICKSTART_PRELAUNCH ), pos, false, aEmpty ); + addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false, aEmpty ); + addMenuItem( hMenu, IDM_EXIT, 0, pShutdownIcon->GetResString( STR_QUICKSTART_EXIT ), pos, false, aEmpty ); // indicate status of autostart folder CheckMenuItem( hMenu, IDM_INSTALL, MF_BYCOMMAND | (ShutdownIcon::GetAutostart() ? MF_CHECKED : MF_UNCHECKED) ); @@ -738,9 +744,17 @@ void OnDrawItem(HWND /*hwnd*/, LPDRAWITEMSTRUCT lpdis) int cx = GetSystemMetrics( SM_CXSMICON ); int cy = GetSystemMetrics( SM_CYSMICON ); - HICON hIcon = (HICON) LoadImageA( GetModuleHandle( NULL ), MAKEINTRESOURCE( pMyItem->iconId ), - IMAGE_ICON, cx, cy, - LR_DEFAULTCOLOR | LR_SHARED ); + HICON hIcon( 0 ); + + if ( pMyItem->module.getLength() > 0 ) + hIcon = (HICON) LoadImageA( GetModuleHandleW( reinterpret_cast( pMyItem->module.getStr() )), + MAKEINTRESOURCE( pMyItem->iconId ), + IMAGE_ICON, cx, cy, + LR_DEFAULTCOLOR | LR_SHARED ); + else + hIcon = (HICON) LoadImageA( GetModuleHandle( NULL ), MAKEINTRESOURCE( pMyItem->iconId ), + IMAGE_ICON, cx, cy, + LR_DEFAULTCOLOR | LR_SHARED ); // DrawIconEx( lpdis->hDC, x, y+(height-cy)/2, hIcon, cx, cy, 0, NULL, DI_NORMAL ); -- cgit From 7a9501c430ba465163b9b97c7ccec032eb6c9fc3 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 30 Mar 2010 18:37:32 +0200 Subject: fwk138: #i97378#: publish DocumentProperties: publish css.document.{,X}DocumentProperties{,Supplier}. css.document.OfficeDocument: add XDocumentPropertiesSupplier. css.document.XDocumentProperties: remove css.uno.Exception from signatures. --- sfx2/source/doc/SfxDocumentMetaData.cxx | 37 +++++++++++++-------------------- 1 file changed, 14 insertions(+), 23 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index adad9cbcbf51..bde5ef6efae7 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -38,7 +38,6 @@ #include "com/sun/star/util/XModifiable.hpp" #include "com/sun/star/xml/sax/XSAXSerializable.hpp" -#include "com/sun/star/lang/NullPointerException.hpp" #include "com/sun/star/lang/WrappedTargetRuntimeException.hpp" #include "com/sun/star/lang/EventObject.hpp" #include "com/sun/star/beans/XPropertySet.hpp" @@ -248,25 +247,21 @@ public: const css::uno::Sequence< css::beans::PropertyValue > & Medium) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::io::WrongFormatException, - css::lang::WrappedTargetException, css::io::IOException, - css::uno::Exception); + css::lang::WrappedTargetException, css::io::IOException); virtual void SAL_CALL loadFromMedium(const ::rtl::OUString & URL, const css::uno::Sequence< css::beans::PropertyValue > & Medium) throw (css::uno::RuntimeException, css::io::WrongFormatException, - css::lang::WrappedTargetException, css::io::IOException, - css::uno::Exception); + css::lang::WrappedTargetException, css::io::IOException); virtual void SAL_CALL storeToStorage( const css::uno::Reference< css::embed::XStorage > & Storage, const css::uno::Sequence< css::beans::PropertyValue > & Medium) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, - css::lang::WrappedTargetException, css::io::IOException, - css::uno::Exception); + css::lang::WrappedTargetException, css::io::IOException); virtual void SAL_CALL storeToMedium(const ::rtl::OUString & URL, const css::uno::Sequence< css::beans::PropertyValue > & Medium) throw (css::uno::RuntimeException, - css::lang::WrappedTargetException, css::io::IOException, - css::uno::Exception); + css::lang::WrappedTargetException, css::io::IOException); // ::com::sun::star::lang::XInitialization: virtual void SAL_CALL initialize( @@ -1862,8 +1857,7 @@ SfxDocumentMetaData::loadFromStorage( const css::uno::Sequence< css::beans::PropertyValue > & Medium) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::io::WrongFormatException, - css::lang::WrappedTargetException, css::io::IOException, - css::uno::Exception) + css::lang::WrappedTargetException, css::io::IOException) { if (!xStorage.is()) throw css::lang::IllegalArgumentException( ::rtl::OUString::createFromAscii("SfxDocumentMetaData::loadFromStorage:" @@ -1875,10 +1869,10 @@ SfxDocumentMetaData::loadFromStorage( xStorage->openStreamElement( ::rtl::OUString::createFromAscii(s_metaXml), css::embed::ElementModes::READ) ); - if (!xStream.is()) throw css::lang::NullPointerException(); + if (!xStream.is()) throw css::uno::RuntimeException(); css::uno::Reference xInStream = xStream->getInputStream(); - if (!xInStream.is()) throw css::lang::NullPointerException(); + if (!xInStream.is()) throw css::uno::RuntimeException(); // create DOM parser service css::uno::Reference xMsf ( @@ -1942,8 +1936,7 @@ SfxDocumentMetaData::storeToStorage( const css::uno::Reference< css::embed::XStorage > & xStorage, const css::uno::Sequence< css::beans::PropertyValue > & Medium) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, - css::lang::WrappedTargetException, css::io::IOException, - css::uno::Exception) + css::lang::WrappedTargetException, css::io::IOException) { if (!xStorage.is()) throw css::lang::IllegalArgumentException( ::rtl::OUString::createFromAscii("SfxDocumentMetaData::storeToStorage:" @@ -1959,7 +1952,7 @@ SfxDocumentMetaData::storeToStorage( xStorage->openStreamElement(::rtl::OUString::createFromAscii(s_metaXml), css::embed::ElementModes::WRITE | css::embed::ElementModes::TRUNCATE); - if (!xStream.is()) throw css::lang::NullPointerException(); + if (!xStream.is()) throw css::uno::RuntimeException(); css::uno::Reference< css::beans::XPropertySet > xStreamProps(xStream, css::uno::UNO_QUERY_THROW); xStreamProps->setPropertyValue( @@ -1973,7 +1966,7 @@ SfxDocumentMetaData::storeToStorage( css::uno::makeAny(static_cast (sal_False))); css::uno::Reference xOutStream = xStream->getOutputStream(); - if (!xOutStream.is()) throw css::lang::NullPointerException(); + if (!xOutStream.is()) throw css::uno::RuntimeException(); css::uno::Reference xMsf ( m_xContext->getServiceManager()); css::uno::Reference xSaxWriter( @@ -2021,8 +2014,7 @@ void SAL_CALL SfxDocumentMetaData::loadFromMedium(const ::rtl::OUString & URL, const css::uno::Sequence< css::beans::PropertyValue > & Medium) throw (css::uno::RuntimeException, css::io::WrongFormatException, - css::lang::WrappedTargetException, css::io::IOException, - css::uno::Exception) + css::lang::WrappedTargetException, css::io::IOException) { css::uno::Reference xIn; ::comphelper::MediaDescriptor md(Medium); @@ -2056,7 +2048,7 @@ SfxDocumentMetaData::loadFromMedium(const ::rtl::OUString & URL, css::uno::makeAny(e)); } if (!xStorage.is()) { - throw css::lang::NullPointerException(::rtl::OUString::createFromAscii( + throw css::uno::RuntimeException(::rtl::OUString::createFromAscii( "SfxDocumentMetaData::loadFromMedium: cannot get Storage"), *this); } @@ -2067,8 +2059,7 @@ void SAL_CALL SfxDocumentMetaData::storeToMedium(const ::rtl::OUString & URL, const css::uno::Sequence< css::beans::PropertyValue > & Medium) throw (css::uno::RuntimeException, - css::lang::WrappedTargetException, css::io::IOException, - css::uno::Exception) + css::lang::WrappedTargetException, css::io::IOException) { ::comphelper::MediaDescriptor md(Medium); if (!URL.equalsAscii("")) { @@ -2080,7 +2071,7 @@ SfxDocumentMetaData::storeToMedium(const ::rtl::OUString & URL, if (!xStorage.is()) { - throw css::lang::NullPointerException(::rtl::OUString::createFromAscii( + throw css::uno::RuntimeException(::rtl::OUString::createFromAscii( "SfxDocumentMetaData::storeToMedium: cannot get Storage"), *this); } -- cgit From 0436f69e21da10550f3eb3af6a02800467a7bd42 Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Thu, 1 Apr 2010 09:50:13 +0200 Subject: nativea: #161787# More safe code to retrieve open icon from shell library --- sfx2/source/appl/shutdowniconw32.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'sfx2/source') diff --git a/sfx2/source/appl/shutdowniconw32.cxx b/sfx2/source/appl/shutdowniconw32.cxx index d5d52a02fda5..7dd043ad85f8 100644 --- a/sfx2/source/appl/shutdowniconw32.cxx +++ b/sfx2/source/appl/shutdowniconw32.cxx @@ -747,10 +747,19 @@ void OnDrawItem(HWND /*hwnd*/, LPDRAWITEMSTRUCT lpdis) HICON hIcon( 0 ); if ( pMyItem->module.getLength() > 0 ) - hIcon = (HICON) LoadImageA( GetModuleHandleW( reinterpret_cast( pMyItem->module.getStr() )), + { + LPCWSTR pModuleName = reinterpret_cast( pMyItem->module.getStr() ); + HMODULE hModule = GetModuleHandleW( pModuleName ); + if ( hModule == NULL ) + { + LoadLibraryW( pModuleName ); + hModule = GetModuleHandleW( pModuleName ); + } + hIcon = (HICON) LoadImageA( hModule, MAKEINTRESOURCE( pMyItem->iconId ), IMAGE_ICON, cx, cy, LR_DEFAULTCOLOR | LR_SHARED ); + } else hIcon = (HICON) LoadImageA( GetModuleHandle( NULL ), MAKEINTRESOURCE( pMyItem->iconId ), IMAGE_ICON, cx, cy, -- cgit From 34d095ff24aa6966edf988d5d3b1654ab349dd3e Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Thu, 1 Apr 2010 14:52:37 +0200 Subject: nativea: #161787# Ensure that SHELL32 is mapped when accessing via GetModuleHandle --- sfx2/source/appl/shutdowniconw32.cxx | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/appl/shutdowniconw32.cxx b/sfx2/source/appl/shutdowniconw32.cxx index 7dd043ad85f8..26fd35272a51 100644 --- a/sfx2/source/appl/shutdowniconw32.cxx +++ b/sfx2/source/appl/shutdowniconw32.cxx @@ -273,7 +273,7 @@ static HMENU createSystrayMenu( ) addMenuItem( hMenu, IDM_TEMPLATE, ICON_TEMPLATE, pShutdownIcon->GetResString( STR_QUICKSTART_FROMTEMPLATE ), pos, true, aEmpty); addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false, aEmpty ); - addMenuItem( hMenu, IDM_OPEN, ICON_OPEN, pShutdownIcon->GetResString( STR_QUICKSTART_FILEOPEN ), pos, true, OUString::createFromAscii( "shell32" )); + addMenuItem( hMenu, IDM_OPEN, ICON_OPEN, pShutdownIcon->GetResString( STR_QUICKSTART_FILEOPEN ), pos, true, OUString::createFromAscii( "SHELL32" )); addMenuItem( hMenu, static_cast< UINT >( -1 ), 0, OUString(), pos, false, aEmpty ); #endif addMenuItem( hMenu, IDM_INSTALL,0, pShutdownIcon->GetResString( STR_QUICKSTART_PRELAUNCH ), pos, false, aEmpty ); @@ -742,28 +742,25 @@ void OnDrawItem(HWND /*hwnd*/, LPDRAWITEMSTRUCT lpdis) x = aRect.left; y = aRect.top; - int cx = GetSystemMetrics( SM_CXSMICON ); - int cy = GetSystemMetrics( SM_CYSMICON ); - HICON hIcon( 0 ); + int cx = GetSystemMetrics( SM_CXSMICON ); + int cy = GetSystemMetrics( SM_CYSMICON ); + HICON hIcon( 0 ); + HMODULE hModule( GetModuleHandle( NULL ) ); if ( pMyItem->module.getLength() > 0 ) { LPCWSTR pModuleName = reinterpret_cast( pMyItem->module.getStr() ); - HMODULE hModule = GetModuleHandleW( pModuleName ); + hModule = GetModuleHandleW( pModuleName ); if ( hModule == NULL ) { LoadLibraryW( pModuleName ); hModule = GetModuleHandleW( pModuleName ); } - hIcon = (HICON) LoadImageA( hModule, - MAKEINTRESOURCE( pMyItem->iconId ), - IMAGE_ICON, cx, cy, - LR_DEFAULTCOLOR | LR_SHARED ); } - else - hIcon = (HICON) LoadImageA( GetModuleHandle( NULL ), MAKEINTRESOURCE( pMyItem->iconId ), - IMAGE_ICON, cx, cy, - LR_DEFAULTCOLOR | LR_SHARED ); + + hIcon = (HICON) LoadImageA( hModule, MAKEINTRESOURCE( pMyItem->iconId ), + IMAGE_ICON, cx, cy, + LR_DEFAULTCOLOR | LR_SHARED ); // DrawIconEx( lpdis->hDC, x, y+(height-cy)/2, hIcon, cx, cy, 0, NULL, DI_NORMAL ); -- cgit From 9ace57ec709cd618b5401da6f1ebacba5a07c1c0 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 1 Apr 2010 15:31:41 +0200 Subject: tl78: #i110383# allow to change the hash always for now --- sfx2/source/doc/objcont.cxx | 15 +++++++++------ sfx2/source/doc/objxtor.cxx | 1 + 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index b1a5968b2b5a..5d14007ec169 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -1486,13 +1486,16 @@ sal_uInt16 SfxObjectShell::GetModifyPasswordHash() const sal_Bool SfxObjectShell::SetModifyPasswordHash( sal_uInt16 nHash ) { - if ( !IsReadOnly() && !IsReadOnlyUI() ) - { - // the hash can be changed only in editable documents, +// Commented out before the solution for Saving process is found +// if ( ( !IsReadOnly() && !IsReadOnlyUI() ) +// || !(pImp->nFlagsInProgress & SFX_LOADED_MAINDOCUMENT ) ) +// { +// // the hash can be changed only in editable documents, +// // or during loading of document pImp->m_nModifyPasswordHash = nHash; return sal_True; - } - - return sal_False; +// } +// +// return sal_False; } diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 0ed230dd9dd9..0b0c356b65ed 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -261,6 +261,7 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,m_bCreateTempStor( sal_False ) ,m_xDocInfoListener() ,m_bIsInit( sal_False ) + ,m_bUIStoring( sal_False ) ,m_bIncomplEncrWarnShown( sal_False ) ,m_nModifyPasswordHash( 0 ) { -- cgit From 62eee956dbb05c25600030ab47310bf39db0c7ee Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 1 Apr 2010 15:37:38 +0200 Subject: tl78: #i110383# fix typo --- sfx2/source/doc/objxtor.cxx | 1 - 1 file changed, 1 deletion(-) (limited to 'sfx2/source') diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 0b0c356b65ed..0ed230dd9dd9 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -261,7 +261,6 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,m_bCreateTempStor( sal_False ) ,m_xDocInfoListener() ,m_bIsInit( sal_False ) - ,m_bUIStoring( sal_False ) ,m_bIncomplEncrWarnShown( sal_False ) ,m_nModifyPasswordHash( 0 ) { -- cgit From f2fffda1c70fa75f1a4ca9d33710fae3584d20f7 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 7 Apr 2010 22:36:23 +0200 Subject: slidecopy: initial, empty ToolPanelDeck in a TaskPane (docking) window --- sfx2/source/appl/appreg.cxx | 2 + sfx2/source/dialog/dialog.src | 4 + sfx2/source/dialog/makefile.mk | 3 +- sfx2/source/dialog/taskpane.cxx | 248 ++++++++++++++++++++++++++++++++++++++++ sfx2/source/inc/helpid.hrc | 1 + 5 files changed, 257 insertions(+), 1 deletion(-) create mode 100644 sfx2/source/dialog/taskpane.cxx (limited to 'sfx2/source') diff --git a/sfx2/source/appl/appreg.cxx b/sfx2/source/appl/appreg.cxx index 9e688f885e3c..2cb4453700be 100644 --- a/sfx2/source/appl/appreg.cxx +++ b/sfx2/source/appl/appreg.cxx @@ -45,6 +45,7 @@ #include "inettbc.hxx" #include "stbitem.hxx" #include +#include #include #include #include "partwnd.hxx" @@ -69,6 +70,7 @@ void SfxApplication::Registrations_Impl() // ChildWindows SfxRecordingFloatWrapper_Impl::RegisterChildWindow(); SfxNavigatorWrapper::RegisterChildWindow( FALSE, NULL, SFX_CHILDWIN_NEVERHIDE ); + ::sfx2::TaskPaneWrapper::RegisterChildWindow( TRUE ); SfxPartChildWnd_Impl::RegisterChildWindow(); SfxTemplateDialogWrapper::RegisterChildWindow(TRUE); SfxDockingWrapper::RegisterChildWindow(); diff --git a/sfx2/source/dialog/dialog.src b/sfx2/source/dialog/dialog.src index c50b17436ca6..6cafb2dc04de 100644 --- a/sfx2/source/dialog/dialog.src +++ b/sfx2/source/dialog/dialog.src @@ -254,6 +254,10 @@ String SID_NAVIGATOR { Text [ en-US ] = "Navigator"; }; +String SID_TASKPANE +{ + Text [ en-US ] = "Tasks"; +}; ErrorBox MSG_ERROR_WRONG_CONFIRM { diff --git a/sfx2/source/dialog/makefile.mk b/sfx2/source/dialog/makefile.mk index 230bbe432aea..d420a2d37918 100644 --- a/sfx2/source/dialog/makefile.mk +++ b/sfx2/source/dialog/makefile.mk @@ -72,7 +72,8 @@ SLOFILES =\ $(SLO)$/tabdlg.obj \ $(SLO)$/tplcitem.obj \ $(SLO)$/tplpitem.obj \ - $(SLO)$/versdlg.obj + $(SLO)$/versdlg.obj \ + $(SLO)$/taskpane.obj SRS1NAME=$(TARGET) SRC1FILES =\ diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx new file mode 100644 index 000000000000..e82302627e97 --- /dev/null +++ b/sfx2/source/dialog/taskpane.cxx @@ -0,0 +1,248 @@ +/************************************************************************* + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_sfx2.hxx" + +#include "sfx2/taskpane.hxx" +#include "sfx2/sfxsids.hrc" +#include "sfxresid.hxx" +#include "helpid.hrc" + +#include +#include + +#include + +//...................................................................................................................... +namespace sfx2 +{ +//...................................................................................................................... + +#define USE_DUMMY_PANEL +#if OSL_DEBUG_LEVEL > 0 + //================================================================================================================== + //= DummyPanel - declaration + //================================================================================================================== + class DummyPanel : public ::svt::ToolPanelBase + { + public: + DummyPanel( Window& i_rParent ); + virtual ~DummyPanel(); + + // IToolPanel + virtual ::rtl::OUString GetDisplayName() const; + virtual Image GetImage() const; + virtual void Activate( Window& i_rParentWindow ); + virtual void Deactivate(); + virtual void SetSizePixel( const Size& i_rPanelWindowSize ); + virtual void GrabFocus(); + virtual void Dispose(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + CreatePanelAccessible( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible + ); + + class GreenWindow : public Window + { + public: + GreenWindow( Window& i_rParent ) + :Window( &i_rParent, 0 ) + { + SetLineColor(); + SetFillColor( COL_GREEN ); + } + virtual void Paint( const Rectangle& i_rRect ) + { + DrawRect( i_rRect ); + } + }; + + private: + ::boost::scoped_ptr< Window > m_pWindow; + }; + + //================================================================================================================== + //= DummyPanel - implementation + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + DummyPanel::DummyPanel( Window& i_rParent ) + :m_pWindow( new GreenWindow( i_rParent ) ) + { + m_pWindow->SetPosSizePixel( Point(), i_rParent.GetOutputSizePixel() ); + } + + //------------------------------------------------------------------------------------------------------------------ + DummyPanel::~DummyPanel() + { + } + + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString DummyPanel::GetDisplayName() const + { + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Soylent Green" ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + Image DummyPanel::GetImage() const + { + return Image(); + } + + //------------------------------------------------------------------------------------------------------------------ + void DummyPanel::Activate( Window& i_rParentWindow ) + { + OSL_ENSURE( &i_rParentWindow == m_pWindow->GetParent(), "DummyPanel::Activate: reparenting not supported (and not expected to be needed)!" ); + (void)i_rParentWindow; + + m_pWindow->Show(); + } + + //------------------------------------------------------------------------------------------------------------------ + void DummyPanel::Deactivate() + { + m_pWindow->Hide(); + } + + //------------------------------------------------------------------------------------------------------------------ + void DummyPanel::SetSizePixel( const Size& i_rPanelWindowSize ) + { + m_pWindow->SetPosSizePixel( Point(), i_rPanelWindowSize ); + } + + //------------------------------------------------------------------------------------------------------------------ + void DummyPanel::GrabFocus() + { + m_pWindow->GrabFocus(); + } + + //------------------------------------------------------------------------------------------------------------------ + void DummyPanel::Dispose() + { + m_pWindow.reset(); + } + + //------------------------------------------------------------------------------------------------------------------ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::accessibility::XAccessible; + Reference< XAccessible > DummyPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ) + { + (void)i_rParentAccessible; + return NULL; + } + +#endif + + //================================================================================================================== + //= TaskPane_Impl + //================================================================================================================== + class TaskPane_Impl : public ::boost::noncopyable + { + public: + TaskPane_Impl( TaskPane& i_rAntiImpl ) + :m_rAntiImpl( i_rAntiImpl ) + ,m_aToolPanels( i_rAntiImpl, 0 ) + { + m_aToolPanels.Show(); +#if ( OSL_DEBUG_LEVEL > 0 ) && defined ( USE_DUMMY_PANEL ) + m_aToolPanels.InsertPanel( ::svt::PToolPanel( new DummyPanel( m_aToolPanels.GetPanelWindowAnchor() ) ), m_aToolPanels.GetPanelCount() ); +#endif + OnResize(); + } + + ~TaskPane_Impl() + { + } + + void OnResize(); + void OnGetFocus(); + + private: + TaskPane& m_rAntiImpl; + ::svt::ToolPanelDeck m_aToolPanels; + }; + + //------------------------------------------------------------------------------------------------------------------ + void TaskPane_Impl::OnResize() + { + m_aToolPanels.SetPosSizePixel( Point(), m_rAntiImpl.GetOutputSizePixel() ); + } + + //------------------------------------------------------------------------------------------------------------------ + void TaskPane_Impl::OnGetFocus() + { + m_aToolPanels.GrabFocus(); + } + + //================================================================================================================== + //= TaskPane + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + TaskPane::TaskPane( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper, Window* i_pParent, WinBits i_nBits ) + :SfxDockingWindow( i_pBindings, &i_rWrapper, i_pParent, i_nBits ) + ,m_pImpl( new TaskPane_Impl( *this ) ) + { + SetText( String( SfxResId( SID_TASKPANE ) ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + void TaskPane::GetFocus() + { + SfxDockingWindow::GetFocus(); + m_pImpl->OnGetFocus(); + } + + //------------------------------------------------------------------------------------------------------------------ + void TaskPane::Resize() + { + SfxDockingWindow::Resize(); + m_pImpl->OnResize(); + } + + //================================================================================================================== + //= TaskPaneWrapper + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + SFX_IMPL_DOCKINGWINDOW( TaskPaneWrapper, SID_TASKPANE ); + + //------------------------------------------------------------------------------------------------------------------ + TaskPaneWrapper::TaskPaneWrapper( Window* i_pParent, USHORT i_nId, SfxBindings* i_pBindings, SfxChildWinInfo* i_pInfo ) + :SfxChildWindow( i_pParent, i_nId ) + { + pWindow = new TaskPane( i_pBindings, *this, i_pParent, + WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE); + eChildAlignment = SFX_ALIGN_RIGHT; + + pWindow->SetHelpId( HID_TASKPANE_WINDOW ); + pWindow->SetOutputSizePixel( Size( 300, 450 ) ); + pWindow->Show(); + + dynamic_cast< SfxDockingWindow* >( pWindow )->Initialize( i_pInfo ); + SetHideNotDelete( TRUE ); + } + +//...................................................................................................................... +} // namespace sfx2 +//...................................................................................................................... diff --git a/sfx2/source/inc/helpid.hrc b/sfx2/source/inc/helpid.hrc index b8beacafee3a..00276dcfbebd 100644 --- a/sfx2/source/inc/helpid.hrc +++ b/sfx2/source/inc/helpid.hrc @@ -333,6 +333,7 @@ #define HID_CONFIG_SAVE (HID_SFX_START + 310) #define HID_SEARCHDIALOG (HID_SFX_START + 311) +#define HID_TASKPANE_WINDOW (HID_SFX_START + 312) #define HID_XMLSEC_WARNING_BROKENSIGNATURE (HID_SFX_START + 314) #define HID_XMLSEC_QUERY_LOSINGSIGNATURE (HID_SFX_START + 315) -- cgit From c3e8e980d1abebf984ef8f1fea8d977ec448797f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 7 Apr 2010 22:36:24 +0200 Subject: slidecopy: let the dummy/demo panel create a simple XAccessible, too --- sfx2/source/dialog/taskpane.cxx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index e82302627e97..80273f5e517a 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -34,6 +34,11 @@ #include #include +#if OSL_DEBUG_LEVEL > 0 +#include +#include +#endif + #include //...................................................................................................................... @@ -42,6 +47,7 @@ namespace sfx2 //...................................................................................................................... #define USE_DUMMY_PANEL + #if OSL_DEBUG_LEVEL > 0 //================================================================================================================== //= DummyPanel - declaration @@ -149,8 +155,14 @@ namespace sfx2 using ::com::sun::star::accessibility::XAccessible; Reference< XAccessible > DummyPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ) { - (void)i_rParentAccessible; - return NULL; + Reference< XAccessible > xPanelAccessible( m_pWindow->GetAccessible( FALSE ) ); + if ( !xPanelAccessible.is() ) + { + xPanelAccessible = m_pWindow->GetAccessible( TRUE ); + ::comphelper::OAccessibleImplementationAccess::setAccessibleParent( xPanelAccessible->getAccessibleContext(), + i_rParentAccessible ); + } + return xPanelAccessible; } #endif -- cgit From 1cf2a482871ba237ec9470b88da074b97a2dbf41 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 7 Apr 2010 22:36:26 +0200 Subject: slidecopy: improved the generic TaskPane, now filled from the configuration, including a small sample extension still some way to go .... open items include: - add to all affected applications - respect the ImageURL property of the config data - clarify how this interacts with SD's Drawing Framework, and Impress' TaskPane - re-activate the previously-active tool panel when opening the pane again - obtain the XAccessible from the tool panel - title when docked - proper TAB handling when multiple panel/drawers exist --- sfx2/source/dialog/makefile.mk | 6 +- sfx2/source/dialog/taskpane.cxx | 481 ++++++++++++++++++++++++++++++++++++---- sfx2/source/view/viewfrm.cxx | 34 +++ 3 files changed, 478 insertions(+), 43 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/makefile.mk b/sfx2/source/dialog/makefile.mk index d420a2d37918..410e971607b2 100644 --- a/sfx2/source/dialog/makefile.mk +++ b/sfx2/source/dialog/makefile.mk @@ -49,7 +49,8 @@ EXCEPTIONSFILES=\ $(SLO)$/recfloat.obj \ $(SLO)$/templdlg.obj \ $(SLO)$/dinfdlg.obj \ - $(SLO)$/dockwin.obj + $(SLO)$/dockwin.obj \ + $(SLO)$/taskpane.obj SLOFILES =\ $(EXCEPTIONSFILES) \ @@ -72,8 +73,7 @@ SLOFILES =\ $(SLO)$/tabdlg.obj \ $(SLO)$/tplcitem.obj \ $(SLO)$/tplpitem.obj \ - $(SLO)$/versdlg.obj \ - $(SLO)$/taskpane.obj + $(SLO)$/versdlg.obj SRS1NAME=$(TARGET) SRC1FILES =\ diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index 80273f5e517a..383306da42e8 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -28,11 +28,28 @@ #include "sfx2/taskpane.hxx" #include "sfx2/sfxsids.hrc" +#include "sfx2/bindings.hxx" +#include "sfx2/dispatch.hxx" #include "sfxresid.hxx" #include "helpid.hrc" +/** === begin UNO includes === **/ +#include +#include +#include +#include +#include +#include +#include +/** === end UNO includes === **/ + +#include +#include +#include +#include #include #include +#include #if OSL_DEBUG_LEVEL > 0 #include @@ -46,7 +63,31 @@ namespace sfx2 { //...................................................................................................................... -#define USE_DUMMY_PANEL + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::frame::XModuleManager; + using ::com::sun::star::container::XNameAccess; + using ::com::sun::star::view::XToolPanel; + using ::com::sun::star::ui::XUIElementFactory; + using ::com::sun::star::ui::XUIElement; + using ::com::sun::star::awt::XWindow; + using ::com::sun::star::frame::XModuleManager; + using ::com::sun::star::frame::XFrame; + using ::com::sun::star::lang::XComponent; + /** === end UNO using === **/ + namespace PosSize = ::com::sun::star::awt::PosSize; + +//#define USE_DUMMY_PANEL #if OSL_DEBUG_LEVEL > 0 //================================================================================================================== @@ -168,69 +209,76 @@ namespace sfx2 #endif //================================================================================================================== - //= TaskPane_Impl + //= helpers //================================================================================================================== - class TaskPane_Impl : public ::boost::noncopyable + namespace { - public: - TaskPane_Impl( TaskPane& i_rAntiImpl ) - :m_rAntiImpl( i_rAntiImpl ) - ,m_aToolPanels( i_rAntiImpl, 0 ) + ::rtl::OUString lcl_identifyModule( const Reference< XFrame >& i_rDocumentFrame ) { - m_aToolPanels.Show(); -#if ( OSL_DEBUG_LEVEL > 0 ) && defined ( USE_DUMMY_PANEL ) - m_aToolPanels.InsertPanel( ::svt::PToolPanel( new DummyPanel( m_aToolPanels.GetPanelWindowAnchor() ) ), m_aToolPanels.GetPanelCount() ); -#endif - OnResize(); + ::rtl::OUString sModuleName; + try + { + const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + const Reference< XModuleManager > xModuleManager( aContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); + sModuleName = xModuleManager->identify( i_rDocumentFrame ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return sModuleName; } - ~TaskPane_Impl() + ::rtl::OUString lcl_identifyModule( const SfxBindings* i_pBindings ) { + const SfxViewFrame* pViewFrame = i_pBindings->GetDispatcher()->GetFrame(); + const SfxFrame* pFrame = pViewFrame->GetFrame(); + const Reference< XFrame > xFrame( pFrame->GetFrameInterface() ); + return lcl_identifyModule( xFrame ); } - - void OnResize(); - void OnGetFocus(); - - private: - TaskPane& m_rAntiImpl; - ::svt::ToolPanelDeck m_aToolPanels; - }; - - //------------------------------------------------------------------------------------------------------------------ - void TaskPane_Impl::OnResize() - { - m_aToolPanels.SetPosSizePixel( Point(), m_rAntiImpl.GetOutputSizePixel() ); - } - - //------------------------------------------------------------------------------------------------------------------ - void TaskPane_Impl::OnGetFocus() - { - m_aToolPanels.GrabFocus(); } //================================================================================================================== - //= TaskPane + //= TaskPaneDockingWindow //================================================================================================================== //------------------------------------------------------------------------------------------------------------------ - TaskPane::TaskPane( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper, Window* i_pParent, WinBits i_nBits ) + TaskPaneDockingWindow::TaskPaneDockingWindow( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper, Window* i_pParent, WinBits i_nBits ) :SfxDockingWindow( i_pBindings, &i_rWrapper, i_pParent, i_nBits ) - ,m_pImpl( new TaskPane_Impl( *this ) ) + ,m_aTaskPane( *this, lcl_identifyModule( i_pBindings ) ) { + m_aTaskPane.Show(); SetText( String( SfxResId( SID_TASKPANE ) ) ); } //------------------------------------------------------------------------------------------------------------------ - void TaskPane::GetFocus() + void TaskPaneDockingWindow::GetFocus() { SfxDockingWindow::GetFocus(); - m_pImpl->OnGetFocus(); + m_aTaskPane.GrabFocus(); } //------------------------------------------------------------------------------------------------------------------ - void TaskPane::Resize() + void TaskPaneDockingWindow::Resize() { SfxDockingWindow::Resize(); - m_pImpl->OnResize(); + m_aTaskPane.SetPosSizePixel( Point(), GetOutputSizePixel() ); + } + + //------------------------------------------------------------------------------------------------------------------ + long TaskPaneDockingWindow::Notify( NotifyEvent& i_rNotifyEvent ) + { + // in case this is a MouseButtonDown event, consume it - VCL's DockingWindow would otherwise + // start undocking, no matter which window this event was intended for + if ( i_rNotifyEvent.GetType() == EVENT_MOUSEBUTTONDOWN ) + { + const MouseEvent& rMouseEvent = *i_rNotifyEvent.GetMouseEvent(); + if ( rMouseEvent.IsLeft() && ( rMouseEvent.GetClicks() == 1 ) && !rMouseEvent.IsMod1() ) + { + if ( m_aTaskPane.IsWindowOrChild( i_rNotifyEvent.GetWindow() ) ) + return TRUE; + } + } + return SfxDockingWindow::Notify( i_rNotifyEvent ); } //================================================================================================================== @@ -243,7 +291,7 @@ namespace sfx2 TaskPaneWrapper::TaskPaneWrapper( Window* i_pParent, USHORT i_nId, SfxBindings* i_pBindings, SfxChildWinInfo* i_pInfo ) :SfxChildWindow( i_pParent, i_nId ) { - pWindow = new TaskPane( i_pBindings, *this, i_pParent, + pWindow = new TaskPaneDockingWindow( i_pBindings, *this, i_pParent, WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE); eChildAlignment = SFX_ALIGN_RIGHT; @@ -255,6 +303,359 @@ namespace sfx2 SetHideNotDelete( TRUE ); } + //================================================================================================================== + //= CustomPanelUIElement + //================================================================================================================== + class CustomPanelUIElement + { + public: + CustomPanelUIElement() + :m_xUIElement() + ,m_xToolPanel() + ,m_xPanelWindow() + { + } + + CustomPanelUIElement( const Reference< XUIElement >& i_rUIElement ) + :m_xUIElement( i_rUIElement, UNO_SET_THROW ) + ,m_xToolPanel( i_rUIElement->getRealInterface(), UNO_QUERY_THROW ) + ,m_xPanelWindow( m_xToolPanel->getWindow(), UNO_SET_THROW ) + { + } + + bool is() const { return m_xPanelWindow.is(); } + + const Reference< XUIElement >& getUIElement() const { return m_xUIElement; } + const Reference< XToolPanel >& getToolPanel() const { return m_xToolPanel; } + const Reference< XWindow >& getPanelWindow() const { return m_xPanelWindow; } + + private: + Reference< XUIElement > m_xUIElement; + Reference< XToolPanel > m_xToolPanel; + Reference< XWindow > m_xPanelWindow; + }; + + //================================================================================================================== + //= CustomToolPanel + //================================================================================================================== + class CustomToolPanel : public ::svt::ToolPanelBase + { + public: + CustomToolPanel( const ::utl::OConfigurationNode& i_rPanelWindowState ); + + virtual ::rtl::OUString GetDisplayName() const; + virtual Image GetImage() const; + virtual void Activate( Window& i_rParentWindow ); + virtual void Deactivate(); + virtual void SetSizePixel( const Size& i_rPanelWindowSize ); + virtual void GrabFocus(); + virtual void Dispose(); + virtual Reference< XAccessible > + CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ); + + protected: + ~CustomToolPanel(); + + private: + bool impl_ensureToolPanelWindow( Window& i_rPanelParentWindow ); + + private: + const ::rtl::OUString m_sUIName; + const ::rtl::OUString m_sResourceURL; + CustomPanelUIElement m_aCustomPanel; + bool m_bAttemptedCreation; + }; + + //------------------------------------------------------------------------------------------------------------------ + CustomToolPanel::CustomToolPanel( const ::utl::OConfigurationNode& i_rPanelWindowState ) + :m_sUIName( ::comphelper::getString( i_rPanelWindowState.getNodeValue( "UIName" ) ) ) + ,m_sResourceURL( i_rPanelWindowState.getLocalName() ) + ,m_aCustomPanel() + ,m_bAttemptedCreation( false ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + CustomToolPanel::~CustomToolPanel() + { + } + + //------------------------------------------------------------------------------------------------------------------ + bool CustomToolPanel::impl_ensureToolPanelWindow( Window& i_rPanelParentWindow ) + { + if ( m_bAttemptedCreation ) + return m_aCustomPanel.is(); + + m_bAttemptedCreation = true; + try + { + const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + const Reference< XUIElementFactory > xFactory( aContext.createComponent( "com.sun.star.ui.UIElementFactoryManager" ), UNO_QUERY_THROW ); + + ::comphelper::NamedValueCollection aCreationArgs; + aCreationArgs.put( "ParentWindow", makeAny( i_rPanelParentWindow.GetComponentInterface() ) ); + + const Reference< XUIElement > xElement( + xFactory->createUIElement( m_sResourceURL, aCreationArgs.getPropertyValues() ), + UNO_SET_THROW ); + + m_aCustomPanel = CustomPanelUIElement( xElement ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return m_aCustomPanel.is(); + } + + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString CustomToolPanel::GetDisplayName() const + { + return m_sUIName; + } + + //------------------------------------------------------------------------------------------------------------------ + Image CustomToolPanel::GetImage() const + { + // TODO: read from configuration + return Image(); + } + + //------------------------------------------------------------------------------------------------------------------ + void CustomToolPanel::Activate( Window& i_rParentWindow ) + { + ENSURE_OR_RETURN_VOID( impl_ensureToolPanelWindow( i_rParentWindow ), "no panel to activate!" ); + + // TODO: we might need a mechanism to decide whether the panel should be destroyed/re-created, or (as it is + // done now) hidden/shown + m_aCustomPanel.getPanelWindow()->setVisible( sal_True ); + } + + //------------------------------------------------------------------------------------------------------------------ + void CustomToolPanel::Deactivate() + { + ENSURE_OR_RETURN_VOID( m_aCustomPanel.is(), "no panel to deactivate!" ); + + m_aCustomPanel.getPanelWindow()->setVisible( sal_False ); + } + + //------------------------------------------------------------------------------------------------------------------ + void CustomToolPanel::SetSizePixel( const Size& i_rPanelWindowSize ) + { + ENSURE_OR_RETURN_VOID( m_aCustomPanel.is(), "no panel/window to position!" ); + + try + { + m_aCustomPanel.getPanelWindow()->setPosSize( 0, 0, i_rPanelWindowSize.Width(), i_rPanelWindowSize.Height(), + PosSize::POSSIZE ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //------------------------------------------------------------------------------------------------------------------ + void CustomToolPanel::GrabFocus() + { + ENSURE_OR_RETURN_VOID( m_aCustomPanel.is(), "no panel/window to focus!" ); + + m_aCustomPanel.getPanelWindow()->setFocus(); + } + + //------------------------------------------------------------------------------------------------------------------ + void CustomToolPanel::Dispose() + { + if ( !m_bAttemptedCreation ) + // nothing to dispose + return; + + ENSURE_OR_RETURN_VOID( m_aCustomPanel.is(), "no panel to destroy!" ); + try + { + Reference< XComponent > xUIElementComponent( m_aCustomPanel.getUIElement(), UNO_QUERY_THROW ); + xUIElementComponent->dispose(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > CustomToolPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ) + { + // TODO + (void)i_rParentAccessible; + return NULL; + } + + //================================================================================================================== + //= ModuleTaskPane_Impl + //================================================================================================================== + class ModuleTaskPane_Impl : public ::boost::noncopyable + { + public: + ModuleTaskPane_Impl( ModuleTaskPane& i_rAntiImpl, const ::rtl::OUString& i_rModuleIdentifier ) + :m_rAntiImpl( i_rAntiImpl ) + ,m_sModuleIdentifier( i_rModuleIdentifier ) + ,m_aPanels( i_rAntiImpl, 0 ) + { + m_aPanels.Show(); + #if ( OSL_DEBUG_LEVEL > 0 ) && defined ( USE_DUMMY_PANEL ) + m_aPanels.InsertPanel( ::svt::PToolPanel( new DummyPanel( m_aPanels.GetPanelWindowAnchor() ) ), m_aPanels.GetPanelCount() ); + #endif + OnResize(); + impl_initFromConfiguration(); + } + + ~ModuleTaskPane_Impl() + { + } + + void OnResize(); + void OnGetFocus(); + + static bool ModuleHasToolPanels( const ::rtl::OUString& i_rModuleIdentifier ); + + private: + void impl_initFromConfiguration(); + + static ::utl::OConfigurationTreeRoot + impl_getModuleUIElementStatesConfig( const ::rtl::OUString& i_rModuleIdentifier ); + static bool + impl_isToolPanelResource( const ::rtl::OUString& i_rResourceURL ); + + private: + ModuleTaskPane& m_rAntiImpl; + ::rtl::OUString m_sModuleIdentifier; + ::svt::ToolPanelDeck m_aPanels; + }; + + //------------------------------------------------------------------------------------------------------------------ + void ModuleTaskPane_Impl::OnResize() + { + m_aPanels.SetPosSizePixel( Point(), m_rAntiImpl.GetOutputSizePixel() ); + } + + //------------------------------------------------------------------------------------------------------------------ + void ModuleTaskPane_Impl::OnGetFocus() + { + m_aPanels.GrabFocus(); + } + + //------------------------------------------------------------------------------------------------------------------ + ::utl::OConfigurationTreeRoot ModuleTaskPane_Impl::impl_getModuleUIElementStatesConfig( const ::rtl::OUString& i_rModuleIdentifier ) + { + const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + ::rtl::OUStringBuffer aPathComposer; + try + { + const Reference< XNameAccess > xModuleAccess( aContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); + const ::comphelper::NamedValueCollection aModuleProps( xModuleAccess->getByName( i_rModuleIdentifier ) ); + + const ::rtl::OUString sWindowStateRef( aModuleProps.getOrDefault( "ooSetupFactoryWindowStateConfigRef", ::rtl::OUString() ) ); + + aPathComposer.appendAscii( "org.openoffice.Office.UI." ); + aPathComposer.append( sWindowStateRef ); + aPathComposer.appendAscii( "/UIElements/States" ); + + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return ::utl::OConfigurationTreeRoot( aContext, aPathComposer.makeStringAndClear(), false ); + } + + //------------------------------------------------------------------------------------------------------------------ + bool ModuleTaskPane_Impl::impl_isToolPanelResource( const ::rtl::OUString& i_rResourceURL ) + { + return i_rResourceURL.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:resource/toolpanel/" ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + void ModuleTaskPane_Impl::impl_initFromConfiguration() + { + const ::utl::OConfigurationTreeRoot aWindowStateConfig( impl_getModuleUIElementStatesConfig( m_sModuleIdentifier ) ); + if ( !aWindowStateConfig.isValid() ) + return; + + const Sequence< ::rtl::OUString > aUIElements( aWindowStateConfig.getNodeNames() ); + for ( const ::rtl::OUString* resource = aUIElements.getConstArray(); + resource != aUIElements.getConstArray() + aUIElements.getLength(); + ++resource + ) + { + if ( !impl_isToolPanelResource( *resource ) ) + continue; + + ::utl::OConfigurationNode aResourceNode( aWindowStateConfig.openNode( *resource ) ); + ::svt::PToolPanel pCustomPanel( new CustomToolPanel( aResourceNode ) ); + m_aPanels.InsertPanel( pCustomPanel, m_aPanels.GetPanelCount() ); + } + } + + //------------------------------------------------------------------------------------------------------------------ + bool ModuleTaskPane_Impl::ModuleHasToolPanels( const ::rtl::OUString& i_rModuleIdentifier ) + { + const ::utl::OConfigurationTreeRoot aWindowStateConfig( impl_getModuleUIElementStatesConfig( i_rModuleIdentifier ) ); + if ( !aWindowStateConfig.isValid() ) + return false; + + const Sequence< ::rtl::OUString > aUIElements( aWindowStateConfig.getNodeNames() ); + for ( const ::rtl::OUString* resource = aUIElements.getConstArray(); + resource != aUIElements.getConstArray() + aUIElements.getLength(); + ++resource + ) + { + if ( impl_isToolPanelResource( *resource ) ) + return true; + } + return false; + } + + //================================================================================================================== + //= ModuleTaskPane + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + ModuleTaskPane::ModuleTaskPane( Window& i_rParentWindow, const ::rtl::OUString& i_rModuleIdentifier ) + :Window( &i_rParentWindow, 0 ) + ,m_pImpl( new ModuleTaskPane_Impl( *this, i_rModuleIdentifier ) ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + ModuleTaskPane::~ModuleTaskPane() + { + } + + //------------------------------------------------------------------------------------------------------------------ + bool ModuleTaskPane::ModuleHasToolPanels( const ::rtl::OUString& i_rModuleIdentifier ) + { + return ModuleTaskPane_Impl::ModuleHasToolPanels( i_rModuleIdentifier ); + } + + //------------------------------------------------------------------------------------------------------------------ + bool ModuleTaskPane::ModuleHasToolPanels( const Reference< XFrame >& i_rDocumentFrame ) + { + return ModuleTaskPane_Impl::ModuleHasToolPanels( lcl_identifyModule( i_rDocumentFrame ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + void ModuleTaskPane::Resize() + { + Window::Resize(); + m_pImpl->OnResize(); + } + + //------------------------------------------------------------------------------------------------------------------ + void ModuleTaskPane::GetFocus() + { + Window::GetFocus(); + m_pImpl->OnGetFocus(); + } + //...................................................................................................................... } // namespace sfx2 //...................................................................................................................... diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index ba87f0fc33ca..dad748bbd371 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -46,6 +46,7 @@ #endif #include #include +#include #include #include #include @@ -92,6 +93,8 @@ #include #include +#include + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::ucb; @@ -104,6 +107,7 @@ namespace css = ::com::sun::star; // wg. ViewFrame::Current #include "appdata.hxx" +#include #include #include #include "openflag.hxx" @@ -195,6 +199,8 @@ struct SfxViewFrame_Impl sal_Bool bEnabled:1; sal_Bool bEventFlag:1; sal_Bool bWindowWasEnabled:1; + ::boost::optional< bool > + aHasToolPanels; SfxViewFrame_Impl() : pReloader(0 ) @@ -209,6 +215,19 @@ struct SfxViewFrame_Impl } }; +//------------------------------------------------------------------------- +namespace +{ + bool moduleHasToolPanels( SfxViewFrame_Impl& i_rViewFrameImpl ) + { + if ( !i_rViewFrameImpl.aHasToolPanels ) + { + i_rViewFrameImpl.aHasToolPanels.reset( ::sfx2::ModuleTaskPane::ModuleHasToolPanels( + i_rViewFrameImpl.pFrame->GetTopFrame()->GetFrameInterface() ) ); + } + return *i_rViewFrameImpl.aHasToolPanels; + } +} //------------------------------------------------------------------------- void SfxViewFrame::SetDowning_Impl() { @@ -3750,6 +3769,21 @@ void SfxViewFrame::ChildWindowState( SfxItemSet& rState ) else if ( KnowsChildWindow(nSID) ) rState.Put( SfxBoolItem( nSID, HasChildWindow(nSID) ) ); } + else if ( nSID == SID_TASKPANE ) + { + if ( !KnowsChildWindow( nSID ) ) + { + rState.DisableItem( nSID ); + } + else if ( !moduleHasToolPanels( *pImp ) ) + { + rState.Put( SfxVisibilityItem( nSID, sal_False ) ); + } + else + { + rState.Put( SfxBoolItem( nSID, HasChildWindow( nSID ) ) ); + } + } else if ( KnowsChildWindow(nSID) ) rState.Put( SfxBoolItem( nSID, HasChildWindow(nSID) ) ); else -- cgit From 00d1c0a39e21071c94c230dbb27578347f8e6fc3 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 8 Apr 2010 09:27:41 +0200 Subject: slidecopy: A11Y support at XToolPanel --- sfx2/source/dialog/taskpane.cxx | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index 383306da42e8..c7d91df1ce6b 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -213,6 +213,7 @@ namespace sfx2 //================================================================================================================== namespace { + //-------------------------------------------------------------------------------------------------------------- ::rtl::OUString lcl_identifyModule( const Reference< XFrame >& i_rDocumentFrame ) { ::rtl::OUString sModuleName; @@ -229,6 +230,7 @@ namespace sfx2 return sModuleName; } + //-------------------------------------------------------------------------------------------------------------- ::rtl::OUString lcl_identifyModule( const SfxBindings* i_pBindings ) { const SfxViewFrame* pViewFrame = i_pBindings->GetDispatcher()->GetFrame(); @@ -236,6 +238,8 @@ namespace sfx2 const Reference< XFrame > xFrame( pFrame->GetFrameInterface() ); return lcl_identifyModule( xFrame ); } + + //-------------------------------------------------------------------------------------------------------------- } //================================================================================================================== @@ -361,9 +365,10 @@ namespace sfx2 private: const ::rtl::OUString m_sUIName; + const Image m_aPanelImage; const ::rtl::OUString m_sResourceURL; CustomPanelUIElement m_aCustomPanel; - bool m_bAttemptedCreation; + bool m_bAttemptedCreation; }; //------------------------------------------------------------------------------------------------------------------ @@ -485,9 +490,18 @@ namespace sfx2 //------------------------------------------------------------------------------------------------------------------ Reference< XAccessible > CustomToolPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ) { - // TODO - (void)i_rParentAccessible; - return NULL; + ENSURE_OR_RETURN( m_aCustomPanel.is(), "no panel to ask!", NULL ); + + Reference< XAccessible > xPanelAccessible; + try + { + xPanelAccessible.set( m_aCustomPanel.getToolPanel()->createAccessible( i_rParentAccessible ), UNO_SET_THROW ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return xPanelAccessible; } //================================================================================================================== -- cgit From ec769a41ff0ce34d345eea50d0a779c076f0b227 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 8 Apr 2010 10:38:23 +0200 Subject: slidecopy: respect the ImageURL property for custom tool panels --- sfx2/source/dialog/taskpane.cxx | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index c7d91df1ce6b..4023842f2d15 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -41,6 +41,7 @@ #include #include #include +#include /** === end UNO includes === **/ #include @@ -84,6 +85,8 @@ namespace sfx2 using ::com::sun::star::frame::XModuleManager; using ::com::sun::star::frame::XFrame; using ::com::sun::star::lang::XComponent; + using ::com::sun::star::graphic::XGraphicProvider; + using ::com::sun::star::graphic::XGraphic; /** === end UNO using === **/ namespace PosSize = ::com::sun::star::awt::PosSize; @@ -240,6 +243,29 @@ namespace sfx2 } //-------------------------------------------------------------------------------------------------------------- + Image lcl_getPanelImage( const ::utl::OConfigurationNode& i_rPanelConfigNode ) + { + const ::rtl::OUString sImageURL( ::comphelper::getString( i_rPanelConfigNode.getNodeValue( "ImageURL" ) ) ); + if ( sImageURL.getLength() ) + { + try + { + const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + const Reference< XGraphicProvider > xGraphicProvider( aContext.createComponent( "com.sun.star.graphic.GraphicProvider" ), UNO_QUERY_THROW ); + + ::comphelper::NamedValueCollection aMediaProperties; + aMediaProperties.put( "URL", sImageURL ); + + const Reference< XGraphic > xGraphic( xGraphicProvider->queryGraphic( aMediaProperties.getPropertyValues() ), UNO_SET_THROW ); + return Image( xGraphic ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + return Image(); + } } //================================================================================================================== @@ -374,6 +400,7 @@ namespace sfx2 //------------------------------------------------------------------------------------------------------------------ CustomToolPanel::CustomToolPanel( const ::utl::OConfigurationNode& i_rPanelWindowState ) :m_sUIName( ::comphelper::getString( i_rPanelWindowState.getNodeValue( "UIName" ) ) ) + ,m_aPanelImage( lcl_getPanelImage( i_rPanelWindowState ) ) ,m_sResourceURL( i_rPanelWindowState.getLocalName() ) ,m_aCustomPanel() ,m_bAttemptedCreation( false ) @@ -422,8 +449,7 @@ namespace sfx2 //------------------------------------------------------------------------------------------------------------------ Image CustomToolPanel::GetImage() const { - // TODO: read from configuration - return Image(); + return m_aPanelImage; } //------------------------------------------------------------------------------------------------------------------ -- cgit From 6afa02e3d6e6324b8d3e2ddd91fbb81c583aab83 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 8 Apr 2010 11:14:22 +0200 Subject: slidecopy: remember the tool panel's visibility states, and restore the next time --- sfx2/source/dialog/taskpane.cxx | 90 ++++++++++++++++++++++++++++------------- 1 file changed, 61 insertions(+), 29 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index 4023842f2d15..2ab3e7420632 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -216,6 +216,35 @@ namespace sfx2 //================================================================================================================== namespace { + //-------------------------------------------------------------------------------------------------------------- + ::utl::OConfigurationTreeRoot lcl_getModuleUIElementStatesConfig( const ::rtl::OUString& i_rModuleIdentifier, + const ::rtl::OUString& i_rResourceURL = ::rtl::OUString() ) + { + const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + ::rtl::OUStringBuffer aPathComposer; + try + { + const Reference< XNameAccess > xModuleAccess( aContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); + const ::comphelper::NamedValueCollection aModuleProps( xModuleAccess->getByName( i_rModuleIdentifier ) ); + + const ::rtl::OUString sWindowStateRef( aModuleProps.getOrDefault( "ooSetupFactoryWindowStateConfigRef", ::rtl::OUString() ) ); + + aPathComposer.appendAscii( "org.openoffice.Office.UI." ); + aPathComposer.append( sWindowStateRef ); + aPathComposer.appendAscii( "/UIElements/States" ); + if ( i_rResourceURL.getLength() ) + { + aPathComposer.appendAscii( "/" ); + aPathComposer.append( i_rResourceURL ); + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return ::utl::OConfigurationTreeRoot( aContext, aPathComposer.makeStringAndClear(), false ); + } + //-------------------------------------------------------------------------------------------------------------- ::rtl::OUString lcl_identifyModule( const Reference< XFrame >& i_rDocumentFrame ) { @@ -388,11 +417,13 @@ namespace sfx2 private: bool impl_ensureToolPanelWindow( Window& i_rPanelParentWindow ); + void impl_updatePanelConfig( const bool i_bVisible ) const; private: const ::rtl::OUString m_sUIName; const Image m_aPanelImage; const ::rtl::OUString m_sResourceURL; + const ::rtl::OUString m_sPanelConfigPath; CustomPanelUIElement m_aCustomPanel; bool m_bAttemptedCreation; }; @@ -402,6 +433,7 @@ namespace sfx2 :m_sUIName( ::comphelper::getString( i_rPanelWindowState.getNodeValue( "UIName" ) ) ) ,m_aPanelImage( lcl_getPanelImage( i_rPanelWindowState ) ) ,m_sResourceURL( i_rPanelWindowState.getLocalName() ) + ,m_sPanelConfigPath( i_rPanelWindowState.getNodePath() ) ,m_aCustomPanel() ,m_bAttemptedCreation( false ) { @@ -440,6 +472,16 @@ namespace sfx2 return m_aCustomPanel.is(); } + //------------------------------------------------------------------------------------------------------------------ + void CustomToolPanel::impl_updatePanelConfig( const bool i_bVisible ) const + { + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + ::utl::OConfigurationTreeRoot aConfig( aContext, m_sPanelConfigPath, true ); + + aConfig.setNodeValue( "Visible", makeAny( i_bVisible ) ); + aConfig.commit(); + } + //------------------------------------------------------------------------------------------------------------------ ::rtl::OUString CustomToolPanel::GetDisplayName() const { @@ -460,6 +502,9 @@ namespace sfx2 // TODO: we might need a mechanism to decide whether the panel should be destroyed/re-created, or (as it is // done now) hidden/shown m_aCustomPanel.getPanelWindow()->setVisible( sal_True ); + + // update the panel's configuration + impl_updatePanelConfig( true ); } //------------------------------------------------------------------------------------------------------------------ @@ -468,6 +513,9 @@ namespace sfx2 ENSURE_OR_RETURN_VOID( m_aCustomPanel.is(), "no panel to deactivate!" ); m_aCustomPanel.getPanelWindow()->setVisible( sal_False ); + + // update the panel's configuration + impl_updatePanelConfig( false ); } //------------------------------------------------------------------------------------------------------------------ @@ -561,8 +609,6 @@ namespace sfx2 private: void impl_initFromConfiguration(); - static ::utl::OConfigurationTreeRoot - impl_getModuleUIElementStatesConfig( const ::rtl::OUString& i_rModuleIdentifier ); static bool impl_isToolPanelResource( const ::rtl::OUString& i_rResourceURL ); @@ -584,30 +630,6 @@ namespace sfx2 m_aPanels.GrabFocus(); } - //------------------------------------------------------------------------------------------------------------------ - ::utl::OConfigurationTreeRoot ModuleTaskPane_Impl::impl_getModuleUIElementStatesConfig( const ::rtl::OUString& i_rModuleIdentifier ) - { - const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - ::rtl::OUStringBuffer aPathComposer; - try - { - const Reference< XNameAccess > xModuleAccess( aContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); - const ::comphelper::NamedValueCollection aModuleProps( xModuleAccess->getByName( i_rModuleIdentifier ) ); - - const ::rtl::OUString sWindowStateRef( aModuleProps.getOrDefault( "ooSetupFactoryWindowStateConfigRef", ::rtl::OUString() ) ); - - aPathComposer.appendAscii( "org.openoffice.Office.UI." ); - aPathComposer.append( sWindowStateRef ); - aPathComposer.appendAscii( "/UIElements/States" ); - - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return ::utl::OConfigurationTreeRoot( aContext, aPathComposer.makeStringAndClear(), false ); - } - //------------------------------------------------------------------------------------------------------------------ bool ModuleTaskPane_Impl::impl_isToolPanelResource( const ::rtl::OUString& i_rResourceURL ) { @@ -617,10 +639,12 @@ namespace sfx2 //------------------------------------------------------------------------------------------------------------------ void ModuleTaskPane_Impl::impl_initFromConfiguration() { - const ::utl::OConfigurationTreeRoot aWindowStateConfig( impl_getModuleUIElementStatesConfig( m_sModuleIdentifier ) ); + const ::utl::OConfigurationTreeRoot aWindowStateConfig( lcl_getModuleUIElementStatesConfig( m_sModuleIdentifier ) ); if ( !aWindowStateConfig.isValid() ) return; + size_t nFirstVisiblePanel = size_t( -1 ); + const Sequence< ::rtl::OUString > aUIElements( aWindowStateConfig.getNodeNames() ); for ( const ::rtl::OUString* resource = aUIElements.getConstArray(); resource != aUIElements.getConstArray() + aUIElements.getLength(); @@ -632,14 +656,22 @@ namespace sfx2 ::utl::OConfigurationNode aResourceNode( aWindowStateConfig.openNode( *resource ) ); ::svt::PToolPanel pCustomPanel( new CustomToolPanel( aResourceNode ) ); - m_aPanels.InsertPanel( pCustomPanel, m_aPanels.GetPanelCount() ); + size_t nPanelPos = m_aPanels.InsertPanel( pCustomPanel, m_aPanels.GetPanelCount() ); + + if ( ::comphelper::getBOOL( aResourceNode.getNodeValue( "Visible" ) ) ) + nFirstVisiblePanel = nPanelPos; + } + + if ( nFirstVisiblePanel != size_t( -1 ) ) + { + m_aPanels.ActivatePanel( nFirstVisiblePanel ); } } //------------------------------------------------------------------------------------------------------------------ bool ModuleTaskPane_Impl::ModuleHasToolPanels( const ::rtl::OUString& i_rModuleIdentifier ) { - const ::utl::OConfigurationTreeRoot aWindowStateConfig( impl_getModuleUIElementStatesConfig( i_rModuleIdentifier ) ); + const ::utl::OConfigurationTreeRoot aWindowStateConfig( lcl_getModuleUIElementStatesConfig( i_rModuleIdentifier ) ); if ( !aWindowStateConfig.isValid() ) return false; -- cgit From d14f4691292d5fee516704b6a0aa12f71495a6c0 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 8 Apr 2010 11:32:16 +0200 Subject: slidecopy: default WinBits to WB_DIALOGCONTROL --- sfx2/source/dialog/taskpane.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index 2ab3e7420632..e21edd20afa3 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -587,7 +587,7 @@ namespace sfx2 ModuleTaskPane_Impl( ModuleTaskPane& i_rAntiImpl, const ::rtl::OUString& i_rModuleIdentifier ) :m_rAntiImpl( i_rAntiImpl ) ,m_sModuleIdentifier( i_rModuleIdentifier ) - ,m_aPanels( i_rAntiImpl, 0 ) + ,m_aPanels( i_rAntiImpl ) { m_aPanels.Show(); #if ( OSL_DEBUG_LEVEL > 0 ) && defined ( USE_DUMMY_PANEL ) -- cgit From b1ee1a36d25cf50839def4696dacc75c0bbf3415 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 8 Apr 2010 12:06:22 +0200 Subject: slidecopy: assert when SID_TASKPANE state is requested and we do not know such a child window --- sfx2/source/view/viewfrm.cxx | 1 + 1 file changed, 1 insertion(+) (limited to 'sfx2/source') diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index dad748bbd371..5bfa15b368c4 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -3773,6 +3773,7 @@ void SfxViewFrame::ChildWindowState( SfxItemSet& rState ) { if ( !KnowsChildWindow( nSID ) ) { + OSL_ENSURE( false, "SID_TASKPANE state requested, but no task pane child window exists for this ID!" ); rState.DisableItem( nSID ); } else if ( !moduleHasToolPanels( *pImp ) ) -- cgit From dd69dd837a389426253bdb7e01da78352a1f276a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 9 Apr 2010 09:21:37 +0200 Subject: slidecopy: moved SD's version of DockingWindows (bearing a title bar, and a closer when docked) to SFX, and based the new TaskPane on it --- sfx2/source/dialog/makefile.mk | 10 +- sfx2/source/dialog/taskpane.cxx | 13 +- sfx2/source/dialog/titledockwin.cxx | 349 ++++++++++++++++++++++++++++++++++++ sfx2/source/dialog/titledockwin.src | 43 +++++ sfx2/source/inc/sfxlocal.hrc | 9 +- 5 files changed, 411 insertions(+), 13 deletions(-) create mode 100644 sfx2/source/dialog/titledockwin.cxx create mode 100644 sfx2/source/dialog/titledockwin.src (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/makefile.mk b/sfx2/source/dialog/makefile.mk index 410e971607b2..2f5377e12fe8 100644 --- a/sfx2/source/dialog/makefile.mk +++ b/sfx2/source/dialog/makefile.mk @@ -73,7 +73,8 @@ SLOFILES =\ $(SLO)$/tabdlg.obj \ $(SLO)$/tplcitem.obj \ $(SLO)$/tplpitem.obj \ - $(SLO)$/versdlg.obj + $(SLO)$/versdlg.obj \ + $(SLO)$/titledockwin.obj SRS1NAME=$(TARGET) SRC1FILES =\ @@ -90,7 +91,8 @@ SRC1FILES =\ templdlg.src \ versdlg.src \ printopt.src \ - srchdlg.src + srchdlg.src \ + titledockwin.src .IF "$(BUILD_VER_STRING)"!="" .IF "$(GUI)"=="UNX" @@ -107,9 +109,9 @@ CFLAGS+=-DBUILD_VER_STRING="$(subst,",\" "$(BUILD_VER_STRING)")" $(INCCOM)$/cuilib.hxx: makefile.mk .IF "$(GUI)"=="UNX" $(RM) $@ - echo \#define DLL_NAME \"libcui$(DLLPOSTFIX)$(DLLPOST)\" >$@ + @echo \#define DLL_NAME \"libcui$(DLLPOSTFIX)$(DLLPOST)\" >$@ .ELSE - echo $(EMQ)#define DLL_NAME $(EMQ)"cui$(DLLPOSTFIX)$(DLLPOST)$(EMQ)" >$@ + @echo $(EMQ)#define DLL_NAME $(EMQ)"cui$(DLLPOSTFIX)$(DLLPOST)$(EMQ)" >$@ .ENDIF $(SLO)$/sfxdlg.obj : $(INCCOM)$/cuilib.hxx diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index e21edd20afa3..02917079cf0e 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -302,8 +302,8 @@ namespace sfx2 //================================================================================================================== //------------------------------------------------------------------------------------------------------------------ TaskPaneDockingWindow::TaskPaneDockingWindow( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper, Window* i_pParent, WinBits i_nBits ) - :SfxDockingWindow( i_pBindings, &i_rWrapper, i_pParent, i_nBits ) - ,m_aTaskPane( *this, lcl_identifyModule( i_pBindings ) ) + :TitledDockingWindow( i_pBindings, &i_rWrapper, i_pParent, i_nBits ) + ,m_aTaskPane( GetContentWindow(), lcl_identifyModule( i_pBindings ) ) { m_aTaskPane.Show(); SetText( String( SfxResId( SID_TASKPANE ) ) ); @@ -312,15 +312,14 @@ namespace sfx2 //------------------------------------------------------------------------------------------------------------------ void TaskPaneDockingWindow::GetFocus() { - SfxDockingWindow::GetFocus(); + TitledDockingWindow::GetFocus(); m_aTaskPane.GrabFocus(); } //------------------------------------------------------------------------------------------------------------------ - void TaskPaneDockingWindow::Resize() + void TaskPaneDockingWindow::onLayoutDone() { - SfxDockingWindow::Resize(); - m_aTaskPane.SetPosSizePixel( Point(), GetOutputSizePixel() ); + m_aTaskPane.SetPosSizePixel( Point(), GetContentWindow().GetOutputSizePixel() ); } //------------------------------------------------------------------------------------------------------------------ @@ -337,7 +336,7 @@ namespace sfx2 return TRUE; } } - return SfxDockingWindow::Notify( i_rNotifyEvent ); + return TitledDockingWindow::Notify( i_rNotifyEvent ); } //================================================================================================================== diff --git a/sfx2/source/dialog/titledockwin.cxx b/sfx2/source/dialog/titledockwin.cxx new file mode 100644 index 000000000000..e7593ec15f27 --- /dev/null +++ b/sfx2/source/dialog/titledockwin.cxx @@ -0,0 +1,349 @@ +/************************************************************************* + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_sfx2.hxx" + +#include "sfx2/titledockwin.hxx" +#include "sfx2/bindings.hxx" +#include "sfx2/dispatch.hxx" +#include "sfxlocal.hrc" +#include "sfxresid.hxx" + +#include + +//...................................................................................................................... +namespace sfx2 +{ +//...................................................................................................................... + + //================================================================================================================== + //= TitledDockingWindow + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + TitledDockingWindow::TitledDockingWindow( SfxBindings* i_pBindings, SfxChildWindow* i_pChildWindow, Window* i_pParent, + WinBits i_nStyle ) + :SfxDockingWindow( i_pBindings, i_pChildWindow, i_pParent, i_nStyle ) + ,m_sTitle() + ,m_aToolbox( this ) + ,m_aContentWindow( this ) + ,m_aBorder( 3, 1, 3, 3 ) + ,m_bLayoutPending( false ) + { + impl_construct(); + } + + //------------------------------------------------------------------------------------------------------------------ + TitledDockingWindow::TitledDockingWindow( SfxBindings* i_pBindings, SfxChildWindow* i_pChildWindow, Window* i_pParent, + const ResId& i_rResId ) + :SfxDockingWindow( i_pBindings, i_pChildWindow, i_pParent, i_rResId ) + ,m_sTitle() + ,m_aToolbox( this ) + ,m_aContentWindow( this ) + ,m_aBorder( 3, 1, 3, 3 ) + ,m_bLayoutPending( false ) + { + impl_construct(); + } + + //------------------------------------------------------------------------------------------------------------------ + void TitledDockingWindow::impl_construct() + { + SetBackground( Wallpaper() ); + + m_aToolbox.SetSelectHdl( LINK( this, TitledDockingWindow, OnToolboxItemSelected ) ); + m_aToolbox.SetOutStyle( TOOLBOX_STYLE_FLAT ); + m_aToolbox.SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetDialogColor() ) ); + m_aToolbox.Show(); + impl_resetToolBox(); + + m_aContentWindow.Show(); + } + + //------------------------------------------------------------------------------------------------------------------ + TitledDockingWindow::~TitledDockingWindow() + { + } + + //------------------------------------------------------------------------------------------------------------------ + void TitledDockingWindow::SetTitle( const String& i_rTitle ) + { + m_sTitle = i_rTitle; + Invalidate(); + } + + //------------------------------------------------------------------------------------------------------------------ + void TitledDockingWindow::SetText( const String& i_rText ) + { + SfxDockingWindow::SetText( i_rText ); + if ( m_sTitle.Len() == 0 ) + // our text is used as title, too => repaint + Invalidate(); + } + + //------------------------------------------------------------------------------------------------------------------ + void TitledDockingWindow::Resize() + { + SfxDockingWindow::Resize(); + impl_scheduleLayout(); + } + + //------------------------------------------------------------------------------------------------------------------ + void TitledDockingWindow::onLayoutDone() + { + // not interested in + } + + //------------------------------------------------------------------------------------------------------------------ + void TitledDockingWindow::impl_scheduleLayout() + { + m_bLayoutPending = true; + } + + //------------------------------------------------------------------------------------------------------------------ + void TitledDockingWindow::impl_layout() + { + m_bLayoutPending = false; + + m_aToolbox.ShowItem( 1, !IsFloatingMode() ); + + const Size aToolBoxSize( m_aToolbox.CalcWindowSizePixel() ); + Size aWindowSize( GetOutputSizePixel() ); + + // position the tool box + int nTitleBarHeight( GetSettings().GetStyleSettings().GetTitleHeight() ); + if ( aToolBoxSize.Height() > nTitleBarHeight ) + nTitleBarHeight = aToolBoxSize.Height(); + m_aToolbox.SetPosSizePixel( + Point( + aWindowSize.Width() - aToolBoxSize.Width(), + ( nTitleBarHeight - aToolBoxSize.Height() ) / 2 + ), + aToolBoxSize + ); + + // Place the content window. + if ( nTitleBarHeight < aToolBoxSize.Height() ) + nTitleBarHeight = aToolBoxSize.Height(); + aWindowSize.Height() -= nTitleBarHeight; + m_aContentWindow.SetPosSizePixel( + Point( m_aBorder.Left(), nTitleBarHeight + m_aBorder.Top() ), + Size( + aWindowSize.Width() - m_aBorder.Left() - m_aBorder.Right(), + aWindowSize.Height() - m_aBorder.Top() - m_aBorder.Bottom() + ) + ); + + onLayoutDone(); + } + + //------------------------------------------------------------------------------------------------------------------ + void TitledDockingWindow::Paint( const Rectangle& i_rArea ) + { + if ( m_bLayoutPending ) + impl_layout(); + + SfxDockingWindow::Paint( i_rArea ); + + Push( PUSH_FONT | PUSH_FILLCOLOR | PUSH_LINECOLOR ); + + int nTitleBarHeight( GetSettings().GetStyleSettings().GetTitleHeight() ); + const Size aToolBoxSize = m_aToolbox.CalcWindowSizePixel(); + if ( aToolBoxSize.Height() > nTitleBarHeight ) + nTitleBarHeight = aToolBoxSize.Height(); + + SetFillColor( GetSettings().GetStyleSettings().GetDialogColor() ); + SetLineColor(); + + // bold font + Font aFont( GetFont() ); + aFont.SetWeight( WEIGHT_BOLD ); + SetFont( aFont ); + + // Set border values. + Size aWindowSize( GetOutputSizePixel() ); + int nOuterLeft = 0; + int nInnerLeft = nOuterLeft + m_aBorder.Left() - 1; + int nOuterRight = aWindowSize.Width() - 1; + int nInnerRight = nOuterRight - m_aBorder.Right() + 1; + int nInnerTop = nTitleBarHeight + m_aBorder.Top() - 1; + int nOuterBottom = aWindowSize.Height() - 1; + int nInnerBottom = nOuterBottom - m_aBorder.Bottom() + 1; + + // Paint title bar background. + Rectangle aTitleBarBox( Rectangle( + nOuterLeft, + 0, + nOuterRight, + nInnerTop-1 + ) ); + DrawRect( aTitleBarBox ); + + if ( nInnerLeft > nOuterLeft ) + DrawRect( Rectangle( nOuterLeft, nInnerTop, nInnerLeft, nInnerBottom ) ); + if ( nOuterRight > nInnerRight ) + DrawRect( Rectangle( nInnerRight, nInnerTop, nOuterRight, nInnerBottom ) ); + if ( nInnerBottom < nOuterBottom ) + DrawRect( Rectangle( nOuterLeft, nInnerBottom, nOuterRight, nOuterBottom ) ); + + // Paint bevel border. + SetFillColor(); + SetLineColor( GetSettings().GetStyleSettings().GetShadowColor() ); + if ( m_aBorder.Top() > 0 ) + DrawLine( Point( nInnerLeft, nInnerTop ), Point( nInnerLeft, nInnerBottom ) ); + if ( m_aBorder.Left() > 0 ) + DrawLine( Point( nInnerLeft, nInnerTop ), Point( nInnerRight, nInnerTop ) ); + + SetLineColor( GetSettings().GetStyleSettings().GetLightColor() ); + if ( m_aBorder.Bottom() > 0 ) + DrawLine( Point( nInnerRight, nInnerBottom ), Point( nInnerLeft, nInnerBottom ) ); + if ( m_aBorder.Right() > 0 ) + DrawLine( Point( nInnerRight, nInnerBottom ), Point( nInnerRight, nInnerTop ) ); + + // Paint title bar text. + SetLineColor( GetSettings().GetStyleSettings().GetActiveTextColor() ); + aTitleBarBox.Left() += 3; + DrawText( aTitleBarBox, impl_getTitle(), TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK ); + + // Restore original values of the output device. + Pop(); + } + + //------------------------------------------------------------------------------------------------------------------ + String TitledDockingWindow::impl_getTitle() const + { + return m_sTitle.Len() ? m_sTitle : GetText(); + } + + //------------------------------------------------------------------------------------------------------------------ + void TitledDockingWindow::impl_resetToolBox() + { + m_aToolbox.Clear(); + + // Get the closer bitmap and set it as right most button. + Image aImage( SfxResId( SFX_IMG_CLOSE_DOC ) ); + Image aImageHC( SfxResId( SFX_IMG_CLOSE_DOC_HC ) ); + m_aToolbox.InsertItem( 1, + GetSettings().GetStyleSettings().GetHighContrastMode() + ? aImageHC + : aImage + ); + m_aToolbox.ShowItem( 1 ); + } + + //------------------------------------------------------------------------------------------------------------------ + USHORT TitledDockingWindow::impl_addDropDownToolBoxItem( const String& i_rItemText, ULONG i_nHelpId, const Link& i_rCallback ) + { + // Add the menu before the closer button. + const USHORT nItemCount( m_aToolbox.GetItemCount() ); + const USHORT nItemId( nItemCount + 1 ); + m_aToolbox.InsertItem( nItemId, i_rItemText, TIB_DROPDOWNONLY, nItemCount > 0 ? nItemCount - 1 : TOOLBOX_APPEND ); + m_aToolbox.SetHelpId( nItemId, i_nHelpId ); + m_aToolbox.SetClickHdl( i_rCallback ); + m_aToolbox.SetDropdownClickHdl( i_rCallback ); + + // The tool box has likely changed its size. The title bar has to be + // resized. + impl_scheduleLayout(); + Invalidate(); + + return nItemId; + } + + //------------------------------------------------------------------------------------------------------------------ + IMPL_LINK( TitledDockingWindow, OnToolboxItemSelected, ToolBox*, pToolBox ) + { + const USHORT nId = pToolBox->GetCurItemId(); + + if ( nId == 1 ) + { + // the closer + EndTracking(); + const sal_uInt16 nChildWindowId( GetChildWindow_Impl()->GetType() ); + const SfxBoolItem aVisibility( nChildWindowId, FALSE ); + GetBindings().GetDispatcher()->Execute( + nChildWindowId, + SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, + &aVisibility, + NULL + ); + } + + return 0; + } + + //------------------------------------------------------------------------------------------------------------------ + void TitledDockingWindow::StateChanged( StateChangedType i_nType ) + { + switch ( i_nType ) + { + case STATE_CHANGE_INITSHOW: + impl_scheduleLayout(); + break; + } + SfxDockingWindow::StateChanged( i_nType ); + } + + //------------------------------------------------------------------------------------------------------------------ + void TitledDockingWindow::DataChanged( const DataChangedEvent& i_rDataChangedEvent ) + { + SfxDockingWindow::DataChanged( i_rDataChangedEvent ); + + switch ( i_rDataChangedEvent.GetType() ) + { + case DATACHANGED_SETTINGS: + if ( ( i_rDataChangedEvent.GetFlags() & SETTINGS_STYLE ) == 0) + break; + // else fall through. + case DATACHANGED_FONTS: + case DATACHANGED_FONTSUBSTITUTION: + { + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + + // Font. + Font aFont = rStyleSettings.GetAppFont(); + if ( IsControlFont() ) + aFont.Merge( GetControlFont() ); + SetZoomedPointFont( aFont ); + + // Color. + Color aColor; + if ( IsControlForeground() ) + aColor = GetControlForeground(); + else + aColor = rStyleSettings.GetButtonTextColor(); + SetTextColor( aColor ); + SetTextFillColor(); + + impl_scheduleLayout(); + Invalidate(); + } + break; + } + } + +//...................................................................................................................... +} // namespace sfx2 +//...................................................................................................................... diff --git a/sfx2/source/dialog/titledockwin.src b/sfx2/source/dialog/titledockwin.src new file mode 100644 index 000000000000..fb77a6fc8931 --- /dev/null +++ b/sfx2/source/dialog/titledockwin.src @@ -0,0 +1,43 @@ +/************************************************************************* + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include +#include "sfxlocal.hrc" + +Image SFX_IMG_CLOSE_DOC +{ + ImageBitmap = Bitmap { File = "closedoc.png" ; }; +}; + +Image SFX_IMG_CLOSE_DOC_HC +{ + ImageBitmap = Bitmap { File = "closedochc.png" ; }; +}; + +String STR_SFX_TASKS +{ + Text [ en-US ] = "Tasks"; +}; diff --git a/sfx2/source/inc/sfxlocal.hrc b/sfx2/source/inc/sfxlocal.hrc index bc7d267d75d8..2929b69ef1dd 100644 --- a/sfx2/source/inc/sfxlocal.hrc +++ b/sfx2/source/inc/sfxlocal.hrc @@ -47,6 +47,7 @@ #define STR_SFX_EXPLORERFILE_BUTTONINSERT (RID_SFX_SFXLOCAL_START + 4) #define STR_SFX_IMPORT_ALL (RID_SFX_SFXLOCAL_START + 5) #define STR_SFX_EXPLORERFILE_EXPORT (RID_SFX_SFXLOCAL_START + 6) +#define STR_SFX_TASKS (RID_SFX_SFXLOCAL_START + 7) // Controls -------------------------------------------------------------- @@ -58,13 +59,17 @@ #define SFX_PB_PROPERTY_REMOVE (RID_SFX_SFXLOCAL_START + 5) #define SFX_WIN_PROPERTY_YESNO (RID_SFX_SFXLOCAL_START + 6) #define SFX_QB_WRONG_TYPE (RID_SFX_SFXLOCAL_START + 7) -#define SFX_IMG_PROPERTY_REMOVE (RID_SFX_SFXLOCAL_START + 8) -#define SFX_IMG_PROPERTY_REMOVE_HC (RID_SFX_SFXLOCAL_START + 9) #define SFX_FLD_DATE (RID_SFX_SFXLOCAL_START + 10) #define SFX_FLD_TIME (RID_SFX_SFXLOCAL_START + 11) #define SFX_FLD_DURATION (RID_SFX_SFXLOCAL_START + 12) #define SFX_ST_DURATION_FORMAT (RID_SFX_SFXLOCAL_START + 13) +// Images ---------------------------------------------------------------- + +#define SFX_IMG_PROPERTY_REMOVE (RID_SFX_SFXLOCAL_START + 0) +#define SFX_IMG_PROPERTY_REMOVE_HC (RID_SFX_SFXLOCAL_START + 1) +#define SFX_IMG_CLOSE_DOC (RID_SFX_SFXLOCAL_START + 2) +#define SFX_IMG_CLOSE_DOC_HC (RID_SFX_SFXLOCAL_START + 3) #endif -- cgit From d30937f3ef1f1c8c2f38d0923ab30607c0aceb7f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 9 Apr 2010 11:05:09 +0200 Subject: slidecopy: separate resource ID number circles for svl and svtools (thanks to MBA for the patch) --- sfx2/source/appl/appinit.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sfx2/source') diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx index 837ccc461586..acaaed009f94 100644 --- a/sfx2/source/appl/appinit.cxx +++ b/sfx2/source/appl/appinit.cxx @@ -38,7 +38,7 @@ #include #include -#include +#include #include #include #include -- cgit From cc7338c3b04fa71c33901f6ae6f0b8c865142e49 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 9 Apr 2010 11:28:30 +0200 Subject: slidecopy: moved XToolPanel from css.view to css.ui, now that it is an XUIElement --- sfx2/source/dialog/taskpane.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index 02917079cf0e..289abf85c398 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -36,7 +36,7 @@ /** === begin UNO includes === **/ #include #include -#include +#include #include #include #include @@ -78,7 +78,7 @@ namespace sfx2 using ::com::sun::star::uno::Type; using ::com::sun::star::frame::XModuleManager; using ::com::sun::star::container::XNameAccess; - using ::com::sun::star::view::XToolPanel; + using ::com::sun::star::ui::XToolPanel; using ::com::sun::star::ui::XUIElementFactory; using ::com::sun::star::ui::XUIElement; using ::com::sun::star::awt::XWindow; -- cgit From 267d2a3ac9b9c01c04f920dcde2f92be475369b6 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 9 Apr 2010 11:42:22 +0200 Subject: slidecopy: when creating tool panels, pass the XFrame they're going to live in (needed as context information, and mandatory by css.ui.XUIElementFactory documentation) --- sfx2/source/dialog/taskpane.cxx | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index 289abf85c398..49f6ebf15e1d 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -263,12 +263,12 @@ namespace sfx2 } //-------------------------------------------------------------------------------------------------------------- - ::rtl::OUString lcl_identifyModule( const SfxBindings* i_pBindings ) + Reference< XFrame > lcl_getFrame( const SfxBindings* i_pBindings ) { const SfxViewFrame* pViewFrame = i_pBindings->GetDispatcher()->GetFrame(); const SfxFrame* pFrame = pViewFrame->GetFrame(); const Reference< XFrame > xFrame( pFrame->GetFrameInterface() ); - return lcl_identifyModule( xFrame ); + return xFrame; } //-------------------------------------------------------------------------------------------------------------- @@ -303,7 +303,7 @@ namespace sfx2 //------------------------------------------------------------------------------------------------------------------ TaskPaneDockingWindow::TaskPaneDockingWindow( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper, Window* i_pParent, WinBits i_nBits ) :TitledDockingWindow( i_pBindings, &i_rWrapper, i_pParent, i_nBits ) - ,m_aTaskPane( GetContentWindow(), lcl_identifyModule( i_pBindings ) ) + ,m_aTaskPane( GetContentWindow(), lcl_getFrame( i_pBindings ) ) { m_aTaskPane.Show(); SetText( String( SfxResId( SID_TASKPANE ) ) ); @@ -399,7 +399,7 @@ namespace sfx2 class CustomToolPanel : public ::svt::ToolPanelBase { public: - CustomToolPanel( const ::utl::OConfigurationNode& i_rPanelWindowState ); + CustomToolPanel( const ::utl::OConfigurationNode& i_rPanelWindowState, const Reference< XFrame >& i_rFrame ); virtual ::rtl::OUString GetDisplayName() const; virtual Image GetImage() const; @@ -423,16 +423,18 @@ namespace sfx2 const Image m_aPanelImage; const ::rtl::OUString m_sResourceURL; const ::rtl::OUString m_sPanelConfigPath; + Reference< XFrame > m_xFrame; CustomPanelUIElement m_aCustomPanel; bool m_bAttemptedCreation; }; //------------------------------------------------------------------------------------------------------------------ - CustomToolPanel::CustomToolPanel( const ::utl::OConfigurationNode& i_rPanelWindowState ) + CustomToolPanel::CustomToolPanel( const ::utl::OConfigurationNode& i_rPanelWindowState, const Reference< XFrame >& i_rFrame ) :m_sUIName( ::comphelper::getString( i_rPanelWindowState.getNodeValue( "UIName" ) ) ) ,m_aPanelImage( lcl_getPanelImage( i_rPanelWindowState ) ) ,m_sResourceURL( i_rPanelWindowState.getLocalName() ) ,m_sPanelConfigPath( i_rPanelWindowState.getNodePath() ) + ,m_xFrame( i_rFrame ) ,m_aCustomPanel() ,m_bAttemptedCreation( false ) { @@ -456,6 +458,7 @@ namespace sfx2 const Reference< XUIElementFactory > xFactory( aContext.createComponent( "com.sun.star.ui.UIElementFactoryManager" ), UNO_QUERY_THROW ); ::comphelper::NamedValueCollection aCreationArgs; + aCreationArgs.put( "Frame", makeAny( m_xFrame ) ); aCreationArgs.put( "ParentWindow", makeAny( i_rPanelParentWindow.GetComponentInterface() ) ); const Reference< XUIElement > xElement( @@ -583,9 +586,10 @@ namespace sfx2 class ModuleTaskPane_Impl : public ::boost::noncopyable { public: - ModuleTaskPane_Impl( ModuleTaskPane& i_rAntiImpl, const ::rtl::OUString& i_rModuleIdentifier ) + ModuleTaskPane_Impl( ModuleTaskPane& i_rAntiImpl, const Reference< XFrame >& i_rDocumentFrame ) :m_rAntiImpl( i_rAntiImpl ) - ,m_sModuleIdentifier( i_rModuleIdentifier ) + ,m_sModuleIdentifier( lcl_identifyModule( i_rDocumentFrame ) ) + ,m_xFrame( i_rDocumentFrame ) ,m_aPanels( i_rAntiImpl ) { m_aPanels.Show(); @@ -612,9 +616,10 @@ namespace sfx2 impl_isToolPanelResource( const ::rtl::OUString& i_rResourceURL ); private: - ModuleTaskPane& m_rAntiImpl; - ::rtl::OUString m_sModuleIdentifier; - ::svt::ToolPanelDeck m_aPanels; + ModuleTaskPane& m_rAntiImpl; + const ::rtl::OUString m_sModuleIdentifier; + const Reference< XFrame > m_xFrame; + ::svt::ToolPanelDeck m_aPanels; }; //------------------------------------------------------------------------------------------------------------------ @@ -654,7 +659,7 @@ namespace sfx2 continue; ::utl::OConfigurationNode aResourceNode( aWindowStateConfig.openNode( *resource ) ); - ::svt::PToolPanel pCustomPanel( new CustomToolPanel( aResourceNode ) ); + ::svt::PToolPanel pCustomPanel( new CustomToolPanel( aResourceNode, m_xFrame ) ); size_t nPanelPos = m_aPanels.InsertPanel( pCustomPanel, m_aPanels.GetPanelCount() ); if ( ::comphelper::getBOOL( aResourceNode.getNodeValue( "Visible" ) ) ) @@ -690,9 +695,9 @@ namespace sfx2 //= ModuleTaskPane //================================================================================================================== //------------------------------------------------------------------------------------------------------------------ - ModuleTaskPane::ModuleTaskPane( Window& i_rParentWindow, const ::rtl::OUString& i_rModuleIdentifier ) + ModuleTaskPane::ModuleTaskPane( Window& i_rParentWindow, const Reference< XFrame >& i_rDocumentFrame ) :Window( &i_rParentWindow, 0 ) - ,m_pImpl( new ModuleTaskPane_Impl( *this, i_rModuleIdentifier ) ) + ,m_pImpl( new ModuleTaskPane_Impl( *this, i_rDocumentFrame ) ) { } -- cgit From 9233947f0d9dfab3d7a47645d9bff9ac9d140b74 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 9 Apr 2010 12:31:01 +0200 Subject: slidecopy: task pane is initially invisible --- sfx2/source/appl/appreg.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sfx2/source') diff --git a/sfx2/source/appl/appreg.cxx b/sfx2/source/appl/appreg.cxx index 2cb4453700be..bd618cb8f0bc 100644 --- a/sfx2/source/appl/appreg.cxx +++ b/sfx2/source/appl/appreg.cxx @@ -70,7 +70,7 @@ void SfxApplication::Registrations_Impl() // ChildWindows SfxRecordingFloatWrapper_Impl::RegisterChildWindow(); SfxNavigatorWrapper::RegisterChildWindow( FALSE, NULL, SFX_CHILDWIN_NEVERHIDE ); - ::sfx2::TaskPaneWrapper::RegisterChildWindow( TRUE ); + ::sfx2::TaskPaneWrapper::RegisterChildWindow( FALSE ); SfxPartChildWnd_Impl::RegisterChildWindow(); SfxTemplateDialogWrapper::RegisterChildWindow(TRUE); SfxDockingWrapper::RegisterChildWindow(); -- cgit From e2e01f75b72f24c46df5eb9fd77f051f0f4c809b Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Wed, 14 Apr 2010 11:16:58 +0200 Subject: fwk140: #i110848# show the warning on saving as well --- sfx2/source/doc/guisaveas.cxx | 62 ++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 30 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index cbd269b41516..3be1f4a79cc8 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -1238,6 +1238,7 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& // parse the slot name sal_Int8 nStoreMode = getStoreModeFromSlotName( aSlotName ); + sal_Int8 nStatusSave = STATUS_NO_ACTION; // handle the special cases if ( nStoreMode & SAVEAS_REQUESTED ) @@ -1259,7 +1260,7 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& else if ( nStoreMode & SAVE_REQUESTED ) { // if saving is not acceptable by the configuration the warning must be shown - sal_Int8 nStatusSave = aModelData.CheckSaveAcceptable( STATUS_SAVE ); + nStatusSave = aModelData.CheckSaveAcceptable( STATUS_SAVE ); if ( nStatusSave == STATUS_NO_ACTION ) throw task::ErrorCodeIOException( ::rtl::OUString(), uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT ); @@ -1273,32 +1274,7 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& { throw task::ErrorCodeIOException( ::rtl::OUString(), uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT ); } - else if ( nStatusSave == STATUS_SAVE ) - { - // Document properties can contain streams that should be freed before storing - aModelData.FreeDocumentProps(); - - if ( aModelData.GetStorable2().is() ) - { - try - { - aModelData.GetStorable2()->storeSelf( aModelData.GetMediaDescr().getAsConstPropertyValueList() ); - } - catch( lang::IllegalArgumentException& ) - { - OSL_ENSURE( sal_False, "ModelData didn't handle illegal parameters, all the parameters are ignored!\n" ); - aModelData.GetStorable()->store(); - } - } - else - { - OSL_ENSURE( sal_False, "XStorable2 is not supported by the model!\n" ); - aModelData.GetStorable()->store(); - } - - return sal_False; - } - else + else if ( nStatusSave != STATUS_SAVE ) { // this should be a usual SaveAs operation nStoreMode = SAVEAS_REQUESTED; @@ -1325,6 +1301,32 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& } } + if ( nStoreMode & SAVE_REQUESTED && nStatusSave == STATUS_SAVE ) + { + // Document properties can contain streams that should be freed before storing + aModelData.FreeDocumentProps(); + + if ( aModelData.GetStorable2().is() ) + { + try + { + aModelData.GetStorable2()->storeSelf( aModelData.GetMediaDescr().getAsConstPropertyValueList() ); + } + catch( lang::IllegalArgumentException& ) + { + OSL_ENSURE( sal_False, "ModelData didn't handle illegal parameters, all the parameters are ignored!\n" ); + aModelData.GetStorable()->store(); + } + } + else + { + OSL_ENSURE( sal_False, "XStorable2 is not supported by the model!\n" ); + aModelData.GetStorable()->store(); + } + + return sal_False; + } + // preselect a filter for the storing process uno::Sequence< beans::PropertyValue > aFilterProps = aModelData.GetPreselectedFilter_Impl( nStoreMode ); @@ -1419,13 +1421,13 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& ::rtl::OUString aSelFilterName = aModelData.GetMediaDescr().getUnpackedValueOrDefault( aFilterNameString, ::rtl::OUString() ); - sal_Int8 nStatusSave = aModelData.CheckFilter( aSelFilterName ); - if ( nStatusSave == STATUS_SAVEAS_STANDARDNAME ) + sal_Int8 nStatusFilterSave = aModelData.CheckFilter( aSelFilterName ); + if ( nStatusFilterSave == STATUS_SAVEAS_STANDARDNAME ) { // switch to best filter bSetStandardName = sal_True; } - else if ( nStatusSave == STATUS_SAVE ) + else if ( nStatusFilterSave == STATUS_SAVE ) { // user confirmed alien filter or "good" filter is used bExit = sal_True; -- cgit From 825b9494a5dc84409b457d1895b7db5c82680fa3 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 13 Apr 2010 10:06:23 +0200 Subject: slidecopy: make compile with GCC --- sfx2/source/dialog/taskpane.cxx | 4 ++-- sfx2/source/view/impviewframe.hxx | 2 ++ sfx2/source/view/viewfrm.cxx | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index 49f6ebf15e1d..b00cc922a5c7 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -266,8 +266,8 @@ namespace sfx2 Reference< XFrame > lcl_getFrame( const SfxBindings* i_pBindings ) { const SfxViewFrame* pViewFrame = i_pBindings->GetDispatcher()->GetFrame(); - const SfxFrame* pFrame = pViewFrame->GetFrame(); - const Reference< XFrame > xFrame( pFrame->GetFrameInterface() ); + const SfxFrame& rFrame = pViewFrame->GetFrame(); + const Reference< XFrame > xFrame( rFrame.GetFrameInterface() ); return xFrame; } diff --git a/sfx2/source/view/impviewframe.hxx b/sfx2/source/view/impviewframe.hxx index b3e3f25b8b96..abe4cb6852d9 100644 --- a/sfx2/source/view/impviewframe.hxx +++ b/sfx2/source/view/impviewframe.hxx @@ -31,6 +31,8 @@ #include #include +#include + struct SfxViewFrame_Impl { SvBorder aBorder; diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 815eeadbba17..561209c54a43 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -180,7 +180,7 @@ namespace if ( !i_rViewFrameImpl.aHasToolPanels ) { i_rViewFrameImpl.aHasToolPanels.reset( ::sfx2::ModuleTaskPane::ModuleHasToolPanels( - i_rViewFrameImpl.pFrame->GetTopFrame()->GetFrameInterface() ) ); + i_rViewFrameImpl.rFrame.GetFrameInterface() ) ); } return *i_rViewFrameImpl.aHasToolPanels; } -- cgit From 8c437b4a47762b07c52a0a9d6af2abf5363c15df Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 13 Apr 2010 12:17:53 +0200 Subject: slidecopy: moved SD's task pane implementation to the new base implementation from SFX. Still not all previous functionality restored. --- sfx2/source/dialog/taskpane.cxx | 230 ++++++++++++++++++---------------------- 1 file changed, 105 insertions(+), 125 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index 49f6ebf15e1d..cfee8272c350 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -50,6 +50,8 @@ #include #include #include +#include +#include #include #if OSL_DEBUG_LEVEL > 0 @@ -90,127 +92,6 @@ namespace sfx2 /** === end UNO using === **/ namespace PosSize = ::com::sun::star::awt::PosSize; -//#define USE_DUMMY_PANEL - -#if OSL_DEBUG_LEVEL > 0 - //================================================================================================================== - //= DummyPanel - declaration - //================================================================================================================== - class DummyPanel : public ::svt::ToolPanelBase - { - public: - DummyPanel( Window& i_rParent ); - virtual ~DummyPanel(); - - // IToolPanel - virtual ::rtl::OUString GetDisplayName() const; - virtual Image GetImage() const; - virtual void Activate( Window& i_rParentWindow ); - virtual void Deactivate(); - virtual void SetSizePixel( const Size& i_rPanelWindowSize ); - virtual void GrabFocus(); - virtual void Dispose(); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - CreatePanelAccessible( - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible - ); - - class GreenWindow : public Window - { - public: - GreenWindow( Window& i_rParent ) - :Window( &i_rParent, 0 ) - { - SetLineColor(); - SetFillColor( COL_GREEN ); - } - virtual void Paint( const Rectangle& i_rRect ) - { - DrawRect( i_rRect ); - } - }; - - private: - ::boost::scoped_ptr< Window > m_pWindow; - }; - - //================================================================================================================== - //= DummyPanel - implementation - //================================================================================================================== - //------------------------------------------------------------------------------------------------------------------ - DummyPanel::DummyPanel( Window& i_rParent ) - :m_pWindow( new GreenWindow( i_rParent ) ) - { - m_pWindow->SetPosSizePixel( Point(), i_rParent.GetOutputSizePixel() ); - } - - //------------------------------------------------------------------------------------------------------------------ - DummyPanel::~DummyPanel() - { - } - - //------------------------------------------------------------------------------------------------------------------ - ::rtl::OUString DummyPanel::GetDisplayName() const - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Soylent Green" ) ); - } - - //------------------------------------------------------------------------------------------------------------------ - Image DummyPanel::GetImage() const - { - return Image(); - } - - //------------------------------------------------------------------------------------------------------------------ - void DummyPanel::Activate( Window& i_rParentWindow ) - { - OSL_ENSURE( &i_rParentWindow == m_pWindow->GetParent(), "DummyPanel::Activate: reparenting not supported (and not expected to be needed)!" ); - (void)i_rParentWindow; - - m_pWindow->Show(); - } - - //------------------------------------------------------------------------------------------------------------------ - void DummyPanel::Deactivate() - { - m_pWindow->Hide(); - } - - //------------------------------------------------------------------------------------------------------------------ - void DummyPanel::SetSizePixel( const Size& i_rPanelWindowSize ) - { - m_pWindow->SetPosSizePixel( Point(), i_rPanelWindowSize ); - } - - //------------------------------------------------------------------------------------------------------------------ - void DummyPanel::GrabFocus() - { - m_pWindow->GrabFocus(); - } - - //------------------------------------------------------------------------------------------------------------------ - void DummyPanel::Dispose() - { - m_pWindow.reset(); - } - - //------------------------------------------------------------------------------------------------------------------ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::accessibility::XAccessible; - Reference< XAccessible > DummyPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ) - { - Reference< XAccessible > xPanelAccessible( m_pWindow->GetAccessible( FALSE ) ); - if ( !xPanelAccessible.is() ) - { - xPanelAccessible = m_pWindow->GetAccessible( TRUE ); - ::comphelper::OAccessibleImplementationAccess::setAccessibleParent( xPanelAccessible->getAccessibleContext(), - i_rParentAccessible ); - } - return xPanelAccessible; - } - -#endif - //================================================================================================================== //= helpers //================================================================================================================== @@ -411,6 +292,9 @@ namespace sfx2 virtual Reference< XAccessible > CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ); + const ::rtl::OUString& + GetResourceURL() const { return m_sResourceURL; } + protected: ~CustomToolPanel(); @@ -593,9 +477,6 @@ namespace sfx2 ,m_aPanels( i_rAntiImpl ) { m_aPanels.Show(); - #if ( OSL_DEBUG_LEVEL > 0 ) && defined ( USE_DUMMY_PANEL ) - m_aPanels.InsertPanel( ::svt::PToolPanel( new DummyPanel( m_aPanels.GetPanelWindowAnchor() ) ), m_aPanels.GetPanelCount() ); - #endif OnResize(); impl_initFromConfiguration(); } @@ -609,12 +490,23 @@ namespace sfx2 static bool ModuleHasToolPanels( const ::rtl::OUString& i_rModuleIdentifier ); + ::svt::ToolPanelDeck& GetPanelDeck() { return m_aPanels; } + const ::svt::ToolPanelDeck& GetPanelDeck() const { return m_aPanels; } + + ::boost::optional< size_t > + GetPanelPos( const ::rtl::OUString& i_rResourceURL ); + + void SetDrawersLayout(); + void SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent ); + private: void impl_initFromConfiguration(); static bool impl_isToolPanelResource( const ::rtl::OUString& i_rResourceURL ); + DECL_LINK( OnActivatePanel, void* ); + private: ModuleTaskPane& m_rAntiImpl; const ::rtl::OUString m_sModuleIdentifier; @@ -634,6 +526,13 @@ namespace sfx2 m_aPanels.GrabFocus(); } + //------------------------------------------------------------------------------------------------------------------ + IMPL_LINK( ModuleTaskPane_Impl, OnActivatePanel, void*, i_pArg ) + { + m_aPanels.ActivatePanel( reinterpret_cast< size_t >( i_pArg ) ); + return 1L; + } + //------------------------------------------------------------------------------------------------------------------ bool ModuleTaskPane_Impl::impl_isToolPanelResource( const ::rtl::OUString& i_rResourceURL ) { @@ -668,7 +567,7 @@ namespace sfx2 if ( nFirstVisiblePanel != size_t( -1 ) ) { - m_aPanels.ActivatePanel( nFirstVisiblePanel ); + m_rAntiImpl.PostUserEvent( LINK( this, ModuleTaskPane_Impl, OnActivatePanel ), reinterpret_cast< void* >( nFirstVisiblePanel ) ); } } @@ -691,6 +590,57 @@ namespace sfx2 return false; } + //------------------------------------------------------------------------------------------------------------------ + ::boost::optional< size_t > ModuleTaskPane_Impl::GetPanelPos( const ::rtl::OUString& i_rResourceURL ) + { + ::boost::optional< size_t > aPanelPos; + for ( size_t i = 0; i < m_aPanels.GetPanelCount(); ++i ) + { + const ::svt::PToolPanel pPanel( m_aPanels.GetPanel( i ) ); + const CustomToolPanel* pCustomPanel = dynamic_cast< const CustomToolPanel* >( pPanel.get() ); + ENSURE_OR_CONTINUE( pCustomPanel != NULL, "ModuleTaskPane_Impl::GetPanelPos: illegal panel implementation!" ); + if ( pCustomPanel->GetResourceURL() == i_rResourceURL ) + { + aPanelPos = i; + break; + } + } + return aPanelPos; + } + + //------------------------------------------------------------------------------------------------------------------ + void ModuleTaskPane_Impl::SetDrawersLayout() + { + const ::svt::PDeckLayouter pLayouter( m_aPanels.GetLayouter() ); + const ::svt::DrawerDeckLayouter* pDrawerLayouter = dynamic_cast< const ::svt::DrawerDeckLayouter* >( pLayouter.get() ); + if ( pDrawerLayouter != NULL ) + // already have the proper layout + return; + m_aPanels.SetLayouter( new ::svt::DrawerDeckLayouter( m_aPanels, m_aPanels ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + void ModuleTaskPane_Impl::SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent ) + { + ::svt::PDeckLayouter pLayouter( m_aPanels.GetLayouter() ); + ::svt::TabDeckLayouter* pTabLayouter = dynamic_cast< ::svt::TabDeckLayouter* >( pLayouter.get() ); + if ( ( pTabLayouter != NULL ) + && ( pTabLayouter->GetTabAlignment() == i_eTabAlignment ) + && ( pTabLayouter->GetTabItemContent() == i_eTabContent ) + ) + // already have the requested layout + return; + + if ( pTabLayouter && ( pTabLayouter->GetTabAlignment() == i_eTabAlignment ) ) + { + // changing only the item content does not require a new layouter instance + pTabLayouter->SetTabItemContent( i_eTabContent ); + return; + } + + m_aPanels.SetLayouter( new ::svt::TabDeckLayouter( m_aPanels, m_aPanels, i_eTabAlignment, i_eTabContent ) ); + } + //================================================================================================================== //= ModuleTaskPane //================================================================================================================== @@ -732,6 +682,36 @@ namespace sfx2 m_pImpl->OnGetFocus(); } + //------------------------------------------------------------------------------------------------------------------ + ::svt::ToolPanelDeck& ModuleTaskPane::GetPanelDeck() + { + return m_pImpl->GetPanelDeck(); + } + + //------------------------------------------------------------------------------------------------------------------ + const ::svt::ToolPanelDeck& ModuleTaskPane::GetPanelDeck() const + { + return m_pImpl->GetPanelDeck(); + } + + //------------------------------------------------------------------------------------------------------------------ + ::boost::optional< size_t > ModuleTaskPane::GetPanelPos( const ::rtl::OUString& i_rResourceURL ) + { + return m_pImpl->GetPanelPos( i_rResourceURL ); + } + + //------------------------------------------------------------------------------------------------------------------ + void ModuleTaskPane::SetDrawersLayout() + { + m_pImpl->SetDrawersLayout(); + } + + //------------------------------------------------------------------------------------------------------------------ + void ModuleTaskPane::SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent ) + { + m_pImpl->SetTabsLayout( i_eTabAlignment, i_eTabContent ); + } + //...................................................................................................................... } // namespace sfx2 //...................................................................................................................... -- cgit From b3f01acd62e59c34405b0738b1d92c212e62f842 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 13 Apr 2010 12:51:19 +0200 Subject: slidecopy: missing using statement --- sfx2/source/dialog/taskpane.cxx | 1 + 1 file changed, 1 insertion(+) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index cfee8272c350..d5b57a111a6a 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -89,6 +89,7 @@ namespace sfx2 using ::com::sun::star::lang::XComponent; using ::com::sun::star::graphic::XGraphicProvider; using ::com::sun::star::graphic::XGraphic; + using ::com::sun::star::accessibility::XAccessible; /** === end UNO using === **/ namespace PosSize = ::com::sun::star::awt::PosSize; -- cgit From df0f53a275c1494fb43819ee48ff19b3031ffb45 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 14 Apr 2010 10:37:41 +0200 Subject: slidecopy: re-implemented the TaskPane's "View" menu in SFX, using the code formerly found in SD --- sfx2/source/dialog/makefile.mk | 3 +- sfx2/source/dialog/taskpane.cxx | 509 +++++++++++++++++++++++++++++++++--- sfx2/source/dialog/taskpane.src | 43 +++ sfx2/source/dialog/titledockwin.cxx | 15 ++ sfx2/source/dialog/titledockwin.src | 4 - sfx2/source/inc/helpid.hrc | 2 +- sfx2/source/inc/sfxlocal.hrc | 4 +- 7 files changed, 541 insertions(+), 39 deletions(-) create mode 100644 sfx2/source/dialog/taskpane.src (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/makefile.mk b/sfx2/source/dialog/makefile.mk index 2f5377e12fe8..90a4a251d3ca 100644 --- a/sfx2/source/dialog/makefile.mk +++ b/sfx2/source/dialog/makefile.mk @@ -92,7 +92,8 @@ SRC1FILES =\ versdlg.src \ printopt.src \ srchdlg.src \ - titledockwin.src + titledockwin.src \ + taskpane.src .IF "$(BUILD_VER_STRING)"!="" .IF "$(GUI)"=="UNX" diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index d5b57a111a6a..cadb1189dc5d 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -31,6 +31,7 @@ #include "sfx2/bindings.hxx" #include "sfx2/dispatch.hxx" #include "sfxresid.hxx" +#include "sfxlocal.hrc" #include "helpid.hrc" /** === begin UNO includes === **/ @@ -53,6 +54,7 @@ #include #include #include +#include #if OSL_DEBUG_LEVEL > 0 #include @@ -186,6 +188,7 @@ namespace sfx2 TaskPaneDockingWindow::TaskPaneDockingWindow( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper, Window* i_pParent, WinBits i_nBits ) :TitledDockingWindow( i_pBindings, &i_rWrapper, i_pParent, i_nBits ) ,m_aTaskPane( GetContentWindow(), lcl_getFrame( i_pBindings ) ) + ,m_aPaneController( m_aTaskPane, *this ) { m_aTaskPane.Show(); SetText( String( SfxResId( SID_TASKPANE ) ) ); @@ -204,23 +207,6 @@ namespace sfx2 m_aTaskPane.SetPosSizePixel( Point(), GetContentWindow().GetOutputSizePixel() ); } - //------------------------------------------------------------------------------------------------------------------ - long TaskPaneDockingWindow::Notify( NotifyEvent& i_rNotifyEvent ) - { - // in case this is a MouseButtonDown event, consume it - VCL's DockingWindow would otherwise - // start undocking, no matter which window this event was intended for - if ( i_rNotifyEvent.GetType() == EVENT_MOUSEBUTTONDOWN ) - { - const MouseEvent& rMouseEvent = *i_rNotifyEvent.GetMouseEvent(); - if ( rMouseEvent.IsLeft() && ( rMouseEvent.GetClicks() == 1 ) && !rMouseEvent.IsMod1() ) - { - if ( m_aTaskPane.IsWindowOrChild( i_rNotifyEvent.GetWindow() ) ) - return TRUE; - } - } - return TitledDockingWindow::Notify( i_rNotifyEvent ); - } - //================================================================================================================== //= TaskPaneWrapper //================================================================================================================== @@ -475,9 +461,9 @@ namespace sfx2 :m_rAntiImpl( i_rAntiImpl ) ,m_sModuleIdentifier( lcl_identifyModule( i_rDocumentFrame ) ) ,m_xFrame( i_rDocumentFrame ) - ,m_aPanels( i_rAntiImpl ) + ,m_aPanelDeck( i_rAntiImpl ) { - m_aPanels.Show(); + m_aPanelDeck.Show(); OnResize(); impl_initFromConfiguration(); } @@ -491,8 +477,8 @@ namespace sfx2 static bool ModuleHasToolPanels( const ::rtl::OUString& i_rModuleIdentifier ); - ::svt::ToolPanelDeck& GetPanelDeck() { return m_aPanels; } - const ::svt::ToolPanelDeck& GetPanelDeck() const { return m_aPanels; } + ::svt::ToolPanelDeck& GetPanelDeck() { return m_aPanelDeck; } + const ::svt::ToolPanelDeck& GetPanelDeck() const { return m_aPanelDeck; } ::boost::optional< size_t > GetPanelPos( const ::rtl::OUString& i_rResourceURL ); @@ -512,25 +498,25 @@ namespace sfx2 ModuleTaskPane& m_rAntiImpl; const ::rtl::OUString m_sModuleIdentifier; const Reference< XFrame > m_xFrame; - ::svt::ToolPanelDeck m_aPanels; + ::svt::ToolPanelDeck m_aPanelDeck; }; //------------------------------------------------------------------------------------------------------------------ void ModuleTaskPane_Impl::OnResize() { - m_aPanels.SetPosSizePixel( Point(), m_rAntiImpl.GetOutputSizePixel() ); + m_aPanelDeck.SetPosSizePixel( Point(), m_rAntiImpl.GetOutputSizePixel() ); } //------------------------------------------------------------------------------------------------------------------ void ModuleTaskPane_Impl::OnGetFocus() { - m_aPanels.GrabFocus(); + m_aPanelDeck.GrabFocus(); } //------------------------------------------------------------------------------------------------------------------ IMPL_LINK( ModuleTaskPane_Impl, OnActivatePanel, void*, i_pArg ) { - m_aPanels.ActivatePanel( reinterpret_cast< size_t >( i_pArg ) ); + m_aPanelDeck.ActivatePanel( reinterpret_cast< size_t >( i_pArg ) ); return 1L; } @@ -560,7 +546,7 @@ namespace sfx2 ::utl::OConfigurationNode aResourceNode( aWindowStateConfig.openNode( *resource ) ); ::svt::PToolPanel pCustomPanel( new CustomToolPanel( aResourceNode, m_xFrame ) ); - size_t nPanelPos = m_aPanels.InsertPanel( pCustomPanel, m_aPanels.GetPanelCount() ); + size_t nPanelPos = m_aPanelDeck.InsertPanel( pCustomPanel, m_aPanelDeck.GetPanelCount() ); if ( ::comphelper::getBOOL( aResourceNode.getNodeValue( "Visible" ) ) ) nFirstVisiblePanel = nPanelPos; @@ -595,9 +581,9 @@ namespace sfx2 ::boost::optional< size_t > ModuleTaskPane_Impl::GetPanelPos( const ::rtl::OUString& i_rResourceURL ) { ::boost::optional< size_t > aPanelPos; - for ( size_t i = 0; i < m_aPanels.GetPanelCount(); ++i ) + for ( size_t i = 0; i < m_aPanelDeck.GetPanelCount(); ++i ) { - const ::svt::PToolPanel pPanel( m_aPanels.GetPanel( i ) ); + const ::svt::PToolPanel pPanel( m_aPanelDeck.GetPanel( i ) ); const CustomToolPanel* pCustomPanel = dynamic_cast< const CustomToolPanel* >( pPanel.get() ); ENSURE_OR_CONTINUE( pCustomPanel != NULL, "ModuleTaskPane_Impl::GetPanelPos: illegal panel implementation!" ); if ( pCustomPanel->GetResourceURL() == i_rResourceURL ) @@ -612,18 +598,18 @@ namespace sfx2 //------------------------------------------------------------------------------------------------------------------ void ModuleTaskPane_Impl::SetDrawersLayout() { - const ::svt::PDeckLayouter pLayouter( m_aPanels.GetLayouter() ); + const ::svt::PDeckLayouter pLayouter( m_aPanelDeck.GetLayouter() ); const ::svt::DrawerDeckLayouter* pDrawerLayouter = dynamic_cast< const ::svt::DrawerDeckLayouter* >( pLayouter.get() ); if ( pDrawerLayouter != NULL ) // already have the proper layout return; - m_aPanels.SetLayouter( new ::svt::DrawerDeckLayouter( m_aPanels, m_aPanels ) ); + m_aPanelDeck.SetLayouter( new ::svt::DrawerDeckLayouter( m_aPanelDeck, m_aPanelDeck ) ); } //------------------------------------------------------------------------------------------------------------------ void ModuleTaskPane_Impl::SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent ) { - ::svt::PDeckLayouter pLayouter( m_aPanels.GetLayouter() ); + ::svt::PDeckLayouter pLayouter( m_aPanelDeck.GetLayouter() ); ::svt::TabDeckLayouter* pTabLayouter = dynamic_cast< ::svt::TabDeckLayouter* >( pLayouter.get() ); if ( ( pTabLayouter != NULL ) && ( pTabLayouter->GetTabAlignment() == i_eTabAlignment ) @@ -639,7 +625,7 @@ namespace sfx2 return; } - m_aPanels.SetLayouter( new ::svt::TabDeckLayouter( m_aPanels, m_aPanels, i_eTabAlignment, i_eTabContent ) ); + m_aPanelDeck.SetLayouter( new ::svt::TabDeckLayouter( m_aPanelDeck, m_aPanelDeck, i_eTabAlignment, i_eTabContent ) ); } //================================================================================================================== @@ -713,6 +699,465 @@ namespace sfx2 m_pImpl->SetTabsLayout( i_eTabAlignment, i_eTabContent ); } + // ===================================================================================================================== + // = PanelSelectorLayout + // ===================================================================================================================== + enum PanelSelectorLayout + { + LAYOUT_DRAWERS, + LAYOUT_TABS_RIGHT, + LAYOUT_TABS_LEFT, + LAYOUT_TABS_TOP, + LAYOUT_TABS_BOTTOM + }; + + //================================================================================================================== + //= helper + //================================================================================================================== + namespace + { + PanelSelectorLayout lcl_getTabLayoutFromAlignment( const SfxChildAlignment i_eAlignment ) + { + switch ( i_eAlignment ) + { + case SFX_ALIGN_LEFT: + return LAYOUT_TABS_LEFT; + case SFX_ALIGN_TOP: + return LAYOUT_TABS_TOP; + case SFX_ALIGN_BOTTOM: + return LAYOUT_TABS_BOTTOM; + default: + return LAYOUT_TABS_RIGHT; + } + } + } + + // ===================================================================================================================== + // = PanelDescriptor + // ===================================================================================================================== + /** is a helper class for TaskPaneController_Impl, holding the details about a single panel which is not + contained in the IToolPanel implementation itself. + */ + struct PanelDescriptor + { + ::svt::PToolPanel pPanel; + bool bHidden; + + PanelDescriptor() + :pPanel() + ,bHidden( false ) + { + } + + PanelDescriptor( const ::svt::PToolPanel& i_rPanel ) + :pPanel( i_rPanel ) + ,bHidden( false ) + { + } + }; + + //================================================================================================================== + //= TaskPaneController_Impl + //================================================================================================================== + class TaskPaneController_Impl :public ::boost::noncopyable + ,public ::svt::IToolPanelDeckListener + { + public: + TaskPaneController_Impl( + ModuleTaskPane& i_rTaskPane, + TitledDockingWindow& i_rDockingWindow + ); + ~TaskPaneController_Impl(); + + void SetDefaultTitle( const String& i_rTitle ); + + protected: + // IToolPanelDeckListener overridables + virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ); + virtual void PanelRemoved( const size_t i_nPosition ); + virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); + virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ); + virtual void Dying(); + + private: + DECL_LINK( OnToolboxClicked, ToolBox* ); + DECL_LINK( OnMenuItemSelected, Menu* ); + DECL_LINK( DockingChanged, TitledDockingWindow* ); + ::std::auto_ptr< PopupMenu > impl_createPopupMenu() const; + + /// sets the given layout for the panel selector + void impl_setLayout( const PanelSelectorLayout i_eLayout, const bool i_bForce = false ); + + /// returns the current layout of the panel selector + PanelSelectorLayout + impl_getLayout() const { return m_eCurrentLayout; } + + void impl_updateDockingWindowTitle(); + void impl_togglePanelVisibility( const size_t i_nLogicalPanelIndex ); + size_t impl_getLogicalPanelIndex( const size_t i_nVisibleIndex ); + + private: + enum MenuId + { + MID_UNLOCK_TASK_PANEL = 1, + MID_LOCK_TASK_PANEL = 2, + MID_LAYOUT_TABS = 3, + MID_LAYOUT_DRAWERS = 4, + MID_FIRST_PANEL = 5 + }; + + private: + typedef ::std::vector< PanelDescriptor > PanelDescriptors; + + ModuleTaskPane& m_rTaskPane; + TitledDockingWindow& m_rDockingWindow; + USHORT m_nViewMenuID; + PanelSelectorLayout m_eCurrentLayout; + PanelDescriptors m_aPanelRepository; + bool m_bTogglingPanelVisibility; + ::rtl::OUString m_sDefaultTitle; + }; + + //------------------------------------------------------------------------------------------------------------------ + TaskPaneController_Impl::TaskPaneController_Impl( ModuleTaskPane& i_rTaskPane, TitledDockingWindow& i_rDockingWindow ) + :m_rTaskPane( i_rTaskPane ) + ,m_rDockingWindow( i_rDockingWindow ) + ,m_nViewMenuID( 0 ) + ,m_eCurrentLayout( LAYOUT_DRAWERS ) + ,m_aPanelRepository() + ,m_bTogglingPanelVisibility( false ) + ,m_sDefaultTitle() + { + m_rDockingWindow.ResetToolBox(); + m_nViewMenuID = m_rDockingWindow.AddDropDownToolBoxItem( + String( SfxResId( STR_SFX_TASK_PANE_VIEW ) ), + HID_TASKPANE_VIEW_MENU, + LINK( this, TaskPaneController_Impl, OnToolboxClicked ) + ); + m_rDockingWindow.SetEndDockingHdl( LINK( this, TaskPaneController_Impl, DockingChanged ) ); + impl_setLayout( LAYOUT_DRAWERS, true ); + + m_rTaskPane.GetPanelDeck().AddListener( *this ); + + // initialize the panel repository + for ( size_t i = 0; i < m_rTaskPane.GetPanelDeck().GetPanelCount(); ++i ) + { + ::svt::PToolPanel pPanel( m_rTaskPane.GetPanelDeck().GetPanel( i ) ); + m_aPanelRepository.push_back( PanelDescriptor( pPanel ) ); + } + + m_sDefaultTitle = m_rDockingWindow.GetTitle(); + } + + //------------------------------------------------------------------------------------------------------------------ + TaskPaneController_Impl::~TaskPaneController_Impl() + { + m_rTaskPane.GetPanelDeck().RemoveListener( *this ); + + // remove the panels which are not under the control of the panel deck currently + for ( PanelDescriptors::iterator panelPos = m_aPanelRepository.begin(); + panelPos != m_aPanelRepository.end(); + ++panelPos + ) + { + if ( panelPos->bHidden ) + panelPos->pPanel->Dispose(); + } + m_aPanelRepository.clear(); + } + + // ----------------------------------------------------------------------------------------------------------------- + void TaskPaneController_Impl::SetDefaultTitle( const String& i_rTitle ) + { + m_sDefaultTitle = i_rTitle; + } + + // ----------------------------------------------------------------------------------------------------------------- + IMPL_LINK( TaskPaneController_Impl, DockingChanged, TitledDockingWindow*, i_pDockingWindow ) + { + ENSURE_OR_RETURN( i_pDockingWindow && &m_rDockingWindow, "TaskPaneController_Impl::DockingChanged: where does this come from?", 0L ); + + if ( impl_getLayout() == LAYOUT_DRAWERS ) + return 0L; + + impl_setLayout( lcl_getTabLayoutFromAlignment( i_pDockingWindow->GetAlignment() ) ); + return 1L; + } + + // ----------------------------------------------------------------------------------------------------------------- + IMPL_LINK( TaskPaneController_Impl, OnToolboxClicked, ToolBox*, i_pToolBox ) + { + if ( i_pToolBox->GetCurItemId() == m_nViewMenuID ) + { + i_pToolBox->EndSelection(); + + ::std::auto_ptr< PopupMenu > pMenu = impl_createPopupMenu(); + pMenu->SetSelectHdl( LINK( this, TaskPaneController_Impl, OnMenuItemSelected ) ); + + // pass toolbox button rect so the menu can stay open on button up + Rectangle aMenuRect( i_pToolBox->GetItemRect( m_nViewMenuID ) ); + aMenuRect.SetPos( i_pToolBox->GetPosPixel() ); + pMenu->Execute( &m_rDockingWindow, aMenuRect, POPUPMENU_EXECUTE_DOWN ); + } + + return 0; + } + + // --------------------------------------------------------------------------------------------------------------------- + IMPL_LINK( TaskPaneController_Impl, OnMenuItemSelected, Menu*, i_pMenu ) + { + ENSURE_OR_RETURN( i_pMenu, "TaskPaneController_Impl::OnMenuItemSelected: illegal menu!", 0L ); + + i_pMenu->Deactivate(); + switch ( i_pMenu->GetCurItemId() ) + { + case MID_UNLOCK_TASK_PANEL: + m_rDockingWindow.SetFloatingMode( TRUE ); + break; + + case MID_LOCK_TASK_PANEL: + m_rDockingWindow.SetFloatingMode( FALSE ); + break; + + case MID_LAYOUT_DRAWERS: + impl_setLayout( LAYOUT_DRAWERS ); + break; + + case MID_LAYOUT_TABS: + impl_setLayout( lcl_getTabLayoutFromAlignment( m_rDockingWindow.GetAlignment() ) ); + break; + + default: + { + size_t nPanelIndex = size_t( i_pMenu->GetCurItemId() - MID_FIRST_PANEL ); + impl_togglePanelVisibility( nPanelIndex ); + } + break; + } + + return 1L; + } + + // --------------------------------------------------------------------------------------------------------------------- + size_t TaskPaneController_Impl::impl_getLogicalPanelIndex( const size_t i_nVisibleIndex ) + { + size_t nLogicalIndex = 0; + size_t nVisibleIndex( i_nVisibleIndex ); + for ( size_t i=0; i < m_aPanelRepository.size(); ++i ) + { + if ( !m_aPanelRepository[i].bHidden ) + { + if ( !nVisibleIndex ) + break; + --nVisibleIndex; + } + ++nLogicalIndex; + } + return nLogicalIndex; + } + + // --------------------------------------------------------------------------------------------------------------------- + void TaskPaneController_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) + { + if ( m_bTogglingPanelVisibility ) + return; + + const size_t nLogicalIndex( impl_getLogicalPanelIndex( i_nPosition ) ); + m_aPanelRepository.insert( m_aPanelRepository.begin() + nLogicalIndex, PanelDescriptor( i_pPanel ) ); + } + + // --------------------------------------------------------------------------------------------------------------------- + void TaskPaneController_Impl::PanelRemoved( const size_t i_nPosition ) + { + if ( m_bTogglingPanelVisibility ) + return; + + const size_t nLogicalIndex( impl_getLogicalPanelIndex( i_nPosition ) ); + m_aPanelRepository.erase( m_aPanelRepository.begin() + nLogicalIndex ); + } + + // --------------------------------------------------------------------------------------------------------------------- + void TaskPaneController_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) + { + if ( impl_getLayout() == LAYOUT_DRAWERS ) + // no adjustment of the title when we use the classical "drawers" layout + return; + + impl_updateDockingWindowTitle( ); + (void)i_rOldActive; + (void)i_rNewActive; + } + + // --------------------------------------------------------------------------------------------------------------------- + void TaskPaneController_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) + { + // not interested in + (void)i_rNewLayouter; + } + + // --------------------------------------------------------------------------------------------------------------------- + void TaskPaneController_Impl::Dying() + { + OSL_ENSURE( false, "TaskPaneController_Impl::Dying: unexpected call!" ); + // We are expected to live longer than the ToolPanelDeck we work with. Since we remove ourself, in our dtor, + // as listener from the panel deck, this method here should never be called. + } + + // --------------------------------------------------------------------------------------------------------------------- + void TaskPaneController_Impl::impl_togglePanelVisibility( const size_t i_nLogicalPanelIndex ) + { + ENSURE_OR_RETURN_VOID( i_nLogicalPanelIndex < m_aPanelRepository.size(), "illegal index" ); + + // get the actual panel index, within the deck + size_t nActualPanelIndex(0); + for ( size_t i=0; i < i_nLogicalPanelIndex; ++i ) + { + if ( !m_aPanelRepository[i].bHidden ) + ++nActualPanelIndex; + } + + ::boost::optional< size_t > aActivatePanel; + + m_bTogglingPanelVisibility = true; + if ( m_aPanelRepository[ i_nLogicalPanelIndex ].bHidden ) + { + OSL_VERIFY( m_rTaskPane.GetPanelDeck().InsertPanel( m_aPanelRepository[ i_nLogicalPanelIndex ].pPanel, nActualPanelIndex ) == nActualPanelIndex ); + // if there has not been an active panel before, activate the newly inserted one + ::boost::optional< size_t > aActivePanel( m_rTaskPane.GetPanelDeck().GetActivePanel() ); + if ( !aActivePanel ) + aActivatePanel = nActualPanelIndex; + } + else + { + OSL_VERIFY( m_rTaskPane.GetPanelDeck().RemovePanel( nActualPanelIndex ).get() == m_aPanelRepository[ i_nLogicalPanelIndex ].pPanel.get() ); + } + m_bTogglingPanelVisibility = false; + m_aPanelRepository[ i_nLogicalPanelIndex ].bHidden = !m_aPanelRepository[ i_nLogicalPanelIndex ].bHidden; + + if ( !!aActivatePanel ) + m_rTaskPane.GetPanelDeck().ActivatePanel( *aActivatePanel ); + } + + // --------------------------------------------------------------------------------------------------------------------- + void TaskPaneController_Impl::impl_setLayout( const PanelSelectorLayout i_eLayout, const bool i_bForce ) + { + if ( !i_bForce && ( m_eCurrentLayout == i_eLayout ) ) + return; + + switch ( i_eLayout ) + { + case LAYOUT_DRAWERS: + m_rTaskPane.SetDrawersLayout(); + break; + case LAYOUT_TABS_TOP: + m_rTaskPane.SetTabsLayout( ::svt::TABS_TOP, ::svt::TABITEM_IMAGE_ONLY ); + break; + case LAYOUT_TABS_BOTTOM: + m_rTaskPane.SetTabsLayout( ::svt::TABS_BOTTOM, ::svt::TABITEM_IMAGE_ONLY ); + break; + case LAYOUT_TABS_LEFT: + m_rTaskPane.SetTabsLayout( ::svt::TABS_LEFT, ::svt::TABITEM_IMAGE_ONLY ); + break; + case LAYOUT_TABS_RIGHT: + m_rTaskPane.SetTabsLayout( ::svt::TABS_RIGHT, ::svt::TABITEM_IMAGE_ONLY ); + break; + } + m_eCurrentLayout = i_eLayout; + + impl_updateDockingWindowTitle(); + } + + // --------------------------------------------------------------------------------------------------------------------- + void TaskPaneController_Impl::impl_updateDockingWindowTitle() + { + ::boost::optional< size_t > aActivePanel( m_rTaskPane.GetPanelDeck().GetActivePanel() ); + if ( !aActivePanel || ( impl_getLayout() == LAYOUT_DRAWERS ) ) + m_rDockingWindow.SetTitle( m_sDefaultTitle ); + else + { + size_t nNewActive( *aActivePanel ); + for ( size_t i=0; i < m_aPanelRepository.size(); ++i ) + { + if ( m_aPanelRepository[i].bHidden ) + continue; + + if ( !nNewActive ) + { + m_rDockingWindow.SetTitle( m_aPanelRepository[i].pPanel->GetDisplayName() ); + break; + } + --nNewActive; + } + } + } + + // --------------------------------------------------------------------------------------------------------------------- + ::std::auto_ptr< PopupMenu > TaskPaneController_Impl::impl_createPopupMenu() const + { + ::std::auto_ptr pMenu( new PopupMenu ); + FloatingWindow* pMenuWindow = static_cast< FloatingWindow* >( pMenu->GetWindow() ); + if ( pMenuWindow != NULL ) + { + pMenuWindow->SetPopupModeFlags ( pMenuWindow->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE ); + } + + // Add one entry for every tool panel element to individually make + // them visible or hide them. + USHORT nIndex = MID_FIRST_PANEL; + for ( size_t i=0; iInsertItem( nIndex, rPanelDesc.pPanel->GetDisplayName(), MIB_CHECKABLE ); + pMenu->CheckItem( nIndex, !rPanelDesc.bHidden ); + } + pMenu->InsertSeparator(); + + #if OSL_DEBUG_LEVEL > 0 + pMenu->InsertItem( MID_LAYOUT_TABS, String::CreateFromAscii( "Tab-Layout (exp.)" ), MIB_CHECKABLE ); + pMenu->CheckItem( MID_LAYOUT_TABS, impl_getLayout() != LAYOUT_DRAWERS ); + pMenu->InsertItem( MID_LAYOUT_DRAWERS, String::CreateFromAscii( "Drawer-Layout" ), MIB_CHECKABLE ); + pMenu->CheckItem( MID_LAYOUT_DRAWERS, impl_getLayout() == LAYOUT_DRAWERS ); + + pMenu->InsertSeparator(); + #endif + + // Add entry for docking or un-docking the tool panel. + if ( m_rDockingWindow.IsFloatingMode() ) + pMenu->InsertItem( + MID_LOCK_TASK_PANEL, + String( SfxResId( STR_SFX_DOCK ) ) + ); + else + pMenu->InsertItem( + MID_UNLOCK_TASK_PANEL, + String( SfxResId( STR_SFX_UNDOCK ) ) + ); + + pMenu->RemoveDisabledEntries( FALSE, FALSE ); + + return pMenu; + } + + //================================================================================================================== + //= TaskPaneController + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + TaskPaneController::TaskPaneController( ModuleTaskPane& i_rTaskPane, TitledDockingWindow& i_rDockingWindow ) + :m_pImpl( new TaskPaneController_Impl( i_rTaskPane, i_rDockingWindow ) ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + TaskPaneController::~TaskPaneController() + { + } + + //------------------------------------------------------------------------------------------------------------------ + void TaskPaneController::SetDefaultTitle( const String& i_rTitle ) + { + m_pImpl->SetDefaultTitle( i_rTitle ); + } + //...................................................................................................................... } // namespace sfx2 //...................................................................................................................... diff --git a/sfx2/source/dialog/taskpane.src b/sfx2/source/dialog/taskpane.src new file mode 100644 index 000000000000..e7c6943f6fb4 --- /dev/null +++ b/sfx2/source/dialog/taskpane.src @@ -0,0 +1,43 @@ +/************************************************************************* + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include +#include "sfxlocal.hrc" + +String STR_SFX_DOCK +{ + Text [ en-US ] = "Dock"; +}; + +String STR_SFX_UNDOCK +{ + Text [ en-US ] = "Undock"; +}; + +String STR_SFX_TASK_PANE_VIEW +{ + Text [ en-US ] = "View"; +}; diff --git a/sfx2/source/dialog/titledockwin.cxx b/sfx2/source/dialog/titledockwin.cxx index e7593ec15f27..43fa6152c5a0 100644 --- a/sfx2/source/dialog/titledockwin.cxx +++ b/sfx2/source/dialog/titledockwin.cxx @@ -94,6 +94,12 @@ namespace sfx2 Invalidate(); } + //------------------------------------------------------------------------------------------------------------------ + String TitledDockingWindow::GetTitle() const + { + return impl_getTitle(); + } + //------------------------------------------------------------------------------------------------------------------ void TitledDockingWindow::SetText( const String& i_rText ) { @@ -306,6 +312,15 @@ namespace sfx2 SfxDockingWindow::StateChanged( i_nType ); } + //------------------------------------------------------------------------------------------------------------------ + void TitledDockingWindow::EndDocking( const Rectangle& i_rRect, BOOL i_bFloatMode ) + { + SfxDockingWindow::EndDocking( i_rRect, i_bFloatMode ); + + if ( m_aEndDockingHdl.IsSet() ) + m_aEndDockingHdl.Call( this ); + } + //------------------------------------------------------------------------------------------------------------------ void TitledDockingWindow::DataChanged( const DataChangedEvent& i_rDataChangedEvent ) { diff --git a/sfx2/source/dialog/titledockwin.src b/sfx2/source/dialog/titledockwin.src index fb77a6fc8931..3f52e84ab75d 100644 --- a/sfx2/source/dialog/titledockwin.src +++ b/sfx2/source/dialog/titledockwin.src @@ -37,7 +37,3 @@ Image SFX_IMG_CLOSE_DOC_HC ImageBitmap = Bitmap { File = "closedochc.png" ; }; }; -String STR_SFX_TASKS -{ - Text [ en-US ] = "Tasks"; -}; diff --git a/sfx2/source/inc/helpid.hrc b/sfx2/source/inc/helpid.hrc index 00276dcfbebd..008380f5777e 100644 --- a/sfx2/source/inc/helpid.hrc +++ b/sfx2/source/inc/helpid.hrc @@ -334,7 +334,7 @@ #define HID_SEARCHDIALOG (HID_SFX_START + 311) #define HID_TASKPANE_WINDOW (HID_SFX_START + 312) - +#define HID_TASKPANE_VIEW_MENU (HID_SFX_START + 313) #define HID_XMLSEC_WARNING_BROKENSIGNATURE (HID_SFX_START + 314) #define HID_XMLSEC_QUERY_LOSINGSIGNATURE (HID_SFX_START + 315) #define HID_XMLSEC_QUERY_SAVEBEFORESIGN (HID_SFX_START + 316) diff --git a/sfx2/source/inc/sfxlocal.hrc b/sfx2/source/inc/sfxlocal.hrc index 2929b69ef1dd..8c82711d7b9a 100644 --- a/sfx2/source/inc/sfxlocal.hrc +++ b/sfx2/source/inc/sfxlocal.hrc @@ -47,7 +47,9 @@ #define STR_SFX_EXPLORERFILE_BUTTONINSERT (RID_SFX_SFXLOCAL_START + 4) #define STR_SFX_IMPORT_ALL (RID_SFX_SFXLOCAL_START + 5) #define STR_SFX_EXPLORERFILE_EXPORT (RID_SFX_SFXLOCAL_START + 6) -#define STR_SFX_TASKS (RID_SFX_SFXLOCAL_START + 7) +#define STR_SFX_DOCK (RID_SFX_SFXLOCAL_START + 7) +#define STR_SFX_UNDOCK (RID_SFX_SFXLOCAL_START + 8) +#define STR_SFX_TASK_PANE_VIEW (RID_SFX_SFXLOCAL_START + 9) // Controls -------------------------------------------------------------- -- cgit From 767a546786eb55e5223e03416b53da9b520a960e Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 14 Apr 2010 13:55:39 +0200 Subject: slidecopy: re-introduce the icons for Impress' standard tool panels --- sfx2/source/dialog/taskpane.cxx | 52 +++++++++++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 10 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index cadb1189dc5d..794079d5fe74 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -27,6 +27,7 @@ #include "precompiled_sfx2.hxx" #include "sfx2/taskpane.hxx" +#include "sfx2/imagemgr.hxx" #include "sfx2/sfxsids.hrc" #include "sfx2/bindings.hxx" #include "sfx2/dispatch.hxx" @@ -43,6 +44,7 @@ #include #include #include +#include /** === end UNO includes === **/ #include @@ -55,11 +57,7 @@ #include #include #include - -#if OSL_DEBUG_LEVEL > 0 -#include -#include -#endif +#include #include @@ -156,19 +154,35 @@ namespace sfx2 } //-------------------------------------------------------------------------------------------------------------- - Image lcl_getPanelImage( const ::utl::OConfigurationNode& i_rPanelConfigNode ) + Image lcl_getPanelImage( const Reference< XFrame >& i_rDocFrame, const ::utl::OConfigurationNode& i_rPanelConfigNode ) { const ::rtl::OUString sImageURL( ::comphelper::getString( i_rPanelConfigNode.getNodeValue( "ImageURL" ) ) ); if ( sImageURL.getLength() ) { try { - const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - const Reference< XGraphicProvider > xGraphicProvider( aContext.createComponent( "com.sun.star.graphic.GraphicProvider" ), UNO_QUERY_THROW ); - ::comphelper::NamedValueCollection aMediaProperties; aMediaProperties.put( "URL", sImageURL ); + // special handling: if the ImageURL denotes a CommandName, then retrieve the image for that command + const sal_Char* pCommandImagePrefix = "private:commandimage/"; + const sal_Int32 nCommandImagePrefixLen = strlen( pCommandImagePrefix ); + if ( sImageURL.compareToAscii( pCommandImagePrefix, nCommandImagePrefixLen ) == 0 ) + { + ::rtl::OUStringBuffer aCommandName; + aCommandName.appendAscii( ".uno:" ); + aCommandName.append( sImageURL.copy( nCommandImagePrefixLen ) ); + const ::rtl::OUString sCommandName( aCommandName.makeStringAndClear() ); + + const BOOL bHiContrast( Application::GetSettings().GetStyleSettings().GetHighContrastMode() ); + const Image aPanelImage( GetImage( i_rDocFrame, sCommandName, FALSE, bHiContrast ) ); + return aPanelImage.GetXGraphic(); + } + + // otherwise, delegate to the GraphicProvider + const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + const Reference< XGraphicProvider > xGraphicProvider( aContext.createComponent( "com.sun.star.graphic.GraphicProvider" ), UNO_QUERY_THROW ); + const Reference< XGraphic > xGraphic( xGraphicProvider->queryGraphic( aMediaProperties.getPropertyValues() ), UNO_SET_THROW ); return Image( xGraphic ); } @@ -302,7 +316,7 @@ namespace sfx2 //------------------------------------------------------------------------------------------------------------------ CustomToolPanel::CustomToolPanel( const ::utl::OConfigurationNode& i_rPanelWindowState, const Reference< XFrame >& i_rFrame ) :m_sUIName( ::comphelper::getString( i_rPanelWindowState.getNodeValue( "UIName" ) ) ) - ,m_aPanelImage( lcl_getPanelImage( i_rPanelWindowState ) ) + ,m_aPanelImage( lcl_getPanelImage( i_rFrame, i_rPanelWindowState ) ) ,m_sResourceURL( i_rPanelWindowState.getLocalName() ) ,m_sPanelConfigPath( i_rPanelWindowState.getNodePath() ) ,m_xFrame( i_rFrame ) @@ -482,6 +496,8 @@ namespace sfx2 ::boost::optional< size_t > GetPanelPos( const ::rtl::OUString& i_rResourceURL ); + ::rtl::OUString + GetPanelResourceURL( const size_t i_nPanelPos ) const; void SetDrawersLayout(); void SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent ); @@ -595,6 +611,16 @@ namespace sfx2 return aPanelPos; } + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString ModuleTaskPane_Impl::GetPanelResourceURL( const size_t i_nPanelPos ) const + { + ENSURE_OR_RETURN( i_nPanelPos < m_aPanelDeck.GetPanelCount(), "ModuleTaskPane_Impl::GetPanelResourceURL: illegal panel position!", ::rtl::OUString() ); + const ::svt::PToolPanel pPanel( m_aPanelDeck.GetPanel( i_nPanelPos ) ); + const CustomToolPanel* pCustomPanel = dynamic_cast< const CustomToolPanel* >( pPanel.get() ); + ENSURE_OR_RETURN( pCustomPanel != NULL, "ModuleTaskPane_Impl::GetPanelPos: illegal panel implementation!", ::rtl::OUString() ); + return pCustomPanel->GetResourceURL(); + } + //------------------------------------------------------------------------------------------------------------------ void ModuleTaskPane_Impl::SetDrawersLayout() { @@ -687,6 +713,12 @@ namespace sfx2 return m_pImpl->GetPanelPos( i_rResourceURL ); } + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString ModuleTaskPane::GetPanelResourceURL( const size_t i_nPanelPos ) const + { + return m_pImpl->GetPanelResourceURL( i_nPanelPos ); + } + //------------------------------------------------------------------------------------------------------------------ void ModuleTaskPane::SetDrawersLayout() { -- cgit From ebbda0f3345e688956b3324e909c8eed86fa7341 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 14 Apr 2010 20:24:29 +0200 Subject: slidecopy: allow sorting the tool panels in the TaskPane (so far, the implicit ordering was defined by the order in which the config nodes were returned by the config manager) --- sfx2/source/dialog/taskpane.cxx | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index 794079d5fe74..836a724e408f 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -471,7 +471,8 @@ namespace sfx2 class ModuleTaskPane_Impl : public ::boost::noncopyable { public: - ModuleTaskPane_Impl( ModuleTaskPane& i_rAntiImpl, const Reference< XFrame >& i_rDocumentFrame ) + ModuleTaskPane_Impl( ModuleTaskPane& i_rAntiImpl, const Reference< XFrame >& i_rDocumentFrame, + const IToolPanelCompare* i_pPanelCompare ) :m_rAntiImpl( i_rAntiImpl ) ,m_sModuleIdentifier( lcl_identifyModule( i_rDocumentFrame ) ) ,m_xFrame( i_rDocumentFrame ) @@ -479,7 +480,7 @@ namespace sfx2 { m_aPanelDeck.Show(); OnResize(); - impl_initFromConfiguration(); + impl_initFromConfiguration( i_pPanelCompare ); } ~ModuleTaskPane_Impl() @@ -503,7 +504,7 @@ namespace sfx2 void SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent ); private: - void impl_initFromConfiguration(); + void impl_initFromConfiguration( const IToolPanelCompare* i_pPanelCompare ); static bool impl_isToolPanelResource( const ::rtl::OUString& i_rResourceURL ); @@ -543,7 +544,7 @@ namespace sfx2 } //------------------------------------------------------------------------------------------------------------------ - void ModuleTaskPane_Impl::impl_initFromConfiguration() + void ModuleTaskPane_Impl::impl_initFromConfiguration( const IToolPanelCompare* i_pPanelCompare ) { const ::utl::OConfigurationTreeRoot aWindowStateConfig( lcl_getModuleUIElementStatesConfig( m_sModuleIdentifier ) ); if ( !aWindowStateConfig.isValid() ) @@ -562,7 +563,25 @@ namespace sfx2 ::utl::OConfigurationNode aResourceNode( aWindowStateConfig.openNode( *resource ) ); ::svt::PToolPanel pCustomPanel( new CustomToolPanel( aResourceNode, m_xFrame ) ); - size_t nPanelPos = m_aPanelDeck.InsertPanel( pCustomPanel, m_aPanelDeck.GetPanelCount() ); + + size_t nPanelPos = m_aPanelDeck.GetPanelCount(); + if ( i_pPanelCompare ) + { + // assuming that nobody will insert hundreths of panels, a simple O(n) search should suffice here ... + while ( nPanelPos > 0 ) + { + const short nCompare = i_pPanelCompare->compareToolPanelsURLs( + *resource, + GetPanelResourceURL( --nPanelPos ) + ); + if ( nCompare >= 0 ) + { + ++nPanelPos; + break; + } + } + } + nPanelPos = m_aPanelDeck.InsertPanel( pCustomPanel, nPanelPos ); if ( ::comphelper::getBOOL( aResourceNode.getNodeValue( "Visible" ) ) ) nFirstVisiblePanel = nPanelPos; @@ -660,7 +679,15 @@ namespace sfx2 //------------------------------------------------------------------------------------------------------------------ ModuleTaskPane::ModuleTaskPane( Window& i_rParentWindow, const Reference< XFrame >& i_rDocumentFrame ) :Window( &i_rParentWindow, 0 ) - ,m_pImpl( new ModuleTaskPane_Impl( *this, i_rDocumentFrame ) ) + ,m_pImpl( new ModuleTaskPane_Impl( *this, i_rDocumentFrame, NULL ) ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + ModuleTaskPane::ModuleTaskPane( Window& i_rParentWindow, const Reference< XFrame >& i_rDocumentFrame, + const IToolPanelCompare& i_rCompare ) + :Window( &i_rParentWindow, 0 ) + ,m_pImpl( new ModuleTaskPane_Impl( *this, i_rDocumentFrame, &i_rCompare ) ) { } -- cgit From 5fad51e9db2be4affb53377bd5113346420c1c4b Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Fri, 7 May 2010 12:23:35 +0200 Subject: #i109668# let the default filter be used for export --- sfx2/source/doc/guisaveas.cxx | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 3be1f4a79cc8..5b12ac5537f7 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -835,10 +835,16 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, } ::rtl::OUString aAdjustToType; - - // bSetStandardName == true means that user agreed to store document in the default (default default ;-)) format - if ( !(( nStoreMode & EXPORT_REQUESTED ) && !( nStoreMode & WIDEEXPORT_REQUESTED )) && - ( bSetStandardName || GetStorable()->hasLocation() )) + if ( ( nStoreMode & EXPORT_REQUESTED ) && !( nStoreMode & WIDEEXPORT_REQUESTED )) + { + // it is export, set the preselected filter + ::rtl::OUString aFilterUIName = aPreselectedFilterPropsHM.getUnpackedValueOrDefault( + ::rtl::OUString::createFromAscii( "UIName" ), + ::rtl::OUString() ); + pFileDlg->SetCurrentFilter( aFilterUIName ); + } + // it is no export, bSetStandardName == true means that user agreed to store document in the default (default default ;-)) format + else if ( bSetStandardName || GetStorable()->hasLocation() ) { uno::Sequence< beans::PropertyValue > aOldFilterProps; ::rtl::OUString aOldFilterName = GetDocProps().getUnpackedValueOrDefault( @@ -1572,8 +1578,10 @@ uno::Sequence< beans::PropertyValue > SfxStoringHelper::SearchForFilter( uno::Reference< container::XEnumeration > xFilterEnum = xFilterQuery->createSubSetEnumerationByProperties( aSearchRequest ); - // use the first filter that is found + // the first default filter will be taken, + // if there is no filter with flag default the first acceptable filter will be taken if ( xFilterEnum.is() ) + { while ( xFilterEnum->hasMoreElements() ) { uno::Sequence< beans::PropertyValue > aProps; @@ -1584,11 +1592,17 @@ uno::Sequence< beans::PropertyValue > SfxStoringHelper::SearchForFilter( (sal_Int32)0 ); if ( ( ( nFlags & nMustFlags ) == nMustFlags ) && !( nFlags & nDontFlags ) ) { - aFilterProps = aProps; - break; + if ( ( nFlags & SFX_FILTER_DEFAULT ) == SFX_FILTER_DEFAULT ) + { + aFilterProps = aProps; + break; + } + else if ( !aFilterProps.getLength() ) + aFilterProps = aProps; } } } + } return aFilterProps; } -- cgit From 7a416229473fb14715d1a2af9c9065de8be8d2a7 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Fri, 16 Apr 2010 15:08:05 +0200 Subject: #i10880# fixed pause logo in impress slideshow --- sfx2/source/dialog/about.cxx | 76 +++++++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 33 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/about.cxx b/sfx2/source/dialog/about.cxx index 66d4146d9e62..4635733b934d 100644 --- a/sfx2/source/dialog/about.cxx +++ b/sfx2/source/dialog/about.cxx @@ -109,6 +109,48 @@ static bool impl_loadBitmap( return false; } +/** loads the application logo as used in the about dialog and impress slideshow pause screen */ +Image SfxApplication::GetApplicationLogo() +{ + Image aAppLogo; + + rtl::OUString aAbouts( RTL_CONSTASCII_USTRINGPARAM( ABOUT_BITMAP_STRINGLIST ) ); + bool bLoaded = false; + sal_Int32 nIndex = 0; + do + { + bLoaded = impl_loadBitmap( + rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program" ), + aAbouts.getToken( 0, ',', nIndex ), aAppLogo ); + } + while ( !bLoaded && ( nIndex >= 0 ) ); + + // fallback to "about.bmp" + if ( !bLoaded ) + { + bLoaded = impl_loadBitmap( + rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program/edition" ), + rtl::OUString::createFromAscii( "about.png" ), aAppLogo ); + if ( !bLoaded ) + bLoaded = impl_loadBitmap( + rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program/edition" ), + rtl::OUString::createFromAscii( "about.bmp" ), aAppLogo ); + } + + if ( !bLoaded ) + { + bLoaded = impl_loadBitmap( + rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program" ), + rtl::OUString::createFromAscii( "about.png" ), aAppLogo ); + if ( !bLoaded ) + bLoaded = impl_loadBitmap( + rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program" ), + rtl::OUString::createFromAscii( "about.bmp" ), aAppLogo ); + } + + return aAppLogo; +} + AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerStr ) : SfxModalDialog ( pParent, rId ), @@ -145,39 +187,7 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS } // load image from module path - rtl::OUString aAbouts( RTL_CONSTASCII_USTRINGPARAM( ABOUT_BITMAP_STRINGLIST ) ); - bool bLoaded = false; - sal_Int32 nIndex = 0; - do - { - bLoaded = impl_loadBitmap( - rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program" ), - aAbouts.getToken( 0, ',', nIndex ), aAppLogo ); - } - while ( !bLoaded && ( nIndex >= 0 ) ); - - // fallback to "about.bmp" - if ( !bLoaded ) - { - bLoaded = impl_loadBitmap( - rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program/edition" ), - rtl::OUString::createFromAscii( "about.png" ), aAppLogo ); - if ( !bLoaded ) - bLoaded = impl_loadBitmap( - rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program/edition" ), - rtl::OUString::createFromAscii( "about.bmp" ), aAppLogo ); - } - - if ( !bLoaded ) - { - bLoaded = impl_loadBitmap( - rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program" ), - rtl::OUString::createFromAscii( "about.png" ), aAppLogo ); - if ( !bLoaded ) - bLoaded = impl_loadBitmap( - rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program" ), - rtl::OUString::createFromAscii( "about.bmp" ), aAppLogo ); - } + aAppLogo = SfxApplication::GetApplicationLogo(); // Transparenter Font Font aFont = GetFont(); -- cgit From 628ade34df97fd0f0a7ec18dd3bec21561ff785f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 16 Apr 2010 15:14:15 +0200 Subject: slidecopy: now using SID_TASK_PANE in all applications, also in Impress. Implies registering the respective child window in the apps, not in SFX. Also implies getting rid of SID_RIGHT_PANE in Impress. Also, renamed SID_TASK_PANE in Impress to SID_SHOW_TOOL_PANEL, which better fits its purpose, and avoids confusion with SID_TASKPANE. --- sfx2/source/appl/appreg.cxx | 1 - 1 file changed, 1 deletion(-) (limited to 'sfx2/source') diff --git a/sfx2/source/appl/appreg.cxx b/sfx2/source/appl/appreg.cxx index be313dca1bc0..addace134362 100644 --- a/sfx2/source/appl/appreg.cxx +++ b/sfx2/source/appl/appreg.cxx @@ -66,7 +66,6 @@ void SfxApplication::Registrations_Impl() // ChildWindows SfxRecordingFloatWrapper_Impl::RegisterChildWindow(); SfxNavigatorWrapper::RegisterChildWindow( FALSE, NULL, SFX_CHILDWIN_NEVERHIDE ); - ::sfx2::TaskPaneWrapper::RegisterChildWindow( FALSE ); SfxPartChildWnd_Impl::RegisterChildWindow(); SfxTemplateDialogWrapper::RegisterChildWindow(TRUE); SfxDockingWrapper::RegisterChildWindow(); -- cgit From 026a4dd72a69f091e428012cb119f4e363af470f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 19 Apr 2010 10:50:48 +0200 Subject: slidecopy: SID_TASKPANE => UI name 'Task Pane' --- sfx2/source/dialog/dialog.src | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/dialog.src b/sfx2/source/dialog/dialog.src index c6e3234b26fd..f35b5e42e49e 100644 --- a/sfx2/source/dialog/dialog.src +++ b/sfx2/source/dialog/dialog.src @@ -253,7 +253,7 @@ String SID_NAVIGATOR }; String SID_TASKPANE { - Text [ en-US ] = "Tasks"; + Text [ en-US ] = "Task Pane"; }; ErrorBox MSG_ERROR_WRONG_CONFIRM -- cgit From fb6f49df6515529d09fc131c04be418363e3be2c Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 19 Apr 2010 10:52:23 +0200 Subject: slidecopy: RID_AUTOHIDE is unused --- sfx2/source/dialog/dialog.hrc | 1 - sfx2/source/dialog/dialog.src | 16 ---------------- 2 files changed, 17 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/dialog.hrc b/sfx2/source/dialog/dialog.hrc index f1e100e17cf5..78844d335f6a 100644 --- a/sfx2/source/dialog/dialog.hrc +++ b/sfx2/source/dialog/dialog.hrc @@ -76,7 +76,6 @@ #define CB_URL ( RC_DIALOG_BEGIN + 64 ) #define STR_INTERNET ( RC_DIALOG_BEGIN + 65 ) -#define RID_AUTOHIDE ( RC_DIALOG_BEGIN + 66 ) #define DLG_ONLINE_REGISTER ( RC_DIALOG_BEGIN + 68 ) #define DLG_VERSIONS ( RC_DIALOG_BEGIN + 69 ) diff --git a/sfx2/source/dialog/dialog.src b/sfx2/source/dialog/dialog.src index f35b5e42e49e..0b5a07e34817 100644 --- a/sfx2/source/dialog/dialog.src +++ b/sfx2/source/dialog/dialog.src @@ -231,22 +231,6 @@ ModalDialog RID_URLOPEN Left = TRUE ; }; }; -Menu RID_AUTOHIDE -{ - ItemList = - { - MenuItem - { - Identifier = SID_AUTOHIDE ; - HelpID = SID_AUTOHIDE ; - Text [ en-US ] = "Hide" ; - }; - }; -}; -String RID_AUTOHIDE -{ - Text [ en-US ] = "Don't Hide" ; -}; String SID_NAVIGATOR { Text [ en-US ] = "Navigator"; -- cgit From fffe638f90d81b2b6dd73e9672ab5989443741e8 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 19 Apr 2010 11:52:42 +0200 Subject: slidecopy: docking window title is 'Task Pane', in-window title bar shows 'Tasks' --- sfx2/source/dialog/taskpane.cxx | 2 +- sfx2/source/dialog/taskpane.src | 4 ++++ sfx2/source/inc/sfxlocal.hrc | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index fbb590c175a7..592033d005f3 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -905,7 +905,7 @@ namespace sfx2 m_aPanelRepository.push_back( PanelDescriptor( pPanel ) ); } - m_sDefaultTitle = m_rDockingWindow.GetTitle(); + m_sDefaultTitle = String( SfxResId( STR_SFX_TASKS ) ); } //------------------------------------------------------------------------------------------------------------------ diff --git a/sfx2/source/dialog/taskpane.src b/sfx2/source/dialog/taskpane.src index e7c6943f6fb4..5a955e8587d1 100644 --- a/sfx2/source/dialog/taskpane.src +++ b/sfx2/source/dialog/taskpane.src @@ -41,3 +41,7 @@ String STR_SFX_TASK_PANE_VIEW { Text [ en-US ] = "View"; }; +String STR_SFX_TASKS +{ + Text [ en-US ] = "Tasks"; +}; diff --git a/sfx2/source/inc/sfxlocal.hrc b/sfx2/source/inc/sfxlocal.hrc index 5eb0a24be63f..202ed6f6f00f 100644 --- a/sfx2/source/inc/sfxlocal.hrc +++ b/sfx2/source/inc/sfxlocal.hrc @@ -47,6 +47,7 @@ #define STR_SFX_DOCK (RID_SFX_SFXLOCAL_START + 7) #define STR_SFX_UNDOCK (RID_SFX_SFXLOCAL_START + 8) #define STR_SFX_TASK_PANE_VIEW (RID_SFX_SFXLOCAL_START + 9) +#define STR_SFX_TASKS (RID_SFX_SFXLOCAL_START + 10) // Controls -------------------------------------------------------------- -- cgit From fd9970be9c1152aa2a34b829ee8f86f155c9ad89 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 19 Apr 2010 11:53:51 +0200 Subject: slidecopy: removed more unused stuff from source/dialog --- sfx2/source/dialog/dialog.hrc | 30 --------- sfx2/source/dialog/dialog.src | 137 ----------------------------------------- sfx2/source/dialog/makefile.mk | 1 - sfx2/source/dialog/sfxurl.cxx | 41 ------------ 4 files changed, 209 deletions(-) delete mode 100644 sfx2/source/dialog/sfxurl.cxx (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/dialog.hrc b/sfx2/source/dialog/dialog.hrc index 78844d335f6a..7f03bf416431 100644 --- a/sfx2/source/dialog/dialog.hrc +++ b/sfx2/source/dialog/dialog.hrc @@ -39,53 +39,24 @@ #define RID_DLG_ALIEN_WARNING ( RC_DIALOG_BEGIN + 0) #define STR_RESET ( RC_DIALOG_BEGIN + 0) -#define STR_BASEFMT ( RC_DIALOG_BEGIN + 1) -#define CB_USE_PASSWD ( RC_DIALOG_BEGIN + 2) -#define CB_READ_ONLY ( RC_DIALOG_BEGIN + 3) -#define BTN_MANAGER ( RC_DIALOG_BEGIN + 4) -#define BTN_STANDARD ( RC_DIALOG_BEGIN + 5) #define DLG_PASSWD ( RC_DIALOG_BEGIN + 8) -#define STR_FILEDLG_INSERT ( RC_DIALOG_BEGIN + 10) #define STR_TABPAGE_MANAGESTYLES ( RC_DIALOG_BEGIN + 12) #define MSG_TABPAGE_INVALIDNAME ( RC_DIALOG_BEGIN + 13) #define MSG_TABPAGE_INVALIDSTYLE ( RC_DIALOG_BEGIN + 14) #define DLG_NEW_STYLE_BY_EXAMPLE ( RC_DIALOG_BEGIN + 15) #define MSG_POOL_STYLE_NAME ( RC_DIALOG_BEGIN + 16) -#define MSG_OVERWRITE_STYLE ( RC_DIALOG_BEGIN + 17) #define MSG_TABPAGE_INVALIDPARENT ( RC_DIALOG_BEGIN + 18) #define STR_DELETE_STYLE ( RC_DIALOG_BEGIN + 18) #define STR_DELETE_STYLE_USED ( RC_DIALOG_BEGIN + 20) -#define LOGO_IMAGELIST ( RC_DIALOG_BEGIN + 45) #define MN_CONTEXT_TEMPLDLG ( RC_DIALOG_BEGIN + 46) -#define MSG_LAYOUT_NOT_LOADING ( RC_DIALOG_BEGIN + 49) -#define ACC_LAYOUT_NOT_LOADING ( RC_DIALOG_BEGIN + 50) - -#define MSG_ERR_CANT_EDIT_OLD_FORMAT ( RC_DIALOG_BEGIN + 60 ) -#define MSG_ERR_CANT_EDIT_OPEN_DOCS ( RC_DIALOG_BEGIN + 61 ) - -#define RID_URLOPEN ( RC_DIALOG_BEGIN + 62 ) -#define RID_URLOPEN_OK 1 -#define RID_URLOPEN_CANCEL 2 -#define RID_URLOPEN_URL 3 - -#define CB_FILE ( RC_DIALOG_BEGIN + 63 ) -#define CB_URL ( RC_DIALOG_BEGIN + 64 ) - -#define STR_INTERNET ( RC_DIALOG_BEGIN + 65 ) - -#define DLG_ONLINE_REGISTER ( RC_DIALOG_BEGIN + 68 ) #define DLG_VERSIONS ( RC_DIALOG_BEGIN + 69 ) #define DLG_COMMENTS ( RC_DIALOG_BEGIN + 70 ) -#define RID_REGISTER_DLG ( RC_DIALOG_BEGIN + 73 ) -#define DLG_PHONE_CONFIGURATION ( RC_DIALOG_BEGIN + 74 ) -#define DLG_RECOGNIZER_ENGINEMODE ( RC_DIALOG_BEGIN + 75 ) #define MSG_ERROR_WRONG_CONFIRM ( RC_DIALOG_BEGIN + 76 ) -#define DLG_RECOGNIZER_SPEAKER ( RC_DIALOG_BEGIN + 77 ) #define STR_APPLY ( RC_DIALOG_BEGIN + 87 ) @@ -103,7 +74,6 @@ #define RID_DLG_SEARCH ( RC_DIALOG_BEGIN + 109 ) #define STR_PDF_EXPORT_SEND ( RC_DIALOG_BEGIN + 120 ) -#define STR_RECHECK_DOCUMENT ( RC_DIALOG_BEGIN + 121 ) #define IMG_INFO ( RC_DIALOG_BEGIN + 122 ) #define RID_EDIT_DURATIONS ( RC_DIALOG_BEGIN + 123 ) #define SFX_PB_EDIT ( RC_DIALOG_BEGIN + 124 ) diff --git a/sfx2/source/dialog/dialog.src b/sfx2/source/dialog/dialog.src index 0b5a07e34817..c39425510ae2 100644 --- a/sfx2/source/dialog/dialog.src +++ b/sfx2/source/dialog/dialog.src @@ -31,30 +31,6 @@ #include "helpid.hrc" #include "sfxlocal.hrc" - // Imageliste fuer die AboutBox -ImageList LOGO_IMAGELIST -{ - Prefix = "an"; - MaskColor = Color - { - Red = 0xFFFF ; - Green = 0x0000 ; - Blue = 0xFFFF ; - }; - IdList = - { - 1 ; - 2 ; - 3 ; - 4 ; - 5 ; - 6 ; - }; - IdCount = - { - 6 ; - }; -}; String STR_RESET { Text [ en-US ] = "~Reset" ; @@ -63,48 +39,6 @@ String STR_APPLY { Text [ en-US ] = "Apply"; }; -String STR_INTERNET -{ - Text [ en-US ] = "(Internet)" ; -}; -String STR_BASEFMT -{ - Text [ en-US ] = "Base format" ; -}; -CheckBox CB_USE_PASSWD -{ - HelpId = HID_FILEDLG_USE_PASSWD ; - Text [ en-US ] = "~Password" ; -}; -CheckBox CB_READ_ONLY -{ - HelpId = HID_FILEDLG_READ_ONLY ; - Text [ en-US ] = "~Read-only" ; -}; -PushButton CB_FILE -{ - HelpId = HID_FILEDLG_FILE ; - Text [ en-US ] = "~File System" ; -}; -PushButton CB_URL -{ - HelpId = HID_FILEDLG_URL ; - Text [ en-US ] = "Int~ernet" ; -}; -PushButton BTN_MANAGER -{ - HelpId = HID_FILEDLG_MANAGER ; - Text [ en-US ] = "~Manager..." ; -}; -PushButton BTN_STANDARD -{ - HelpId = HID_FILEDLG_STANDARD ; - Text [ en-US ] = "~Home" ; -}; -String STR_FILEDLG_INSERT -{ - Text [ en-US ] = "Insert File" ; -}; String STR_TABPAGE_MANAGESTYLES { Text [ en-US ] = "Organizer" ; @@ -131,12 +65,6 @@ InfoBox MSG_POOL_STYLE_NAME { Message [ en-US ] = "Name already exists as a default Style.\nPlease choose another name." ; }; -QueryBox MSG_OVERWRITE_STYLE -{ - Buttons = WB_YES_NO ; - DefButton = WB_DEF_NO ; - Message [ en-US ] = "Style already exists. Overwrite?" ; -}; String STR_DELETE_STYLE { Text [ en-US ] = "Do you really want to delete Style $1?" ; @@ -170,67 +98,7 @@ Menu MN_CONTEXT_TEMPLDLG }; }; -InfoBox MSG_LAYOUT_NOT_LOADING -{ - BUTTONS = WB_OK ; - DEFBUTTON = WB_DEF_OK ; - Message [ en-US ] = "Loading document without layout." ; -}; -Accelerator ACC_LAYOUT_NOT_LOADING -{ - ItemList = - { - AcceleratorItem - { - Key = KeyCode - { - Code = KEY_L ; - Shift = FALSE ; Modifier1 = TRUE ; Modifier2 = TRUE ; - }; - Identifier = 1 ; - }; - }; -}; - //------------------------------------------------------------------------ -ErrorBox MSG_ERR_CANT_EDIT_OLD_FORMAT -{ - Message [ en-US ] = "Cannot edit document info for documents\n in this file format." ; -}; //------------------------------------------------------------------------ -ErrorBox MSG_ERR_CANT_EDIT_OPEN_DOCS -{ - Message [ en-US ] = "Document info of documents\n being currently edited cannot be modified from within the document manager." ; -}; -ModalDialog RID_URLOPEN -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 204 , 44 ) ; - Moveable = TRUE ; - Text [ en-US ] = "Enter URL" ; - Moveable = TRUE ; - OKButton RID_URLOPEN_OK - { - Pos = MAP_APPFONT ( 148 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton RID_URLOPEN_CANCEL - { - Pos = MAP_APPFONT ( 148 , 24 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - Edit RID_URLOPEN_URL - { - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 16 ) ; - Size = MAP_APPFONT ( 138 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - }; -}; String SID_NAVIGATOR { Text [ en-US ] = "Navigator"; @@ -252,11 +120,6 @@ String STR_PDF_EXPORT_SEND Text [ en-US ] = "Send" ; }; -String STR_RECHECK_DOCUMENT -{ - Text [ en-US ] = "Recheck Document" ; -}; - Image IMG_INFO { ImageBitmap = Bitmap diff --git a/sfx2/source/dialog/makefile.mk b/sfx2/source/dialog/makefile.mk index 5cc5b0934013..3d0c53cdb932 100644 --- a/sfx2/source/dialog/makefile.mk +++ b/sfx2/source/dialog/makefile.mk @@ -61,7 +61,6 @@ SLOFILES =\ $(SLO)$/passwd.obj \ $(SLO)$/printopt.obj \ $(SLO)$/sfxdlg.obj \ - $(SLO)$/sfxurl.obj \ $(SLO)$/splitwin.obj \ $(SLO)$/srchdlg.obj \ $(SLO)$/styfitem.obj \ diff --git a/sfx2/source/dialog/sfxurl.cxx b/sfx2/source/dialog/sfxurl.cxx deleted file mode 100644 index 47e4062ac350..000000000000 --- a/sfx2/source/dialog/sfxurl.cxx +++ /dev/null @@ -1,41 +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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sfx2.hxx" -#include -#include -#include - -SfxUrlDialog::SfxUrlDialog( Window *pParent ) - : ModalDialog( pParent, SfxResId( RID_URLOPEN ) ), - aEdit( this, SfxResId(RID_URLOPEN_URL) ), - aOk( this, SfxResId(RID_URLOPEN_OK) ), - aCancel( this, SfxResId(RID_URLOPEN_CANCEL) ) -{ - FreeResource(); -} -- cgit From a509a725ba6005df3960a8c5b73f1d1a0f119264 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 19 Apr 2010 12:03:57 +0200 Subject: slidecopy: proper in-window title handling --- sfx2/source/dialog/taskpane.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index 592033d005f3..f6d282b9bce0 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -905,7 +905,7 @@ namespace sfx2 m_aPanelRepository.push_back( PanelDescriptor( pPanel ) ); } - m_sDefaultTitle = String( SfxResId( STR_SFX_TASKS ) ); + SetDefaultTitle( String( SfxResId( STR_SFX_TASKS ) ) ); } //------------------------------------------------------------------------------------------------------------------ @@ -929,6 +929,7 @@ namespace sfx2 void TaskPaneController_Impl::SetDefaultTitle( const String& i_rTitle ) { m_sDefaultTitle = i_rTitle; + impl_updateDockingWindowTitle(); } // ----------------------------------------------------------------------------------------------------------------- -- cgit From 1939f4db53cf2bbc4dfb4f8f4772dd8a5fb7c3db Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 19 Apr 2010 13:42:19 +0200 Subject: slidecopy: WB_DIALOGCONTROL for the ModuleTaskPane --- sfx2/source/dialog/taskpane.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index f6d282b9bce0..51acf5217dd2 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -678,7 +678,7 @@ namespace sfx2 //================================================================================================================== //------------------------------------------------------------------------------------------------------------------ ModuleTaskPane::ModuleTaskPane( Window& i_rParentWindow, const Reference< XFrame >& i_rDocumentFrame ) - :Window( &i_rParentWindow, 0 ) + :Window( &i_rParentWindow, WB_DIALOGCONTROL ) ,m_pImpl( new ModuleTaskPane_Impl( *this, i_rDocumentFrame, NULL ) ) { } @@ -686,7 +686,7 @@ namespace sfx2 //------------------------------------------------------------------------------------------------------------------ ModuleTaskPane::ModuleTaskPane( Window& i_rParentWindow, const Reference< XFrame >& i_rDocumentFrame, const IToolPanelCompare& i_rCompare ) - :Window( &i_rParentWindow, 0 ) + :Window( &i_rParentWindow, WB_DIALOGCONTROL ) ,m_pImpl( new ModuleTaskPane_Impl( *this, i_rDocumentFrame, &i_rCompare ) ) { } -- cgit From cca8197ffed06f6dc30b1928e78c4801edf1543f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 19 Apr 2010 21:02:16 +0200 Subject: slidecopy: properly include imagemgr.hxx (without the sfx2 prefix, to not use the delivered version, which by chance is incompatible in this CWS here) --- sfx2/source/dialog/taskpane.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index 51acf5217dd2..0f847d33da36 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -27,7 +27,7 @@ #include "precompiled_sfx2.hxx" #include "sfx2/taskpane.hxx" -#include "sfx2/imagemgr.hxx" +#include "imagemgr.hxx" #include "sfx2/sfxsids.hrc" #include "sfx2/bindings.hxx" #include "sfx2/dispatch.hxx" -- cgit From 515792c312abc929b4616c757b8eaced67718d10 Mon Sep 17 00:00:00 2001 From: Jens-Heiner Rechtien Date: Tue, 20 Apr 2010 12:17:55 +0200 Subject: DEV300 masterfix: #i10000#: adapt call to SfxViewFrame::GetNext() to changes from CWS autorecovery, 1c65617f50ee@DEV300 --- sfx2/source/doc/printhelper.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sfx2/source') diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index 82ba4d64a91b..2cd195976832 100755 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -273,7 +273,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxPrintHelper::getPrinter() thro while ( pViewFrm && !pPrinter ) { pPrinter = pViewFrm->GetViewShell()->GetActivePrinter(); - pViewFrm = SfxViewFrame::GetNext( *pViewFrm, m_pData->m_pObjectShell, 0, sal_False ); + pViewFrm = SfxViewFrame::GetNext( *pViewFrm, m_pData->m_pObjectShell, sal_False ); } // if no view is printing currently, use the permanent SfxPrinter instance -- cgit From c8357de230b906c40e34447f6fd4eb8a7be7e75a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 21 Apr 2010 09:35:49 +0200 Subject: slidecopy: properly determine the panel to be displayed initially (remembering the position is not a good idea when the positions are subject to change, due to client-defined sorting) --- sfx2/source/dialog/taskpane.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index 51acf5217dd2..82f6d7bd2cf2 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -550,7 +550,7 @@ namespace sfx2 if ( !aWindowStateConfig.isValid() ) return; - size_t nFirstVisiblePanel = size_t( -1 ); + ::rtl::OUString sFirstVisiblePanelResource; const Sequence< ::rtl::OUString > aUIElements( aWindowStateConfig.getNodeNames() ); for ( const ::rtl::OUString* resource = aUIElements.getConstArray(); @@ -584,12 +584,15 @@ namespace sfx2 nPanelPos = m_aPanelDeck.InsertPanel( pCustomPanel, nPanelPos ); if ( ::comphelper::getBOOL( aResourceNode.getNodeValue( "Visible" ) ) ) - nFirstVisiblePanel = nPanelPos; + sFirstVisiblePanelResource = *resource; } - if ( nFirstVisiblePanel != size_t( -1 ) ) + if ( sFirstVisiblePanelResource.getLength() ) { - m_rAntiImpl.PostUserEvent( LINK( this, ModuleTaskPane_Impl, OnActivatePanel ), reinterpret_cast< void* >( nFirstVisiblePanel ) ); + ::boost::optional< size_t > aPanelPos( GetPanelPos( sFirstVisiblePanelResource ) ); + OSL_ENSURE( !!aPanelPos, "ModuleTaskPane_Impl::impl_isToolPanelResource: just inserted it, and it's not there?!" ); + if ( !!aPanelPos ) + m_rAntiImpl.PostUserEvent( LINK( this, ModuleTaskPane_Impl, OnActivatePanel ), reinterpret_cast< void* >( *aPanelPos ) ); } } -- cgit From 8313a0004caec718efdd3b50542f10e05db3fa0d Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 22 Apr 2010 12:38:47 +0200 Subject: slidecopy: allow the SfxModule to overrule the availability of child windows, this way preventing their creation --- sfx2/source/appl/module.cxx | 13 ++++++ sfx2/source/appl/workwin.cxx | 107 +++++++++++++++++++++++++++---------------- sfx2/source/inc/workwin.hxx | 1 + 3 files changed, 81 insertions(+), 40 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx index c8a9742f49cf..895263ef4783 100644 --- a/sfx2/source/appl/module.cxx +++ b/sfx2/source/appl/module.cxx @@ -49,6 +49,8 @@ #include #include #include +#include "sfx2/taskpane.hxx" +#include #define SfxModule #include "sfxslots.hxx" @@ -400,6 +402,17 @@ BOOL SfxModule::IsActive() const return FALSE; } +bool SfxModule::IsChildWindowAvailable( const USHORT i_nId, const SfxViewFrame* i_pViewFrame ) const +{ + if ( i_nId != SID_TASKPANE ) + // by default, assume it is + return true; + + const SfxViewFrame* pViewFrame = i_pViewFrame ? i_pViewFrame : GetFrame(); + ENSURE_OR_RETURN( pViewFrame, "SfxModule::IsChildWindowAvailable: no frame to ask for the module identifier!", false ); + return ::sfx2::ModuleTaskPane::ModuleHasToolPanels( pViewFrame->GetFrame().GetFrameInterface() ); +} + SfxModule* SfxModule::GetActiveModule( SfxViewFrame* pFrame ) { if ( !pFrame ) diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index 24cf7dab8095..f9a388deee5c 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -1538,6 +1539,16 @@ void SfxWorkWindow::UpdateObjectBars_Impl() } } +bool SfxWorkWindow::AllowChildWindowCreation_Impl( const SfxChildWin_Impl& i_rCW ) const +{ + // or checking the availability of child windows, we need access to the module + const SfxViewFrame* pViewFrame = pBindings->GetDispatcher_Impl()->GetFrame(); + const SfxObjectShell* pShell = pViewFrame ? pViewFrame->GetObjectShell() : NULL; + const SfxModule* pModule = pShell ? pShell->GetModule() : NULL; + ENSURE_OR_RETURN( pModule, "SfxWorkWindow::UpdateChildWindows_Impl: did not find an SfxModule to ask for the child win availability!", true ); + return pModule->IsChildWindowAvailable( i_rCW.nId, pViewFrame ); +} + void SfxWorkWindow::UpdateChildWindows_Impl() { // alle vorhandenen oder in den Kontext gekommenen ChildWindows @@ -1550,7 +1561,7 @@ void SfxWorkWindow::UpdateChildWindows_Impl() { // Im Kontext ist ein geeignetes ChildWindow erlaubt; // ist es auch eingeschaltet ? - if ( pChildWin == 0 && pCW->bCreate ) + if ( pChildWin == NULL && pCW->bCreate ) { // Internal docking is only used for embedding into another // container. We force the floating state of all floatable @@ -1571,6 +1582,9 @@ void SfxWorkWindow::UpdateChildWindows_Impl() else bCreate = TRUE; + if ( bCreate ) + bCreate = AllowChildWindowCreation_Impl( *pCW ); + // Momentan kein Fenster da, aber es ist eingeschaltet; Fenster // und ggf. Context erzeugen if ( bCreate ) @@ -1588,19 +1602,25 @@ void SfxWorkWindow::UpdateChildWindows_Impl() if ( ( !bIsFullScreen || pChildWin->GetAlignment() == SFX_ALIGN_NOALIGNMENT ) && bAllChildsVisible ) { // Updatemode ist kompatibel; auf jeden Fall wieder einschalten - bCreate = TRUE; - if ( pCW->pCli ) + bCreate = AllowChildWindowCreation_Impl( *pCW ); + if ( bCreate ) { - // Fenster ist direktes Child - if ( bAllChildsVisible && ( (IsDockingAllowed() && bInternalDockingAllowed) || pCW->pCli->eAlign == SFX_ALIGN_NOALIGNMENT ) ) - pCW->pCli->nVisible |= CHILD_NOT_HIDDEN; + if ( pCW->pCli ) + { + // Fenster ist direktes Child + if ( bAllChildsVisible && ( (IsDockingAllowed() && bInternalDockingAllowed) || pCW->pCli->eAlign == SFX_ALIGN_NOALIGNMENT ) ) + pCW->pCli->nVisible |= CHILD_NOT_HIDDEN; + } + else + { + if ( pCW->bCreate && IsDockingAllowed() && bInternalDockingAllowed ) + // Fenster liegt in einem SplitWindow + ((SfxDockingWindow*)pChildWin->GetWindow())->Reappear_Impl(); + } + + if ( pCW->nInterfaceId != pChildWin->GetContextId() ) + pChildWin->CreateContext( pCW->nInterfaceId, GetBindings() ); } - else if ( pCW->bCreate && IsDockingAllowed() && bInternalDockingAllowed ) - // Fenster liegt in einem SplitWindow - ((SfxDockingWindow*)pChildWin->GetWindow())->Reappear_Impl(); - - if ( pCW->nInterfaceId != pChildWin->GetContextId() ) - pChildWin->CreateContext( pCW->nInterfaceId, GetBindings() ); } } } @@ -2225,7 +2245,7 @@ void SfxWorkWindow::ToggleChildWindow_Impl(USHORT nId, BOOL bSetFocus) SfxChildWin_Impl *pCW = (*pChildWins)[n]; SfxChildWindow *pChild = pCW->pWin; - bool bCreationAllowed( sal_True ); + bool bCreationAllowed( true ); if ( !bInternalDockingAllowed ) { // Special case for all non-floatable child windows. We have @@ -2233,43 +2253,51 @@ void SfxWorkWindow::ToggleChildWindow_Impl(USHORT nId, BOOL bSetFocus) bCreationAllowed = !( pCW->aInfo.nFlags & SFX_CHILDWIN_FORCEDOCK ); } - if ( pChild && pCW->bCreate && bCreationAllowed ) + if ( bCreationAllowed ) { - if ( pChild->QueryClose() ) + if ( pCW->bCreate ) { - if ( pChild && pChild->IsHideAtToggle() ) + if ( pChild ) { - pCW->bCreate = !pCW->bCreate; - ShowChildWindow_Impl( nId, pCW->bCreate, bSetFocus ); + if ( pChild->QueryClose() ) + { + pCW->bCreate = FALSE; + if ( pChild->IsHideAtToggle() ) + { + ShowChildWindow_Impl( nId, FALSE, bSetFocus ); + } + else + { + // Fenster soll ausgeschaltet werdem + pChild->SetVisible_Impl( FALSE ); + RemoveChildWin_Impl( pCW ); + } + } } else { - // Fenster soll ausgeschaltet werdem + // no actual Window exists, yet => just remember the "switched off" state pCW->bCreate = FALSE; - pChild->SetVisible_Impl( FALSE ); - RemoveChildWin_Impl( pCW ); } } - } - else if ( pCW->bCreate && bCreationAllowed ) - { - pCW->bCreate = FALSE; - } - else if ( bCreationAllowed ) - { - pCW->bCreate = TRUE; - - if ( pChild ) - { - ShowChildWindow_Impl( nId, pCW->bCreate, bSetFocus ); - } else { - // Fenster erzeugen - CreateChildWin_Impl( pCW, bSetFocus ); - if ( !pCW->pWin ) - // Erzeugung war erfolglos - pCW->bCreate = FALSE; + pCW->bCreate = AllowChildWindowCreation_Impl( *pCW ); + if ( pCW->bCreate ) + { + if ( pChild ) + { + ShowChildWindow_Impl( nId, TRUE, bSetFocus ); + } + else + { + // create actual Window + CreateChildWin_Impl( pCW, bSetFocus ); + if ( !pCW->pWin ) + // no success + pCW->bCreate = FALSE; + } + } } } @@ -2488,7 +2516,6 @@ void SfxWorkWindow::ShowChildWindow_Impl(USHORT nId, BOOL bVisible, BOOL bSetFoc SfxChildWindow *pChildWin = pCW->pWin; if ( pChildWin ) { -// pCW->bCreate = bVisible; if ( bVisible ) { if ( pCW->pCli ) diff --git a/sfx2/source/inc/workwin.hxx b/sfx2/source/inc/workwin.hxx index ae005d1bad88..a82b72bc2947 100644 --- a/sfx2/source/inc/workwin.hxx +++ b/sfx2/source/inc/workwin.hxx @@ -365,6 +365,7 @@ public: void SetActiveChild_Impl( Window *pChild ); Window* GetActiveChild_Impl(); virtual BOOL ActivateNextChild_Impl( BOOL bForward = TRUE ); + bool AllowChildWindowCreation_Impl( const SfxChildWin_Impl& i_rCW ) const; // Methoden f"ur StatusBar void SetTempStatusBar_Impl( BOOL bSet ); -- cgit From e0986b3290e9c73116d86f9ae3b8e35f94aadc2b Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 22 Apr 2010 12:51:04 +0200 Subject: tl78: #i110383# password to modify support --- sfx2/source/dialog/filedlghelper.cxx | 63 +------- sfx2/source/doc/docfile.cxx | 50 ++++++ sfx2/source/doc/objcont.cxx | 10 ++ sfx2/source/doc/objmisc.cxx | 29 ++++ sfx2/source/doc/objxtor.cxx | 1 + sfx2/source/inc/objshimp.hxx | 2 +- sfx2/source/view/viewfrm.cxx | 286 +++++++++++++++++++++-------------- 7 files changed, 270 insertions(+), 171 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index c1b9aaf7838d..d7109496d670 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -80,7 +80,6 @@ #include #include #include -#include #include #include #include @@ -465,22 +464,6 @@ sal_Bool FileDialogHelper_Impl::isInOpenMode() const // ------------------------------------------------------------------------ -namespace { - -sal_Bool lclCheckPasswordCapability( const SfxFilter* pFilter ) -{ - return pFilter && ( pFilter->GetFilterFlags() & SFX_FILTER_ENCRYPTION ); -} - -sal_Bool lclCheckPasswordToModifyCapability( const SfxFilter* pFilter ) -{ - return pFilter && ( pFilter->GetFilterFlags() & SFX_FILTER_PASSWORDTOMODIFY ); -} - -} - -// ------------------------------------------------------------------------ - void FileDialogHelper_Impl::updateFilterOptionsBox() { if ( !m_bHaveFilterOptions ) @@ -571,9 +554,10 @@ void FileDialogHelper_Impl::enablePasswordBox( sal_Bool bInit ) sal_Bool bWasEnabled = mbIsPwdEnabled; + const SfxFilter* pCurrentFilter = getCurentSfxFilter(); mbIsPwdEnabled = updateExtendedControl( ExtendedFilePickerElementIds::CHECKBOX_PASSWORD, - lclCheckPasswordCapability( getCurentSfxFilter() ) + pCurrentFilter && ( pCurrentFilter->GetFilterFlags() & SFX_FILTER_ENCRYPTION ) ); if( bInit ) @@ -1643,7 +1627,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, return ERRCODE_ABORT; // check, wether or not we have to display a password box - if ( mbHasPassword && mbIsPwdEnabled && xCtrlAccess.is() ) + if ( pCurrentFilter && mbHasPassword && mbIsPwdEnabled && xCtrlAccess.is() ) { try { @@ -1663,7 +1647,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, ::comphelper::DocPasswordRequestType_MS : ::comphelper::DocPasswordRequestType_STANDARD; - ::rtl::Reference< ::comphelper::DocPasswordRequest > pPasswordRequest( new ::comphelper::DocPasswordRequest( eType, ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)), lclCheckPasswordToModifyCapability( pCurrentFilter ) ) ); + ::rtl::Reference< ::comphelper::DocPasswordRequest > pPasswordRequest( new ::comphelper::DocPasswordRequest( eType, ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)), ( pCurrentFilter->GetFilterFlags() & SFX_FILTER_PASSWORDTOMODIFY ) ) ); uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pPasswordRequest.get() ); xInteractionHandler->handle( rRequest ); @@ -1675,43 +1659,10 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, if ( pPasswordRequest->getRecommendReadOnly() ) rpSet->Put( SfxBoolItem( SID_RECOMMENDREADONLY, sal_True ) ); - if ( pPasswordRequest->getPasswordToModify().getLength() ) - { - rtl_TextEncoding nEncoding = RTL_TEXTENCODING_UTF8; - if ( bMSType ) - { - // if the MS-filter should be used - // use the inconsistent algorithm to find the encoding specified by MS - nEncoding = osl_getThreadTextEncoding(); - switch( nEncoding ) - { - case RTL_TEXTENCODING_ISO_8859_15: - case RTL_TEXTENCODING_MS_874: - case RTL_TEXTENCODING_MS_1250: - case RTL_TEXTENCODING_MS_1251: - case RTL_TEXTENCODING_MS_1252: - case RTL_TEXTENCODING_MS_1253: - case RTL_TEXTENCODING_MS_1254: - case RTL_TEXTENCODING_MS_1255: - case RTL_TEXTENCODING_MS_1256: - case RTL_TEXTENCODING_MS_1257: - case RTL_TEXTENCODING_MS_1258: - case RTL_TEXTENCODING_SHIFT_JIS: - case RTL_TEXTENCODING_GB_2312: - case RTL_TEXTENCODING_BIG5: - // in case the system uses an encoding from the list above, it should be used - break; - - default: - // in case other encoding is used, use one of the encodings from the list - nEncoding = RTL_TEXTENCODING_MS_1250; - break; - } - } - - sal_uInt16 nHash = ::comphelper::DocPasswordHelper::GetXLHashAsUINT16( pPasswordRequest->getPasswordToModify(), nEncoding ); + // the empty password has 0 as Hash + sal_uInt16 nHash = SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), bMSType ); + if ( nHash ) rpSet->Put( SfxUInt16Item( SID_PASSWORDTOMODIFYHASH, nHash ) ); - } } else return ERRCODE_ABORT; diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 0b535088b0bd..1740d2703ed1 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -115,6 +115,7 @@ using namespace ::com::sun::star::io; #include #include #include +#include #include #include #include @@ -2671,18 +2672,67 @@ void SfxMedium::SetFilter( const SfxFilter* pFilterP, sal_Bool /*bResetOrig*/ ) pFilter = pFilterP; pImp->nFileVersion = 0; } + //---------------------------------------------------------------- const SfxFilter* SfxMedium::GetOrigFilter( sal_Bool bNotCurrent ) const { return ( pImp->pOrigFilter || bNotCurrent ) ? pImp->pOrigFilter : pFilter; } + //---------------------------------------------------------------- void SfxMedium::SetOrigFilter_Impl( const SfxFilter* pOrigFilter ) { pImp->pOrigFilter = pOrigFilter; } + +//------------------------------------------------------------------ + +sal_uInt16 SfxMedium::CreatePasswordToModifyHash( const ::rtl::OUString& aPasswd, sal_Bool bMSType ) +{ + sal_uInt16 nHash = 0; + + if ( aPasswd.getLength() ) + { + rtl_TextEncoding nEncoding = RTL_TEXTENCODING_UTF8; + if ( bMSType ) + { + // if the MS-filter should be used + // use the inconsistent algorithm to find the encoding specified by MS + nEncoding = osl_getThreadTextEncoding(); + switch( nEncoding ) + { + case RTL_TEXTENCODING_ISO_8859_15: + case RTL_TEXTENCODING_MS_874: + case RTL_TEXTENCODING_MS_1250: + case RTL_TEXTENCODING_MS_1251: + case RTL_TEXTENCODING_MS_1252: + case RTL_TEXTENCODING_MS_1253: + case RTL_TEXTENCODING_MS_1254: + case RTL_TEXTENCODING_MS_1255: + case RTL_TEXTENCODING_MS_1256: + case RTL_TEXTENCODING_MS_1257: + case RTL_TEXTENCODING_MS_1258: + case RTL_TEXTENCODING_SHIFT_JIS: + case RTL_TEXTENCODING_GB_2312: + case RTL_TEXTENCODING_BIG5: + // in case the system uses an encoding from the list above, it should be used + break; + + default: + // in case other encoding is used, use one of the encodings from the list + nEncoding = RTL_TEXTENCODING_MS_1250; + break; + } + } + + nHash = ::comphelper::DocPasswordHelper::GetXLHashAsUINT16( aPasswd, nEncoding ); + } + + return nHash; +} + //------------------------------------------------------------------ void SfxMedium::Close() diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index 5d14007ec169..0a02a7f8df49 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -1499,3 +1499,13 @@ sal_Bool SfxObjectShell::SetModifyPasswordHash( sal_uInt16 nHash ) // return sal_False; } +void SfxObjectShell::SetModifyPasswordEntered() +{ + pImp->m_bModifyPasswordEntered = sal_True; +} + +sal_Bool SfxObjectShell::IsModifyPasswordEntered() +{ + return pImp->m_bModifyPasswordEntered; +} + diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 1cb88e98f59f..a7adf530afc9 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -476,6 +476,32 @@ void SfxObjectShell::SetReadOnlyUI( sal_Bool bReadOnly ) //------------------------------------------------------------------------- +void SfxObjectShell::SetReadOnly() +{ + // Let the document be completely readonly, means that the + // medium open mode is adjusted accordingly, and the write lock + // on the file is removed. + + if ( pMedium && !IsReadOnlyMedium() ) + { + sal_Bool bWasROUI = IsReadOnly(); + + pMedium->UnlockFile( sal_False ); + + // the storage-based mediums are already based on the temporary file + // so UnlockFile has already closed the locking stream + if ( !pMedium->HasStorage_Impl() && IsLoadingFinished() ) + pMedium->CloseInStream(); + + pMedium->SetOpenMode( SFX_STREAM_READONLY, pMedium->IsDirect(), sal_True ); + pMedium->GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, sal_True ) ); + + if ( !bWasROUI ) + Broadcast( SfxSimpleHint(SFX_HINT_MODECHANGED) ); + } +} +//------------------------------------------------------------------------- + sal_Bool SfxObjectShell::IsReadOnly() const { return pImp->bReadOnlyUI || IsReadOnlyMedium(); @@ -1370,6 +1396,9 @@ void SfxObjectShell::FinishedLoading( sal_uInt16 nFlags ) if( !IsAbortingImport() ) PositionView_Impl(); + if ( GetModifyPasswordHash() ) + SetReadOnly(); + // Salvage if ( pSalvageItem ) bSetModifiedTRUE = sal_True; diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 0ed230dd9dd9..cc983e5eb543 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -263,6 +263,7 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,m_bIsInit( sal_False ) ,m_bIncomplEncrWarnShown( sal_False ) ,m_nModifyPasswordHash( 0 ) + ,m_bModifyPasswordEntered( sal_False ) { } diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx index a97018e4b3f6..04df263a3de8 100644 --- a/sfx2/source/inc/objshimp.hxx +++ b/sfx2/source/inc/objshimp.hxx @@ -171,7 +171,7 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess sal_Bool m_bIncomplEncrWarnShown; sal_uInt16 m_nModifyPasswordHash; - + sal_Bool m_bModifyPasswordEntered; SfxObjectShell_Impl( SfxObjectShell& _rDocShell ); virtual ~SfxObjectShell_Impl(); diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 2291e8079b3a..1d61b09fdd63 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -71,6 +71,7 @@ #include #include #include +#include #include #include @@ -86,6 +87,7 @@ #include #include #include +#include #include #include @@ -113,6 +115,7 @@ namespace css = ::com::sun::star; #include "sfxtypes.hxx" #include #include +#include #include #include "sfxresid.hxx" #include "appbas.hxx" @@ -158,6 +161,48 @@ TYPEINIT1(SfxViewFrameItem, SfxPoolItem); //========================================================================= +static sal_Bool AskPasswordToModify_Impl( const uno::Reference< task::XInteractionHandler >& xHandler, const ::rtl::OUString& aPath, const SfxFilter* pFilter, sal_uInt16 nPasswordHash ) +{ + sal_Bool bResult = !nPasswordHash; + + OSL_ENSURE( pFilter && ( pFilter->GetFilterFlags() & SFX_FILTER_PASSWORDTOMODIFY ), "PasswordToModify feature is active for a filter that does not support it!" ); + + if ( pFilter && xHandler.is() ) + { + sal_Bool bCancel = sal_False; + sal_Bool bFirstTime = sal_True; + + while ( !bResult && !bCancel ) + { + sal_Bool bMSType = !pFilter->IsOwnFormat(); + ::comphelper::DocPasswordRequestType nType = bMSType ? + ::comphelper::DocPasswordRequestType_MS : + ::comphelper::DocPasswordRequestType_STANDARD; + + ::rtl::Reference< ::comphelper::DocPasswordRequest > pPasswordRequest( + new ::comphelper::DocPasswordRequest( + bMSType ? ::comphelper::DocPasswordRequestType_MS : ::comphelper::DocPasswordRequestType_STANDARD, + bFirstTime ? ::com::sun::star::task::PasswordRequestMode_PASSWORD_ENTER : ::com::sun::star::task::PasswordRequestMode_PASSWORD_REENTER, + aPath, + sal_True ) ); + + uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pPasswordRequest.get() ); + xHandler->handle( rRequest ); + + if ( pPasswordRequest->isPassword() ) + bResult = ( SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), bMSType ) == nPasswordHash ); + else + bCancel = sal_True; + + bFirstTime = sal_False; + } + } + + return bResult; +} + +//========================================================================= + struct SfxViewFrame_Impl { SvBorder aBorder; @@ -371,10 +416,11 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) if( !pSh || !pSh->HasName() || !(pSh->Get_Impl()->nLoadedFlags & SFX_LOADED_MAINDOCUMENT )) break; + SfxMedium* pMed = pSh->GetMedium(); + SFX_ITEMSET_ARG( pSh->GetMedium()->GetItemSet(), pItem, SfxBoolItem, SID_VIEWONLY, sal_False ); if ( pItem && pItem->GetValue() ) { - SfxMedium* pMed = pSh->GetMedium(); SfxApplication* pApp = SFX_APP(); SfxAllItemSet aSet( pApp->GetPool() ); aSet.Put( SfxStringItem( SID_FILE_NAME, pMed->GetURLObject().GetMainURL(INetURLObject::NO_DECODE) ) ); @@ -417,6 +463,22 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) } else { + if ( pSh->IsReadOnlyMedium() + && pSh->GetModifyPasswordHash() + && !pSh->IsModifyPasswordEntered() ) + { + ::rtl::OUString aDocumentName = INetURLObject( pMed->GetOrigURL() ).GetMainURL( INetURLObject::DECODE_WITH_CHARSET ); + if( !AskPasswordToModify_Impl( pMed->GetInteractionHandler(), aDocumentName, pMed->GetOrigFilter(), pSh->GetModifyPasswordHash() ) ) + { + // this is a read-only document, if it has "Password to modify" + // the user should enter password before he can edit the document + rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), sal_False ) ); + return; + } + + pSh->SetModifyPasswordEntered(); + } + nOpenMode = SFX_STREAM_READWRITE; pSh->SetReadOnlyUI( sal_False ); @@ -436,142 +498,138 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) } // doing - if( pSh ) + String aTemp; + utl::LocalFileHelper::ConvertPhysicalNameToURL( pMed->GetPhysicalName(), aTemp ); + INetURLObject aPhysObj( aTemp ); + SFX_ITEMSET_ARG( pSh->GetMedium()->GetItemSet(), + pVersionItem, SfxInt16Item, SID_VERSION, sal_False ); + + INetURLObject aMedObj( pMed->GetName() ); + + // the logic below is following, if the document seems not to need to be reloaded and the physical name is different + // to the logical one, then on file system it can be checked that the copy is still newer than the original and no document reload is required + if ( ( !bNeedsReload && ( (aMedObj.GetProtocol() == INET_PROT_FILE && + aMedObj.getFSysPath(INetURLObject::FSYS_DETECT) != aPhysObj.getFSysPath(INetURLObject::FSYS_DETECT) && + !::utl::UCBContentHelper::IsYounger( aMedObj.GetMainURL( INetURLObject::NO_DECODE ), aPhysObj.GetMainURL( INetURLObject::NO_DECODE ) )) + || pMed->IsRemote() ) ) + || pVersionItem ) { - SfxMedium* pMed = pSh->GetMedium(); - String aTemp; - utl::LocalFileHelper::ConvertPhysicalNameToURL( pMed->GetPhysicalName(), aTemp ); - INetURLObject aPhysObj( aTemp ); - SFX_ITEMSET_ARG( pSh->GetMedium()->GetItemSet(), - pVersionItem, SfxInt16Item, SID_VERSION, sal_False ); - - INetURLObject aMedObj( pMed->GetName() ); - - // the logic below is following, if the document seems not to need to be reloaded and the physical name is different - // to the logical one, then on file system it can be checked that the copy is still newer than the original and no document reload is required - if ( ( !bNeedsReload && ( (aMedObj.GetProtocol() == INET_PROT_FILE && - aMedObj.getFSysPath(INetURLObject::FSYS_DETECT) != aPhysObj.getFSysPath(INetURLObject::FSYS_DETECT) && - !::utl::UCBContentHelper::IsYounger( aMedObj.GetMainURL( INetURLObject::NO_DECODE ), aPhysObj.GetMainURL( INetURLObject::NO_DECODE ) )) - || pMed->IsRemote() ) ) - || pVersionItem ) + sal_Bool bOK = sal_False; + if ( !pVersionItem ) { - sal_Bool bOK = sal_False; - if ( !pVersionItem ) + sal_Bool bHasStorage = pMed->HasStorage_Impl(); + // switching edit mode could be possible without reload + if ( bHasStorage && pMed->GetStorage() == pSh->GetStorage() ) { - sal_Bool bHasStorage = pMed->HasStorage_Impl(); - // switching edit mode could be possible without reload - if ( bHasStorage && pMed->GetStorage() == pSh->GetStorage() ) - { - // TODO/LATER: faster creation of copy - if ( !pSh->ConnectTmpStorage_Impl( pMed->GetStorage(), pMed ) ) - return; - } + // TODO/LATER: faster creation of copy + if ( !pSh->ConnectTmpStorage_Impl( pMed->GetStorage(), pMed ) ) + return; + } - pMed->CloseAndRelease(); - pMed->GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, !( nOpenMode & STREAM_WRITE ) ) ); - pMed->SetOpenMode( nOpenMode, pMed->IsDirect() ); + pMed->CloseAndRelease(); + pMed->GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, !( nOpenMode & STREAM_WRITE ) ) ); + pMed->SetOpenMode( nOpenMode, pMed->IsDirect() ); - pMed->CompleteReOpen(); - if ( nOpenMode & STREAM_WRITE ) - pMed->LockOrigFileOnDemand( sal_False, sal_True ); + pMed->CompleteReOpen(); + if ( nOpenMode & STREAM_WRITE ) + pMed->LockOrigFileOnDemand( sal_False, sal_True ); - // LockOrigFileOnDemand might set the readonly flag itself, it should be set back - pMed->GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, !( nOpenMode & STREAM_WRITE ) ) ); + // LockOrigFileOnDemand might set the readonly flag itself, it should be set back + pMed->GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, !( nOpenMode & STREAM_WRITE ) ) ); - if ( !pMed->GetErrorCode() ) - bOK = sal_True; - } + if ( !pMed->GetErrorCode() ) + bOK = sal_True; + } - if( !bOK ) + if( !bOK ) + { + ErrCode nErr = pMed->GetErrorCode(); + if ( pVersionItem ) + nErr = ERRCODE_IO_ACCESSDENIED; + else { - ErrCode nErr = pMed->GetErrorCode(); - if ( pVersionItem ) - nErr = ERRCODE_IO_ACCESSDENIED; - else - { - pMed->ResetError(); - pMed->SetOpenMode( SFX_STREAM_READONLY, pMed->IsDirect() ); - pMed->ReOpen(); - pSh->DoSaveCompleted( pMed ); - } + pMed->ResetError(); + pMed->SetOpenMode( SFX_STREAM_READONLY, pMed->IsDirect() ); + pMed->ReOpen(); + pSh->DoSaveCompleted( pMed ); + } - // r/o-Doc kann nicht in Editmode geschaltet werden? - rReq.Done( sal_False ); + // r/o-Doc kann nicht in Editmode geschaltet werden? + rReq.Done( sal_False ); - SFX_REQUEST_ARG( rReq, pFSetItem, SfxBoolItem, SID_EDIT_FRAMESET, sal_False); - if ( nOpenMode == SFX_STREAM_READWRITE && !rReq.IsAPI() ) + SFX_REQUEST_ARG( rReq, pFSetItem, SfxBoolItem, SID_EDIT_FRAMESET, sal_False); + if ( nOpenMode == SFX_STREAM_READWRITE && !rReq.IsAPI() ) + { + // dem ::com::sun::star::sdbcx::User anbieten, als Vorlage zu oeffnen + QueryBox aBox( &GetWindow(), SfxResId(MSG_QUERY_OPENASTEMPLATE) ); + if ( !pFSetItem && RET_YES == aBox.Execute() ) { - // dem ::com::sun::star::sdbcx::User anbieten, als Vorlage zu oeffnen - QueryBox aBox( &GetWindow(), SfxResId(MSG_QUERY_OPENASTEMPLATE) ); - if ( !pFSetItem && RET_YES == aBox.Execute() ) + SfxApplication* pApp = SFX_APP(); + SfxAllItemSet aSet( pApp->GetPool() ); + aSet.Put( SfxStringItem( SID_FILE_NAME, pMed->GetName() ) ); + SFX_ITEMSET_ARG( pMed->GetItemSet(), pReferer, SfxStringItem, SID_REFERER, sal_False ); + if ( pReferer ) + aSet.Put( *pReferer ); + aSet.Put( SfxBoolItem( SID_TEMPLATE, sal_True ) ); + if ( pVersionItem ) + aSet.Put( *pVersionItem ); + + if( pMed->GetFilter() ) { - SfxApplication* pApp = SFX_APP(); - SfxAllItemSet aSet( pApp->GetPool() ); - aSet.Put( SfxStringItem( SID_FILE_NAME, pMed->GetName() ) ); - SFX_ITEMSET_ARG( pMed->GetItemSet(), pReferer, SfxStringItem, SID_REFERER, sal_False ); - if ( pReferer ) - aSet.Put( *pReferer ); - aSet.Put( SfxBoolItem( SID_TEMPLATE, sal_True ) ); - if ( pVersionItem ) - aSet.Put( *pVersionItem ); - - if( pMed->GetFilter() ) - { - aSet.Put( SfxStringItem( SID_FILTER_NAME, pMed->GetFilter()->GetFilterName() ) ); - SFX_ITEMSET_ARG( pMed->GetItemSet(), pOptions, - SfxStringItem, SID_FILE_FILTEROPTIONS, sal_False ); - if ( pOptions ) - aSet.Put( *pOptions ); - } - - GetDispatcher()->Execute( SID_OPENDOC, SFX_CALLMODE_ASYNCHRON, aSet ); - return; + aSet.Put( SfxStringItem( SID_FILTER_NAME, pMed->GetFilter()->GetFilterName() ) ); + SFX_ITEMSET_ARG( pMed->GetItemSet(), pOptions, + SfxStringItem, SID_FILE_FILTEROPTIONS, sal_False ); + if ( pOptions ) + aSet.Put( *pOptions ); } - else - nErr = 0; - } - ErrorHandler::HandleError( nErr ); - rReq.SetReturnValue( - SfxBoolItem( rReq.GetSlot(), sal_False ) ); - return; - } - else - { - pSh->DoSaveCompleted( pMed ); - pSh->Broadcast( SfxSimpleHint(SFX_HINT_MODECHANGED) ); - rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), sal_True ) ); - rReq.Done( sal_True ); - // if( nOpenMode == SFX_STREAM_READONLY ) - // pMed->Close(); - - // ReloadForEdit bei Framesets schaltet auch FramesetEditmode - sal_Bool bIsReadonly = GetObjectShell()->IsReadOnly(); - if ( bIsReadonly != bWasReadonly && !GetFrame()->GetParentFrame() ) - { - SfxBoolItem aItem( SID_EDIT_FRAMESET, !bIsReadonly ); - GetDispatcher()->Execute( SID_EDIT_FRAMESET, - SFX_CALLMODE_RECORD, &aItem, 0L ); - pSh->Broadcast( SfxSimpleHint( SFX_HINT_TITLECHANGED ) ); + GetDispatcher()->Execute( SID_OPENDOC, SFX_CALLMODE_ASYNCHRON, aSet ); + return; } - return; + else + nErr = 0; } - } - /* - if ( !bReload ) - { - // Es soll nicht reloaded werden - SfxErrorContext aEc( ERRCODE_SFX_NODOCRELOAD ); - ErrorHandler::HandleError( ERRCODE_SFX_NODOCRELOAD ); + ErrorHandler::HandleError( nErr ); rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), sal_False ) ); return; } - */ - // Ansonsten ( lokal und arbeiten auf Kopie ) muss gereloaded - // werden. + else + { + pSh->DoSaveCompleted( pMed ); + pSh->Broadcast( SfxSimpleHint(SFX_HINT_MODECHANGED) ); + rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), sal_True ) ); + rReq.Done( sal_True ); + // if( nOpenMode == SFX_STREAM_READONLY ) + // pMed->Close(); + + // ReloadForEdit bei Framesets schaltet auch FramesetEditmode + sal_Bool bIsReadonly = GetObjectShell()->IsReadOnly(); + if ( bIsReadonly != bWasReadonly && !GetFrame()->GetParentFrame() ) + { + SfxBoolItem aItem( SID_EDIT_FRAMESET, !bIsReadonly ); + GetDispatcher()->Execute( SID_EDIT_FRAMESET, + SFX_CALLMODE_RECORD, &aItem, 0L ); + pSh->Broadcast( SfxSimpleHint( SFX_HINT_TITLECHANGED ) ); + } + return; + } + } + + /* + if ( !bReload ) + { + // Es soll nicht reloaded werden + SfxErrorContext aEc( ERRCODE_SFX_NODOCRELOAD ); + ErrorHandler::HandleError( ERRCODE_SFX_NODOCRELOAD ); + rReq.SetReturnValue( + SfxBoolItem( rReq.GetSlot(), sal_False ) ); + return; } + */ + // Ansonsten ( lokal und arbeiten auf Kopie ) muss gereloaded + // werden. rReq.AppendItem( SfxBoolItem( SID_FORCERELOAD, sal_True) ); rReq.AppendItem( SfxBoolItem( SID_SILENT, sal_True )); -- cgit From e6110f11e272a15a547de94bb140992b949fd9b4 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 26 Apr 2010 17:43:25 +0200 Subject: vcl111: #i111167# correct SetModifed handling --- sfx2/source/view/viewprn.cxx | 45 ++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index 2d5403b72abd..0774e5ca68f1 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -129,28 +129,6 @@ SfxPrinterController::SfxPrinterController( const Any& i_rComplete, StartListening( *mpViewShell ); mpObjectShell = mpViewShell->GetObjectShell(); StartListening( *mpObjectShell ); - m_bOrigStatus = mpObjectShell->IsEnableSetModified(); - - // check configuration: shall update of printing information in DocInfo set the document to "modified"? - if ( m_bOrigStatus && !SvtPrintWarningOptions().IsModifyDocumentOnPrintingAllowed() ) - { - mpObjectShell->EnableSetModified( sal_False ); - m_bNeedsChange = sal_True; - } - - // refresh document info - uno::Reference xDocProps(mpObjectShell->getDocProperties()); - m_aLastPrintedBy = xDocProps->getPrintedBy(); - m_aLastPrinted = xDocProps->getPrintDate(); - - xDocProps->setPrintedBy( mpObjectShell->IsUseUserData() - ? ::rtl::OUString( SvtUserOptions().GetFullName() ) - : ::rtl::OUString() ); - ::DateTime now; - - xDocProps->setPrintDate( util::DateTime( - now.Get100Sec(), now.GetSec(), now.GetMin(), now.GetHour(), - now.GetDay(), now.GetMonth(), now.GetYear() ) ); } // initialize extra ui options @@ -283,6 +261,29 @@ void SfxPrinterController::jobStarted() { if ( mpObjectShell ) { + m_bOrigStatus = mpObjectShell->IsEnableSetModified(); + + // check configuration: shall update of printing information in DocInfo set the document to "modified"? + if ( m_bOrigStatus && !SvtPrintWarningOptions().IsModifyDocumentOnPrintingAllowed() ) + { + mpObjectShell->EnableSetModified( sal_False ); + m_bNeedsChange = sal_True; + } + + // refresh document info + uno::Reference xDocProps(mpObjectShell->getDocProperties()); + m_aLastPrintedBy = xDocProps->getPrintedBy(); + m_aLastPrinted = xDocProps->getPrintDate(); + + xDocProps->setPrintedBy( mpObjectShell->IsUseUserData() + ? ::rtl::OUString( SvtUserOptions().GetFullName() ) + : ::rtl::OUString() ); + ::DateTime now; + + xDocProps->setPrintDate( util::DateTime( + now.Get100Sec(), now.GetSec(), now.GetMin(), now.GetHour(), + now.GetDay(), now.GetMonth(), now.GetYear() ) ); + // FIXME: how to get all print options incl. AdditionalOptions easily? uno::Sequence < beans::PropertyValue > aOpts; mpObjectShell->Broadcast( SfxPrintingHint( view::PrintableState_JOB_STARTED, aOpts ) ); -- cgit From 65cf934efc6f8958d9c024ee965685cfd6cac704 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Thu, 29 Apr 2010 13:02:24 +0200 Subject: cws tl79: fixed problems after merging with DEV300_m77 --- sfx2/source/dialog/dinfdlg.cxx | 1 + sfx2/source/dialog/securitypage.cxx | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 1495a560965b..f8da760bc12d 100755 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" + #include #include #include diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx index affebc8615cb..d6351143c51e 100755 --- a/sfx2/source/dialog/securitypage.cxx +++ b/sfx2/source/dialog/securitypage.cxx @@ -29,22 +29,23 @@ #include "precompiled_sfx2.hxx" #include "sfx2/securitypage.hxx" -#include "sfx2/sfx.hrc" + #include "securitypage.hrc" #include "sfxresid.hxx" +#include +#include +#include +#include +#include + #include #include #include #include -#include -#include -#include #include -#include -#include #include -#include +#include -- cgit From 2005bc7b8b04f6eaa3d4636a3a1df1d6ff02f550 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Mon, 3 May 2010 09:08:38 +0200 Subject: cws tl78: build issues after merging with DEV300_m77 --- sfx2/source/view/viewfrm.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index aedd383b042a..c8cf7bd8c6c8 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -82,6 +82,7 @@ #include #include #include +#include #include #include @@ -183,9 +184,6 @@ static sal_Bool AskPasswordToModify_Impl( const uno::Reference< task::XInteracti while ( !bResult && !bCancel ) { sal_Bool bMSType = !pFilter->IsOwnFormat(); - ::comphelper::DocPasswordRequestType nType = bMSType ? - ::comphelper::DocPasswordRequestType_MS : - ::comphelper::DocPasswordRequestType_STANDARD; ::rtl::Reference< ::comphelper::DocPasswordRequest > pPasswordRequest( new ::comphelper::DocPasswordRequest( -- cgit From 5ac537f937a7d8bfbe6c12203e8f10d0d92441df Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 5 May 2010 22:26:58 +0200 Subject: slidecopy: set the WB_DIALOGCONTROL and WB_CHILDLDGCTRL bits both at the generic panel anchor window, and the panel window provided by the XToolPanel --- sfx2/source/dialog/taskpane.cxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index ba1295b4126c..6a966ab68313 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -45,6 +45,7 @@ #include #include #include +#include /** === end UNO includes === **/ #include @@ -58,6 +59,7 @@ #include #include #include +#include #include @@ -90,6 +92,7 @@ namespace sfx2 using ::com::sun::star::graphic::XGraphicProvider; using ::com::sun::star::graphic::XGraphic; using ::com::sun::star::accessibility::XAccessible; + using ::com::sun::star::awt::XControl; /** === end UNO using === **/ namespace PosSize = ::com::sun::star::awt::PosSize; @@ -351,6 +354,18 @@ namespace sfx2 UNO_SET_THROW ); m_aCustomPanel = CustomPanelUIElement( xElement ); + + // ensure tabbing through the panel window works - need access to the VCL Window for this + Reference< XWindow > xPanelWindow( m_aCustomPanel.getPanelWindow() ); + const Reference< XControl > xPanelControl( xPanelWindow, UNO_QUERY ); + if ( xPanelControl.is() ) + // windows created by the XContainerWindowProvider might, in real, be an XControl + // In this case, obtain the VCL Window from the peer + xPanelWindow.set( xPanelControl->getPeer(), UNO_QUERY_THROW ); + Window* pPanelWindow = VCLUnoHelper::GetWindow( xPanelWindow ); + OSL_ENSURE( pPanelWindow != NULL, "CustomToolPanel::impl_ensureToolPanelWindow: invalid (unknown) XWindow implementation of the panel window!" ); + if ( pPanelWindow != NULL ) + pPanelWindow->SetStyle( pPanelWindow->GetStyle() | WB_DIALOGCONTROL | WB_CHILDDLGCTRL ); } catch( const Exception& ) { -- cgit From 0434aa5708d99334f445b894c48b7650732cc2cb Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 7 May 2010 10:19:42 +0200 Subject: slidecopy: allow activating a tool panel view XLayoutManager::showElement --- sfx2/source/appl/app.cxx | 1 + sfx2/source/dialog/taskpane.cxx | 29 +++++++++++++++++++++++++++++ sfx2/source/view/viewfrm.cxx | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+) (limited to 'sfx2/source') diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index d42d203e57f5..6e13894feb49 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -322,6 +322,7 @@ SfxApplication* SfxApplication::GetOrCreate() ::framework::SetStatusBarControllerCreator( SfxStatusBarControllerFactory ); ::framework::SetDockingWindowCreator( SfxDockingWindowFactory ); ::framework::SetIsDockingWindowVisible( IsDockingWindowVisible ); + ::framework::SetActivateToolPanel( &SfxViewFrame::ActivateToolPanel ); SfxHelp* pSfxHelp = new SfxHelp; Application::SetHelp( pSfxHelp ); diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index 6a966ab68313..3fa5875eec69 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -211,6 +211,12 @@ namespace sfx2 SetText( String( SfxResId( SID_TASKPANE ) ) ); } + //------------------------------------------------------------------------------------------------------------------ + void TaskPaneDockingWindow::ActivateToolPanel( const ::rtl::OUString& i_rPanelURL ) + { + m_aPaneController.ActivateToolPanel( i_rPanelURL ); + } + //------------------------------------------------------------------------------------------------------------------ void TaskPaneDockingWindow::GetFocus() { @@ -246,6 +252,14 @@ namespace sfx2 SetHideNotDelete( TRUE ); } + //------------------------------------------------------------------------------------------------------------------ + void TaskPaneWrapper::ActivateToolPanel( const ::rtl::OUString& i_rPanelURL ) + { + TaskPaneDockingWindow* pDockingWindow = dynamic_cast< TaskPaneDockingWindow* >( GetWindow() ); + ENSURE_OR_RETURN_VOID( pDockingWindow, "TaskPaneWrapper::ActivateToolPanel: invalid docking window implementation!" ); + pDockingWindow->ActivateToolPanel( i_rPanelURL ); + } + //================================================================================================================== //= CustomPanelUIElement //================================================================================================================== @@ -847,6 +861,7 @@ namespace sfx2 ~TaskPaneController_Impl(); void SetDefaultTitle( const String& i_rTitle ); + void ActivateToolPanel( const ::rtl::OUString& i_rPanelURL ); protected: // IToolPanelDeckListener overridables @@ -950,6 +965,14 @@ namespace sfx2 impl_updateDockingWindowTitle(); } + //------------------------------------------------------------------------------------------------------------------ + void TaskPaneController_Impl::ActivateToolPanel( const ::rtl::OUString& i_rPanelURL ) + { + ::boost::optional< size_t > aPanelPos( m_rTaskPane.GetPanelPos( i_rPanelURL ) ); + ENSURE_OR_RETURN_VOID( !!aPanelPos, "TaskPaneController_Impl::ActivateToolPanel: no such panel!" ); + m_rTaskPane.GetPanelDeck().ActivatePanel( aPanelPos ); + } + // ----------------------------------------------------------------------------------------------------------------- IMPL_LINK( TaskPaneController_Impl, DockingChanged, TitledDockingWindow*, i_pDockingWindow ) { @@ -1236,6 +1259,12 @@ namespace sfx2 m_pImpl->SetDefaultTitle( i_rTitle ); } + //------------------------------------------------------------------------------------------------------------------ + void TaskPaneController::ActivateToolPanel( const ::rtl::OUString& i_rPanelURL ) + { + m_pImpl->ActivateToolPanel( i_rPanelURL ); + } + //...................................................................................................................... } // namespace sfx2 //...................................................................................................................... diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 561209c54a43..395a0467b8c3 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -3414,3 +3414,35 @@ void SfxViewFrame::SetViewFrame( SfxViewFrame* pFrame ) { SFX_APP()->SetViewFrame_Impl( pFrame ); } + +// --------------------------------------------------------------------------------------------------------------------- +void SfxViewFrame::ActivateToolPanel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, const ::rtl::OUString& i_rPanelURL ) +{ + // look up the SfxFrame for the given XFrame + SfxFrame* pFrame = NULL; + for ( pFrame = SfxFrame::GetFirst(); pFrame; pFrame = SfxFrame::GetNext( *pFrame ) ) + { + if ( pFrame->GetFrameInterface() == i_rFrame ) + break; + } + SfxViewFrame* pViewFrame = pFrame ? pFrame->GetCurrentViewFrame() : NULL; + ENSURE_OR_RETURN_VOID( pViewFrame != NULL, "SfxViewFrame::ActivateToolPanel: did not find an SfxFrame for the given XFrame!" ); + + pViewFrame->ActivateToolPanel_Impl( i_rPanelURL ); +} + +// --------------------------------------------------------------------------------------------------------------------- +void SfxViewFrame::ActivateToolPanel_Impl( const ::rtl::OUString& i_rPanelURL ) +{ + // ensure the task pane is visible + ENSURE_OR_RETURN_VOID( KnowsChildWindow( SID_TASKPANE ), "SfxViewFrame::ActivateToolPanel: this frame/module does not allow for a task pane!" ); + if ( !HasChildWindow( SID_TASKPANE ) ) + ToggleChildWindow( SID_TASKPANE ); + + SfxChildWindow* pTaskPaneChildWindow = GetChildWindow( SID_TASKPANE ); + ENSURE_OR_RETURN_VOID( pTaskPaneChildWindow, "SfxViewFrame::ActivateToolPanel_Impl: just switched it on, but it is not there!" ); + + ::sfx2::ITaskPaneToolPanelAccess* pPanelAccess = dynamic_cast< ::sfx2::ITaskPaneToolPanelAccess* >( pTaskPaneChildWindow ); + ENSURE_OR_RETURN_VOID( pPanelAccess, "SfxViewFrame::ActivateToolPanel_Impl: task pane child window does not implement a required interface!" ); + pPanelAccess->ActivateToolPanel( i_rPanelURL ); +} -- cgit From e8f78faa415a94dda55b8cd3249d3586d36dc119 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Fri, 7 May 2010 10:40:12 +0200 Subject: cws tl78: fixing windows specific build problems after merging with DEV300_m77 --- sfx2/source/appl/appuno.cxx | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) mode change 100644 => 100755 sfx2/source/appl/appuno.cxx (limited to 'sfx2/source') diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx old mode 100644 new mode 100755 index fd33e21ea645..66452f10bbfb --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -2411,6 +2411,26 @@ RequestPackageReparation::RequestPackageReparation( ::rtl::OUString aName ) m_lContinuations[1] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pDisapprove ); } +/*uno::*/Any SAL_CALL RequestPackageReparation::queryInterface( const /*uno::*/Type& rType ) throw (RuntimeException) +{ + return ::cppu::queryInterface ( rType, + // OWeakObject interfaces + dynamic_cast< XInterface* > ( (XInteractionRequest *) this ), + static_cast< XWeak* > ( this ), + // my own interfaces + static_cast< XInteractionRequest* > ( this ) ); +} + +void SAL_CALL RequestPackageReparation::acquire( ) throw () +{ + OWeakObject::acquire(); +} + +void SAL_CALL RequestPackageReparation::release( ) throw () +{ + OWeakObject::release(); +} + ::com::sun::star::uno::Any SAL_CALL RequestPackageReparation::getRequest() throw( ::com::sun::star::uno::RuntimeException ) { @@ -2442,6 +2462,26 @@ NotifyBrokenPackage::NotifyBrokenPackage( ::rtl::OUString aName ) m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pAbort ); } +/*uno::*/Any SAL_CALL NotifyBrokenPackage::queryInterface( const /*uno::*/Type& rType ) throw (RuntimeException) +{ + return ::cppu::queryInterface ( rType, + // OWeakObject interfaces + dynamic_cast< XInterface* > ( (XInteractionRequest *) this ), + static_cast< XWeak* > ( this ), + // my own interfaces + static_cast< XInteractionRequest* > ( this ) ); +} + +void SAL_CALL NotifyBrokenPackage::acquire( ) throw () +{ + OWeakObject::acquire(); +} + +void SAL_CALL NotifyBrokenPackage::release( ) throw () +{ + OWeakObject::release(); +} + ::com::sun::star::uno::Any SAL_CALL NotifyBrokenPackage::getRequest() throw( ::com::sun::star::uno::RuntimeException ) { -- cgit From 028d3184a822a79d19d154b3cc6a5deaa4af023f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 7 May 2010 12:54:30 +0200 Subject: slidecopy: ActivateToolPanel: lock the SolarMutex, this can be entered from anywhere ... --- sfx2/source/view/viewfrm.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sfx2/source') diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 395a0467b8c3..189c9a8aae0e 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -3418,6 +3418,8 @@ void SfxViewFrame::SetViewFrame( SfxViewFrame* pFrame ) // --------------------------------------------------------------------------------------------------------------------- void SfxViewFrame::ActivateToolPanel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, const ::rtl::OUString& i_rPanelURL ) { + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + // look up the SfxFrame for the given XFrame SfxFrame* pFrame = NULL; for ( pFrame = SfxFrame::GetFirst(); pFrame; pFrame = SfxFrame::GetNext( *pFrame ) ) -- cgit From bc53fa7c87db3c9390fcbeb43dfa6a65aa48f4bb Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 7 May 2010 13:08:15 +0200 Subject: slidecopy: when activating a tool panel which is already active, let it grab the focus --- sfx2/source/dialog/taskpane.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index 3fa5875eec69..566c2181c056 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -970,7 +970,16 @@ namespace sfx2 { ::boost::optional< size_t > aPanelPos( m_rTaskPane.GetPanelPos( i_rPanelURL ) ); ENSURE_OR_RETURN_VOID( !!aPanelPos, "TaskPaneController_Impl::ActivateToolPanel: no such panel!" ); - m_rTaskPane.GetPanelDeck().ActivatePanel( aPanelPos ); + + if ( aPanelPos == m_rTaskPane.GetPanelDeck().GetActivePanel() ) + { + ::svt::PToolPanel pPanel( m_rTaskPane.GetPanelDeck().GetPanel( *aPanelPos ) ); + pPanel->GrabFocus(); + } + else + { + m_rTaskPane.GetPanelDeck().ActivatePanel( aPanelPos ); + } } // ----------------------------------------------------------------------------------------------------------------- -- cgit From 0e1079119202c55866d01479e913a30bf7513ce6 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Mon, 10 May 2010 13:58:03 +0200 Subject: CWS mba33issues01: #i109842#: delete global resources in pro version also --- sfx2/source/appl/appquit.cxx | 50 -------------------------------------------- 1 file changed, 50 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/appl/appquit.cxx b/sfx2/source/appl/appquit.cxx index 4da32cf9f566..d615d90ff37a 100644 --- a/sfx2/source/appl/appquit.cxx +++ b/sfx2/source/appl/appquit.cxx @@ -74,57 +74,11 @@ using ::basic::BasicManagerRepository; -#ifdef DBG_UTIL -DECLARE_LIST( SfxFrameWindowFactoryArray_Impl, SfxFrameWindowFactory* ) -SV_DECL_PTRARR(SfxInitLinkList, Link*, 2, 2) -#endif - //=================================================================== BOOL SfxApplication::QueryExit_Impl() { BOOL bQuit = TRUE; -/* - BOOL bPrinting = FALSE; - for ( SfxViewShell *pViewSh = SfxViewShell::GetFirst(); - !bPrinting && pViewSh; - pViewSh = SfxViewShell::GetNext(*pViewSh) ) - { - SfxPrinter *pPrinter = pViewSh->GetPrinter(); - bPrinting = pPrinter && pPrinter->IsPrinting(); - } - - if ( bPrinting ) - { - // Benutzer fragen, ob abgebrochen werden soll - if ( RET_OK == QueryBox( 0, SfxResId( MSG_ISPRINTING_QUERYABORT ) ).Execute() ) - { - // alle Jobs canceln - for ( SfxViewShell *pViewSh = SfxViewShell::GetFirst(); - !bPrinting && pViewSh; - pViewSh = SfxViewShell::GetNext(*pViewSh) ) - { - SfxPrinter *pPrinter = pViewSh->GetPrinter(); - if ( pPrinter && pPrinter->IsPrinting() ) - pPrinter->AbortJob(); - } - - // da das Canceln asynchron ist, Quit erstmal wieder verlassen - GetDispatcher_Impl()->Execute( SID_QUITAPP, SFX_CALLMODE_ASYNCHRON ); - DBG_TRACE( "QueryExit => FALSE (printing)" ); - return FALSE; - } - } -*/ -/* - SfxObjectShell *pLastDocSh = SfxObjectShell::GetFirst(); - if ( bQuit ) - { - // Jetzt zur Sicherheit auch hidden Frames abr"aumen - SfxViewFrame::CloseHiddenFrames_Impl(); - pLastDocSh = SfxObjectShell::GetFirst(); - } -*/ // will trotzdem noch jemand, den man nicht abschiessen kann, die App haben? if ( !bQuit ) { @@ -197,22 +151,18 @@ void SfxApplication::Deinitialize() delete pAppData_Impl->pLabelResMgr; -#ifdef DBG_UTIL DELETEX(pAppData_Impl->pSlotPool); DELETEX(pAppData_Impl->pEventConfig); SfxMacroConfig::Release_Impl(); DELETEX(pAppData_Impl->pFactArr); DELETEX(pAppData_Impl->pInitLinkList); -#endif -#ifdef DBG_UTIL DELETEX(pAppData_Impl->pTbxCtrlFac); DELETEX(pAppData_Impl->pStbCtrlFac); DELETEX(pAppData_Impl->pMenuCtrlFac); DELETEX(pAppData_Impl->pViewFrames); DELETEX(pAppData_Impl->pViewShells); DELETEX(pAppData_Impl->pObjShells); -#endif //TODO/CLEANTUP //ReleaseArgs could be used instead! -- cgit From cd50d383f645aa1d188331039d334faebfa1add0 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Wed, 12 May 2010 08:38:13 +0200 Subject: CWS mba33issues01: #i105239#: safe way to access SfxApplication in IMEStatusWindow --- sfx2/source/appl/appdata.cxx | 5 ++--- sfx2/source/appl/imestatuswindow.cxx | 6 +++--- sfx2/source/appl/imestatuswindow.hxx | 7 +------ sfx2/source/bastyp/progress.cxx | 2 +- sfx2/source/control/unoctitm.cxx | 2 +- sfx2/source/view/viewfrm.cxx | 2 +- 6 files changed, 9 insertions(+), 15 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx index a07623df46b1..38ea69280c49 100644 --- a/sfx2/source/appl/appdata.cxx +++ b/sfx2/source/appl/appdata.cxx @@ -89,7 +89,7 @@ void SfxBasicManagerCreationListener::onBasicManagerCreated( const Reference< XM m_rAppData.OnApplicationBasicManagerCreated( _rBasicManager ); } -SfxAppData_Impl::SfxAppData_Impl( SfxApplication* pApp ) : +SfxAppData_Impl::SfxAppData_Impl( SfxApplication* ) : pDdeService( 0 ), pDocTopics( 0 ), pTriggerTopic(0), @@ -116,8 +116,7 @@ SfxAppData_Impl::SfxAppData_Impl( SfxApplication* pApp ) : nRescheduleLocks(0), nInReschedule(0), nAsynchronCalls(0), - m_xImeStatusWindow(new sfx2::appl::ImeStatusWindow( - *pApp, comphelper::getProcessServiceFactory())) + m_xImeStatusWindow(new sfx2::appl::ImeStatusWindow(comphelper::getProcessServiceFactory())) , pTbxCtrlFac(0) , pStbCtrlFac(0) , pViewFrames(0) diff --git a/sfx2/source/appl/imestatuswindow.cxx b/sfx2/source/appl/imestatuswindow.cxx index 3cdc3064fb81..07eb47bd92ad 100644 --- a/sfx2/source/appl/imestatuswindow.cxx +++ b/sfx2/source/appl/imestatuswindow.cxx @@ -57,10 +57,8 @@ namespace css = com::sun::star; using sfx2::appl::ImeStatusWindow; ImeStatusWindow::ImeStatusWindow( - SfxApplication & rApplication, css::uno::Reference< css::lang::XMultiServiceFactory > const & rServiceFactory): - m_rApplication(rApplication), m_xServiceFactory(rServiceFactory), m_bDisposed(false) {} @@ -161,7 +159,9 @@ ImeStatusWindow::propertyChange(css::beans::PropertyChangeEvent const & ) throw (css::uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); - m_rApplication.Invalidate(SID_SHOW_IME_STATUS_WINDOW); + SfxApplication* pApp = SfxApplication::Get(); + if (pApp) + pApp->Invalidate(SID_SHOW_IME_STATUS_WINDOW); } css::uno::Reference< css::beans::XPropertySet > ImeStatusWindow::getConfig() diff --git a/sfx2/source/appl/imestatuswindow.hxx b/sfx2/source/appl/imestatuswindow.hxx index 71c0b371f796..4edba523ed30 100644 --- a/sfx2/source/appl/imestatuswindow.hxx +++ b/sfx2/source/appl/imestatuswindow.hxx @@ -37,7 +37,6 @@ namespace com { namespace sun { namespace star { namespace beans { class XPropertySet; } namespace lang { class XMultiServiceFactory; } } } } -class SfxApplication; namespace sfx2 { namespace appl { @@ -56,10 +55,7 @@ ImeStatusWindow_Impl; class ImeStatusWindow: private ImeStatusWindow_Impl { public: - ImeStatusWindow(SfxApplication & rApplication, - com::sun::star::uno::Reference< - com::sun::star::lang::XMultiServiceFactory > const & - rServiceFactory); + ImeStatusWindow( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > const& rServiceFactory ); /** Set up VCL according to the configuration. @@ -115,7 +111,6 @@ private: com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > getConfig(); - SfxApplication & m_rApplication; com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory; diff --git a/sfx2/source/bastyp/progress.cxx b/sfx2/source/bastyp/progress.cxx index 649ae121c274..3af0ba2b0a6f 100644 --- a/sfx2/source/bastyp/progress.cxx +++ b/sfx2/source/bastyp/progress.cxx @@ -706,7 +706,7 @@ SfxProgress* SfxProgress::GetActiveProgress */ { - if ( !SfxApplication::Is_Impl() ) + if ( !SfxApplication::Get() ) return 0; SfxProgress *pProgress = 0; diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index d2ad8c645eb7..e53f1766b7b9 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -823,7 +823,7 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util pItem = pDispatcher->Execute( GetId(), nCall, 0, &aInternalSet, nModifier ); // no bindings, no invalidate ( usually done in SfxDispatcher::Call_Impl()! ) - if ( SfxApplication::Is_Impl() ) + if ( SfxApplication::Get() ) { SfxDispatcher* pAppDispat = SFX_APP()->GetAppDispatcher_Impl(); if ( pAppDispat ) diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 66af0d7ac8ba..0d3c1f727e5b 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1510,7 +1510,7 @@ void SfxViewFrame::KillDispatcher_Impl() //------------------------------------------------------------------------ SfxViewFrame* SfxViewFrame::Current() { - return SfxApplication::Is_Impl() ? SFX_APP()->Get_Impl()->pViewFrame : NULL; + return SfxApplication::Get() ? SFX_APP()->Get_Impl()->pViewFrame : NULL; } //-------------------------------------------------------------------- -- cgit From c1ed865d8c954220dae653bb45ec2f870fd87f2d Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 18 May 2010 12:01:02 +0200 Subject: slidecopy: HelpID support for tool panels --- sfx2/source/dialog/taskpane.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index 566c2181c056..1fd0e3212234 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -156,6 +156,13 @@ namespace sfx2 return xFrame; } + //-------------------------------------------------------------------------------------------------------------- + ::rtl::OUString lcl_getPanelHelpURL( const ::utl::OConfigurationNode& i_rPanelConfigNode ) + { + const ::rtl::OUString sHelpURL( ::comphelper::getString( i_rPanelConfigNode.getNodeValue( "HelpURL" ) ) ); + return sHelpURL; + } + //-------------------------------------------------------------------------------------------------------------- Image lcl_getPanelImage( const Reference< XFrame >& i_rDocFrame, const ::utl::OConfigurationNode& i_rPanelConfigNode ) { @@ -302,6 +309,7 @@ namespace sfx2 virtual ::rtl::OUString GetDisplayName() const; virtual Image GetImage() const; + virtual SmartId GetHelpID() const; virtual void Activate( Window& i_rParentWindow ); virtual void Deactivate(); virtual void SetSizePixel( const Size& i_rPanelWindowSize ); @@ -323,6 +331,7 @@ namespace sfx2 private: const ::rtl::OUString m_sUIName; const Image m_aPanelImage; + const ::rtl::OUString m_aPanelHelpURL; const ::rtl::OUString m_sResourceURL; const ::rtl::OUString m_sPanelConfigPath; Reference< XFrame > m_xFrame; @@ -334,6 +343,7 @@ namespace sfx2 CustomToolPanel::CustomToolPanel( const ::utl::OConfigurationNode& i_rPanelWindowState, const Reference< XFrame >& i_rFrame ) :m_sUIName( ::comphelper::getString( i_rPanelWindowState.getNodeValue( "UIName" ) ) ) ,m_aPanelImage( lcl_getPanelImage( i_rFrame, i_rPanelWindowState ) ) + ,m_aPanelHelpURL( lcl_getPanelHelpURL( i_rPanelWindowState ) ) ,m_sResourceURL( i_rPanelWindowState.getLocalName() ) ,m_sPanelConfigPath( i_rPanelWindowState.getNodePath() ) ,m_xFrame( i_rFrame ) @@ -410,6 +420,12 @@ namespace sfx2 return m_aPanelImage; } + //------------------------------------------------------------------------------------------------------------------ + SmartId CustomToolPanel::GetHelpID() const + { + return SmartId( m_aPanelHelpURL ); + } + //------------------------------------------------------------------------------------------------------------------ void CustomToolPanel::Activate( Window& i_rParentWindow ) { -- cgit From d310e6479f4db1c86629ca98f6e0f7480a0fa5e4 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Tue, 18 May 2010 17:10:29 +0200 Subject: CWS mba33issues01: #i109842#: missing typedef --- sfx2/source/appl/appmain.cxx | 3 --- 1 file changed, 3 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/appl/appmain.cxx b/sfx2/source/appl/appmain.cxx index 020f68d01e8d..cf097b900b52 100644 --- a/sfx2/source/appl/appmain.cxx +++ b/sfx2/source/appl/appmain.cxx @@ -93,9 +93,6 @@ static SfxItemInfo __READONLY_DATA aItemInfos[] = //=================================================================== -typedef Link* LinkPtr; -SV_DECL_PTRARR(SfxInitLinkList, LinkPtr, 4, 4) - TYPEINIT2(SfxApplication,SfxShell,SfxBroadcaster); //-------------------------------------------------------------------- -- cgit From 74efe21718537220ec16adab9964a00fc13cd9fd Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Tue, 18 May 2010 17:10:57 +0200 Subject: CWS mba33issues01: #i109842#: missing typedef --- sfx2/source/inc/appdata.hxx | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sfx2/source') diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx index 91305eb95cce..bd12f3db80dc 100644 --- a/sfx2/source/inc/appdata.hxx +++ b/sfx2/source/inc/appdata.hxx @@ -82,6 +82,9 @@ class SfxBasicManagerCreationListener; namespace sfx2 { namespace appl { class ImeStatusWindow; } } +typedef Link* LinkPtr; +SV_DECL_PTRARR(SfxInitLinkList, LinkPtr, 4, 4) + //========================================================================= // SfxAppData_Impl //========================================================================= -- cgit From 9a4d07cc52534a40cf1cd68efdef1464475e694b Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Tue, 18 May 2010 17:19:21 +0200 Subject: CWS mba33issues01: #i107576#: make code safe against releasing of external references to client site --- sfx2/source/view/ipclient.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sfx2/source') diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index 6d61f4182bbb..328d88d8b2b9 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -131,6 +131,8 @@ public: , m_bResizeNoScale( sal_False ) {} + ~SfxInPlaceClient_Impl(); + void SizeHasChanged(); DECL_LINK (TimerHdl, Timer*); uno::Reference < frame::XFrame > GetFrame() const; @@ -168,6 +170,10 @@ public: virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); }; +SfxInPlaceClient_Impl::~SfxInPlaceClient_Impl() +{ +} + void SAL_CALL SfxInPlaceClient_Impl::changingState( const ::com::sun::star::lang::EventObject& /*aEvent*/, ::sal_Int32 /*nOldState*/, @@ -645,6 +651,7 @@ SfxInPlaceClient::SfxInPlaceClient( SfxViewShell* pViewShell, Window *pDraw, sal m_pViewSh( pViewShell ), m_pEditWin( pDraw ) { + m_pImp->acquire(); m_pImp->m_pClient = this; m_pImp->m_nAspect = nAspect; m_pImp->m_aScaleWidth = m_pImp->m_aScaleHeight = Fraction(1,1); @@ -668,6 +675,7 @@ SfxInPlaceClient::~SfxInPlaceClient() // the next call will destroy m_pImp if no other reference to it exists m_pImp->m_xClient = uno::Reference < embed::XEmbeddedClient >(); + m_pImp->release(); // TODO/LATER: // the class is not intended to be used in multithreaded environment; -- cgit From 05a463c55182efc777e1fee5f708fc36de6eda92 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 19 May 2010 09:07:02 +0200 Subject: slidecopy: fixed TAB traveling in the task pane --- sfx2/source/dialog/taskpane.cxx | 12 ------------ sfx2/source/dialog/titledockwin.cxx | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index 1fd0e3212234..f25485a1401c 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -378,18 +378,6 @@ namespace sfx2 UNO_SET_THROW ); m_aCustomPanel = CustomPanelUIElement( xElement ); - - // ensure tabbing through the panel window works - need access to the VCL Window for this - Reference< XWindow > xPanelWindow( m_aCustomPanel.getPanelWindow() ); - const Reference< XControl > xPanelControl( xPanelWindow, UNO_QUERY ); - if ( xPanelControl.is() ) - // windows created by the XContainerWindowProvider might, in real, be an XControl - // In this case, obtain the VCL Window from the peer - xPanelWindow.set( xPanelControl->getPeer(), UNO_QUERY_THROW ); - Window* pPanelWindow = VCLUnoHelper::GetWindow( xPanelWindow ); - OSL_ENSURE( pPanelWindow != NULL, "CustomToolPanel::impl_ensureToolPanelWindow: invalid (unknown) XWindow implementation of the panel window!" ); - if ( pPanelWindow != NULL ) - pPanelWindow->SetStyle( pPanelWindow->GetStyle() | WB_DIALOGCONTROL | WB_CHILDDLGCTRL ); } catch( const Exception& ) { diff --git a/sfx2/source/dialog/titledockwin.cxx b/sfx2/source/dialog/titledockwin.cxx index 43fa6152c5a0..58a61d66ba8b 100644 --- a/sfx2/source/dialog/titledockwin.cxx +++ b/sfx2/source/dialog/titledockwin.cxx @@ -48,7 +48,7 @@ namespace sfx2 :SfxDockingWindow( i_pBindings, i_pChildWindow, i_pParent, i_nStyle ) ,m_sTitle() ,m_aToolbox( this ) - ,m_aContentWindow( this ) + ,m_aContentWindow( this, WB_DIALOGCONTROL ) ,m_aBorder( 3, 1, 3, 3 ) ,m_bLayoutPending( false ) { -- cgit From 4659d84eb4e0e8038ac21044ddd3c390e2585581 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Wed, 19 May 2010 14:28:33 +0200 Subject: cws tl79: #i110254# new security tap page in 'File/Properties' --- sfx2/source/dialog/securitypage.cxx | 320 ++++++++++++++++++++++++------------ sfx2/source/dialog/securitypage.hrc | 6 +- sfx2/source/dialog/securitypage.src | 19 ++- sfx2/source/doc/objxtor.cxx | 24 +++ 4 files changed, 251 insertions(+), 118 deletions(-) mode change 100644 => 100755 sfx2/source/doc/objxtor.cxx (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx index d6351143c51e..d4f217671d6e 100755 --- a/sfx2/source/dialog/securitypage.cxx +++ b/sfx2/source/dialog/securitypage.cxx @@ -38,64 +38,70 @@ #include #include #include +#include #include #include #include +#include #include #include #include +#include #include +using namespace ::com::sun::star; ////////////////////////////////////////////////////////////////////// -namespace +static short lcl_GetPassword( Window *pParent, bool bShowConfirm, /*out*/String &rPassword ) { - enum RedliningMode { RL_NONE, RL_WRITER, RL_CALC }; + bool bRes = false; + SfxPasswordDialog aPasswdDlg( pParent ); + if (bShowConfirm) + aPasswdDlg.ShowExtras( SHOWEXTRAS_CONFIRM ); + if (RET_OK == aPasswdDlg.Execute() && aPasswdDlg.GetPassword().Len() > 0) + { + rPassword = aPasswdDlg.GetPassword(); + bRes = true; + } + return bRes; +} - enum RedlineFunc { RF_ON, RF_PROTECT }; - const SfxBoolItem* ExecuteRecordChangesFunc( RedliningMode _eMode, RedlineFunc _eFunc, BOOL _bVal, Window* _pParent = NULL ) - { - const SfxBoolItem* pRet = NULL; +static bool lcl_IsPasswordCorrect( const String &rPassword ) +{ + bool bRes = false; - if (_eMode != RL_NONE) - { - USHORT nSlot; - if (_eMode == RL_WRITER) - nSlot = _eFunc == RF_ON ? FN_REDLINE_ON : FN_REDLINE_PROTECT; - else - nSlot = _eFunc == RF_ON ? FID_CHG_RECORD : SID_CHG_PROTECT; + SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); + uno::Sequence< sal_Int8 > aPasswordHash; + bool bHasPassword = pCurDocShell->GetProtectionHash( aPasswordHash ); + + // check if supplied password was correct + uno::Sequence< sal_Int8 > aNewPasswd( aPasswordHash ); + SvPasswordHelper::GetHashPassword( aNewPasswd, rPassword ); + if (SvPasswordHelper::CompareHashPassword( aPasswordHash, rPassword )) + bRes = true; // password was correct + else + InfoBox( NULL, String( SfxResId( RID_SFX_INCORRECT_PASSWORD ) ) ).Execute(); - // execute - SfxViewShell* pViewSh = SfxViewShell::Current(); - if (pViewSh) - { - bool bNeedItem = _eMode == RL_WRITER || _eFunc != RF_ON; - SfxBoolItem* pItem = bNeedItem ? new SfxBoolItem( nSlot, _bVal ) : NULL; - SfxDispatcher* pDisp = pViewSh->GetDispatcher(); - if (_pParent) - { - XWindowItem aParentItem( SID_ATTR_XWINDOW, _pParent ); - pRet = static_cast< const SfxBoolItem* >( - pDisp->Execute( nSlot, SFX_CALLMODE_SYNCHRON, &aParentItem, pItem, 0L ) ); - } - else - pRet = static_cast< const SfxBoolItem* >( - pDisp->Execute( nSlot, SFX_CALLMODE_SYNCHRON, pItem, 0L ) ); - delete pItem; - } - } + return bRes; +} + + +////////////////////////////////////////////////////////////////////// + + +namespace +{ + enum RedliningMode { RL_NONE, RL_WRITER, RL_CALC }; + enum RedlineFunc { RF_ON, RF_PROTECT }; - return pRet; - } bool QueryState( USHORT _nSlot, bool& _rValue ) { bool bRet = false; - SfxViewShell* pViewSh = SfxViewShell::Current(); if (pViewSh) { @@ -105,33 +111,30 @@ namespace if (bRet) _rValue = ( static_cast< const SfxBoolItem* >( pItem ) )->GetValue(); } - return bRet; } + bool QueryRecordChangesProtectionState( RedliningMode _eMode, bool& _rValue ) { bool bRet = false; - if (_eMode != RL_NONE) { USHORT nSlot = _eMode == RL_WRITER ? FN_REDLINE_PROTECT : SID_CHG_PROTECT; bRet = QueryState( nSlot, _rValue ); } - return bRet; } + bool QueryRecordChangesState( RedliningMode _eMode, bool& _rValue ) { bool bRet = false; - if (_eMode != RL_NONE) { USHORT nSlot = _eMode == RL_WRITER ? FN_REDLINE_ON : FID_CHG_RECORD; bRet = QueryState( nSlot, _rValue ); } - return bRet; } } @@ -142,64 +145,71 @@ namespace struct SfxSecurityPage_Impl { - SfxSecurityPage & m_rDialog; + SfxSecurityPage & m_rMyTabPage; - FixedLine m_aPasswordToOpenFL; - FixedText m_aPasswordToOpenFT; - Edit m_aPasswordToOpenED; + FixedLine m_aNewPasswordToOpenFL; + FixedText m_aNewPasswordToOpenFT; + Edit m_aNewPasswordToOpenED; FixedText m_aConfirmPasswordToOpenFT; Edit m_aConfirmPasswordToOpenED; - FixedText m_aPasswordInfoFT; + FixedText m_aNewPasswordInfoFT; - FixedLine m_aPasswordToModifyFL; - FixedText m_aPasswordToModifyFT; - Edit m_aPasswordToModifyED; + FixedLine m_aNewPasswordToModifyFL; + FixedText m_aNewPasswordToModifyFT; + Edit m_aNewPasswordToModifyED; FixedText m_aConfirmPasswordToModifyFT; Edit m_aConfirmPasswordToModifyED; FixedLine m_aOptionsFL; CheckBox m_aOpenReadonlyCB; - CheckBox m_aRemoveInfoOnSavingCB; CheckBox m_aRecordChangesCB; // for record changes PushButton m_aChangeProtectionPB; // for record changes String m_aProtectSTR; // for record changes String m_aUnProtectSTR; // for record changes RedliningMode m_eRedlingMode; // for record changes + bool m_bOrigPasswordIsConfirmed; + bool m_bNewPasswordIsValid; + String m_aNewPassword; + + String m_aEndRedliningWarning; + bool m_bEndRedliningWarningDone; + DECL_LINK( RecordChangesCBHdl, void* ); DECL_LINK( ChangeProtectionPBHdl, void* ); SfxSecurityPage_Impl( SfxSecurityPage &rDlg, const SfxItemSet &rItemSet ); ~SfxSecurityPage_Impl(); - void CheckRecordChangesState( void ); - BOOL FillItemSet_Impl( SfxItemSet & ); void Reset_Impl( const SfxItemSet & ); }; -SfxSecurityPage_Impl::SfxSecurityPage_Impl( SfxSecurityPage &rDlg, const SfxItemSet & ) : - m_rDialog (rDlg), - m_aPasswordToOpenFL (&rDlg, SfxResId( PASSWORD_TO_OPEN_FL ) ), - m_aPasswordToOpenFT (&rDlg, SfxResId( PASSWORD_TO_OPEN_FT ) ), - m_aPasswordToOpenED (&rDlg, SfxResId( PASSWORD_TO_OPEN_ED ) ), - m_aConfirmPasswordToOpenFT (&rDlg, SfxResId( CONFIRM_PASSWORD_TO_OPEN_FT ) ), - m_aConfirmPasswordToOpenED (&rDlg, SfxResId( CONFIRM_PASSWORD_TO_OPEN_ED ) ), - m_aPasswordInfoFT (&rDlg, SfxResId( PASSWORD_INFO_FT ) ), - m_aPasswordToModifyFL (&rDlg, SfxResId( PASSWORD_TO_MODIFY_FL ) ), - m_aPasswordToModifyFT (&rDlg, SfxResId( PASSWORD_TO_MODIFY_FT ) ), - m_aPasswordToModifyED (&rDlg, SfxResId( PASSWORD_TO_MODIFY_ED ) ), - m_aConfirmPasswordToModifyFT (&rDlg, SfxResId( CONFIRM_PASSWORD_TO_MODIFY_FT ) ), - m_aConfirmPasswordToModifyED (&rDlg, SfxResId( CONFIRM_PASSWORD_TO_MODIFY_ED ) ), - m_aOptionsFL (&rDlg, SfxResId( OPTIONS_FL ) ), - m_aOpenReadonlyCB (&rDlg, SfxResId( OPEN_READONLY_CB ) ), - m_aRemoveInfoOnSavingCB (&rDlg, SfxResId( REMOVE_INFO_ON_SAVING_CB ) ), - m_aRecordChangesCB (&rDlg, SfxResId( RECORD_CHANGES_CB ) ), - m_aChangeProtectionPB (&rDlg, SfxResId( CHANGE_PROTECTION_PB ) ), +SfxSecurityPage_Impl::SfxSecurityPage_Impl( SfxSecurityPage &rTabPage, const SfxItemSet & ) : + m_rMyTabPage (rTabPage), + m_aNewPasswordToOpenFL (&rTabPage, SfxResId( PASSWORD_TO_OPEN_FL ) ), + m_aNewPasswordToOpenFT (&rTabPage, SfxResId( PASSWORD_TO_OPEN_FT ) ), + m_aNewPasswordToOpenED (&rTabPage, SfxResId( PASSWORD_TO_OPEN_ED ) ), + m_aConfirmPasswordToOpenFT (&rTabPage, SfxResId( CONFIRM_PASSWORD_TO_OPEN_FT ) ), + m_aConfirmPasswordToOpenED (&rTabPage, SfxResId( CONFIRM_PASSWORD_TO_OPEN_ED ) ), + m_aNewPasswordInfoFT (&rTabPage, SfxResId( PASSWORD_INFO_FT ) ), + m_aNewPasswordToModifyFL (&rTabPage, SfxResId( PASSWORD_TO_MODIFY_FL ) ), + m_aNewPasswordToModifyFT (&rTabPage, SfxResId( PASSWORD_TO_MODIFY_FT ) ), + m_aNewPasswordToModifyED (&rTabPage, SfxResId( PASSWORD_TO_MODIFY_ED ) ), + m_aConfirmPasswordToModifyFT (&rTabPage, SfxResId( CONFIRM_PASSWORD_TO_MODIFY_FT ) ), + m_aConfirmPasswordToModifyED (&rTabPage, SfxResId( CONFIRM_PASSWORD_TO_MODIFY_ED ) ), + m_aOptionsFL (&rTabPage, SfxResId( OPTIONS_FL ) ), + m_aOpenReadonlyCB (&rTabPage, SfxResId( OPEN_READONLY_CB ) ), + m_aRecordChangesCB (&rTabPage, SfxResId( RECORD_CHANGES_CB ) ), + m_aChangeProtectionPB (&rTabPage, SfxResId( CHANGE_PROTECTION_PB ) ), m_aProtectSTR ( SfxResId( STR_PROTECT ) ), m_aUnProtectSTR ( SfxResId( STR_UNPROTECT ) ), - m_eRedlingMode ( RL_NONE ) + m_eRedlingMode ( RL_NONE ), + m_bOrigPasswordIsConfirmed ( false ), + m_bNewPasswordIsValid ( false ), + m_aEndRedliningWarning ( SfxResId( STR_END_REDLINING_WARNING ) ), + m_bEndRedliningWarningDone ( false ) { m_aChangeProtectionPB.SetText( m_aProtectSTR ); // adjust button width if necessary @@ -218,30 +228,46 @@ SfxSecurityPage_Impl::~SfxSecurityPage_Impl() } -void SfxSecurityPage_Impl::CheckRecordChangesState( void ) -{ - bool bVal; - if (QueryRecordChangesState( m_eRedlingMode, bVal )) - { - m_aRecordChangesCB.Enable(); - m_aRecordChangesCB.Check( bVal ); - } - else - m_aRecordChangesCB.Disable(); // because now we don't know the state! - - m_aChangeProtectionPB.Enable( QueryRecordChangesProtectionState( m_eRedlingMode, bVal ) ); -} - - BOOL SfxSecurityPage_Impl::FillItemSet_Impl( SfxItemSet & ) { - BOOL bModified = FALSE; + bool bModified = false; SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); if (pCurDocShell) { + if (m_eRedlingMode != RL_NONE && !pCurDocShell->IsReadOnly()) + { + // change recording + const bool bDoRecordChanges = m_aRecordChangesCB.IsChecked(); + pCurDocShell->SetChangeRecording( bDoRecordChanges ); + + // no change recording should imply no password protection + if (!bDoRecordChanges && (!m_bNewPasswordIsValid || m_aNewPassword.Len() != 0)) + { + // actually this should not be possible. Thus just as 'coded comment': + DBG_ASSERT( 0, "unexpected state of UI" ); + m_bNewPasswordIsValid = true; + m_aNewPassword = String(); + } + + // change record protection + if (m_bNewPasswordIsValid) + { + const bool bDoChangeProtection = m_aChangeProtectionPB.GetText() != m_aProtectSTR; + DBG_ASSERT( !bDoChangeProtection || bDoRecordChanges, + "change protection requires record changes to be active!" ); + pCurDocShell->SetProtectionPassword( m_aNewPassword ); + } + + bModified = true; + } + + // open read-only? if (pCurDocShell->HasSecurityOptOpenReadOnly()) + { pCurDocShell->SetSecurityOptOpenReadOnly( m_aOpenReadonlyCB.IsChecked() ); + bModified = true; + } } return bModified; @@ -284,23 +310,37 @@ void SfxSecurityPage_Impl::Reset_Impl( const SfxItemSet & ) else m_aOpenReadonlyCB.Disable(); - bool bVal; - if (QueryRecordChangesState( RL_WRITER, bVal ) && !bIsHTMLDoc) + bool bRecordChanges; + if (QueryRecordChangesState( RL_WRITER, bRecordChanges ) && !bIsHTMLDoc) m_eRedlingMode = RL_WRITER; - else if (QueryRecordChangesState( RL_CALC, bVal )) + else if (QueryRecordChangesState( RL_CALC, bRecordChanges )) m_eRedlingMode = RL_CALC; else m_eRedlingMode = RL_NONE; if (m_eRedlingMode != RL_NONE) { - m_aRecordChangesCB.Check( bVal ); - m_aRecordChangesCB.Enable( !bVal && !bIsReadonly ); - m_aChangeProtectionPB.Enable( - QueryRecordChangesProtectionState( m_eRedlingMode, bVal ) && !bIsReadonly ); + bool bProtection; + QueryRecordChangesProtectionState( m_eRedlingMode, bProtection ); + + m_aChangeProtectionPB.Enable( !bIsReadonly ); // set the right text - if (bVal) + if (bProtection) sNewText = m_aUnProtectSTR; + + m_aRecordChangesCB.Check( bRecordChanges ); + m_aRecordChangesCB.Enable( /*!bProtection && */!bIsReadonly ); + + DBG_ASSERT( pCurDocShell, "doc shell missing" ); + if (pCurDocShell) + { + m_bOrigPasswordIsConfirmed = true; // default case if no password is set + uno::Sequence< sal_Int8 > aPasswordHash; + // check if password is available + if (pCurDocShell->GetProtectionHash( aPasswordHash ) && + aPasswordHash.getLength() > 0) + m_bOrigPasswordIsConfirmed = false; // password found, needs to be confirmed later on + } } } @@ -310,27 +350,94 @@ void SfxSecurityPage_Impl::Reset_Impl( const SfxItemSet & ) IMPL_LINK( SfxSecurityPage_Impl, RecordChangesCBHdl, void*, EMPTYARG ) { - ExecuteRecordChangesFunc( m_eRedlingMode, RF_ON, m_aRecordChangesCB.IsChecked(), &m_rDialog ); - CheckRecordChangesState(); + // when change recording gets disabled protection must be disabled as well + if (!m_aRecordChangesCB.IsChecked()) // the new check state is already present, thus the '!' + { + bool bAlreadyDone = false; + if (!m_bEndRedliningWarningDone) + { + WarningBox aBox( m_rMyTabPage.GetParent(), WinBits(WB_YES_NO | WB_DEF_NO), + m_aEndRedliningWarning ); + if (aBox.Execute() != RET_YES) + bAlreadyDone = true; + else + m_bEndRedliningWarningDone = true; + } + + const bool bNeedPasssword = !m_bOrigPasswordIsConfirmed + && m_aChangeProtectionPB.GetText() != m_aProtectSTR; + if (!bAlreadyDone && bNeedPasssword) + { + String aPasswordText; + + // dialog canceled or no password provided + if (!lcl_GetPassword( m_rMyTabPage.GetParent(), false, aPasswordText )) + bAlreadyDone = true; + + // ask for password and if dialog is canceled or no password provided return + if (lcl_IsPasswordCorrect( aPasswordText )) + m_bOrigPasswordIsConfirmed = true; + else + bAlreadyDone = true; + } + + if (bAlreadyDone) + m_aRecordChangesCB.Check( true ); // restore original state + else + { + // remember required values to change protection and change recording in + // FillItemSet_Impl later on if password was correct. + m_bNewPasswordIsValid = true; + m_aNewPassword = String(); + + m_aChangeProtectionPB.SetText( m_aProtectSTR ); + } + } + return 0; } IMPL_LINK( SfxSecurityPage_Impl, ChangeProtectionPBHdl, void*, EMPTYARG ) { - bool bProt; - QueryRecordChangesProtectionState( m_eRedlingMode, bProt ); - ExecuteRecordChangesFunc( m_eRedlingMode, RF_PROTECT, !bProt, &m_rDialog ); - CheckRecordChangesState(); + if (m_eRedlingMode == RL_NONE) + return 0; + + // the push button text is always the opposite of the current state. Thus: + const bool bCurrentProtection = m_aChangeProtectionPB.GetText() != m_aProtectSTR; - if (QueryRecordChangesProtectionState( m_eRedlingMode, bProt )) + // ask user for password (if still necessary) + String aPasswordText; + bool bNewProtection = !bCurrentProtection; + const bool bNeedPassword = bNewProtection || !m_bOrigPasswordIsConfirmed; + if (bNeedPassword) { - // RecordChangesCB is enabled if protection is off - m_aRecordChangesCB.Enable( !bProt ); - // toggle text of button "Protect" <-> "Unprotect" - String sNewText = bProt ? m_aUnProtectSTR : m_aProtectSTR; - m_aChangeProtectionPB.SetText( sNewText ); + // ask for password and if dialog is canceled or no password provided return + if (!lcl_GetPassword( m_rMyTabPage.GetParent(), bNewProtection, aPasswordText )) + return 0; + + // provided password still needs to be checked? + if (!bNewProtection && !m_bOrigPasswordIsConfirmed) + { + if (lcl_IsPasswordCorrect( aPasswordText )) + m_bOrigPasswordIsConfirmed = true; + else + return 0; + } } + DBG_ASSERT( m_bOrigPasswordIsConfirmed, "ooops... this should not have happened!" ); + + // remember required values to change protection and change recording in + // FillItemSet_Impl later on if password was correct. + m_bNewPasswordIsValid = true; + m_aNewPassword = bNewProtection? aPasswordText : String(); + +// // RecordChangesCB is enabled if protection is off +// m_aRecordChangesCB.Enable( !bNewProtection ); + m_aRecordChangesCB.Check( bNewProtection ); + // toggle text of button "Protect" <-> "Unprotect" + m_aChangeProtectionPB.SetText( bNewProtection ? m_aUnProtectSTR : m_aProtectSTR ); + return 0; } @@ -378,3 +485,4 @@ void SfxSecurityPage::Reset( const SfxItemSet & rItemSet ) ////////////////////////////////////////////////////////////////////// + diff --git a/sfx2/source/dialog/securitypage.hrc b/sfx2/source/dialog/securitypage.hrc index 820dab538b9f..d425131b4772 100755 --- a/sfx2/source/dialog/securitypage.hrc +++ b/sfx2/source/dialog/securitypage.hrc @@ -41,12 +41,12 @@ #define CONFIRM_PASSWORD_TO_MODIFY_ED 11 #define OPTIONS_FL 12 #define OPEN_READONLY_CB 13 -#define REMOVE_INFO_ON_SAVING_CB 14 -#define RECORD_CHANGES_CB 15 -#define CHANGE_PROTECTION_PB 16 +#define RECORD_CHANGES_CB 14 +#define CHANGE_PROTECTION_PB 15 #define STR_PROTECT 101 #define STR_UNPROTECT 102 +#define STR_END_REDLINING_WARNING 103 #endif diff --git a/sfx2/source/dialog/securitypage.src b/sfx2/source/dialog/securitypage.src index 32f5fac704a4..4bf8cdaf58a9 100755 --- a/sfx2/source/dialog/securitypage.src +++ b/sfx2/source/dialog/securitypage.src @@ -125,21 +125,15 @@ TabPage TP_DOCINFOSECURITY Size = MAP_APPFONT( 176, RSC_CD_CHECKBOX_HEIGHT ); Text [ en-US ] = "~Open file read-only"; }; - CheckBox REMOVE_INFO_ON_SAVING_CB - { - Pos = MAP_APPFONT( 12, 147 ); - Size = MAP_APPFONT( 176, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "Remove personal ~information on saving"; - }; CheckBox RECORD_CHANGES_CB { - Pos = MAP_APPFONT( 12, 162 ); + Pos = MAP_APPFONT( 12, 147 ); Size = MAP_APPFONT( 176, RSC_CD_CHECKBOX_HEIGHT ); Text [ en-US ] = "Record ~changes"; }; PushButton CHANGE_PROTECTION_PB { - Pos = MAP_APPFONT( 194, 160 ); + Pos = MAP_APPFONT( 194, 145 ); Size = MAP_APPFONT( 60, RSC_CD_PUSHBUTTON_HEIGHT ); }; String STR_PROTECT @@ -150,7 +144,14 @@ TabPage TP_DOCINFOSECURITY { Text [ en-US ] = "~Unprotect..."; }; - + String STR_END_REDLINING_WARNING + { + Text [ en-US ] = "This action will exit the change recording mode.\nAny information about changes will be lost.\n\nExit change recording mode?\n\n" ; + }; }; +String RID_SFX_INCORRECT_PASSWORD +{ + Text [ en-US ] = "Incorrect password" ; +}; diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx old mode 100644 new mode 100755 index 6502eeaeb78c..751525910958 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -1074,3 +1074,27 @@ void SfxObjectShell::SetInitialized_Impl( const bool i_fromInitNew ) SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_LOADFINISHED, GlobalEventConfig::GetEventName(STR_EVENT_LOADFINISHED), this ) ); } } + + +void SfxObjectShell::SetChangeRecording( bool /*bActivate*/ ) +{ + // currently this function needs to be overwritten by Writer and Calc only + DBG_ASSERT( 0, "function not implemented" ); +} + + +bool SfxObjectShell::SetProtectionPassword( const String &rPassword ) +{ + // currently this function needs to be overwritten by Writer and Calc only + DBG_ASSERT( 0, "function not implemented" ); + return false; +} + + +bool SfxObjectShell::GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > & /*rPasswordHash*/ ) +{ + // currently this function needs to be overwritten by Writer and Calc only + DBG_ASSERT( 0, "function not implemented" ); + return false; +} + -- cgit From 23db89852fe61acef4e8f58fa83f80dd65591e1d Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Wed, 19 May 2010 18:38:32 +0200 Subject: sw33bf04: #i111712#: sfx2: convert crude test in Metadatable.cxx to cppunit --- sfx2/source/doc/Metadatable.cxx | 162 ---------------------------------------- 1 file changed, 162 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/doc/Metadatable.cxx b/sfx2/source/doc/Metadatable.cxx index b1b69e5ac74f..92f391305aeb 100644 --- a/sfx2/source/doc/Metadatable.cxx +++ b/sfx2/source/doc/Metadatable.cxx @@ -1674,168 +1674,6 @@ throw (uno::RuntimeException) #if OSL_DEBUG_LEVEL > 1 -static ::sfx2::XmlIdRegistryDocument s_Reg; -static ::sfx2::XmlIdRegistryClipboard s_RegClip; - -class MockMetadatable : public ::sfx2::Metadatable -{ -public: - MockMetadatable(bool i_isInClip = false) : - m_bInClipboard(i_isInClip), m_bInUndo(false), m_bInContent(true) {} - bool m_bInClipboard; - bool m_bInUndo; - bool m_bInContent; - virtual bool IsInClipboard() const { return m_bInClipboard; } - virtual bool IsInUndo() const { return m_bInUndo; } - virtual bool IsInContent() const { return m_bInContent; } - virtual ::sfx2::XmlIdRegistry& GetRegistry() { return m_bInClipboard ? static_cast< ::sfx2::XmlIdRegistry&>(s_RegClip) : static_cast< ::sfx2::XmlIdRegistry&>(s_Reg); } - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::rdf::XMetadatable > MakeUnoObject() { return 0; } -}; - -bool operator==(beans::StringPair p1, beans::StringPair p2) -{ - return p1.First == p2.First && p1.Second == p2.Second; -} - -void test() -{ - OSL_TRACE("SwMetadatable test(): start\n"); - MockMetadatable m1; - MockMetadatable m2; - MockMetadatable m3; - MockMetadatable m4; - MockMetadatable m5; - ::rtl::OUString empty; - ::rtl::OUString content( ::rtl::OUString::createFromAscii("content.xml") ); - ::rtl::OUString styles ( ::rtl::OUString::createFromAscii("styles.xml") ); - ::rtl::OUString sid1( ::rtl::OUString::createFromAscii("id1") ); - ::rtl::OUString sid2( ::rtl::OUString::createFromAscii("id2") ); - ::rtl::OUString sid3( ::rtl::OUString::createFromAscii("id3") ); - ::rtl::OUString sid4( ::rtl::OUString::createFromAscii("id4") ); - beans::StringPair id1(content, sid1); - beans::StringPair id2(content, sid2); - beans::StringPair id3(content, sid3); - beans::StringPair id4(styles, sid4); - beans::StringPair id3e(empty, sid3); - beans::StringPair id4e(empty, sid4); - m1.SetMetadataReference(id1); - OSL_ENSURE(m1.GetMetadataReference() == id1, "set failed"); - try { - m2.SetMetadataReference(id1); - OSL_ENSURE(false, "set duplicate succeeded"); - } catch (lang::IllegalArgumentException) { } - m1.SetMetadataReference(id1); - OSL_ENSURE(m1.GetMetadataReference() == id1, "set failed (existing)"); - m1.EnsureMetadataReference(); - OSL_ENSURE(m1.GetMetadataReference() == id1, "ensure failed (existing)"); - - m2.EnsureMetadataReference(); - beans::StringPair m2id(m2.GetMetadataReference()); - OSL_ENSURE(m2id.Second.getLength(), "ensure failed"); - m2.EnsureMetadataReference(); - OSL_ENSURE(m2.GetMetadataReference() == m2id, "ensure failed (idempotent)"); - - m1.m_bInUndo = true; - OSL_ENSURE(!m1.GetMetadataReference().Second.getLength(), "move to undo failed"); - - m1.m_bInUndo = false; - OSL_ENSURE(m1.GetMetadataReference() == id1, "move from undo failed"); - - m1.m_bInUndo = true; - try { - m2.SetMetadataReference(id1); // steal! - } catch (lang::IllegalArgumentException &) { - OSL_ENSURE(false, "set duplicate to undo failed"); - } - m1.m_bInUndo = false; - OSL_ENSURE(!m1.GetMetadataReference().Second.getLength(), "move from undo: duplicate"); - - m3.RegisterAsCopyOf(m2); - OSL_ENSURE(m2.GetMetadataReference() == id1, "copy: source"); - OSL_ENSURE(!m3.GetMetadataReference().Second.getLength(), "copy: duplicate"); - m4.RegisterAsCopyOf(m3); - OSL_ENSURE(m2.GetMetadataReference() == id1, "copy: source"); - OSL_ENSURE(!m3.GetMetadataReference().Second.getLength(), "copy: duplicate"); - OSL_ENSURE(!m4.GetMetadataReference().Second.getLength(), "copy: duplicate"); - m2.m_bInUndo = true; - OSL_ENSURE(m3.GetMetadataReference() == id1, "duplicate to undo"); - OSL_ENSURE(!m2.GetMetadataReference().Second.getLength(), "duplicate to undo"); - m2.m_bInUndo = false; - OSL_ENSURE(m2.GetMetadataReference() == id1, "duplicate from undo"); - OSL_ENSURE(!m3.GetMetadataReference().Second.getLength(), "duplicate from undo"); - - m4.EnsureMetadataReference(); // new! - beans::StringPair m4id(m4.GetMetadataReference()); - OSL_ENSURE(m4id.Second.getLength() && !(m4id == id1), "ensure on duplicate"); - - MockMetadatable mc1(true); // in clipboard - MockMetadatable mc2(true); - MockMetadatable mc3(true); - MockMetadatable mc4(true); - MockMetadatable m2p; - MockMetadatable m3p; - - mc1.SetMetadataReference(id2); - OSL_ENSURE(mc1.GetMetadataReference() == id2, "set failed"); - try { - mc2.SetMetadataReference(id2); - OSL_ENSURE(false, "set duplicate succeeded"); - } catch (lang::IllegalArgumentException) { } - mc1.SetMetadataReference(id2); - OSL_ENSURE(mc1.GetMetadataReference() == id2, "set failed (existing)"); - mc1.EnsureMetadataReference(); - OSL_ENSURE(mc1.GetMetadataReference() == id2, "ensure failed (existing)"); - mc2.EnsureMetadataReference(); - beans::StringPair mc2id(mc2.GetMetadataReference()); - OSL_ENSURE(mc2id.Second.getLength(), "ensure failed"); - mc2.EnsureMetadataReference(); - OSL_ENSURE(mc2.GetMetadataReference() == mc2id, "ensure failed (idempotent)"); - mc2.RemoveMetadataReference(); - OSL_ENSURE(!mc2.GetMetadataReference().Second.getLength(), "remove failed"); - - // set up mc2 as copy of m2 and mc3 as copy of m3 - mc3.RegisterAsCopyOf(m3); - OSL_ENSURE(!mc3.GetMetadataReference().Second.getLength() , "copy to clipboard (latent)"); - mc2.RegisterAsCopyOf(m2); - OSL_ENSURE(mc2.GetMetadataReference() == id1, "copy to clipboard (non-latent)"); - // paste mc2 to m2p and mc3 to m3p - m2p.RegisterAsCopyOf(mc2); - OSL_ENSURE(!m2p.GetMetadataReference().Second.getLength() , "paste from clipboard (non-latent)"); - m3p.RegisterAsCopyOf(mc3); - OSL_ENSURE(!m3p.GetMetadataReference().Second.getLength() , "paste from clipboard (latent)"); - // delete m2, m2p, m3 - m2.RemoveMetadataReference(); - OSL_ENSURE(!m2.GetMetadataReference().Second.getLength(), "remove failed"); - OSL_ENSURE(m2p.GetMetadataReference() == id1, "paste-remove (non-latent)"); - m2p.RemoveMetadataReference(); - OSL_ENSURE(!m2p.GetMetadataReference().Second.getLength(), "remove failed"); - OSL_ENSURE(m3.GetMetadataReference() == id1, "paste-remove2 (non-latent)"); - m3.RemoveMetadataReference(); - OSL_ENSURE(!m3.GetMetadataReference().Second.getLength(), "remove failed"); - OSL_ENSURE(m3p.GetMetadataReference() == id1, "paste-remove (latent)"); - // delete mc2 - mc2.SetMetadataReference(beans::StringPair()); - OSL_ENSURE(!mc3.GetMetadataReference().Second.getLength() , "in clipboard becomes non-latent"); - // paste mc2 - m2p.RegisterAsCopyOf(mc2); - OSL_ENSURE(!m2p.GetMetadataReference().Second.getLength(), "remove-paste"); - OSL_ENSURE(m3p.GetMetadataReference() == id1, "remove-paste (stolen)"); - - // auto-detect stream - m5.SetMetadataReference(id3e); - OSL_ENSURE(m5.GetMetadataReference() == id3, "auto-detect (content)"); - m5.m_bInContent = false; - m5.SetMetadataReference(id4e); - OSL_ENSURE(m5.GetMetadataReference() == id4, "auto-detect (styles)"); - - OSL_TRACE("sfx2::Metadatable test(): finished\n"); -} - -struct Test { Test() { test(); } }; -static Test s_test; - - #include static void dump(sfx2::XmlIdList_t * pList) -- cgit From 468f644cf2e9b0eb58c1c4fd808158fb01657807 Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Thu, 20 May 2010 10:59:04 +0200 Subject: fwk139: #i105125# Fix state of selection check box in system file picker --- sfx2/source/dialog/filedlghelper.cxx | 59 +++++++++++++++++++++--------------- sfx2/source/dialog/filedlgimpl.hxx | 2 ++ 2 files changed, 36 insertions(+), 25 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 5270eb5d4207..29d4ac78ccb8 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -542,33 +542,13 @@ void FileDialogHelper_Impl::updateExportButton() // ------------------------------------------------------------------------ void FileDialogHelper_Impl::updateSelectionBox() { - if ( !mbExport ) + if ( !mbHasSelectionBox ) return; - // Does the selection box exist? - bool bSelectionBoxFound = false; - uno::Reference< XControlInformation > xCtrlInfo( mxFileDlg, UNO_QUERY ); - if ( xCtrlInfo.is() ) - { - Sequence< ::rtl::OUString > aCtrlList = xCtrlInfo->getSupportedControls(); - sal_uInt32 nCount = aCtrlList.getLength(); - for ( sal_uInt32 nCtrl = 0; nCtrl < nCount; ++nCtrl ) - if ( aCtrlList[ nCtrl ].equalsAscii("SelectionBox") ) - { - bSelectionBoxFound = true; - break; - } - } - - if ( bSelectionBoxFound ) - { - const SfxFilter* pFilter = getCurentSfxFilter(); - updateExtendedControl( - ExtendedFilePickerElementIds::CHECKBOX_SELECTION, - ( mbSelectionEnabled && pFilter && ( pFilter->GetFilterFlags() & SFX_FILTER_SUPPORTSSELECTION ) != 0 ) ); - uno::Reference< XFilePickerControlAccess > xCtrlAccess( mxFileDlg, UNO_QUERY ); - xCtrlAccess->setValue( ExtendedFilePickerElementIds::CHECKBOX_SELECTION, 0, makeAny( (sal_Bool)mbSelection ) ); - } + const SfxFilter* pFilter = getCurentSfxFilter(); + mbSelectionFltrEnabled = updateExtendedControl( + ExtendedFilePickerElementIds::CHECKBOX_SELECTION, + ( mbSelectionEnabled && pFilter && ( pFilter->GetFilterFlags() & SFX_FILTER_SUPPORTSSELECTION ) != 0 ) ); } // ------------------------------------------------------------------------ @@ -956,6 +936,8 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( mbPwdCheckBoxState = sal_False; mbSelection = sal_False; mbSelectionEnabled = sal_True; + mbHasSelectionBox = sal_False; + mbSelectionFltrEnabled = sal_False; // default settings m_nDontFlags = SFX_FILTER_INTERNAL | SFX_FILTER_NOTINFILEDLG | SFX_FILTER_NOTINSTALLED; @@ -1025,6 +1007,7 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( nTemplateDescription = TemplateDescription::FILESAVE_AUTOEXTENSION_SELECTION; mbHasAutoExt = sal_True; mbIsSaveDlg = sal_True; + mbHasSelectionBox = sal_True; if ( mbExport && !mxFilterCFG.is() && xFactory.is() ) { mxFilterCFG = uno::Reference< XNameAccess >( @@ -2073,6 +2056,21 @@ void FileDialogHelper_Impl::saveConfig() } } + if( mbHasSelectionBox && mbSelectionFltrEnabled ) + { + try + { + aValue = xDlg->getValue( ExtendedFilePickerElementIds::CHECKBOX_SELECTION, 0 ); + sal_Bool bSelection = sal_True; + aValue >>= bSelection; + if ( aUserData.GetTokenCount(' ') < 3 ) + aUserData.Append(' '); + aUserData.SetToken( 2, ' ', String::CreateFromInt32( (sal_Int32) bSelection ) ); + bWriteConfig = sal_True; + } + catch( IllegalArgumentException ){} + } + if ( bWriteConfig ) aDlgOpt.SetUserItem( USERITEM_NAME, makeAny( OUString( aUserData ) ) ); } @@ -2206,6 +2204,17 @@ void FileDialogHelper_Impl::loadConfig() catch( IllegalArgumentException ){} } + if( mbHasSelectionBox ) + { + sal_Int32 nFlag = aUserData.GetToken( 2, ' ' ).ToInt32(); + aValue <<= (sal_Bool) nFlag; + try + { + xDlg->setValue( ExtendedFilePickerElementIds::CHECKBOX_SELECTION, 0, aValue ); + } + catch( IllegalArgumentException ){} + } + if ( !maPath.getLength() ) displayFolder( SvtPathOptions().GetWorkPath() ); } diff --git a/sfx2/source/dialog/filedlgimpl.hxx b/sfx2/source/dialog/filedlgimpl.hxx index b023b8fb53a9..6965e14ae84d 100644 --- a/sfx2/source/dialog/filedlgimpl.hxx +++ b/sfx2/source/dialog/filedlgimpl.hxx @@ -107,6 +107,8 @@ namespace sfx2 sal_Bool mbPwdCheckBoxState : 1; sal_Bool mbSelection : 1; sal_Bool mbSelectionEnabled : 1; + sal_Bool mbHasSelectionBox : 1; + sal_Bool mbSelectionFltrEnabled : 1; private: void addFilters( sal_Int64 nFlags, -- cgit From 3ff45fd2d5b0bbf8318a5559fa66aba45b5c4040 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Thu, 20 May 2010 11:04:13 +0200 Subject: cws tl79: #i111422# pre-notify for 'Toggle' of check box --- sfx2/source/dialog/securitypage.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx index d4f217671d6e..f88525107f1c 100755 --- a/sfx2/source/dialog/securitypage.cxx +++ b/sfx2/source/dialog/securitypage.cxx @@ -175,7 +175,7 @@ struct SfxSecurityPage_Impl String m_aEndRedliningWarning; bool m_bEndRedliningWarningDone; - DECL_LINK( RecordChangesCBHdl, void* ); + DECL_LINK( RecordChangesCBToggleHdl, void* ); DECL_LINK( ChangeProtectionPBHdl, void* ); SfxSecurityPage_Impl( SfxSecurityPage &rDlg, const SfxItemSet &rItemSet ); @@ -218,7 +218,9 @@ SfxSecurityPage_Impl::SfxSecurityPage_Impl( SfxSecurityPage &rTabPage, const Sfx if (nTemp > nBtnTextWidth) nBtnTextWidth = nTemp; - m_aRecordChangesCB.SetClickHdl( LINK( this, SfxSecurityPage_Impl, RecordChangesCBHdl ) ); + // force toggle hdl called before visual change of checkbox + m_aRecordChangesCB.SetStyle( m_aRecordChangesCB.GetStyle() | WB_EARLYTOGGLE ); + m_aRecordChangesCB.SetToggleHdl( LINK( this, SfxSecurityPage_Impl, RecordChangesCBToggleHdl ) ); m_aChangeProtectionPB.SetClickHdl( LINK( this, SfxSecurityPage_Impl, ChangeProtectionPBHdl ) ); } @@ -348,7 +350,7 @@ void SfxSecurityPage_Impl::Reset_Impl( const SfxItemSet & ) } -IMPL_LINK( SfxSecurityPage_Impl, RecordChangesCBHdl, void*, EMPTYARG ) +IMPL_LINK( SfxSecurityPage_Impl, RecordChangesCBToggleHdl, void*, EMPTYARG ) { // when change recording gets disabled protection must be disabled as well if (!m_aRecordChangesCB.IsChecked()) // the new check state is already present, thus the '!' -- cgit From ca69909c1f7d45e42edd4752bca3e98661d40f84 Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Thu, 20 May 2010 13:43:32 +0200 Subject: fwk139: #i96288# Fixed disable command 'Digital Signature' doesn't disable button with the sam efunction --- sfx2/source/dialog/dinfdlg.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 81c2da0ce78d..45ebfeac69f9 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -119,6 +120,8 @@ const USHORT HI_TYPE = 2; const USHORT HI_VALUE = 3; const USHORT HI_ACTION = 4; +static const char DOCUMENT_SIGNATURE_MENU_CMD[] = "Signature"; + //------------------------------------------------------------------------ String CreateSizeText( ULONG nSize, BOOL bExtraBytes = TRUE, BOOL bSmartExtraBytes = FALSE ); String CreateSizeText( ULONG nSize, BOOL bExtraBytes, BOOL bSmartExtraBytes ) @@ -858,6 +861,13 @@ SfxDocumentPage::SfxDocumentPage( Window* pParent, const SfxItemSet& rItemSet ) aNewSize.Width() -= nDelta; aUseUserDataCB.SetSizePixel( aNewSize ); } + // See i96288 + // Check if the document signature command is enabled + // on the main list enable/disable the pushbutton accordingly + SvtCommandOptions aCmdOptions; + if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( DOCUMENT_SIGNATURE_MENU_CMD ) ) ) ) + aSignatureBtn.Disable(); } //------------------------------------------------------------------------ -- cgit From de8796345a26ebc4607cfd0fd10b303c20b866e9 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Tue, 25 May 2010 11:45:06 +0200 Subject: cws tl79: #i110254# security tab page in 'File/Properties' --- sfx2/source/dialog/securitypage.cxx | 163 ++++++++++++++++++++++-------------- sfx2/source/dialog/securitypage.src | 8 ++ sfx2/source/doc/objxtor.cxx | 16 ++++ 3 files changed, 122 insertions(+), 65 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx index f88525107f1c..0c6688ab1229 100755 --- a/sfx2/source/dialog/securitypage.cxx +++ b/sfx2/source/dialog/securitypage.cxx @@ -53,43 +53,6 @@ using namespace ::com::sun::star; -////////////////////////////////////////////////////////////////////// - -static short lcl_GetPassword( Window *pParent, bool bShowConfirm, /*out*/String &rPassword ) -{ - bool bRes = false; - SfxPasswordDialog aPasswdDlg( pParent ); - if (bShowConfirm) - aPasswdDlg.ShowExtras( SHOWEXTRAS_CONFIRM ); - if (RET_OK == aPasswdDlg.Execute() && aPasswdDlg.GetPassword().Len() > 0) - { - rPassword = aPasswdDlg.GetPassword(); - bRes = true; - } - return bRes; -} - - -static bool lcl_IsPasswordCorrect( const String &rPassword ) -{ - bool bRes = false; - - SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); - uno::Sequence< sal_Int8 > aPasswordHash; - bool bHasPassword = pCurDocShell->GetProtectionHash( aPasswordHash ); - - // check if supplied password was correct - uno::Sequence< sal_Int8 > aNewPasswd( aPasswordHash ); - SvPasswordHelper::GetHashPassword( aNewPasswd, rPassword ); - if (SvPasswordHelper::CompareHashPassword( aPasswordHash, rPassword )) - bRes = true; // password was correct - else - InfoBox( NULL, String( SfxResId( RID_SFX_INCORRECT_PASSWORD ) ) ).Execute(); - - return bRes; -} - - ////////////////////////////////////////////////////////////////////// @@ -98,6 +61,21 @@ namespace enum RedliningMode { RL_NONE, RL_WRITER, RL_CALC }; enum RedlineFunc { RF_ON, RF_PROTECT }; +/* + bool QueryIsEnabled( USHORT _nSlot ) + { + bool bRes = false; + SfxViewShell* pViewSh = SfxViewShell::Current(); + if (pViewSh) + { + const SfxPoolItem* pItem; + SfxDispatcher* pDisp = pViewSh->GetDispatcher(); + SfxItemState eState = pDisp->QueryState( _nSlot, pItem ); + bRes = (eState & SFX_ITEM_DISABLED) == 0; + } + return bRes; + } +*/ bool QueryState( USHORT _nSlot, bool& _rValue ) { @@ -107,7 +85,8 @@ namespace { const SfxPoolItem* pItem; SfxDispatcher* pDisp = pViewSh->GetDispatcher(); - bRet = SFX_ITEM_AVAILABLE <= pDisp->QueryState( _nSlot, pItem ); + SfxItemState nState = pDisp->QueryState( _nSlot, pItem ); + bRet = SFX_ITEM_AVAILABLE <= nState; if (bRet) _rValue = ( static_cast< const SfxBoolItem* >( pItem ) )->GetValue(); } @@ -143,6 +122,50 @@ namespace ////////////////////////////////////////////////////////////////////// +static short lcl_GetPassword( + Window *pParent, + bool bProtect, + /*out*/String &rPassword ) +{ + bool bRes = false; + SfxPasswordDialog aPasswdDlg( pParent ); + const String aTitle( SfxResId( bProtect ? RID_SFX_PROTECT_RECORDS : RID_SFX_UNPROTECT_RECORDS ) ); + aPasswdDlg.SetText( aTitle ); + aPasswdDlg.SetMinLen( 1 ); + if (bProtect) + aPasswdDlg.ShowExtras( SHOWEXTRAS_CONFIRM ); + if (RET_OK == aPasswdDlg.Execute() && aPasswdDlg.GetPassword().Len() > 0) + { + rPassword = aPasswdDlg.GetPassword(); + bRes = true; + } + return bRes; +} + + +static bool lcl_IsPasswordCorrect( const String &rPassword ) +{ + bool bRes = false; + + SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); + uno::Sequence< sal_Int8 > aPasswordHash; + bool bHasPassword = pCurDocShell->GetProtectionHash( aPasswordHash ); + + // check if supplied password was correct + uno::Sequence< sal_Int8 > aNewPasswd( aPasswordHash ); + SvPasswordHelper::GetHashPassword( aNewPasswd, rPassword ); + if (SvPasswordHelper::CompareHashPassword( aPasswordHash, rPassword )) + bRes = true; // password was correct + else + InfoBox( NULL, String( SfxResId( RID_SFX_INCORRECT_PASSWORD ) ) ).Execute(); + + return bRes; +} + + +////////////////////////////////////////////////////////////////////// + + struct SfxSecurityPage_Impl { SfxSecurityPage & m_rMyTabPage; @@ -235,39 +258,43 @@ BOOL SfxSecurityPage_Impl::FillItemSet_Impl( SfxItemSet & ) bool bModified = false; SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); - if (pCurDocShell) + if (pCurDocShell&& !pCurDocShell->IsReadOnly()) { - if (m_eRedlingMode != RL_NONE && !pCurDocShell->IsReadOnly()) + if (m_eRedlingMode != RL_NONE ) { - // change recording - const bool bDoRecordChanges = m_aRecordChangesCB.IsChecked(); - pCurDocShell->SetChangeRecording( bDoRecordChanges ); + const bool bDoRecordChanges = m_aRecordChangesCB.IsChecked(); + const bool bDoChangeProtection = m_aChangeProtectionPB.GetText() != m_aProtectSTR; + + // sanity checks + DBG_ASSERT( bDoRecordChanges || !bDoChangeProtection, "no change recording should imply no change protection" ); + DBG_ASSERT( bDoChangeProtection || !bDoRecordChanges, "no change protection should imply no change recording" ); + DBG_ASSERT( !bDoChangeProtection || m_aNewPassword.Len() > 0, "change protection should imply password length is > 0" ); + DBG_ASSERT( bDoChangeProtection || m_aNewPassword.Len() == 0, "no change protection should imply password length is 0" ); - // no change recording should imply no password protection - if (!bDoRecordChanges && (!m_bNewPasswordIsValid || m_aNewPassword.Len() != 0)) + // change recording + if (bDoRecordChanges != pCurDocShell->IsChangeRecording()) { - // actually this should not be possible. Thus just as 'coded comment': - DBG_ASSERT( 0, "unexpected state of UI" ); - m_bNewPasswordIsValid = true; - m_aNewPassword = String(); + pCurDocShell->SetChangeRecording( bDoRecordChanges ); + bModified = true; } // change record protection - if (m_bNewPasswordIsValid) + if (m_bNewPasswordIsValid && + bDoChangeProtection != pCurDocShell->HasChangeRecordProtection()) { - const bool bDoChangeProtection = m_aChangeProtectionPB.GetText() != m_aProtectSTR; DBG_ASSERT( !bDoChangeProtection || bDoRecordChanges, "change protection requires record changes to be active!" ); pCurDocShell->SetProtectionPassword( m_aNewPassword ); + bModified = true; } - - bModified = true; } // open read-only? - if (pCurDocShell->HasSecurityOptOpenReadOnly()) + const sal_Bool bDoOpenReadonly = m_aOpenReadonlyCB.IsChecked(); + if (pCurDocShell->HasSecurityOptOpenReadOnly() && + bDoOpenReadonly != pCurDocShell->IsSecurityOptOpenReadOnly()) { - pCurDocShell->SetSecurityOptOpenReadOnly( m_aOpenReadonlyCB.IsChecked() ); + pCurDocShell->SetSecurityOptOpenReadOnly( bDoOpenReadonly ); bModified = true; } } @@ -333,16 +360,22 @@ void SfxSecurityPage_Impl::Reset_Impl( const SfxItemSet & ) m_aRecordChangesCB.Check( bRecordChanges ); m_aRecordChangesCB.Enable( /*!bProtection && */!bIsReadonly ); - DBG_ASSERT( pCurDocShell, "doc shell missing" ); - if (pCurDocShell) - { - m_bOrigPasswordIsConfirmed = true; // default case if no password is set - uno::Sequence< sal_Int8 > aPasswordHash; - // check if password is available - if (pCurDocShell->GetProtectionHash( aPasswordHash ) && - aPasswordHash.getLength() > 0) - m_bOrigPasswordIsConfirmed = false; // password found, needs to be confirmed later on - } + m_bOrigPasswordIsConfirmed = true; // default case if no password is set + uno::Sequence< sal_Int8 > aPasswordHash; + // check if password is available + if (pCurDocShell->GetProtectionHash( aPasswordHash ) && + aPasswordHash.getLength() > 0) + m_bOrigPasswordIsConfirmed = false; // password found, needs to be confirmed later on + } + else + { + // A Calc document that is shared will have 'm_eRedlingMode == RL_NONE' + // In shared documents change recording and protection must be disabled, + // similar to documents that do not support change recording at all. + m_aRecordChangesCB.Check( FALSE ); + m_aRecordChangesCB.Disable(); + m_aChangeProtectionPB.Check( FALSE ); + m_aChangeProtectionPB.Disable(); } } diff --git a/sfx2/source/dialog/securitypage.src b/sfx2/source/dialog/securitypage.src index 4bf8cdaf58a9..7c0fffd96057 100755 --- a/sfx2/source/dialog/securitypage.src +++ b/sfx2/source/dialog/securitypage.src @@ -150,6 +150,14 @@ TabPage TP_DOCINFOSECURITY }; }; +String RID_SFX_PROTECT_RECORDS +{ + Text [ en-US ] = "Protect Records" ; +}; +String RID_SFX_UNPROTECT_RECORDS +{ + Text [ en-US ] = "Unprotect Records" ; +}; String RID_SFX_INCORRECT_PASSWORD { Text [ en-US ] = "Incorrect password" ; diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 751525910958..fdbd2b6a5cf0 100755 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -1076,6 +1076,22 @@ void SfxObjectShell::SetInitialized_Impl( const bool i_fromInitNew ) } +bool SfxObjectShell::IsChangeRecording() const +{ + // currently this function needs to be overwritten by Writer and Calc only + DBG_ASSERT( 0, "function not implemented" ); + return false; +} + + +bool SfxObjectShell::HasChangeRecordProtection() const +{ + // currently this function needs to be overwritten by Writer and Calc only + DBG_ASSERT( 0, "function not implemented" ); + return false; +} + + void SfxObjectShell::SetChangeRecording( bool /*bActivate*/ ) { // currently this function needs to be overwritten by Writer and Calc only -- cgit From 6b4917460417793350ed406aa0742ec31ef6ca3c Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Wed, 26 May 2010 08:13:07 +0200 Subject: cws tl79: warning-free code --- sfx2/source/dialog/securitypage.cxx | 2 +- sfx2/source/doc/objxtor.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx index 0c6688ab1229..d32ee843cbf2 100755 --- a/sfx2/source/dialog/securitypage.cxx +++ b/sfx2/source/dialog/securitypage.cxx @@ -149,7 +149,7 @@ static bool lcl_IsPasswordCorrect( const String &rPassword ) SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); uno::Sequence< sal_Int8 > aPasswordHash; - bool bHasPassword = pCurDocShell->GetProtectionHash( aPasswordHash ); + pCurDocShell->GetProtectionHash( aPasswordHash ); // check if supplied password was correct uno::Sequence< sal_Int8 > aNewPasswd( aPasswordHash ); diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index fdbd2b6a5cf0..217faeca2e55 100755 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -1099,7 +1099,7 @@ void SfxObjectShell::SetChangeRecording( bool /*bActivate*/ ) } -bool SfxObjectShell::SetProtectionPassword( const String &rPassword ) +bool SfxObjectShell::SetProtectionPassword( const String & /*rPassword*/ ) { // currently this function needs to be overwritten by Writer and Calc only DBG_ASSERT( 0, "function not implemented" ); -- cgit From fe90e521ed48a0b697f94f383340498e550fe6c8 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Wed, 26 May 2010 15:50:21 +0200 Subject: fwk139: #i101937# integrate patch --- sfx2/source/dialog/filedlghelper.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 29d4ac78ccb8..9c2cb46b15f2 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -2673,10 +2674,12 @@ static int impl_isFolder( const OUString& rPath ) { } + ::rtl::Reference <::comphelper::StillReadWriteInteraction> aHandler = new ::comphelper::StillReadWriteInteraction( xHandler ); + try { ::ucbhelper::Content aContent( - rPath, new ::ucbhelper::CommandEnvironment( xHandler, uno::Reference< ucb::XProgressHandler >() ) ); + rPath, new ::ucbhelper::CommandEnvironment( static_cast< task::XInteractionHandler* > ( aHandler.get() ), uno::Reference< ucb::XProgressHandler >() ) ); if ( aContent.isFolder() ) return 1; -- cgit From ba856bbd9981bf72f5729b1ee36bc71f3a54eb6a Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Wed, 26 May 2010 16:04:10 +0200 Subject: fwk139: #i40233# integrate the patch --- sfx2/source/doc/docfac.cxx | 124 +++++++++++++++++++++++++++++++++++++++++ sfx2/source/doc/makefile.mk | 3 +- sfx2/source/doc/syspath.hxx | 44 +++++++++++++++ sfx2/source/doc/syspathw32.cxx | 79 ++++++++++++++++++++++++++ 4 files changed, 249 insertions(+), 1 deletion(-) create mode 100644 sfx2/source/doc/syspath.hxx create mode 100644 sfx2/source/doc/syspathw32.cxx (limited to 'sfx2/source') diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx index 48c01a1ac3fe..88ae54d1c58a 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -30,13 +30,19 @@ #include #include #include +#include +#include +#include +#include #include #include #include #include #include #include +#include #include +#include #include #include @@ -49,9 +55,15 @@ #include #include "sfxresid.hxx" #include +#include "syspath.hxx" +#include +#include #include "doc.hrc" +#include + namespace css = ::com::sun::star; +using namespace ::com::sun::star; //======================================================================== @@ -182,13 +194,125 @@ void SfxObjectFactory::SetModule_Impl( SfxModule *pMod ) pImpl->pModule = pMod; } +void SfxObjectFactory::SetSystemTemplate( const String& rServiceName, const String& rTemplateName ) +{ + static ::rtl::OUString SERVICE_FILTER_FACTORY = ::rtl::OUString::createFromAscii( "com.sun.star.document.FilterFactory" ); + static ::rtl::OUString SERVICE_TYPE_DECTECTION = ::rtl::OUString::createFromAscii( "com.sun.star.document.TypeDetection" ); + static ::rtl::OUString SERVICE_SIMPLE_ACCESS = ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ); + + static ::rtl::OUString CONF_ROOT = ::rtl::OUString::createFromAscii( "/org.openoffice.Setup"); + static ::rtl::OUString CONF_PATH = ::rtl::OUString::createFromAscii( "Office/Factories/" ) + ::rtl::OUString( rServiceName ); + static ::rtl::OUString PROP_DEF_TEMPL_CHANGED = ::rtl::OUString::createFromAscii( "ooSetupFactorySystemDefaultTemplateChanged" ); + static ::rtl::OUString PROP_ACTUAL_FILTER = ::rtl::OUString::createFromAscii( "ooSetupFactoryActualFilter" ); + + static ::rtl::OUString DEF_TPL_STR = ::rtl::OUString::createFromAscii("/soffice."); + + String sURL; + ::utl::LocalFileHelper::ConvertPhysicalNameToURL( String( SystemPath::GetUserTemplateLocation()), sURL ); + + ::rtl::OUString aUserTemplateURL( sURL ); + if ( aUserTemplateURL.getLength() != 0) + { + try + { + uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + uno::Reference< uno::XInterface > xConfig = ::comphelper::ConfigurationHelper::openConfig( + xFactory, CONF_ROOT, ::comphelper::ConfigurationHelper::E_STANDARD ); + + ::rtl::OUString aActualFilter; + ::comphelper::ConfigurationHelper::readRelativeKey( xConfig, CONF_PATH, PROP_ACTUAL_FILTER ) >>= aActualFilter; + sal_Bool bChanged; + ::comphelper::ConfigurationHelper::readRelativeKey( xConfig, CONF_PATH, PROP_DEF_TEMPL_CHANGED ) >>= bChanged; + + uno::Reference< container::XNameAccess > xFilterFactory( + xFactory->createInstance( SERVICE_FILTER_FACTORY ), uno::UNO_QUERY_THROW ); + uno::Reference< container::XNameAccess > xTypeDetection( + xFactory->createInstance( SERVICE_TYPE_DECTECTION ), uno::UNO_QUERY_THROW ); + + ::rtl::OUString aActualFilterTypeName; + uno::Sequence< beans::PropertyValue > aActuralFilterData; + xFilterFactory->getByName( aActualFilter ) >>= aActuralFilterData; + for ( sal_Int32 nInd = 0; nInd < aActuralFilterData.getLength(); nInd++ ) + if ( aActuralFilterData[nInd].Name.equalsAscii( "Type" ) ) + aActuralFilterData[nInd].Value >>= aActualFilterTypeName; + ::comphelper::SequenceAsHashMap aProps1( xTypeDetection->getByName( aActualFilterTypeName ) ); + uno::Sequence< ::rtl::OUString > aAllExt = + aProps1.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Extensions" ), uno::Sequence< ::rtl::OUString >() ); + //To-do: check if aAllExt is empty first + ::rtl::OUString aExt = aAllExt[0]; + + aUserTemplateURL += DEF_TPL_STR; + aUserTemplateURL += aExt; + + uno::Reference< ucb::XSimpleFileAccess > xSimpleFileAccess( + xFactory->createInstance( SERVICE_SIMPLE_ACCESS ), uno::UNO_QUERY_THROW ); + + ::rtl::OUString aBackupURL; + ::osl::Security().getConfigDir(aBackupURL); + aBackupURL += ::rtl::OUString::createFromAscii( "/temp" ); + + if ( !xSimpleFileAccess->exists( aBackupURL ) ) + xSimpleFileAccess->createFolder( aBackupURL ); + + aBackupURL += DEF_TPL_STR; + aBackupURL += aExt; + + if ( rTemplateName.Len() != 0 ) + { + if ( xSimpleFileAccess->exists( aUserTemplateURL ) && !bChanged ) + xSimpleFileAccess->copy( aUserTemplateURL, aBackupURL ); + + uno::Reference< document::XTypeDetection > xTypeDetector( xTypeDetection, uno::UNO_QUERY ); + ::comphelper::SequenceAsHashMap aProps2( xTypeDetection->getByName( xTypeDetector->queryTypeByURL( rTemplateName ) ) ); + ::rtl::OUString aFilterName = + aProps2.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii("PreferredFilter"), ::rtl::OUString() ); + + uno::Sequence< beans::PropertyValue > aArgs( 3 ); + aArgs[0].Name = ::rtl::OUString::createFromAscii( "FilterName" ); + aArgs[0].Value <<= aFilterName; + aArgs[1].Name = ::rtl::OUString::createFromAscii( "AsTemplate" ); + aArgs[1].Value <<= sal_True; + aArgs[2].Name = ::rtl::OUString::createFromAscii( "URL" ); + aArgs[2].Value <<= ::rtl::OUString( rTemplateName ); + + uno::Reference< frame::XLoadable > xLoadable( xFactory->createInstance( ::rtl::OUString( rServiceName ) ), uno::UNO_QUERY ); + xLoadable->load( aArgs ); + + aArgs.realloc( 2 ); + aArgs[1].Name = ::rtl::OUString::createFromAscii( "Overwrite" ); + aArgs[1].Value <<= sal_True; + + uno::Reference< frame::XStorable > xStorable( xLoadable, uno::UNO_QUERY ); + xStorable->storeToURL( aUserTemplateURL, aArgs ); + ::comphelper::ConfigurationHelper::writeRelativeKey( xConfig, CONF_PATH, PROP_DEF_TEMPL_CHANGED, uno::makeAny( sal_True )); + ::comphelper::ConfigurationHelper::flush( xConfig ); + } + else + { + DBG_ASSERT( bChanged, "invalid ooSetupFactorySystemDefaultTemplateChanged value!" ); + + xSimpleFileAccess->copy( aBackupURL, aUserTemplateURL ); + xSimpleFileAccess->kill( aBackupURL ); + ::comphelper::ConfigurationHelper::writeRelativeKey( xConfig, CONF_PATH, PROP_DEF_TEMPL_CHANGED, uno::makeAny( sal_False )); + ::comphelper::ConfigurationHelper::flush( xConfig ); + } + } + catch( uno::Exception& ) + { + } + } +} + void SfxObjectFactory::SetStandardTemplate( const String& rServiceName, const String& rTemplate ) { SvtModuleOptions::EFactory eFac = SvtModuleOptions::ClassifyFactoryByServiceName(rServiceName); if (eFac == SvtModuleOptions::E_UNKNOWN_FACTORY) eFac = SvtModuleOptions::ClassifyFactoryByShortName(rServiceName); if (eFac != SvtModuleOptions::E_UNKNOWN_FACTORY) + { + SetSystemTemplate( rServiceName, rTemplate ); SvtModuleOptions().SetFactoryStandardTemplate(eFac, rTemplate); + } } String SfxObjectFactory::GetStandardTemplate( const String& rServiceName ) diff --git a/sfx2/source/doc/makefile.mk b/sfx2/source/doc/makefile.mk index b766921e346b..fd812297a8ab 100644 --- a/sfx2/source/doc/makefile.mk +++ b/sfx2/source/doc/makefile.mk @@ -83,7 +83,8 @@ SLOFILES = \ $(SLO)$/sfxmodelfactory.obj \ $(SLO)$/sfxacldetect.obj \ $(SLO)$/docstoragemodifylistener.obj \ - $(SLO)$/querytemplate.obj + $(SLO)$/querytemplate.obj \ + $(SLO)$/syspathw32.obj # $(SLO)$/applet.obj \ diff --git a/sfx2/source/doc/syspath.hxx b/sfx2/source/doc/syspath.hxx new file mode 100644 index 000000000000..a41836775421 --- /dev/null +++ b/sfx2/source/doc/syspath.hxx @@ -0,0 +1,44 @@ +/************************************************************************* +* +* 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 +* +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +#ifndef __SYSPATH_HXX__ +#define __SYSPATH_HXX__ +//#pragma warning(disable:4917) + +#include +#include + +class SFX2_DLLPUBLIC SystemPath +{ +public: + static ::rtl::OUString GetUserTemplateLocation(); +}; + +#endif \ No newline at end of file diff --git a/sfx2/source/doc/syspathw32.cxx b/sfx2/source/doc/syspathw32.cxx new file mode 100644 index 000000000000..9919df2f65a3 --- /dev/null +++ b/sfx2/source/doc/syspathw32.cxx @@ -0,0 +1,79 @@ +/************************************************************************* +* +* 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 +* +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sfx2.hxx" + +#include "syspath.hxx" + +using namespace ::rtl; + +#ifdef WNT +#include + +#define ALLOC(type, n) ((type *) HeapAlloc(GetProcessHeap(), 0, sizeof(type) * n )) +#define FREE(p) HeapFree(GetProcessHeap(), 0, p) + +static OUString _SHGetSpecialFolderW32( int nFolderID ) +{ + LPITEMIDLIST pidl; + HRESULT hHdl = SHGetSpecialFolderLocation( NULL, nFolderID, &pidl ); + OUString aFolder; + + if( hHdl == NOERROR ) + { + WCHAR *lpFolderA; + lpFolderA = ALLOC( WCHAR, 16000 ); + + SHGetPathFromIDListW( pidl, lpFolderA ); + aFolder = OUString( reinterpret_cast(lpFolderA) ); + + FREE( lpFolderA ); + IMalloc *pMalloc; + if( NOERROR == SHGetMalloc(&pMalloc) ) + { + pMalloc->Free( pidl ); + pMalloc->Release(); + } + } + return aFolder; +} + +#endif + +OUString SystemPath::GetUserTemplateLocation() +{ +#ifdef WNT + return _SHGetSpecialFolderW32(CSIDL_TEMPLATES); +#endif +#ifdef UNX + return OUString(); +#endif +} -- cgit From 720cb002b90767f097bed1ee63f61337632b731d Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Mon, 31 May 2010 12:59:01 +0200 Subject: fwk143: #i111516# Support language argument and configuration item for dictionary repository URL. --- sfx2/source/appl/appserv.cxx | 63 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 55 insertions(+), 8 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 14789100bb24..bd9efc9bca1e 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -51,20 +51,15 @@ #include #include -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX #include -#endif #include +#include "comphelper/configurationhelper.hxx" -#ifndef _SVT_DOC_ADDRESSTEMPLATE_HXX_ #include -#endif #include #include -#ifndef _UNOTOOLS_CONFIGMGR_HXX_ #include -#endif #include #include #include @@ -90,6 +85,7 @@ #include #include #include +#include #include #include @@ -879,6 +875,31 @@ namespace } } +static ::rtl::OUString getConfigurationStringValue( + const ::rtl::OUString& rPackage, + const ::rtl::OUString& rRelPath, + const ::rtl::OUString& rKey, + const ::rtl::OUString& rDefaultValue ) +{ + ::rtl::OUString aDefVal( rDefaultValue ); + + try + { + ::comphelper::ConfigurationHelper::readDirectKey( + comphelper::getProcessServiceFactory(), + rPackage, + rRelPath, + rKey, + ::comphelper::ConfigurationHelper::E_READONLY) >>= aDefVal; + } + catch(const com::sun::star::uno::RuntimeException& exRun) + { throw exRun; } + catch(const com::sun::star::uno::Exception&) + {} + + return aDefVal; +} + void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) { DBG_MEMTEST(); @@ -924,8 +945,34 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) uno::Reference< css::system::XSystemShellExecute > xSystemShell( xSMGR->createInstance( DEFINE_CONST_UNICODE("com.sun.star.system.SystemShellExecute" ) ), uno::UNO_QUERY_THROW ); - if ( xSystemShell.is() ) - xSystemShell->execute( DEFINE_CONST_UNICODE("http://extensions.services.openoffice.org/dictionary?cid=926385"), ::rtl::OUString(), css::system::SystemShellExecuteFlags::DEFAULTS ); + + // read repository URL from configuration + ::rtl::OUString sTemplRepoURL = + getConfigurationStringValue( + ::rtl::OUString::createFromAscii("org.openoffice.Office.Common"), + ::rtl::OUString::createFromAscii("Dictionaries"), + ::rtl::OUString::createFromAscii("RepositoryURL"), + ::rtl::OUString()); + + if ( xSystemShell.is() && sTemplRepoURL.getLength() > 0 ) + { + ::rtl::OUStringBuffer aURLBuf( sTemplRepoURL ); + aURLBuf.appendAscii( "?" ); + aURLBuf.appendAscii( "lang=" ); + + // read locale from configuration + ::rtl::OUString sLocale = getConfigurationStringValue( + ::rtl::OUString::createFromAscii("org.openoffice.Setup"), + ::rtl::OUString::createFromAscii("L10N"), + ::rtl::OUString::createFromAscii("ooLocale"), + ::rtl::OUString::createFromAscii("en-US")); + + aURLBuf.append( sLocale ); + xSystemShell->execute( + aURLBuf.makeStringAndClear(), + ::rtl::OUString(), + css::system::SystemShellExecuteFlags::DEFAULTS ); + } } catch( const ::com::sun::star::uno::Exception& ) { -- cgit From 3655eab4df54f47e8821db8aed9b90fa7fab33bd Mon Sep 17 00:00:00 2001 From: tono Date: Mon, 31 May 2010 21:53:32 +0900 Subject: i#111958: MinGW port enhancement: runtime-pseude-reloc-v2 --- sfx2/source/bastyp/sfxhtml.cxx | 4 ---- 1 file changed, 4 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/bastyp/sfxhtml.cxx b/sfx2/source/bastyp/sfxhtml.cxx index 6132e958b900..8a4b434f460b 100644 --- a/sfx2/source/bastyp/sfxhtml.cxx +++ b/sfx2/source/bastyp/sfxhtml.cxx @@ -62,11 +62,7 @@ sal_Char __FAR_DATA sHTML_MIME_application[] = "application/"; sal_Char __FAR_DATA sHTML_MIME_experimental[] = "x-"; // -#ifdef __MINGW32__ // for runtime pseudo reloc -static HTMLOptionEnum aAreaShapeOptEnums[] = -#else static HTMLOptionEnum __READONLY_DATA aAreaShapeOptEnums[] = -#endif { { OOO_STRING_SVTOOLS_HTML_SH_rect, IMAP_OBJ_RECTANGLE }, { OOO_STRING_SVTOOLS_HTML_SH_rectangle, IMAP_OBJ_RECTANGLE }, -- cgit From d90913a6131cd829292e7f13cc6c9b28120a5e43 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Wed, 2 Jun 2010 10:16:03 +0200 Subject: CWS mba33issues01: #i112021#: remove obsolete code --- sfx2/source/dialog/about.cxx | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/about.cxx b/sfx2/source/dialog/about.cxx index 66d4146d9e62..02f05c773f73 100644 --- a/sfx2/source/dialog/about.cxx +++ b/sfx2/source/dialog/about.cxx @@ -130,20 +130,6 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS rtl::OUString sProduct; utl::ConfigManager::GetDirectConfigProperty(utl::ConfigManager::PRODUCTNAME) >>= sProduct; - if ( sProduct.equals( rtl::OUString::createFromAscii("StarOffice") ) || - sProduct.equals( rtl::OUString::createFromAscii("StarSuite") ) ) - { - // --> PB 2004-11-18 #118455# new copyright text (only in french version show a french text) - ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale(); - ::rtl::OUString sFrenchLang( DEFINE_CONST_OUSTRING( "fr" ) ); - if ( aLocale.Language.equals( sFrenchLang ) ) - { - String sNewCopyrightText( ResId( ABOUT_STR_FRENCH_COPYRIGHT, *rId.GetResMgr() ) ); - aCopyrightText.SetText( sNewCopyrightText ); - } - // <-- - } - // load image from module path rtl::OUString aAbouts( RTL_CONSTASCII_USTRINGPARAM( ABOUT_BITMAP_STRINGLIST ) ); bool bLoaded = false; @@ -289,22 +275,6 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS // explizite Help-Id SetHelpId( SID_ABOUT ); - - //#112429# replace occurences of "StarOffice" in the "StarSuite" version - String sCopyright( aCopyrightText.GetText() ); - if(sProduct.equals(rtl::OUString::createFromAscii("StarSuite"))) - { - String sSO(String::CreateFromAscii("StarOffice")); - sCopyright.SearchAndReplaceAll(sSO, sProduct); - } - - String sNewYear( DEFINE_CONST_UNICODE("2005") ); - xub_StrLen nIdx = sCopyright.SearchAndReplace( DEFINE_CONST_UNICODE("2002"), sNewYear ); - if ( STRING_NOTFOUND == nIdx ) - nIdx = sCopyright.SearchAndReplace( DEFINE_CONST_UNICODE("2003"), sNewYear ); - if ( STRING_NOTFOUND == nIdx ) - nIdx = sCopyright.SearchAndReplace( DEFINE_CONST_UNICODE("2004"), sNewYear ); - aCopyrightText.SetText( sCopyright ); } // ----------------------------------------------------------------------- -- cgit From af5a0f41ea1717070aded0acca6b31ab89aea8b6 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Wed, 2 Jun 2010 12:16:56 +0200 Subject: fwk139: #i10000# adopt for solaris --- sfx2/source/dialog/filedlghelper.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 9c2cb46b15f2..7d177d0bbfd8 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -2674,7 +2674,7 @@ static int impl_isFolder( const OUString& rPath ) { } - ::rtl::Reference <::comphelper::StillReadWriteInteraction> aHandler = new ::comphelper::StillReadWriteInteraction( xHandler ); + ::rtl::Reference< ::comphelper::StillReadWriteInteraction > aHandler = new ::comphelper::StillReadWriteInteraction( xHandler ); try { -- cgit From 00c2c6c2c7deeb332d31ce7d87311cbde705bee0 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Wed, 2 Jun 2010 12:44:35 +0200 Subject: fwk139: #i10000# adopt for solaris --- sfx2/source/doc/syspath.hxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sfx2/source') diff --git a/sfx2/source/doc/syspath.hxx b/sfx2/source/doc/syspath.hxx index a41836775421..c305ed4c85b9 100644 --- a/sfx2/source/doc/syspath.hxx +++ b/sfx2/source/doc/syspath.hxx @@ -41,4 +41,5 @@ public: static ::rtl::OUString GetUserTemplateLocation(); }; -#endif \ No newline at end of file +#endif + -- cgit From d66c74409ed0406f07cbcb694af2ca4ccc488279 Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Wed, 2 Jun 2010 17:05:52 +0200 Subject: fwk139: #i10000# Added pragma statement to fix warnings from Windows headers --- sfx2/source/doc/syspathw32.cxx | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sfx2/source') diff --git a/sfx2/source/doc/syspathw32.cxx b/sfx2/source/doc/syspathw32.cxx index 9919df2f65a3..485ebc203890 100644 --- a/sfx2/source/doc/syspathw32.cxx +++ b/sfx2/source/doc/syspathw32.cxx @@ -36,6 +36,9 @@ using namespace ::rtl; #ifdef WNT +#ifdef _MSC_VER +#pragma warning(disable:4917) +#endif #include #define ALLOC(type, n) ((type *) HeapAlloc(GetProcessHeap(), 0, sizeof(type) * n )) -- cgit From b1ec4b2cd5a9e6ece0e2a928cc0a11fef6bbe818 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 3 Jun 2010 00:10:45 +0200 Subject: tl78: #i110383# password to modify support for binary types only --- sfx2/source/dialog/filedlghelper.cxx | 8 ++++---- sfx2/source/doc/docfile.cxx | 17 +++++++++++------ sfx2/source/doc/guisaveas.cxx | 34 +++------------------------------- sfx2/source/doc/objcont.cxx | 4 ++-- sfx2/source/doc/sfxbasemodel.cxx | 14 ++++++++++++++ sfx2/source/inc/objshimp.hxx | 2 +- sfx2/source/view/viewfrm.cxx | 4 ++-- 7 files changed, 37 insertions(+), 46 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index d7109496d670..759c47598f9f 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -1528,7 +1528,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, mbPwdCheckBoxState = ( pPassItem != NULL ); // in case the document has password to modify, the dialog should be shown - SFX_ITEMSET_ARG( rpSet, pPassToModifyItem, SfxUInt16Item, SID_PASSWORDTOMODIFYHASH, FALSE ); + SFX_ITEMSET_ARG( rpSet, pPassToModifyItem, SfxUInt32Item, SID_MODIFYPASSWORDHASH, FALSE ); mbPwdCheckBoxState |= ( pPassToModifyItem && pPassToModifyItem->GetValue() ); } @@ -1541,7 +1541,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, // the password will be set in case user decide so rpSet->ClearItem( SID_PASSWORD ); rpSet->ClearItem( SID_RECOMMENDREADONLY ); - rpSet->ClearItem( SID_PASSWORDTOMODIFYHASH ); + rpSet->ClearItem( SID_MODIFYPASSWORDHASH ); } @@ -1660,9 +1660,9 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, rpSet->Put( SfxBoolItem( SID_RECOMMENDREADONLY, sal_True ) ); // the empty password has 0 as Hash - sal_uInt16 nHash = SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), bMSType ); + sal_uInt16 nHash = SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ).equals( pCurrentFilter->GetServiceName() ) ); if ( nHash ) - rpSet->Put( SfxUInt16Item( SID_PASSWORDTOMODIFYHASH, nHash ) ); + rpSet->Put( SfxInt32Item( SID_MODIFYPASSWORDHASH, (sal_Int32)nHash ) ); } else return ERRCODE_ABORT; diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index bb30670162fd..1dea202e0d0e 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -2576,15 +2576,20 @@ void SfxMedium::SetOrigFilter_Impl( const SfxFilter* pOrigFilter ) //------------------------------------------------------------------ -sal_uInt16 SfxMedium::CreatePasswordToModifyHash( const ::rtl::OUString& aPasswd, sal_Bool bMSType ) +sal_uInt32 SfxMedium::CreatePasswordToModifyHash( const ::rtl::OUString& aPasswd, sal_Bool bWriter ) { - sal_uInt16 nHash = 0; + sal_uInt32 nHash = 0; if ( aPasswd.getLength() ) { - rtl_TextEncoding nEncoding = RTL_TEXTENCODING_UTF8; - if ( bMSType ) + if ( bWriter ) { + nHash = ::comphelper::DocPasswordHelper::GetWordHashAsUINT32( aPasswd ); + } + else + { + rtl_TextEncoding nEncoding = RTL_TEXTENCODING_UTF8; + // if the MS-filter should be used // use the inconsistent algorithm to find the encoding specified by MS nEncoding = osl_getThreadTextEncoding(); @@ -2612,9 +2617,9 @@ sal_uInt16 SfxMedium::CreatePasswordToModifyHash( const ::rtl::OUString& aPasswd nEncoding = RTL_TEXTENCODING_MS_1250; break; } - } - nHash = ::comphelper::DocPasswordHelper::GetXLHashAsUINT16( aPasswd, nEncoding ); + nHash = ::comphelper::DocPasswordHelper::GetXLHashAsUINT16( aPasswd, nEncoding ); + } } return nHash; diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 4993e96b40bb..d68fd9dd2bad 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -180,18 +180,13 @@ class DocumentSettingsGuard { uno::Reference< beans::XPropertySet > m_xDocumentSettings; sal_Bool m_bPreserveReadOnly; - sal_uInt16 m_nPreserveHash; - sal_Bool m_bReadOnlySupported; - sal_Bool m_bModifyPasswordHashSupported; sal_Bool m_bRestoreSettings; public: - DocumentSettingsGuard( const uno::Reference< frame::XModel >& xModel, sal_Bool bReadOnly, sal_uInt16 nHash, sal_Bool bRestore ) + DocumentSettingsGuard( const uno::Reference< frame::XModel >& xModel, sal_Bool bReadOnly, sal_Bool bRestore ) : m_bPreserveReadOnly( sal_False ) - , m_nPreserveHash( 0 ) , m_bReadOnlySupported( sal_False ) - , m_bModifyPasswordHashSupported( sal_False ) , m_bRestoreSettings( bRestore ) { try @@ -203,7 +198,6 @@ public: uno::UNO_QUERY_THROW ); ::rtl::OUString aLoadReadonlyString( RTL_CONSTASCII_USTRINGPARAM( "LoadReadonly" ) ); - ::rtl::OUString aModifyPasswordHashString( RTL_CONSTASCII_USTRINGPARAM( "ModifyPasswordHash" ) ); try { @@ -213,20 +207,11 @@ public: } catch( uno::Exception& ) {} - - try - { - m_xDocumentSettings->getPropertyValue( aModifyPasswordHashString ) >>= m_nPreserveHash; - m_xDocumentSettings->setPropertyValue( aModifyPasswordHashString, uno::makeAny( nHash ) ); - m_bModifyPasswordHashSupported = sal_True; - } - catch( uno::Exception& ) - {} } catch( uno::Exception& ) {} - if ( ( bReadOnly && !m_bReadOnlySupported ) || ( nHash && !m_bModifyPasswordHashSupported ) ) + if ( ( bReadOnly && !m_bReadOnlySupported ) ) throw uno::RuntimeException(); // the user could provide the data, so it must be stored } @@ -235,15 +220,11 @@ public: if ( m_bRestoreSettings ) { ::rtl::OUString aLoadReadonlyString( RTL_CONSTASCII_USTRINGPARAM( "LoadReadonly" ) ); - ::rtl::OUString aModifyPasswordHashString( RTL_CONSTASCII_USTRINGPARAM( "ModifyPasswordHash" ) ); try { if ( m_bReadOnlySupported ) m_xDocumentSettings->setPropertyValue( aLoadReadonlyString, uno::makeAny( m_bPreserveReadOnly ) ); - - if ( m_bModifyPasswordHashSupported ) - m_xDocumentSettings->setPropertyValue( aModifyPasswordHashString, uno::makeAny( m_nPreserveHash ) ); } catch( uno::Exception& ) { @@ -272,7 +253,6 @@ class ModelData_Impl ::comphelper::SequenceAsHashMap m_aMediaDescrHM; sal_Bool m_bRecommendReadOnly; - sal_uInt16 m_nPasswordToModifyHash; public: ModelData_Impl( SfxStoringHelper& aOwner, @@ -291,7 +271,6 @@ public: ::comphelper::SequenceAsHashMap& GetMediaDescr() { return m_aMediaDescrHM; } sal_Bool IsRecommendReadOnly() { return m_bRecommendReadOnly; } - sal_uInt16 GetPasswordToModifyHash() { return m_nPasswordToModifyHash; } const ::comphelper::SequenceAsHashMap& GetDocProps(); @@ -346,8 +325,6 @@ ModelData_Impl::ModelData_Impl( SfxStoringHelper& aOwner, , m_pModulePropsHM( NULL ) , m_aMediaDescrHM( aMediaDescr ) , m_bRecommendReadOnly( sal_False ) -, m_nPasswordToModifyHash( 0 ) - { CheckInteractionHandler(); } @@ -1018,11 +995,6 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, m_bRecommendReadOnly = ( pRecommendReadOnly && pRecommendReadOnly->GetValue() ); pDialogParams->ClearItem( SID_RECOMMENDREADONLY ); - SFX_ITEMSET_ARG( pDialogParams, pPassToModifyItem, SfxUInt16Item, SID_PASSWORDTOMODIFYHASH, sal_False ); - if ( pPassToModifyItem ) - m_nPasswordToModifyHash = pPassToModifyItem->GetValue(); - pDialogParams->ClearItem( SID_PASSWORDTOMODIFYHASH ); - uno::Sequence< beans::PropertyValue > aPropsFromDialog; TransformItems( nSlotID, *pDialogParams, aPropsFromDialog, NULL ); GetMediaDescr() << aPropsFromDialog; @@ -1607,7 +1579,7 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& // store the document and handle it's docinfo SvtSaveOptions aOptions; - DocumentSettingsGuard aSettingsGuard( aModelData.GetModel(), aModelData.IsRecommendReadOnly(), aModelData.GetPasswordToModifyHash(), nStoreMode & EXPORT_REQUESTED ); + DocumentSettingsGuard aSettingsGuard( aModelData.GetModel(), aModelData.IsRecommendReadOnly(), nStoreMode & EXPORT_REQUESTED ); if ( aOptions.IsDocInfoSave() && ( !aModelData.GetStorable()->hasLocation() diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index 4cf5a5e7ad51..dc834debd533 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -1242,12 +1242,12 @@ void SfxObjectShell::SetSaveVersionOnClose( sal_Bool bNew ) pImp->bSaveVersionOnClose = bNew; } -sal_uInt16 SfxObjectShell::GetModifyPasswordHash() const +sal_uInt32 SfxObjectShell::GetModifyPasswordHash() const { return pImp->m_nModifyPasswordHash; } -sal_Bool SfxObjectShell::SetModifyPasswordHash( sal_uInt16 nHash ) +sal_Bool SfxObjectShell::SetModifyPasswordHash( sal_uInt32 nHash ) { // Commented out before the solution for Saving process is found // if ( ( !IsReadOnly() && !IsReadOnlyUI() ) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index e1b37c119f1a..d3707636d5ea 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -74,6 +74,7 @@ #include #include #include +#include #include #include #include @@ -2731,6 +2732,12 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL uno::Reference< uno::XInterface >() ); } + SFX_ITEMSET_ARG( aParams, pModifyPasswordHashItem, SfxInt32Item, SID_MODIFYPASSWORDHASH, sal_False ); + sal_uInt32 nModifyPasswordHash = pModifyPasswordHashItem ? pModifyPasswordHashItem->GetValue() : 0; + aParams->ClearItem( SID_MODIFYPASSWORDHASH ); + sal_uInt32 nOldModifyPasswordHash = m_pData->m_pObjectShell->GetModifyPasswordHash(); + m_pData->m_pObjectShell->SetModifyPasswordHash( nModifyPasswordHash ); + // since saving a document modifies its DocumentInfo, the current // DocumentInfo must be saved on "SaveTo", so it can be restored // after saving @@ -2809,10 +2816,14 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL if ( !bSaveTo ) { m_pData->m_aPreusedFilterName = GetMediumFilterName_Impl(); + m_pData->m_pObjectShell->SetModifyPasswordEntered(); + SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEASDOCDONE, GlobalEventConfig::GetEventName(STR_EVENT_SAVEASDOCDONE), m_pData->m_pObjectShell ) ); } else { + m_pData->m_pObjectShell->SetModifyPasswordHash( nOldModifyPasswordHash ); + SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVETODOCDONE, GlobalEventConfig::GetEventName(STR_EVENT_SAVETODOCDONE), m_pData->m_pObjectShell ) ); } } @@ -2822,6 +2833,9 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Storing failed!" ) ) ); m_pData->m_pObjectShell->StoreLog(); + m_pData->m_pObjectShell->SetModifyPasswordHash( nOldModifyPasswordHash ); + + SFX_APP()->NotifyEvent( SfxEventHint( bSaveTo ? SFX_EVENT_SAVETODOCFAILED : SFX_EVENT_SAVEASDOCFAILED, GlobalEventConfig::GetEventName( bSaveTo ? STR_EVENT_SAVETODOCFAILED : STR_EVENT_SAVEASDOCFAILED), m_pData->m_pObjectShell ) ); diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx index 5aa0c793e12b..e170a7c27240 100644 --- a/sfx2/source/inc/objshimp.hxx +++ b/sfx2/source/inc/objshimp.hxx @@ -149,7 +149,7 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess sal_Bool m_bIncomplEncrWarnShown; - sal_uInt16 m_nModifyPasswordHash; + sal_uInt32 m_nModifyPasswordHash; sal_Bool m_bModifyPasswordEntered; SfxObjectShell_Impl( SfxObjectShell& _rDocShell ); diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index c8cf7bd8c6c8..ca95475cabe6 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -170,7 +170,7 @@ TYPEINIT1(SfxViewFrameItem, SfxPoolItem); //========================================================================= //------------------------------------------------------------------------- -static sal_Bool AskPasswordToModify_Impl( const uno::Reference< task::XInteractionHandler >& xHandler, const ::rtl::OUString& aPath, const SfxFilter* pFilter, sal_uInt16 nPasswordHash ) +static sal_Bool AskPasswordToModify_Impl( const uno::Reference< task::XInteractionHandler >& xHandler, const ::rtl::OUString& aPath, const SfxFilter* pFilter, sal_uInt32 nPasswordHash ) { sal_Bool bResult = !nPasswordHash; @@ -196,7 +196,7 @@ static sal_Bool AskPasswordToModify_Impl( const uno::Reference< task::XInteracti xHandler->handle( rRequest ); if ( pPasswordRequest->isPassword() ) - bResult = ( SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), bMSType ) == nPasswordHash ); + bResult = ( SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ).equals( pFilter->GetServiceName() ) ) == nPasswordHash ); else bCancel = sal_True; -- cgit From f40f3c1bcf2031b89913ad15e1e9390268340399 Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Thu, 3 Jun 2010 17:54:38 +0200 Subject: fwk139: #i10000# Fix build problem on Windows build bot --- sfx2/source/doc/docfac.cxx | 9 +++++++-- sfx2/source/doc/syspath.hxx | 3 +-- sfx2/source/doc/syspathw32.cxx | 26 ++++++++++---------------- 3 files changed, 18 insertions(+), 20 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx index 88ae54d1c58a..a2dcef9a63fc 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -196,6 +196,7 @@ void SfxObjectFactory::SetModule_Impl( SfxModule *pMod ) void SfxObjectFactory::SetSystemTemplate( const String& rServiceName, const String& rTemplateName ) { + static const int nMaxPathSize = 16000; static ::rtl::OUString SERVICE_FILTER_FACTORY = ::rtl::OUString::createFromAscii( "com.sun.star.document.FilterFactory" ); static ::rtl::OUString SERVICE_TYPE_DECTECTION = ::rtl::OUString::createFromAscii( "com.sun.star.document.TypeDetection" ); static ::rtl::OUString SERVICE_SIMPLE_ACCESS = ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ); @@ -207,8 +208,12 @@ void SfxObjectFactory::SetSystemTemplate( const String& rServiceName, const Stri static ::rtl::OUString DEF_TPL_STR = ::rtl::OUString::createFromAscii("/soffice."); - String sURL; - ::utl::LocalFileHelper::ConvertPhysicalNameToURL( String( SystemPath::GetUserTemplateLocation()), sURL ); + String sURL; + String sPath; + sal_Unicode aPathBuffer[nMaxPathSize]; + if ( SystemPath::GetUserTemplateLocation( aPathBuffer, nMaxPathSize )) + sPath = String( aPathBuffer ); + ::utl::LocalFileHelper::ConvertPhysicalNameToURL( sPath, sURL ); ::rtl::OUString aUserTemplateURL( sURL ); if ( aUserTemplateURL.getLength() != 0) diff --git a/sfx2/source/doc/syspath.hxx b/sfx2/source/doc/syspath.hxx index c305ed4c85b9..015c16f18d26 100644 --- a/sfx2/source/doc/syspath.hxx +++ b/sfx2/source/doc/syspath.hxx @@ -32,13 +32,12 @@ #define __SYSPATH_HXX__ //#pragma warning(disable:4917) -#include #include class SFX2_DLLPUBLIC SystemPath { public: - static ::rtl::OUString GetUserTemplateLocation(); + static bool GetUserTemplateLocation(sal_Unicode*, int nSize); }; #endif diff --git a/sfx2/source/doc/syspathw32.cxx b/sfx2/source/doc/syspathw32.cxx index 485ebc203890..76a8f5beba9f 100644 --- a/sfx2/source/doc/syspathw32.cxx +++ b/sfx2/source/doc/syspathw32.cxx @@ -41,24 +41,19 @@ using namespace ::rtl; #endif #include -#define ALLOC(type, n) ((type *) HeapAlloc(GetProcessHeap(), 0, sizeof(type) * n )) -#define FREE(p) HeapFree(GetProcessHeap(), 0, p) - -static OUString _SHGetSpecialFolderW32( int nFolderID ) +static bool _SHGetSpecialFolderW32( int nFolderID, WCHAR* pszFolder, int nSize ) { LPITEMIDLIST pidl; HRESULT hHdl = SHGetSpecialFolderLocation( NULL, nFolderID, &pidl ); - OUString aFolder; if( hHdl == NOERROR ) { - WCHAR *lpFolderA; - lpFolderA = ALLOC( WCHAR, 16000 ); + WCHAR *lpFolder = static_cast< WCHAR* >( HeapAlloc( GetProcessHeap(), 0, 16000 )); - SHGetPathFromIDListW( pidl, lpFolderA ); - aFolder = OUString( reinterpret_cast(lpFolderA) ); + SHGetPathFromIDListW( pidl, lpFolder ); + wcsncpy( pszFolder, lpFolder, nSize ); - FREE( lpFolderA ); + HeapFree( GetProcessHeap(), 0, lpFolder ); IMalloc *pMalloc; if( NOERROR == SHGetMalloc(&pMalloc) ) { @@ -66,17 +61,16 @@ static OUString _SHGetSpecialFolderW32( int nFolderID ) pMalloc->Release(); } } - return aFolder; + return true; } #endif -OUString SystemPath::GetUserTemplateLocation() +bool SystemPath::GetUserTemplateLocation(sal_Unicode* pFolder, int nSize ) { #ifdef WNT - return _SHGetSpecialFolderW32(CSIDL_TEMPLATES); -#endif -#ifdef UNX - return OUString(); + return _SHGetSpecialFolderW32(CSIDL_TEMPLATES, pFolder, nSize ); +#else + return false; #endif } -- cgit From 0b7aa4d5b3f2fad7158531486a8f4f9c230a6640 Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Fri, 4 Jun 2010 11:30:03 +0200 Subject: fwk139: #i10000# Another fix for type redefinitions --- sfx2/source/doc/syspathw32.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/doc/syspathw32.cxx b/sfx2/source/doc/syspathw32.cxx index 76a8f5beba9f..a47880bc0c0c 100644 --- a/sfx2/source/doc/syspathw32.cxx +++ b/sfx2/source/doc/syspathw32.cxx @@ -29,12 +29,11 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sfx2.hxx" +// Comment out precompiled statement due to redefinition errors +//#include "precompiled_sfx2.hxx" #include "syspath.hxx" -using namespace ::rtl; - #ifdef WNT #ifdef _MSC_VER #pragma warning(disable:4917) -- cgit From e54612ea425f775ef22ba038dba697540d916eaa Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Mon, 7 Jun 2010 13:16:44 +0200 Subject: fwk139: #i10000# Next idea to fix build problem with build bot --- sfx2/source/doc/makefile.mk | 1 + sfx2/source/doc/syspath.cxx | 46 ++++++++++++++++++++++++++++++++++++++++++ sfx2/source/doc/syspathw32.cxx | 21 +++++++++++-------- 3 files changed, 60 insertions(+), 8 deletions(-) create mode 100755 sfx2/source/doc/syspath.cxx (limited to 'sfx2/source') diff --git a/sfx2/source/doc/makefile.mk b/sfx2/source/doc/makefile.mk index fd812297a8ab..69fee96ccf18 100644 --- a/sfx2/source/doc/makefile.mk +++ b/sfx2/source/doc/makefile.mk @@ -84,6 +84,7 @@ SLOFILES = \ $(SLO)$/sfxacldetect.obj \ $(SLO)$/docstoragemodifylistener.obj \ $(SLO)$/querytemplate.obj \ + $(SLO)$/syspath.obj \ $(SLO)$/syspathw32.obj # $(SLO)$/applet.obj \ diff --git a/sfx2/source/doc/syspath.cxx b/sfx2/source/doc/syspath.cxx new file mode 100755 index 000000000000..96bbee376306 --- /dev/null +++ b/sfx2/source/doc/syspath.cxx @@ -0,0 +1,46 @@ +/************************************************************************* +* +* 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 +* +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +// Comment out precompiled statement due to redefinition errors +#include "precompiled_sfx2.hxx" + +#include "syspath.hxx" + +extern "C" bool GetUserTemplateLocation(sal_Unicode*, int nSize); + +bool SystemPath::GetUserTemplateLocation(sal_Unicode* pFolder, int nSize ) +{ +#ifdef WNT + return ::GetUserTemplateLocation( pFolder, nSize ); +#else + return false; +#endif +} diff --git a/sfx2/source/doc/syspathw32.cxx b/sfx2/source/doc/syspathw32.cxx index a47880bc0c0c..ba2e96f5b1f5 100644 --- a/sfx2/source/doc/syspathw32.cxx +++ b/sfx2/source/doc/syspathw32.cxx @@ -28,18 +28,23 @@ * ************************************************************************/ -// MARKER(update_precomp.py): autogen include statement, do not remove -// Comment out precompiled statement due to redefinition errors -//#include "precompiled_sfx2.hxx" - -#include "syspath.hxx" - #ifdef WNT #ifdef _MSC_VER #pragma warning(disable:4917) #endif #include +// Copied from sal/types.h to circumvent problems with precompiled headers +// and redefinitions of BOOL, INT32 and other types. Unfortunately tools +// also define these type incompatible with Win32 types which leads from +// time to time to very nasty compilation errors. If someone finds a better +// way to solve these probs please remove this copied part! +#if ( defined(WIN32) && !defined(__MINGW32__) ) + typedef wchar_t sal_Unicode; +#else + typedef sal_uInt16 sal_Unicode; +#endif + static bool _SHGetSpecialFolderW32( int nFolderID, WCHAR* pszFolder, int nSize ) { LPITEMIDLIST pidl; @@ -65,10 +70,10 @@ static bool _SHGetSpecialFolderW32( int nFolderID, WCHAR* pszFolder, int nSize ) #endif -bool SystemPath::GetUserTemplateLocation(sal_Unicode* pFolder, int nSize ) +extern "C" bool GetUserTemplateLocation(sal_Unicode* pFolder, int nSize) { #ifdef WNT - return _SHGetSpecialFolderW32(CSIDL_TEMPLATES, pFolder, nSize ); + return _SHGetSpecialFolderW32( CSIDL_TEMPLATES, pFolder, nSize ); #else return false; #endif -- cgit From b58f6d66bc9726882a3ab1891847e7c083f1a6c1 Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Mon, 7 Jun 2010 18:10:48 +0200 Subject: fwk139: #i10000# Solve build problem on Solaris/Intel --- sfx2/source/doc/syspathw32.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sfx2/source') diff --git a/sfx2/source/doc/syspathw32.cxx b/sfx2/source/doc/syspathw32.cxx index a47880bc0c0c..5e3b8cd91062 100644 --- a/sfx2/source/doc/syspathw32.cxx +++ b/sfx2/source/doc/syspathw32.cxx @@ -70,6 +70,8 @@ bool SystemPath::GetUserTemplateLocation(sal_Unicode* pFolder, int nSize ) #ifdef WNT return _SHGetSpecialFolderW32(CSIDL_TEMPLATES, pFolder, nSize ); #else + (void)pFolder; + (void)nSize; return false; #endif } -- cgit From 0389ab5d8741b095ed457cfaa1955eabc57e2df0 Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Tue, 8 Jun 2010 09:23:15 +0200 Subject: fwk139: #i10000# Have to include precompiled header directive --- sfx2/source/doc/syspathw32.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sfx2/source') diff --git a/sfx2/source/doc/syspathw32.cxx b/sfx2/source/doc/syspathw32.cxx index 74522654ff49..d9412795f263 100644 --- a/sfx2/source/doc/syspathw32.cxx +++ b/sfx2/source/doc/syspathw32.cxx @@ -28,6 +28,8 @@ * ************************************************************************/ +#include "precompiled_sfx2.hxx" + #ifdef WNT #ifdef _MSC_VER #pragma warning(disable:4917) -- cgit From 3590257aa9c23407ed4787652a9fdbf778d15e1a Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Tue, 8 Jun 2010 16:55:18 +0200 Subject: fwk139: #i10000# Add syspathw32.obj to NOOPTFILES to remove warning due to missing precompiled header directive --- sfx2/source/doc/makefile.mk | 3 ++- sfx2/source/doc/syspathw32.cxx | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/doc/makefile.mk b/sfx2/source/doc/makefile.mk index 69fee96ccf18..b1bddf82e428 100644 --- a/sfx2/source/doc/makefile.mk +++ b/sfx2/source/doc/makefile.mk @@ -93,7 +93,8 @@ SLOFILES = \ #HACK TO DISABLE PCH NOOPTFILES= \ - $(SLO)$/sfxacldetect.obj + $(SLO)$/sfxacldetect.obj \ + $(SLO)$/syspathw32.obj .ENDIF diff --git a/sfx2/source/doc/syspathw32.cxx b/sfx2/source/doc/syspathw32.cxx index d9412795f263..74522654ff49 100644 --- a/sfx2/source/doc/syspathw32.cxx +++ b/sfx2/source/doc/syspathw32.cxx @@ -28,8 +28,6 @@ * ************************************************************************/ -#include "precompiled_sfx2.hxx" - #ifdef WNT #ifdef _MSC_VER #pragma warning(disable:4917) -- cgit From db2236600ffc64b188d23f43fb88ee0bf13a680a Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Tue, 8 Jun 2010 17:01:41 +0200 Subject: tl78: #i110383# fix reload functionality --- sfx2/source/dialog/filedlghelper.cxx | 6 +++--- sfx2/source/doc/objcont.cxx | 4 ++-- sfx2/source/doc/objmisc.cxx | 2 +- sfx2/source/view/viewfrm.cxx | 13 ++++++++++--- 4 files changed, 16 insertions(+), 9 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 759c47598f9f..072729648628 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -1528,7 +1528,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, mbPwdCheckBoxState = ( pPassItem != NULL ); // in case the document has password to modify, the dialog should be shown - SFX_ITEMSET_ARG( rpSet, pPassToModifyItem, SfxUInt32Item, SID_MODIFYPASSWORDHASH, FALSE ); + SFX_ITEMSET_ARG( rpSet, pPassToModifyItem, SfxInt32Item, SID_MODIFYPASSWORDHASH, FALSE ); mbPwdCheckBoxState |= ( pPassToModifyItem && pPassToModifyItem->GetValue() ); } @@ -1660,9 +1660,9 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, rpSet->Put( SfxBoolItem( SID_RECOMMENDREADONLY, sal_True ) ); // the empty password has 0 as Hash - sal_uInt16 nHash = SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ).equals( pCurrentFilter->GetServiceName() ) ); + sal_Int32 nHash = SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ).equals( pCurrentFilter->GetServiceName() ) ); if ( nHash ) - rpSet->Put( SfxInt32Item( SID_MODIFYPASSWORDHASH, (sal_Int32)nHash ) ); + rpSet->Put( SfxInt32Item( SID_MODIFYPASSWORDHASH, nHash ) ); } else return ERRCODE_ABORT; diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index dc834debd533..547198f60ace 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -1262,9 +1262,9 @@ sal_Bool SfxObjectShell::SetModifyPasswordHash( sal_uInt32 nHash ) // return sal_False; } -void SfxObjectShell::SetModifyPasswordEntered() +void SfxObjectShell::SetModifyPasswordEntered( sal_Bool bEntered ) { - pImp->m_bModifyPasswordEntered = sal_True; + pImp->m_bModifyPasswordEntered = bEntered; } sal_Bool SfxObjectShell::IsModifyPasswordEntered() diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 76aed9d11ed1..afcaa1614f2c 100755 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -1389,7 +1389,7 @@ void SfxObjectShell::FinishedLoading( sal_uInt16 nFlags ) if( !IsAbortingImport() ) PositionView_Impl(); - if ( GetModifyPasswordHash() ) + if ( GetModifyPasswordHash() && !IsModifyPasswordEntered() ) SetReadOnly(); // Salvage diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index ca95475cabe6..a80741df13a6 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -714,6 +714,10 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) } xNewObj = SfxObjectShell::CreateObject( pFilter->GetServiceName(), SFX_CREATE_MODE_STANDARD ); + + if ( xOldObj->IsModifyPasswordEntered() ) + xNewObj->SetModifyPasswordEntered(); + uno::Sequence < beans::PropertyValue > aLoadArgs; TransformItems( SID_OPENDOC, *pNewSet, aLoadArgs ); try @@ -769,6 +773,12 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) } else { + if ( xNewObj->GetModifyPasswordHash() && xNewObj->GetModifyPasswordHash() != xOldObj->GetModifyPasswordHash() ) + { + xNewObj->SetModifyPasswordEntered( sal_False ); + xNewObj->SetReadOnly(); + } + if ( xNewObj->IsDocShared() ) { // the file is shared but the closing can change the sharing control file @@ -781,10 +791,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) TransformItems( SID_OPENDOC, *xNewObj->GetMedium()->GetItemSet(), aLoadArgs ); UpdateDocument_Impl(); - } - if ( xNewObj.Is() ) - { try { while ( !aViewFrames.empty() ) -- cgit From d148b9b253a4dc439d7572877afd7b43aa943ca8 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Tue, 8 Jun 2010 18:04:16 +0200 Subject: cws tl79: #i110254# help ids added --- sfx2/source/dialog/securitypage.src | 15 ++++++++++++--- sfx2/source/inc/helpid.hrc | 10 +++++++++- 2 files changed, 21 insertions(+), 4 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/securitypage.src b/sfx2/source/dialog/securitypage.src index 7c0fffd96057..fee60404d01c 100755 --- a/sfx2/source/dialog/securitypage.src +++ b/sfx2/source/dialog/securitypage.src @@ -54,6 +54,7 @@ TabPage TP_DOCINFOSECURITY }; Edit PASSWORD_TO_OPEN_ED { + HelpId = HID_SECURITYTAB_PASSWORD_TO_OPEN; Pos = MAP_APPFONT( 100, 18 ); Size = MAP_APPFONT( 88, RSC_CD_TEXTBOX_HEIGHT ); Border = TRUE; @@ -67,6 +68,7 @@ TabPage TP_DOCINFOSECURITY }; Edit CONFIRM_PASSWORD_TO_OPEN_ED { + HelpId = HID_SECURITYTAB_CONFIRM_PASSWORD_TO_OPEN; Pos = MAP_APPFONT( 100, 32 ); Size = MAP_APPFONT( 88, RSC_CD_TEXTBOX_HEIGHT ); Border = TRUE; @@ -76,9 +78,11 @@ TabPage TP_DOCINFOSECURITY { Pos = MAP_APPFONT( 12, 48 ); Size = MAP_APPFONT( 236, 3 * RSC_CD_FIXEDTEXT_HEIGHT ); - Text [ en-US ] = "Note: If you lose or forget the password, it cannot be recovered."\ - "It is advisable to keep passwords in a safe place."\ - "Passwords are case-sensitive."; + Text [ en-US ] = + "Note: After a password has been set, the document will only open "\ + "with the password. Should you lose the password, there will be "\ + "no way to recover the document. Please also note that this password "\ + "is case-sensitive."; WordBreak = TRUE; }; FixedLine PASSWORD_TO_MODIFY_FL @@ -95,6 +99,7 @@ TabPage TP_DOCINFOSECURITY }; Edit PASSWORD_TO_MODIFY_ED { + HelpId = HID_SECURITYTAB_PASSWORD_TO_MODIFY; Pos = MAP_APPFONT( 100, 90 ); Size = MAP_APPFONT( 88, RSC_CD_TEXTBOX_HEIGHT ); Border = TRUE; @@ -108,6 +113,7 @@ TabPage TP_DOCINFOSECURITY }; Edit CONFIRM_PASSWORD_TO_MODIFY_ED { + HelpId = HID_SECURITYTAB_CONFIRM_PASSWORD_TO_MODIFY; Pos = MAP_APPFONT( 100, 104 ); Size = MAP_APPFONT( 88, RSC_CD_TEXTBOX_HEIGHT ); Border = TRUE; @@ -121,18 +127,21 @@ TabPage TP_DOCINFOSECURITY }; CheckBox OPEN_READONLY_CB { + HelpId = HID_SECURITYTAB_OPEN_FILE_READONLY; Pos = MAP_APPFONT( 12, 133 ); Size = MAP_APPFONT( 176, RSC_CD_CHECKBOX_HEIGHT ); Text [ en-US ] = "~Open file read-only"; }; CheckBox RECORD_CHANGES_CB { + HelpId = HID_SECURITYTAB_RECORD_CHANGES; Pos = MAP_APPFONT( 12, 147 ); Size = MAP_APPFONT( 176, RSC_CD_CHECKBOX_HEIGHT ); Text [ en-US ] = "Record ~changes"; }; PushButton CHANGE_PROTECTION_PB { + HelpId = HID_SECURITYTAB_PROTECTION; Pos = MAP_APPFONT( 194, 145 ); Size = MAP_APPFONT( 60, RSC_CD_PUSHBUTTON_HEIGHT ); }; diff --git a/sfx2/source/inc/helpid.hrc b/sfx2/source/inc/helpid.hrc index f09ac7e94ecc..4c9aa3fd7f63 100755 --- a/sfx2/source/inc/helpid.hrc +++ b/sfx2/source/inc/helpid.hrc @@ -346,7 +346,15 @@ #define HID_CTRL_CUSTOMPROPS_YES_NO (HID_SFX_START + 326) #define HID_DLG_CUSTOMPROPS_DURATION (HID_SFX_START + 327) -#define ACT_SFX_HID_END HID_DLG_CUSTOMPROPS_DURATION +#define HID_SECURITYTAB_PASSWORD_TO_OPEN (HID_SFX_START + 328) +#define HID_SECURITYTAB_CONFIRM_PASSWORD_TO_OPEN (HID_SFX_START + 329) +#define HID_SECURITYTAB_PASSWORD_TO_MODIFY (HID_SFX_START + 330) +#define HID_SECURITYTAB_CONFIRM_PASSWORD_TO_MODIFY (HID_SFX_START + 331) +#define HID_SECURITYTAB_OPEN_FILE_READONLY (HID_SFX_START + 332) +#define HID_SECURITYTAB_RECORD_CHANGES (HID_SFX_START + 333) +#define HID_SECURITYTAB_PROTECTION (HID_SFX_START + 334) + +#define ACT_SFX_HID_END HID_SECURITYTAB_PROTECTION // "Uberlaufpr"ufung -------------------------------------------------------- -- cgit From f79b849179975147947da84272cda998cf9c7af0 Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Wed, 9 Jun 2010 11:18:37 +0200 Subject: fwk139: #i10000# Fix additional warnings with gcc --- sfx2/source/doc/docfac.cxx | 2 +- sfx2/source/doc/syspath.cxx | 2 ++ sfx2/source/doc/syspathw32.cxx | 23 ++++++++++++----------- 3 files changed, 15 insertions(+), 12 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx index a2dcef9a63fc..bfd67210ec44 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -226,7 +226,7 @@ void SfxObjectFactory::SetSystemTemplate( const String& rServiceName, const Stri ::rtl::OUString aActualFilter; ::comphelper::ConfigurationHelper::readRelativeKey( xConfig, CONF_PATH, PROP_ACTUAL_FILTER ) >>= aActualFilter; - sal_Bool bChanged; + sal_Bool bChanged(sal_False); ::comphelper::ConfigurationHelper::readRelativeKey( xConfig, CONF_PATH, PROP_DEF_TEMPL_CHANGED ) >>= bChanged; uno::Reference< container::XNameAccess > xFilterFactory( diff --git a/sfx2/source/doc/syspath.cxx b/sfx2/source/doc/syspath.cxx index 96bbee376306..a1025370ed24 100755 --- a/sfx2/source/doc/syspath.cxx +++ b/sfx2/source/doc/syspath.cxx @@ -41,6 +41,8 @@ bool SystemPath::GetUserTemplateLocation(sal_Unicode* pFolder, int nSize ) #ifdef WNT return ::GetUserTemplateLocation( pFolder, nSize ); #else + (void)pFolder; + (void)nSize; return false; #endif } diff --git a/sfx2/source/doc/syspathw32.cxx b/sfx2/source/doc/syspathw32.cxx index 74522654ff49..73bd84f5249a 100644 --- a/sfx2/source/doc/syspathw32.cxx +++ b/sfx2/source/doc/syspathw32.cxx @@ -34,17 +34,6 @@ #endif #include -// Copied from sal/types.h to circumvent problems with precompiled headers -// and redefinitions of BOOL, INT32 and other types. Unfortunately tools -// also define these type incompatible with Win32 types which leads from -// time to time to very nasty compilation errors. If someone finds a better -// way to solve these probs please remove this copied part! -#if ( defined(WIN32) && !defined(__MINGW32__) ) - typedef wchar_t sal_Unicode; -#else - typedef sal_uInt16 sal_Unicode; -#endif - static bool _SHGetSpecialFolderW32( int nFolderID, WCHAR* pszFolder, int nSize ) { LPITEMIDLIST pidl; @@ -70,6 +59,18 @@ static bool _SHGetSpecialFolderW32( int nFolderID, WCHAR* pszFolder, int nSize ) #endif +// Copied from sal/types.h to circumvent problems with precompiled headers +// and redefinitions of BOOL, INT32 and other types. Unfortunately tools +// also define these type incompatible with Win32 types which leads from +// time to time to very nasty compilation errors. If someone finds a better +// way to solve these probs please remove this copied part! +typedef unsigned short sal_uInt16; +#if ( defined(WIN32) && !defined(__MINGW32__) ) + typedef wchar_t sal_Unicode; +#else + typedef sal_uInt16 sal_Unicode; +#endif + extern "C" bool GetUserTemplateLocation(sal_Unicode* pFolder, int nSize) { #ifdef WNT -- cgit From dad227c459a2329bf6da8eec4847ce8fca228575 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Wed, 9 Jun 2010 14:04:54 +0200 Subject: tl78: #i110383# fix condition --- sfx2/source/dialog/filedlghelper.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sfx2/source') diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 072729648628..569c0ddb163e 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -1647,7 +1647,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, ::comphelper::DocPasswordRequestType_MS : ::comphelper::DocPasswordRequestType_STANDARD; - ::rtl::Reference< ::comphelper::DocPasswordRequest > pPasswordRequest( new ::comphelper::DocPasswordRequest( eType, ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)), ( pCurrentFilter->GetFilterFlags() & SFX_FILTER_PASSWORDTOMODIFY ) ) ); + ::rtl::Reference< ::comphelper::DocPasswordRequest > pPasswordRequest( new ::comphelper::DocPasswordRequest( eType, ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)), ( pCurrentFilter->GetFilterFlags() & SFX_FILTER_PASSWORDTOMODIFY ) != 0 ) ); uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pPasswordRequest.get() ); xInteractionHandler->handle( rRequest ); -- cgit From 09733434899d23c04e60d4caa18765b4bed87f3a Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 10 Jun 2010 19:17:08 +0200 Subject: tl78: #i110383# fix reload functionality --- sfx2/source/view/viewfrm.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index a80741df13a6..47f0926d00b6 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -382,12 +382,17 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) // Speichern und Readonly Reloaden if( pSh->IsModified() ) { - if ( !pSh->PrepareClose() ) + if ( pSh->PrepareClose() ) + { + // the storing could let the medium be changed + pMed = pSh->GetMedium(); + bNeedsReload = sal_True; + } + else { rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), sal_False ) ); return; } - else bNeedsReload = sal_True; } nOpenMode = SFX_STREAM_READONLY; } -- cgit From c44ba0727fecc1a1a70f525e72b0854527ab3e22 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Mon, 14 Jun 2010 20:07:33 +0200 Subject: tl78: #i111065# let the model be correctly loaded into a frame --- sfx2/source/view/viewfrm.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 47f0926d00b6..08c4980881f7 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -2113,9 +2113,7 @@ SfxViewShell* SfxViewFrame::LoadViewIntoFrame_Impl( const SfxObjectShell& i_rDoc else aTransformLoadArgs.remove( "Hidden" ); - ::rtl::OUString sURL( xDocument->getURL() ); - if ( !sURL.getLength() ) - sURL = i_rDoc.GetFactory().GetFactoryURL(); + ::rtl::OUString sURL( RTL_CONSTASCII_USTRINGPARAM( "private:object" ) ); Reference< XComponentLoader > xLoader( i_rFrame, UNO_QUERY_THROW ); xLoader->loadComponentFromURL( sURL, ::rtl::OUString::createFromAscii( "_self" ), 0, -- cgit From 7b4fd03cc280edac58705d047566e30d0b41bae0 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Tue, 15 Jun 2010 21:01:57 +0200 Subject: tl78v2: #i112427# Support password to modify in calc and writer ODF documents --- sfx2/source/appl/appuno.cxx | 17 +++++++++++++++-- sfx2/source/dialog/filedlghelper.cxx | 25 ++++++++++++++++++------- sfx2/source/doc/objcont.cxx | 36 +++++++++++++++++++++++++++--------- sfx2/source/doc/sfxbasemodel.cxx | 18 +++++++++++++++--- sfx2/source/inc/objshimp.hxx | 2 ++ 5 files changed, 77 insertions(+), 21 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index 66452f10bbfb..6f9d3b258745 100755 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -191,6 +191,7 @@ static char const sFolderName[] = "FolderName"; static char const sUseSystemDialog[] = "UseSystemDialog"; static char const sStandardDir[] = "StandardDir"; static char const sBlackList[] = "BlackList"; +static char const sModifyPasswordInfo[] = "ModifyPasswordInfo"; void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs, SfxAllItemSet& rSet, const SfxSlot* pSlot ) { @@ -846,6 +847,10 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxBoolItem( SID_NOAUTOSAVE, bVal ) ); } + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sModifyPasswordInfo)) ) + { + rSet.Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, rProp.Value ) ); + } #ifdef DBG_UTIL else --nFoundArgs; @@ -1058,6 +1063,8 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta nAdditional++; if ( rSet.GetItemState( SID_NOAUTOSAVE ) == SFX_ITEM_SET ) nAdditional++; + if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO ) == SFX_ITEM_SET ) + nAdditional++; // consider additional arguments nProps += nAdditional; @@ -1197,7 +1204,9 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta // used only internally if ( nId == SID_SAVETO ) continue; - } + if ( nId == SID_MODIFYPASSWORDINFO ) + continue; + } ByteString aDbg( "Unknown item detected: "); aDbg += ByteString::CreateFromInt32( nId ); @@ -1555,7 +1564,11 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sNoAutoSave)); pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); } - + if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO, sal_False, &pItem ) == SFX_ITEM_SET ) + { + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sModifyPasswordInfo)); + pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); + } } } diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 569c0ddb163e..dba0da93208d 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -80,11 +80,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include "openflag.hxx" @@ -1528,8 +1530,8 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, mbPwdCheckBoxState = ( pPassItem != NULL ); // in case the document has password to modify, the dialog should be shown - SFX_ITEMSET_ARG( rpSet, pPassToModifyItem, SfxInt32Item, SID_MODIFYPASSWORDHASH, FALSE ); - mbPwdCheckBoxState |= ( pPassToModifyItem && pPassToModifyItem->GetValue() ); + SFX_ITEMSET_ARG( rpSet, pPassToModifyItem, SfxUnoAnyItem, SID_MODIFYPASSWORDINFO, FALSE ); + mbPwdCheckBoxState |= ( pPassToModifyItem && pPassToModifyItem->GetValue().hasValue() ); } SFX_ITEMSET_ARG( rpSet, pSelectItem, SfxBoolItem, SID_SELECTION, FALSE ); @@ -1541,7 +1543,7 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, // the password will be set in case user decide so rpSet->ClearItem( SID_PASSWORD ); rpSet->ClearItem( SID_RECOMMENDREADONLY ); - rpSet->ClearItem( SID_MODIFYPASSWORDHASH ); + rpSet->ClearItem( SID_MODIFYPASSWORDINFO ); } @@ -1659,10 +1661,19 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, if ( pPasswordRequest->getRecommendReadOnly() ) rpSet->Put( SfxBoolItem( SID_RECOMMENDREADONLY, sal_True ) ); - // the empty password has 0 as Hash - sal_Int32 nHash = SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ).equals( pCurrentFilter->GetServiceName() ) ); - if ( nHash ) - rpSet->Put( SfxInt32Item( SID_MODIFYPASSWORDHASH, nHash ) ); + if ( bMSType ) + { + // the empty password has 0 as Hash + sal_Int32 nHash = SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ).equals( pCurrentFilter->GetServiceName() ) ); + if ( nHash ) + rpSet->Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, uno::makeAny( nHash ) ) ); + } + else + { + uno::Sequence< beans::PropertyValue > aModifyPasswordInfo = ::comphelper::DocPasswordHelper::GenerateNewModifyPasswordInfo( pPasswordRequest->getPasswordToModify() ); + if ( aModifyPasswordInfo.getLength() ) + rpSet->Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, uno::makeAny( aModifyPasswordInfo ) ) ); + } } else return ERRCODE_ABORT; diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index 547198f60ace..451e33084c07 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -1249,17 +1249,35 @@ sal_uInt32 SfxObjectShell::GetModifyPasswordHash() const sal_Bool SfxObjectShell::SetModifyPasswordHash( sal_uInt32 nHash ) { -// Commented out before the solution for Saving process is found -// if ( ( !IsReadOnly() && !IsReadOnlyUI() ) -// || !(pImp->nFlagsInProgress & SFX_LOADED_MAINDOCUMENT ) ) -// { -// // the hash can be changed only in editable documents, -// // or during loading of document + if ( ( !IsReadOnly() && !IsReadOnlyUI() ) + || !(pImp->nFlagsInProgress & SFX_LOADED_MAINDOCUMENT ) ) + { + // the hash can be changed only in editable documents, + // or during loading of document pImp->m_nModifyPasswordHash = nHash; return sal_True; -// } -// -// return sal_False; + } + + return sal_False; +} + +uno::Sequence< beans::PropertyValue > SfxObjectShell::GetModifyPasswordInfo() const +{ + return pImp->m_aModifyPasswordInfo; +} + +sal_Bool SfxObjectShell::SetModifyPasswordInfo( const uno::Sequence< beans::PropertyValue >& aInfo ) +{ + if ( ( !IsReadOnly() && !IsReadOnlyUI() ) + || !(pImp->nFlagsInProgress & SFX_LOADED_MAINDOCUMENT ) ) + { + // the hash can be changed only in editable documents, + // or during loading of document + pImp->m_aModifyPasswordInfo = aInfo; + return sal_True; + } + + return sal_False; } void SfxObjectShell::SetModifyPasswordEntered( sal_Bool bEntered ) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index d3707636d5ea..96f44169bfd0 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -2732,11 +2732,21 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL uno::Reference< uno::XInterface >() ); } - SFX_ITEMSET_ARG( aParams, pModifyPasswordHashItem, SfxInt32Item, SID_MODIFYPASSWORDHASH, sal_False ); - sal_uInt32 nModifyPasswordHash = pModifyPasswordHashItem ? pModifyPasswordHashItem->GetValue() : 0; - aParams->ClearItem( SID_MODIFYPASSWORDHASH ); + sal_uInt32 nModifyPasswordHash = 0; + uno::Sequence< beans::PropertyValue > aModifyPasswordInfo; + SFX_ITEMSET_ARG( aParams, pModifyPasswordInfoItem, SfxUnoAnyItem, SID_MODIFYPASSWORDINFO, sal_False ); + if ( pModifyPasswordInfoItem ) + { + // it contains either a simple hash or a set of PropertyValues + // TODO/LATER: the sequence of PropertyValue should replace the hash completely in future + pModifyPasswordInfoItem->GetValue() >>= nModifyPasswordHash; + pModifyPasswordInfoItem->GetValue() >>= aModifyPasswordInfo; + } + aParams->ClearItem( SID_MODIFYPASSWORDINFO ); sal_uInt32 nOldModifyPasswordHash = m_pData->m_pObjectShell->GetModifyPasswordHash(); m_pData->m_pObjectShell->SetModifyPasswordHash( nModifyPasswordHash ); + uno::Sequence< beans::PropertyValue > aOldModifyPasswordInfo = m_pData->m_pObjectShell->GetModifyPasswordInfo(); + m_pData->m_pObjectShell->SetModifyPasswordInfo( aModifyPasswordInfo ); // since saving a document modifies its DocumentInfo, the current // DocumentInfo must be saved on "SaveTo", so it can be restored @@ -2823,6 +2833,7 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL else { m_pData->m_pObjectShell->SetModifyPasswordHash( nOldModifyPasswordHash ); + m_pData->m_pObjectShell->SetModifyPasswordInfo( aOldModifyPasswordInfo ); SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVETODOCDONE, GlobalEventConfig::GetEventName(STR_EVENT_SAVETODOCDONE), m_pData->m_pObjectShell ) ); } @@ -2834,6 +2845,7 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL m_pData->m_pObjectShell->StoreLog(); m_pData->m_pObjectShell->SetModifyPasswordHash( nOldModifyPasswordHash ); + m_pData->m_pObjectShell->SetModifyPasswordInfo( aOldModifyPasswordInfo ); SFX_APP()->NotifyEvent( SfxEventHint( bSaveTo ? SFX_EVENT_SAVETODOCFAILED : SFX_EVENT_SAVEASDOCFAILED, GlobalEventConfig::GetEventName( bSaveTo ? STR_EVENT_SAVETODOCFAILED : STR_EVENT_SAVEASDOCFAILED), diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx index e170a7c27240..b5087fb46294 100644 --- a/sfx2/source/inc/objshimp.hxx +++ b/sfx2/source/inc/objshimp.hxx @@ -149,7 +149,9 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess sal_Bool m_bIncomplEncrWarnShown; + // TODO/LATER: m_aModifyPasswordInfo should completely replace m_nModifyPasswordHash in future sal_uInt32 m_nModifyPasswordHash; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_aModifyPasswordInfo; sal_Bool m_bModifyPasswordEntered; SfxObjectShell_Impl( SfxObjectShell& _rDocShell ); -- cgit From 3d2a51111ac8e45f6eae9d1fd9e52ee8c4cb35d0 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Wed, 16 Jun 2010 10:36:38 +0200 Subject: tl78v2: #i112427# Support password to modify in calc and writer ODF documents --- sfx2/source/doc/objmisc.cxx | 2 +- sfx2/source/doc/sfxbasemodel.cxx | 4 +++- sfx2/source/view/viewfrm.cxx | 22 +++++++++++++++++----- 3 files changed, 21 insertions(+), 7 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index afcaa1614f2c..addb648ef2e9 100755 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -1389,7 +1389,7 @@ void SfxObjectShell::FinishedLoading( sal_uInt16 nFlags ) if( !IsAbortingImport() ) PositionView_Impl(); - if ( GetModifyPasswordHash() && !IsModifyPasswordEntered() ) + if ( ( GetModifyPasswordHash() || GetModifyPasswordInfo().getLength() ) && !IsModifyPasswordEntered() ) SetReadOnly(); // Salvage diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 96f44169bfd0..b5a9536b12c5 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -2739,7 +2739,9 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL { // it contains either a simple hash or a set of PropertyValues // TODO/LATER: the sequence of PropertyValue should replace the hash completely in future - pModifyPasswordInfoItem->GetValue() >>= nModifyPasswordHash; + sal_Int32 nMPHTmp = 0; + pModifyPasswordInfoItem->GetValue() >>= nMPHTmp; + nModifyPasswordHash = (sal_uInt32)nMPHTmp; pModifyPasswordInfoItem->GetValue() >>= aModifyPasswordInfo; } aParams->ClearItem( SID_MODIFYPASSWORDINFO ); diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 08c4980881f7..1dbd3aed623f 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -83,6 +83,7 @@ #include #include #include +#include #include #include @@ -170,9 +171,10 @@ TYPEINIT1(SfxViewFrameItem, SfxPoolItem); //========================================================================= //------------------------------------------------------------------------- -static sal_Bool AskPasswordToModify_Impl( const uno::Reference< task::XInteractionHandler >& xHandler, const ::rtl::OUString& aPath, const SfxFilter* pFilter, sal_uInt32 nPasswordHash ) +static sal_Bool AskPasswordToModify_Impl( const uno::Reference< task::XInteractionHandler >& xHandler, const ::rtl::OUString& aPath, const SfxFilter* pFilter, sal_uInt32 nPasswordHash, const uno::Sequence< beans::PropertyValue > aInfo ) { - sal_Bool bResult = !nPasswordHash; + // TODO/LATER: In future the info should replace the direct hash completely + sal_Bool bResult = ( !nPasswordHash && !aInfo.getLength() ); OSL_ENSURE( pFilter && ( pFilter->GetFilterFlags() & SFX_FILTER_PASSWORDTOMODIFY ), "PasswordToModify feature is active for a filter that does not support it!" ); @@ -196,7 +198,17 @@ static sal_Bool AskPasswordToModify_Impl( const uno::Reference< task::XInteracti xHandler->handle( rRequest ); if ( pPasswordRequest->isPassword() ) - bResult = ( SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ).equals( pFilter->GetServiceName() ) ) == nPasswordHash ); + { + if ( aInfo.getLength() ) + { + bResult = ::comphelper::DocPasswordHelper::IsModifyPasswordCorrect( pPasswordRequest->getPasswordToModify(), aInfo ); + } + else + { + // the binary format + bResult = ( SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ).equals( pFilter->GetServiceName() ) ) == nPasswordHash ); + } + } else bCancel = sal_True; @@ -399,11 +411,11 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) else { if ( pSh->IsReadOnlyMedium() - && pSh->GetModifyPasswordHash() + && ( pSh->GetModifyPasswordHash() || pSh->GetModifyPasswordInfo().getLength() ) && !pSh->IsModifyPasswordEntered() ) { ::rtl::OUString aDocumentName = INetURLObject( pMed->GetOrigURL() ).GetMainURL( INetURLObject::DECODE_WITH_CHARSET ); - if( !AskPasswordToModify_Impl( pMed->GetInteractionHandler(), aDocumentName, pMed->GetOrigFilter(), pSh->GetModifyPasswordHash() ) ) + if( !AskPasswordToModify_Impl( pMed->GetInteractionHandler(), aDocumentName, pMed->GetOrigFilter(), pSh->GetModifyPasswordHash(), pSh->GetModifyPasswordInfo() ) ) { // this is a read-only document, if it has "Password to modify" // the user should enter password before he can edit the document -- cgit