CWS-TOOLING: integrate CWS fwk167

This commit is contained in:
Ivo Hinkelmann 2011-03-28 17:00:24 +02:00
commit 334dea3109
17 changed files with 141 additions and 113 deletions

View file

@ -1732,8 +1732,17 @@ void Desktop::Main()
bool bAbort = CheckExtensionDependencies();
if ( bAbort )
return;
{
::comphelper::ComponentContext aContext( xSMgr );
xRestartManager.set( aContext.getSingleton( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.OfficeRestartManager" ) ) ), UNO_QUERY );
}
// check whether the shutdown is caused by restart
pExecGlobals->bRestartRequested = ( xRestartManager.is() && xRestartManager->isRestartRequested( sal_True ) );
// First Start Wizard allowed ?
if ( ! pCmdLineArgs->IsNoFirstStartWizard())
if ( ! pCmdLineArgs->IsNoFirstStartWizard() && !pExecGlobals->bRestartRequested )
{
RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ FirstStartWizard" );

View file

@ -66,6 +66,8 @@ class IVistaFilePickerInternalNotify
public:
virtual void onAutoExtensionChanged (bool bChecked) = 0;
virtual bool onFileTypeChanged( UINT nTypeIndex ) = 0;
};
}}}

View file

@ -224,7 +224,7 @@ void SAL_CALL VistaFilePicker::setTitle(const ::rtl::OUString& sTitle)
//-----------------------------------------------------------------------------------------
void SAL_CALL VistaFilePicker::appendFilter(const ::rtl::OUString& sTitle ,
const ::rtl::OUString& sFilter)
const ::rtl::OUString& sFilter)
throw(css::lang::IllegalArgumentException,
css::uno::RuntimeException )
{
@ -263,17 +263,15 @@ void SAL_CALL VistaFilePicker::setCurrentFilter(const ::rtl::OUString& sTitle)
//-----------------------------------------------------------------------------------------
void SAL_CALL VistaFilePicker::appendFilterGroup(const ::rtl::OUString& /*sGroupTitle*/,
const css::uno::Sequence< css::beans::StringPair >& lFilters )
const css::uno::Sequence< css::beans::StringPair >& rFilters )
throw (css::lang::IllegalArgumentException,
css::uno::RuntimeException )
{
::sal_Int32 c = lFilters.getLength();
::sal_Int32 i = 0;
for (i=0; i<c; ++i)
{
const css::beans::StringPair& rFilter = lFilters[i];
appendFilter(rFilter.First, rFilter.Second);
}
RequestRef rRequest(new Request());
rRequest->setRequest (VistaFilePickerImpl::E_APPEND_FILTERGROUP);
rRequest->setArgument(PROP_FILTER_GROUP, rFilters);
m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED);
}
//-----------------------------------------------------------------------------------------

View file

@ -269,33 +269,16 @@ STDMETHODIMP VistaFilePickerEventHandler::OnShareViolation(IFileDialog*
}
//-----------------------------------------------------------------------------------------
STDMETHODIMP VistaFilePickerEventHandler::OnTypeChange(IFileDialog* /*pDialog*/)
STDMETHODIMP VistaFilePickerEventHandler::OnTypeChange(IFileDialog* pDialog)
{
/*
IFileDialogCustomize *iCustomize;
pDialog->QueryInterface(IID_IFileDialogCustomize, (void**)(&iCustomize));
UINT nFileTypeIndex;
HRESULT hResult = pDialog->GetFileTypeIndex( &nFileTypeIndex );
BOOL bValue = FALSE;
HRESULT hResult = iCustomize->GetCheckButtonState( css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, &bValue);
if ( bValue )
if ( hResult == S_OK )
{
UINT nIndex;
pDialog->GetFileTypeIndex( &nIndex );
LPCWSTR lpFilterExt = lFilters[nIndex].pszSpec;
lpFilterExt = wcschr( lpFilterExt, '.' );
if ( lpFilterExt )
lpFilterExt++;
pDialog->SetDefaultExtension( lpFilterExt );
if ( m_pInternalNotify->onFileTypeChanged( nFileTypeIndex ))
impl_sendEvent(E_CONTROL_STATE_CHANGED, css::ui::dialogs::CommonFilePickerElementIds::LISTBOX_FILTER);
}
return S_OK;
*/
impl_sendEvent(E_CONTROL_STATE_CHANGED, css::ui::dialogs::CommonFilePickerElementIds::LISTBOX_FILTER);
return S_OK;
}
@ -334,32 +317,9 @@ STDMETHODIMP VistaFilePickerEventHandler::OnCheckButtonToggled(IFileDialogCustom
DWORD nIDCtl ,
BOOL bChecked )
{
/*
if (nIDCtl == css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION)
{
LPCWSTR lpFilterExt = 0;
if ( bChecked )
{
UINT nIndex;
if (m_pDialog)
{
m_pDialog->GetFileTypeIndex( &nIndex );
lpFilterExt = lFilters[nIndex].pszSpec;
lpFilterExt = wcschr( lpFilterExt, '.' );
if ( lpFilterExt )
lpFilterExt++;
}
}
if (m_pDialog)
m_pDialog->SetDefaultExtension( lpFilterExt );
}
*/
if (nIDCtl == css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION)
m_pInternalNotify->onAutoExtensionChanged(bChecked);
impl_sendEvent(E_CONTROL_STATE_CHANGED, static_cast<sal_Int16>( nIDCtl));
return S_OK;

View file

@ -34,6 +34,7 @@
#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
#include <com/sun/star/ui/dialogs/ControlActions.hpp>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/beans/StringPair.hpp>
#include <comphelper/sequenceasvector.hxx>
#include <osl/file.hxx>
#include <osl/mutex.hxx>
@ -42,6 +43,8 @@
#endif
#include "..\misc\WinImplHelper.hxx"
#include <Shlguid.h>
inline bool is_current_process_window(HWND hwnd)
{
DWORD pid;
@ -199,6 +202,10 @@ void VistaFilePickerImpl::doRequest(const RequestRef& rRequest)
impl_sta_appendFilter(rRequest);
break;
case E_APPEND_FILTERGROUP :
impl_sta_appendFilterGroup(rRequest);
break;
case E_SET_CURRENT_FILTER :
impl_sta_setCurrentFilter(rRequest);
break;
@ -330,6 +337,28 @@ void VistaFilePickerImpl::impl_sta_appendFilter(const RequestRef& rRequest)
m_lFilters.addFilter(sTitle, sFilter);
}
//-------------------------------------------------------------------------------
void VistaFilePickerImpl::impl_sta_appendFilterGroup(const RequestRef& rRequest)
{
const css::uno::Sequence< css::beans::StringPair > aFilterGroup =
rRequest->getArgumentOrDefault(PROP_FILTER_GROUP, css::uno::Sequence< css::beans::StringPair >());
// SYNCHRONIZED->
::rtl::OUString aEmpty;
::osl::ResettableMutexGuard aLock(m_aMutex);
if ( m_lFilters.numFilter() > 0 && aFilterGroup.getLength() > 0 )
m_lFilters.addFilter( STRING_SEPARATOR, aEmpty, sal_True );
::sal_Int32 c = aFilterGroup.getLength();
::sal_Int32 i = 0;
for (i=0; i<c; ++i)
{
const css::beans::StringPair& rFilter = aFilterGroup[i];
m_lFilters.addFilter(rFilter.First, rFilter.Second);
}
}
//-------------------------------------------------------------------------------
void VistaFilePickerImpl::impl_sta_setCurrentFilter(const RequestRef& rRequest)
{
@ -941,7 +970,7 @@ void VistaFilePickerImpl::impl_sta_ShowDialogModal(const RequestRef& rRequest)
return;
impl_sta_getSelectedFiles(rRequest);
rRequest->setArgument(PROP_DIALOG_SHOW_RESULT, (::sal_Bool)sal_True);
rRequest->setArgument(PROP_DIALOG_SHOW_RESULT, sal_True);
}
//-------------------------------------------------------------------------------
@ -1179,6 +1208,23 @@ void VistaFilePickerImpl::impl_SetDefaultExtension( const rtl::OUString& current
}
}
static void impl_refreshFileDialog( TFileDialog iDialog )
{
if ( SUCCEEDED(iDialog->SetFileName(L"")) &&
SUCCEEDED(iDialog->SetFileName(L"*.*")) )
{
IOleWindow* iOleWindow;
if (SUCCEEDED(iDialog->QueryInterface(IID_PPV_ARGS(&iOleWindow))))
{
HWND hwnd;
if (SUCCEEDED(iOleWindow->GetWindow(&hwnd)))
{
PostMessage(hwnd, WM_COMMAND, IDOK, 0);
}
iOleWindow->Release();
}
}
}
//-------------------------------------------------------------------------------
void VistaFilePickerImpl::onAutoExtensionChanged (bool bChecked)
@ -1207,6 +1253,11 @@ void VistaFilePickerImpl::onAutoExtensionChanged (bool bChecked)
iDialog->SetDefaultExtension( pExt );
}
bool VistaFilePickerImpl::onFileTypeChanged( UINT /*nTypeIndex*/ )
{
return true;
}
} // namespace vista
} // namespace win32
} // namespace fpicker

View file

@ -104,12 +104,14 @@ static const ::rtl::OUString PROP_TEMPLATE_DESCR = ::rtl::OUString::createF
static const ::rtl::OUString PROP_FILTER_TITLE = ::rtl::OUString::createFromAscii("filter_title" ); // [OUString]
static const ::rtl::OUString PROP_FILTER_VALUE = ::rtl::OUString::createFromAscii("filter_value" ); // [OUString]
static const ::rtl::OUString PROP_FORCE = ::rtl::OUString::createFromAscii("force" ); // [sal_Bool]
static const ::rtl::OUString PROP_FILTER_GROUP = ::rtl::OUString::createFromAscii("filter_group" ); // [seq< css:beans::StringPair >] contains a group of filters
static const ::rtl::OUString PROP_CONTROL_ID = ::rtl::OUString::createFromAscii("control_id" ); // [sal_Int16]
static const ::rtl::OUString PROP_CONTROL_ACTION = ::rtl::OUString::createFromAscii("control_action" ); // [sal_Int16]
static const ::rtl::OUString PROP_CONTROL_VALUE = ::rtl::OUString::createFromAscii("control_value" ); // [Any]
static const ::rtl::OUString PROP_CONTROL_LABEL = ::rtl::OUString::createFromAscii("control_label" ); // [OUString]
static const ::rtl::OUString PROP_CONTROL_ENABLE = ::rtl::OUString::createFromAscii("control_enable" ); // [sal_Bool] true=ON, false=OFF
static const ::rtl::OUString STRING_SEPARATOR = ::rtl::OUString::createFromAscii("------------------------------------------" );
//-----------------------------------------------------------------------------
/** native implementation of the file picker on Vista and upcoming windows versions.
@ -149,7 +151,8 @@ class VistaFilePickerImpl : private ::cppu::BaseMutex
E_GET_CONTROL_VALUE,
E_SET_CONTROL_LABEL,
E_GET_CONTROL_LABEL,
E_ENABLE_CONTROL
E_ENABLE_CONTROL,
E_APPEND_FILTERGROUP
};
public:
@ -168,8 +171,11 @@ class VistaFilePickerImpl : private ::cppu::BaseMutex
virtual void doRequest(const RequestRef& rRequest);
virtual void after();
//---------------------------------------------------------------------
// IVistaFilePickerInternalNotify
//---------------------------------------------------------------------
virtual void onAutoExtensionChanged (bool bChecked);
virtual bool onFileTypeChanged( UINT nTypeIndex );
private:
@ -185,6 +191,10 @@ class VistaFilePickerImpl : private ::cppu::BaseMutex
/// implementation of request E_APPEND_FILTER
void impl_sta_appendFilter(const RequestRef& rRequest);
//---------------------------------------------------------------------
/// implementation of request E_APPEND_FILTERGROUP
void impl_sta_appendFilterGroup(const RequestRef& rRequest);
//---------------------------------------------------------------------
/// implementation of request E_SET_CURRENT_FILTER
void impl_sta_setCurrentFilter(const RequestRef& rRequest);

View file

@ -316,11 +316,24 @@ void SAL_CALL CWinFileOpenImpl::appendFilterGroup(const rtl::OUString& sGroupTit
// XExtendedFilePicker
//=================================================================================================================
// #i90917: Due to a different feature set for the system-dependent file pickers
// it's possible that generic code (e.g. sfx2) provides control ids
// (see ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR) which are NOT
// available on all platforms. This filter function should filter out control ids
// which are only available on KDE/GTK file pickers.
static bool filterControlCommand( sal_Int16 nControlId )
{
if ( nControlId == LISTBOX_FILTER_SELECTOR )
return true;
return false;
}
void SAL_CALL CWinFileOpenImpl::setValue(sal_Int16 aControlId, sal_Int16 aControlAction, const uno::Any& aValue)
throw(uno::RuntimeException)
{
OSL_ASSERT(m_FilePickerState);
m_FilePickerState->setValue(aControlId, aControlAction, aValue);
if ( !filterControlCommand( aControlId ))
m_FilePickerState->setValue(aControlId, aControlAction, aValue);
}
//-----------------------------------------------------------------------------------------
@ -332,7 +345,10 @@ uno::Any SAL_CALL CWinFileOpenImpl::getValue(sal_Int16 aControlId, sal_Int16 aCo
throw(uno::RuntimeException)
{
OSL_ASSERT(m_FilePickerState);
return m_FilePickerState->getValue(aControlId, aControlAction);
if ( !filterControlCommand( aControlId ))
return m_FilePickerState->getValue(aControlId, aControlAction);
else
return uno::Any();
}
//-----------------------------------------------------------------------------------------
@ -343,7 +359,8 @@ void SAL_CALL CWinFileOpenImpl::enableControl(sal_Int16 ControlID, sal_Bool bEna
throw(uno::RuntimeException)
{
OSL_ASSERT(m_FilePickerState);
m_FilePickerState->enableControl(ControlID, bEnable);
if ( !filterControlCommand( ControlID ))
m_FilePickerState->enableControl(ControlID, bEnable);
}
//-----------------------------------------------------------------------------------------
@ -353,7 +370,9 @@ void SAL_CALL CWinFileOpenImpl::enableControl(sal_Int16 ControlID, sal_Bool bEna
void SAL_CALL CWinFileOpenImpl::setLabel( sal_Int16 aControlId, const rtl::OUString& aLabel )
throw (uno::RuntimeException)
{
m_FilePickerState->setLabel(aControlId, aLabel);
OSL_ASSERT(m_FilePickerState);
if ( !filterControlCommand( aControlId ))
m_FilePickerState->setLabel(aControlId, aLabel);
}
//-----------------------------------------------------------------------------------------
@ -363,7 +382,11 @@ void SAL_CALL CWinFileOpenImpl::setLabel( sal_Int16 aControlId, const rtl::OUStr
rtl::OUString SAL_CALL CWinFileOpenImpl::getLabel( sal_Int16 aControlId )
throw (uno::RuntimeException)
{
return m_FilePickerState->getLabel(aControlId);
OSL_ASSERT(m_FilePickerState);
if ( !filterControlCommand( aControlId ))
return m_FilePickerState->getLabel(aControlId);
else
return rtl::OUString();
}
//-----------------------------------------------------------------------------------------

View file

@ -47,32 +47,6 @@
#pragma warning(pop)
#endif
// ATL/WTL
//#include <atlbase.h>
//#include <atlstr.h>
//#include <atlapp.h>
//extern CAppModule _Module;
//#include <atlcom.h>
//#include <atlwin.h>
//#include <atlframe.h>
//#include <atlcrack.h>
//#include <atlctrls.h>
//#include <atlctrlx.h>
//#include <atldlgs.h>
//#include <atlmisc.h>
/*
// STL
#include <vector>
// Global functions
LPCTSTR PrepFilterString ( CString& sFilters );
bool PathFromShellItem ( IShellItem* pItem, CString& sPath );
bool BuildFilterSpecList ( _U_STRINGorID szFilterList,
std::vector<CString>& vecsFilterParts,
std::vector<COMDLG_FILTERSPEC>& vecFilters );
*/
#if defined _M_IX86
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
@ -84,4 +58,3 @@ bool BuildFilterSpecList ( _U_STRINGorID szFilterList,
#endif
#endif

View file

@ -308,7 +308,7 @@ void SAL_CALL CPreviewAdapterImpl::rearrangeLayout()
// style bit of the FileOpen dialog must be set after that
// message
LONG lStyle = GetWindowLong(prvwnd,GWL_STYLE);
sal_Bool bIsVisible = (sal_Bool)(lStyle & WS_VISIBLE);
bool bIsVisible = ((lStyle & WS_VISIBLE) != 0);
int cx = 0;

View file

@ -61,6 +61,7 @@
#endif
#include <vcl/svapp.hxx>
#include <vcl/wrkwin.hxx>
#include <rtl/string.hxx>
//_________________________________________________________________________________________________________________
// namespace
@ -343,7 +344,9 @@ void PersistentWindowState::implst_setWindowStateOnWindow(const css::uno::Refere
if (pWorkWindow->IsMinimized())
return;
pSystemWindow->SetWindowState(U2B_ENC(sWindowState,RTL_TEXTENCODING_UTF8));
::rtl::OUString sOldWindowState = ::rtl::OStringToOUString( pSystemWindow->GetWindowState(), RTL_TEXTENCODING_ASCII_US );
if ( sOldWindowState != sWindowState )
pSystemWindow->SetWindowState(U2B_ENC(sWindowState,RTL_TEXTENCODING_UTF8));
aSolarLock.clear();
// <- SOLAR SAFE ------------------------

View file

@ -420,6 +420,14 @@ bool ToolbarLayoutManager::requestToolbar( const ::rtl::OUString& rResourceURL )
bool bMustCallCreate( false );
uno::Reference< ui::XUIElement > xUIElement;
ReadGuard aReadLock( m_aLock );
uno::Reference< frame::XFrame > xFrame( m_xFrame );
aReadLock.unlock();
uno::Reference< frame::XModel > xModel( impl_getModelFromFrame( xFrame ));
if ( implts_isPreviewModel( xModel ))
return false; // no toolbars for preview frame!
UIElement aRequestedToolbar = impl_findToolbar( rResourceURL );
if ( aRequestedToolbar.m_aName != rResourceURL )
{

View file

@ -98,6 +98,8 @@ SfxAppData_Impl::SfxAppData_Impl( SfxApplication* ) :
pTopFrames( new SfxFrameArr_Impl ),
pInitLinkList(0),
pMatcher( 0 ),
pBasicResMgr( 0 ),
pSvtResMgr( 0 ),
pAppDispatch(NULL),
pTemplates( 0 ),
pPool(0),

View file

@ -262,12 +262,11 @@ bool SfxApplication::Initialize_Impl()
// nichtgehandelte Fehler durch Errorcode 1 an SFX gegeben.
new SimpleErrorHandler;
#endif
new SfxErrorHandler(RID_ERRHDL, ERRCODE_AREA_TOOLS, ERRCODE_AREA_LIB1);
new SfxErrorHandler(
RID_SO_ERROR_HANDLER, ERRCODE_AREA_SO, ERRCODE_AREA_SO_END);
new SfxErrorHandler(
RID_BASIC_START, ERRCODE_AREA_SBX, ERRCODE_AREA_SBX_END );
pAppData_Impl->pBasicResMgr = CreateResManager("sb");
pAppData_Impl->pSvtResMgr = CreateResManager("svt");
new SfxErrorHandler( RID_ERRHDL, ERRCODE_AREA_TOOLS, ERRCODE_AREA_LIB1 );
new SfxErrorHandler( RID_SO_ERROR_HANDLER, ERRCODE_AREA_SO, ERRCODE_AREA_SO_END, pAppData_Impl->pSvtResMgr );
new SfxErrorHandler( RID_BASIC_START, ERRCODE_AREA_SBX, ERRCODE_AREA_SBX_END, pAppData_Impl->pBasicResMgr );
// diverse Pointer
SfxPickList::GetOrCreate( SvtHistoryOptions().GetSize( ePICKLIST ) );

View file

@ -167,4 +167,6 @@ void SfxApplication::Deinitialize()
NoChaos::ReleaseItemPool();
*/
pAppData_Impl->pPool = NULL;
DELETEZ(pAppData_Impl->pBasicResMgr);
DELETEZ(pAppData_Impl->pSvtResMgr);
}

View file

@ -27,19 +27,6 @@
#include <sfx2/sfx.hrc>
String STR_STYLE_FILTER_USED
{
Text [ en-US ] = "Applied Styles" ;
};
String STR_STYLE_FILTER_USERDEF
{
Text [ en-US ] = "Custom Styles" ;
};
String STR_STYLE_FILTER_ALL
{
Text [ en-US ] = "All Styles" ;
};
String STR_ACCTITLE_PRODUCTIVITYTOOLS
{
Text [ en-US ] = "%PRODUCTNAME";

View file

@ -110,7 +110,8 @@ public:
// application members
SfxFilterMatcher* pMatcher;
ResMgr* pLabelResMgr;
ResMgr* pBasicResMgr;
ResMgr* pSvtResMgr;
SfxStatusDispatcher* pAppDispatch;
SfxDocumentTemplates* pTemplates;

View file

@ -30,7 +30,7 @@
String ABOUT_STR_COPYRIGHT
{
Text[ en-US ] = "Copyright © 2000, 2010 Oracle and/or its affiliates. All rights reserved.\nThis product was created by %OOOVENDOR, based on OpenOffice.org.\nOpenOffice.org acknowledges all community members, especially those mentioned at\n http://www.openoffice.org/welcome/credits.html.";
Text[ en-US ] = "Copyright © 2000, 2011 Oracle and/or its affiliates. All rights reserved.\nThis product was created by %OOOVENDOR, based on OpenOffice.org.\nOpenOffice.org acknowledges all community members, especially those mentioned at\n http://www.openoffice.org/welcome/credits.html.";
};
StringArray ABOUT_STR_DEVELOPER_ARY