summaryrefslogtreecommitdiff
path: root/ucbhelper
diff options
context:
space:
mode:
authorKai Sommerfeld <kso@openoffice.org>2010-01-06 10:40:02 +0100
committerKai Sommerfeld <kso@openoffice.org>2010-01-06 10:40:02 +0100
commit59a8c29ca861dbe23fcc41cb13dfc6a19f088bd4 (patch)
treefd083393aa341cca9a0cf4164bae0193fd293904 /ucbhelper
parentc062cc0b89a8832c7ad507e79fe56de10b09f659 (diff)
compiles again, but not yet working.
Diffstat (limited to 'ucbhelper')
-rw-r--r--ucbhelper/workben/ucbexplorer/ucbexplorer.cxx142
-rw-r--r--ucbhelper/workben/ucbexplorer/ucbexplorer.src2
2 files changed, 77 insertions, 67 deletions
diff --git a/ucbhelper/workben/ucbexplorer/ucbexplorer.cxx b/ucbhelper/workben/ucbexplorer/ucbexplorer.cxx
index 276476d9e21f..9a41c55ccfd8 100644
--- a/ucbhelper/workben/ucbexplorer/ucbexplorer.cxx
+++ b/ucbhelper/workben/ucbexplorer/ucbexplorer.cxx
@@ -40,8 +40,8 @@
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/ucb/XCommandInfo.hpp>
#include <com/sun/star/ucb/XContentAccess.hpp>
-#include <com/sun/star/ucb/XContentCreator.hpp>
#include <com/sun/star/ucb/CommandAbortedException.hpp>
+#include <com/sun/star/ucb/ContentInfo.hpp>
#include <com/sun/star/ucb/ContentInfoAttribute.hpp>
#include "rtl/ref.hxx"
@@ -124,7 +124,8 @@ private:
DECL_LINK( NameHdl, Edit * );
public:
- StringInputDialog( const String& rTitle,
+ StringInputDialog( ResMgr& rResMgr,
+ const String& rTitle,
const String& rDefaultText,
String* pGroupName = 0 );
String GetValue() const { return m_aNameEdit.GetText(); }
@@ -143,15 +144,15 @@ class UcbExplorerListBoxEntry : public SvLBoxEntry
enum EntryType { FOLDER, DOCUMENT, LINK };
- ::ucb::Content m_aContent;
- EntryType m_eType;
+ ::ucbhelper::Content m_aContent;
+ EntryType m_eType;
public:
UcbExplorerListBoxEntry();
virtual ~UcbExplorerListBoxEntry();
BOOL createNewContent( const ContentInfo& rInfo,
- ::ucb::Content& rNewContent );
+ ::ucbhelper::Content& rNewContent );
};
//=========================================================================
@@ -172,13 +173,13 @@ private:
virtual void RequestingChilds( SvLBoxEntry* pParent );
public:
- UcbExplorerTreeListBox( Window* pParent, WinBits nWinStyle = 0 );
+ UcbExplorerTreeListBox( ResMgr & rResMgr, Window* pParent, WinBits nWinStyle = 0 );
virtual ~UcbExplorerTreeListBox();
virtual void Command( const CommandEvent& rCEvt );
UcbExplorerListBoxEntry*
- InsertEntry( ::ucb::Content& rContent, SvLBoxEntry* pParent );
+ InsertEntry( ::ucbhelper::Content& rContent, SvLBoxEntry* pParent );
UcbExplorerListBoxEntry*
InsertEntry( const String& rURL, SvLBoxEntry* pParent = 0 );
};
@@ -196,7 +197,7 @@ class UcbExplorerWindow : public WorkWindow
UcbExplorerTreeListBox m_aTree;
public:
- UcbExplorerWindow( Window *pParent, WinBits nWinStyle );
+ UcbExplorerWindow( ResMgr & rResMgr, Window *pParent, WinBits nWinStyle );
virtual ~UcbExplorerWindow();
virtual void Resize();
@@ -269,16 +270,17 @@ uno::Reference< XInputStream > SAL_CALL TestDataSink::getInputStream()
//
//=========================================================================
-StringInputDialog::StringInputDialog( const String& rTitle,
+StringInputDialog::StringInputDialog( ResMgr& rResMgr,
+ const String& rTitle,
const String& rDefaultText,
String* pGroupName )
-: ModalDialog( 0, ResId( DLG_STRINGINPUT ) ),
- m_aNameText ( this, ResId( FT_STRINGINPUT_DLG_NAME ) ),
- m_aNameEdit ( this, ResId( ED_STRINGINPUT_DLG_NAME ) ),
- m_aNameGroup( this, ResId( GB_STRINGINPUT_DLG_NAME ) ),
- m_aOKBtn ( this, ResId( BT_STRINGINPUT_DLG_OK ) ),
- m_aCancelBtn( this, ResId( BT_STRINGINPUT_DLG_CANCEL ) ),
- m_aHelpBtn ( this, ResId( BT_STRINGINPUT_DLG_HELP ) )
+ : ModalDialog( 0, ResId( DLG_STRINGINPUT, rResMgr ) ),
+ m_aNameText ( this, ResId( FT_STRINGINPUT_DLG_NAME, rResMgr ) ),
+ m_aNameEdit ( this, ResId( ED_STRINGINPUT_DLG_NAME, rResMgr ) ),
+ m_aNameGroup( this, ResId( GB_STRINGINPUT_DLG_NAME, rResMgr ) ),
+ m_aOKBtn ( this, ResId( BT_STRINGINPUT_DLG_OK, rResMgr ) ),
+ m_aCancelBtn( this, ResId( BT_STRINGINPUT_DLG_CANCEL, rResMgr ) ),
+ m_aHelpBtn ( this, ResId( BT_STRINGINPUT_DLG_HELP, rResMgr ) )
{
FreeResource();
SetText( rTitle );
@@ -339,7 +341,7 @@ UcbExplorerListBoxEntry::~UcbExplorerListBoxEntry()
//=========================================================================
BOOL UcbExplorerListBoxEntry::createNewContent( const ContentInfo& rInfo,
- ::ucb::Content& rNewContent )
+ ::ucbhelper::Content& rNewContent )
{
sal_Int32 nCount = rInfo.Properties.getLength();
Sequence< Any > aPropValues( nCount );
@@ -354,7 +356,10 @@ BOOL UcbExplorerListBoxEntry::createNewContent( const ContentInfo& rInfo,
for ( sal_Int32 n = 0; n < nCount; ++n )
{
const OUString& rName = pProps[ n ].Name;
- StringInputDialog* pDlg = new StringInputDialog( rName, rName );
+
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr( CREATEVERSIONRESMGR_NAME( ucbexplorer ) ) );
+ StringInputDialog* pDlg = new StringInputDialog( *xManager.get(), rName, rName );
USHORT nRet = pDlg->Execute();
if ( nRet == RET_OK )
{
@@ -440,7 +445,10 @@ BOOL UcbExplorerListBoxEntry::createNewContent( const ContentInfo& rInfo,
// Let the user specify the URL of a content containing the
// data to supply to the new content.
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr( CREATEVERSIONRESMGR_NAME( ucbexplorer ) ) );
StringInputDialog* pDlg = new StringInputDialog(
+ *xManager.get(),
OUString::createFromAscii(
"Document Data Source URL" ),
OUString() );
@@ -461,7 +469,7 @@ BOOL UcbExplorerListBoxEntry::createNewContent( const ContentInfo& rInfo,
{
uno::Reference< XCommandEnvironment > xEnv;
- ::ucb::ContentBroker* pBroker = ::ucb::ContentBroker::get();
+ ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get();
if ( pBroker )
{
uno::Reference< XInteractionHandler > xInteractionHandler(
@@ -473,15 +481,15 @@ BOOL UcbExplorerListBoxEntry::createNewContent( const ContentInfo& rInfo,
uno::Reference< XProgressHandler > xProgressHandler
/* = new ProgressHandler( *pBroker ) */ ;
- xEnv = new ::ucb::CommandEnvironment( xInteractionHandler,
- xProgressHandler );
+ xEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler,
+ xProgressHandler );
}
- ::ucb::Content aSourceContent( aSourceURL, xEnv );
+ ::ucbhelper::Content aSourceContent( aSourceURL, xEnv );
// Get source data.
rtl::Reference< TestDataSink > xSourceData = new TestDataSink;
- aSourceContent.openStream( xSourceData.getBodyPtr() );
+ aSourceContent.openStream( xSourceData.get() );
xData = xSourceData->getInputStream();
}
catch ( ContentCreationException const & )
@@ -541,13 +549,14 @@ BOOL UcbExplorerListBoxEntry::createNewContent( const ContentInfo& rInfo,
//
//=========================================================================
-UcbExplorerTreeListBox::UcbExplorerTreeListBox(
- Window* pParent, WinBits nWinStyle )
+UcbExplorerTreeListBox::UcbExplorerTreeListBox( ResMgr & rResMgr,
+ Window* pParent,
+ WinBits nWinStyle )
: SvTreeListBox( pParent, nWinStyle ),
- m_aFolderClosed( ResId( BMP_FOLDER_CLOSED ) ),
- m_aFolderOpened( ResId( BMP_FOLDER_OPENED ) ),
- m_aDocument( ResId( BMP_DOCUMENT ) ),
- m_aLink( ResId( BMP_LINK ) )
+ m_aFolderClosed( ResId( BMP_FOLDER_CLOSED, rResMgr ) ),
+ m_aFolderOpened( ResId( BMP_FOLDER_OPENED, rResMgr ) ),
+ m_aDocument( ResId( BMP_DOCUMENT, rResMgr ) ),
+ m_aLink( ResId( BMP_LINK, rResMgr ) )
{
}
@@ -587,7 +596,7 @@ void UcbExplorerTreeListBox::RequestingChilds( SvLBoxEntry* pParent )
uno::Reference< XResultSet > xResultSet
= pEntry->m_aContent.createCursor(
aPropertyNames,
- ::ucb::INCLUDE_FOLDERS_AND_DOCUMENTS );
+ ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS );
uno::Reference< XContentAccess > xContentAccess(
xResultSet, UNO_QUERY );
@@ -644,7 +653,9 @@ void UcbExplorerTreeListBox::Command( const CommandEvent& rCEvt )
GetEntry( rPos, TRUE ) );
if ( pEntry )
{
- PopupMenu* pMenu = new PopupMenu( ResId( MENU_POPUP ) );
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr( CREATEVERSIONRESMGR_NAME( ucbexplorer ) ) );
+ PopupMenu* pMenu = new PopupMenu( ResId( MENU_POPUP, *xManager.get() ) );
PopupMenu* pNewMenu = 0;
// pMenu->SetSelectHdl( LINK( this,
@@ -655,25 +666,19 @@ void UcbExplorerTreeListBox::Command( const CommandEvent& rCEvt )
// Configure "New"
//////////////////////////////////////////////////////////////
- uno::Reference< XContentCreator > xCreator(
- pEntry->m_aContent.get(), UNO_QUERY );
- Sequence< ContentInfo > aInfo;
- BOOL bCanCreate = xCreator.is();
- if ( bCanCreate )
- {
- aInfo = xCreator->queryCreatableContentsInfo();
- const ContentInfo* pInfo = aInfo.getConstArray();
- sal_Int32 nCount = aInfo.getLength();
- bCanCreate = ( nCount > 0 );
+ Sequence< ContentInfo > aInfo
+ = pEntry->m_aContent.queryCreatableContentsInfo();
+ const ContentInfo* pInfo = aInfo.getConstArray();
+ sal_Int32 nCount = aInfo.getLength();
+ BOOL bCanCreate = ( nCount > 0 );
- pNewMenu = new PopupMenu;
- pMenu->SetPopupMenu( MENU_NEW, pNewMenu );
+ pNewMenu = new PopupMenu;
+ pMenu->SetPopupMenu( MENU_NEW, pNewMenu );
- for ( sal_Int32 n = 0; n < nCount; ++n )
- {
- const ContentInfo& rInfo = pInfo[ n ];
- pNewMenu->InsertItem( 20000 + n + 1, rInfo.Type );
- }
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const ContentInfo& rInfo = pInfo[ n ];
+ pNewMenu->InsertItem( 20000 + n + 1, rInfo.Type );
}
pMenu->EnableItem( MENU_NEW, bCanCreate );
@@ -763,8 +768,11 @@ void UcbExplorerTreeListBox::Command( const CommandEvent& rCEvt )
{
}
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr( CREATEVERSIONRESMGR_NAME( ucbexplorer ) ) );
StringInputDialog* pDlg
= new StringInputDialog(
+ *xManager.get(),
OUString::createFromAscii( "Title" ),
aNewTitle );
@@ -880,7 +888,7 @@ void UcbExplorerTreeListBox::Command( const CommandEvent& rCEvt )
{
// New-menu entry selected.
- ::ucb::Content aNewContent;
+ ::ucbhelper::Content aNewContent;
if ( pEntry->createNewContent(
aInfo.getConstArray()[ nSelected - 20001 ],
aNewContent ) )
@@ -906,7 +914,7 @@ void UcbExplorerTreeListBox::Command( const CommandEvent& rCEvt )
//=========================================================================
UcbExplorerListBoxEntry* UcbExplorerTreeListBox::InsertEntry(
- ::ucb::Content& rContent,
+ ::ucbhelper::Content& rContent,
SvLBoxEntry* pParent )
{
try
@@ -998,7 +1006,7 @@ UcbExplorerListBoxEntry* UcbExplorerTreeListBox::InsertEntry(
{
uno::Reference< XCommandEnvironment > xEnv;
- ::ucb::ContentBroker* pBroker = ::ucb::ContentBroker::get();
+ ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get();
if ( pBroker )
{
uno::Reference< XInteractionHandler > xInteractionHandler(
@@ -1010,11 +1018,11 @@ UcbExplorerListBoxEntry* UcbExplorerTreeListBox::InsertEntry(
uno::Reference< XProgressHandler > xProgressHandler
/* = new ProgressHandler( *pBroker ) */ ;
- xEnv = new ::ucb::CommandEnvironment( xInteractionHandler,
- xProgressHandler );
+ xEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler,
+ xProgressHandler );
}
- ::ucb::Content aContent( rURL, xEnv );
+ ::ucbhelper::Content aContent( rURL, xEnv );
return InsertEntry( aContent, pParent );
}
catch ( ContentCreationException const & )
@@ -1030,9 +1038,9 @@ UcbExplorerListBoxEntry* UcbExplorerTreeListBox::InsertEntry(
//
//=========================================================================
-UcbExplorerWindow::UcbExplorerWindow( Window *pParent, WinBits nWinStyle )
+UcbExplorerWindow::UcbExplorerWindow( ResMgr & rResMgr, Window *pParent, WinBits nWinStyle )
: WorkWindow( pParent, nWinStyle ),
- m_aTree( this, WB_HSCROLL )
+ m_aTree( rResMgr, this, WB_HSCROLL )
{
Font aTreeFont( m_aTree.GetFont() );
aTreeFont.SetName( String( RTL_CONSTASCII_USTRINGPARAM("Courier") ) );
@@ -1101,7 +1109,7 @@ void MyApp::Main()
comphelper::setProcessServiceFactory( xFac );
- unO::Reference< XComponent > xComponent( xFac, UNO_QUERY );
+ uno::Reference< XComponent > xComponent( xFac, UNO_QUERY );
//////////////////////////////////////////////////////////////////////
// Create UCB.
@@ -1112,16 +1120,16 @@ void MyApp::Main()
Sequence< Any > aArgs( 2 );
aArgs[ 0 ] <<= OUString::createFromAscii( UCB_CONFIGURATION_KEY1_LOCAL );
aArgs[ 1 ] <<= OUString::createFromAscii( UCB_CONFIGURATION_KEY2_OFFICE );
- sal_Bool bSuccess = ::ucb::ContentBroker::initialize( xFac, aArgs );
+ sal_Bool bSuccess = ::ucbhelper::ContentBroker::initialize( xFac, aArgs );
#else
// Init UCB (Use provided configuration data)
- ::ucb::ContentProviderDataList aProviders;
+ ::ucbhelper::ContentProviderDataList aProviders;
aProviders.push_back(
- ::ucb::ContentProviderData(
+ ::ucbhelper::ContentProviderData(
OUString::createFromAscii( "com.sun.star.ucb.FileContentProvider" ),
OUString::createFromAscii( "file" ),
OUString() ) );
- sal_Bool bSuccess = ::ucb::ContentBroker::initialize( xFac, aProviders );
+ sal_Bool bSuccess = ::ucbhelper::ContentBroker::initialize( xFac, aProviders );
#endif
if ( !bSuccess )
@@ -1134,12 +1142,12 @@ void MyApp::Main()
// Create/init/show app window.
//////////////////////////////////////////////////////////////////////
- ResMgr* pMgr = ResMgr::CreateResMgr( CREATEVERSIONRESMGR( ucbexplorer ) );
- Resource::SetResManager( pMgr );
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr( CREATEVERSIONRESMGR_NAME( ucbexplorer ) ) );
- UcbExplorerWindow aAppWin( 0, WB_APP | WB_STDWORK );
+ UcbExplorerWindow aAppWin( *xManager.get(), 0, WB_APP | WB_STDWORK );
- MenuBar aMBMain( ResId( MENU_MAIN ) );
+ MenuBar aMBMain( ResId( MENU_MAIN, *xManager.get() ) );
// Check for command line params
#if 0
@@ -1154,7 +1162,7 @@ void MyApp::Main()
aRootURL = UniString::CreateFromAscii(
RTL_CONSTASCII_STRINGPARAM( "vnd.sun.star.hier:/" ) );
- String aTitle( ResId( TEXT_TITLEBAR ) );
+ String aTitle( ResId( TEXT_TITLEBAR, *xManager.get() ) );
aTitle.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " - " ) );
aTitle += aRootURL;
@@ -1179,7 +1187,7 @@ void MyApp::Main()
// m_aTree holds UCB contents!
aAppWin.m_aTree.Clear();
- ::ucb::ContentBroker::deinitialize();
+ ::ucbhelper::ContentBroker::deinitialize();
if ( xComponent.is() )
xComponent->dispose();
diff --git a/ucbhelper/workben/ucbexplorer/ucbexplorer.src b/ucbhelper/workben/ucbexplorer/ucbexplorer.src
index 355732741d6d..1449897341d5 100644
--- a/ucbhelper/workben/ucbexplorer/ucbexplorer.src
+++ b/ucbhelper/workben/ucbexplorer/ucbexplorer.src
@@ -82,6 +82,7 @@ Menu MENU_POPUP
};
};
+/*
Bitmap BMP_FOLDER_CLOSED
{
File = "bmp/fldclose.bmp" ;
@@ -98,6 +99,7 @@ Bitmap BMP_LINK
{
File = "bmp/link.bmp" ;
};
+*/
ModalDialog DLG_STRINGINPUT
{