1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_dbaccess.hxx" 30*cdf0e10cSrcweir #ifndef DBAUI_COLLECTIONVIEW_HXX 31*cdf0e10cSrcweir #include "CollectionView.hxx" 32*cdf0e10cSrcweir #endif 33*cdf0e10cSrcweir #ifndef DBAUI_COLLECTIONVIEW_HRC 34*cdf0e10cSrcweir #include "CollectionView.hrc" 35*cdf0e10cSrcweir #endif 36*cdf0e10cSrcweir #ifndef _TOOLS_DEBUG_HXX 37*cdf0e10cSrcweir #include <tools/debug.hxx> 38*cdf0e10cSrcweir #endif 39*cdf0e10cSrcweir #ifndef TOOLS_DIAGNOSE_EX_H 40*cdf0e10cSrcweir #include <tools/diagnose_ex.h> 41*cdf0e10cSrcweir #endif 42*cdf0e10cSrcweir #ifndef _DBAUI_MODULE_DBU_HXX_ 43*cdf0e10cSrcweir #include "moduledbu.hxx" 44*cdf0e10cSrcweir #endif 45*cdf0e10cSrcweir #ifndef _DBU_DLG_HRC_ 46*cdf0e10cSrcweir #include "dbu_dlg.hrc" 47*cdf0e10cSrcweir #endif 48*cdf0e10cSrcweir #ifndef _COMPHELPER_INTERACTION_HXX_ 49*cdf0e10cSrcweir #include <comphelper/interaction.hxx> 50*cdf0e10cSrcweir #endif 51*cdf0e10cSrcweir #ifndef _CPPUHELPER_EXC_HLP_HXX_ 52*cdf0e10cSrcweir #include <cppuhelper/exc_hlp.hxx> 53*cdf0e10cSrcweir #endif 54*cdf0e10cSrcweir #ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ 55*cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx> 56*cdf0e10cSrcweir #endif 57*cdf0e10cSrcweir #ifndef SVT_QUERYFOLDER_HXX 58*cdf0e10cSrcweir #include <svtools/QueryFolderName.hxx> 59*cdf0e10cSrcweir #endif 60*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ 61*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 62*cdf0e10cSrcweir #endif 63*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_ 64*cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp> 65*cdf0e10cSrcweir #endif 66*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_ 67*cdf0e10cSrcweir #include <com/sun/star/container/XChild.hpp> 68*cdf0e10cSrcweir #endif 69*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_ 70*cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp> 71*cdf0e10cSrcweir #endif 72*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ 73*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 74*cdf0e10cSrcweir #endif 75*cdf0e10cSrcweir #ifndef _SV_MSGBOX_HXX 76*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 77*cdf0e10cSrcweir #endif 78*cdf0e10cSrcweir #ifndef DBACCESS_SHARED_DBUSTRINGS_HRC 79*cdf0e10cSrcweir #include "dbustrings.hrc" 80*cdf0e10cSrcweir #endif 81*cdf0e10cSrcweir #ifndef DBAUI_TOOLS_HXX 82*cdf0e10cSrcweir #include "UITools.hxx" 83*cdf0e10cSrcweir #endif 84*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_CONTAINER_XHIERARCHICALNAMECONTAINER_HPP_ 85*cdf0e10cSrcweir #include <com/sun/star/container/XHierarchicalNameContainer.hpp> 86*cdf0e10cSrcweir #endif 87*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UCB_INTERACTIVEAUGMENTEDIOEXCEPTION_HPP_ 88*cdf0e10cSrcweir #include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp> 89*cdf0e10cSrcweir #endif 90*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UCB_IOERRORCODE_HPP_ 91*cdf0e10cSrcweir #include <com/sun/star/ucb/IOErrorCode.hpp> 92*cdf0e10cSrcweir #endif 93*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP_ 94*cdf0e10cSrcweir #include <com/sun/star/task/XInteractionHandler.hpp> 95*cdf0e10cSrcweir #endif 96*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_TASK_INTERACTIONCLASSIFICATION_HPP_ 97*cdf0e10cSrcweir #include <com/sun/star/task/InteractionClassification.hpp> 98*cdf0e10cSrcweir #endif 99*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBC_SQLEXCEPTION_HPP_ 100*cdf0e10cSrcweir #include <com/sun/star/sdbc/SQLException.hpp> 101*cdf0e10cSrcweir #endif 102*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_ 103*cdf0e10cSrcweir #include <com/sun/star/awt/XWindow.hpp> 104*cdf0e10cSrcweir #endif 105*cdf0e10cSrcweir #ifndef INCLUDED_SVTOOLS_VIEWOPTIONS_HXX 106*cdf0e10cSrcweir #include <unotools/viewoptions.hxx> 107*cdf0e10cSrcweir #endif 108*cdf0e10cSrcweir #ifndef _OSL_THREAD_H_ 109*cdf0e10cSrcweir #include <osl/thread.h> 110*cdf0e10cSrcweir #endif 111*cdf0e10cSrcweir #ifndef _DBHELPER_DBEXCEPTION_HXX_ 112*cdf0e10cSrcweir #include <connectivity/dbexception.hxx> 113*cdf0e10cSrcweir #endif 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir #define FILEDIALOG_DEF_IMAGEBORDER 10 116*cdf0e10cSrcweir //......................................................................... 117*cdf0e10cSrcweir namespace dbaui 118*cdf0e10cSrcweir { 119*cdf0e10cSrcweir //......................................................................... 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 122*cdf0e10cSrcweir using namespace ::com::sun::star::ucb; 123*cdf0e10cSrcweir using namespace ::com::sun::star::lang; 124*cdf0e10cSrcweir using namespace ::com::sun::star::beans; 125*cdf0e10cSrcweir using namespace ::com::sun::star::container; 126*cdf0e10cSrcweir using namespace ::com::sun::star::ucb; 127*cdf0e10cSrcweir using namespace ::com::sun::star::task; 128*cdf0e10cSrcweir using namespace ::com::sun::star::sdbc; 129*cdf0e10cSrcweir using namespace comphelper; 130*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 131*cdf0e10cSrcweir DBG_NAME(OCollectionView) 132*cdf0e10cSrcweir OCollectionView::OCollectionView( Window * pParent 133*cdf0e10cSrcweir ,const Reference< XContent>& _xContent 134*cdf0e10cSrcweir ,const ::rtl::OUString& _sDefaultName 135*cdf0e10cSrcweir ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB) 136*cdf0e10cSrcweir : ModalDialog( pParent, ModuleRes(DLG_COLLECTION_VIEW)) 137*cdf0e10cSrcweir , m_aFTCurrentPath( this, ModuleRes( FT_EXPLORERFILE_CURRENTPATH ) ) 138*cdf0e10cSrcweir , m_aNewFolder( this, ModuleRes( BTN_EXPLORERFILE_NEWFOLDER ) ) 139*cdf0e10cSrcweir , m_aUp( this, ModuleRes( BTN_EXPLORERFILE_UP ) ) 140*cdf0e10cSrcweir , m_aView( this, ModuleRes( CTRL_VIEW ) ,FILEVIEW_SHOW_TITLE ) 141*cdf0e10cSrcweir , m_aFTName( this, ModuleRes( FT_EXPLORERFILE_FILENAME ) ) 142*cdf0e10cSrcweir , m_aName( this, ModuleRes( ED_EXPLORERFILE_FILENAME ) ) 143*cdf0e10cSrcweir , m_aFL( this, ModuleRes( FL_1 ) ) 144*cdf0e10cSrcweir , m_aPB_OK( this, ModuleRes( BTN_EXPLORERFILE_SAVE ) ) 145*cdf0e10cSrcweir , m_aPB_CANCEL( this, ModuleRes( PB_CANCEL ) ) 146*cdf0e10cSrcweir , m_aPB_HELP( this, ModuleRes( PB_HELP ) ) 147*cdf0e10cSrcweir , m_sPath( ModuleRes( STR_PATHNAME ) ) 148*cdf0e10cSrcweir , m_xContent(_xContent) 149*cdf0e10cSrcweir , m_xORB(_xORB) 150*cdf0e10cSrcweir , m_bCreateForm(sal_True) 151*cdf0e10cSrcweir { 152*cdf0e10cSrcweir DBG_CTOR(OCollectionView,NULL); 153*cdf0e10cSrcweir FreeResource(); 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir OSL_ENSURE(m_xContent.is(),"No valid content!"); 156*cdf0e10cSrcweir m_aView.Initialize(m_xContent,String()); 157*cdf0e10cSrcweir m_aFTCurrentPath.SetStyle( m_aFTCurrentPath.GetStyle() | WB_PATHELLIPSIS ); 158*cdf0e10cSrcweir initCurrentPath(); 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir m_aName.SetText(_sDefaultName); 161*cdf0e10cSrcweir m_aName.GrabFocus(); 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir m_aNewFolder.SetStyle( m_aNewFolder.GetStyle() | WB_NOPOINTERFOCUS ); 164*cdf0e10cSrcweir m_aUp.SetModeImage(ModuleRes(IMG_NAVIGATION_BTN_UP_SC)); 165*cdf0e10cSrcweir m_aUp.SetModeImage(ModuleRes(IMG_NAVIGATION_BTN_UP_SCH),BMP_COLOR_HIGHCONTRAST); 166*cdf0e10cSrcweir m_aNewFolder.SetModeImage(ModuleRes(IMG_NAVIGATION_CREATEFOLDER_SC)); 167*cdf0e10cSrcweir m_aNewFolder.SetModeImage(ModuleRes(IMG_NAVIGATION_CREATEFOLDER_SCH),BMP_COLOR_HIGHCONTRAST); 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir m_aView.SetDoubleClickHdl( LINK( this, OCollectionView, Dbl_Click_FileView ) ); 170*cdf0e10cSrcweir m_aView.EnableAutoResize(); 171*cdf0e10cSrcweir m_aUp.SetClickHdl( LINK( this, OCollectionView, Up_Click ) ); 172*cdf0e10cSrcweir m_aNewFolder.SetClickHdl( LINK( this, OCollectionView, NewFolder_Click ) ); 173*cdf0e10cSrcweir m_aPB_OK.SetClickHdl( LINK( this, OCollectionView, Save_Click ) ); 174*cdf0e10cSrcweir } 175*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 176*cdf0e10cSrcweir OCollectionView::~OCollectionView( ) 177*cdf0e10cSrcweir { 178*cdf0e10cSrcweir DBG_DTOR(OCollectionView,NULL); 179*cdf0e10cSrcweir } 180*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 181*cdf0e10cSrcweir Reference< XContent> OCollectionView::getSelectedFolder() const 182*cdf0e10cSrcweir { 183*cdf0e10cSrcweir return m_xContent; 184*cdf0e10cSrcweir } 185*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 186*cdf0e10cSrcweir IMPL_LINK( OCollectionView, Save_Click, PushButton*, EMPTYARG ) 187*cdf0e10cSrcweir { 188*cdf0e10cSrcweir ::rtl::OUString sName = m_aName.GetText(); 189*cdf0e10cSrcweir if ( !sName.getLength() ) 190*cdf0e10cSrcweir return 0; 191*cdf0e10cSrcweir try 192*cdf0e10cSrcweir { 193*cdf0e10cSrcweir ::rtl::OUString sSubFolder = m_aView.GetCurrentURL(); 194*cdf0e10cSrcweir sal_Int32 nIndex = sName.lastIndexOf('/') + 1; 195*cdf0e10cSrcweir if ( nIndex ) 196*cdf0e10cSrcweir { 197*cdf0e10cSrcweir if ( nIndex == 1 ) // special handling for root 198*cdf0e10cSrcweir { 199*cdf0e10cSrcweir Reference<XChild> xChild(m_xContent,UNO_QUERY); 200*cdf0e10cSrcweir Reference<XNameAccess> xNameAccess(xChild,UNO_QUERY); 201*cdf0e10cSrcweir while( xNameAccess.is() ) 202*cdf0e10cSrcweir { 203*cdf0e10cSrcweir xNameAccess.set(xChild->getParent(),UNO_QUERY); 204*cdf0e10cSrcweir if ( xNameAccess.is() ) 205*cdf0e10cSrcweir { 206*cdf0e10cSrcweir m_xContent.set(xNameAccess,UNO_QUERY); 207*cdf0e10cSrcweir xChild.set(m_xContent,UNO_QUERY); 208*cdf0e10cSrcweir } 209*cdf0e10cSrcweir } 210*cdf0e10cSrcweir m_aView.Initialize(m_xContent,String()); 211*cdf0e10cSrcweir initCurrentPath(); 212*cdf0e10cSrcweir } 213*cdf0e10cSrcweir sSubFolder = sName.copy(0,nIndex-1); 214*cdf0e10cSrcweir sName = sName.copy(nIndex); 215*cdf0e10cSrcweir Reference<XHierarchicalNameContainer> xHier(m_xContent,UNO_QUERY); 216*cdf0e10cSrcweir OSL_ENSURE(xHier.is(),"XHierarchicalNameContainer not supported!"); 217*cdf0e10cSrcweir if ( sSubFolder.getLength() && xHier.is() ) 218*cdf0e10cSrcweir { 219*cdf0e10cSrcweir if ( xHier->hasByHierarchicalName(sSubFolder) ) 220*cdf0e10cSrcweir { 221*cdf0e10cSrcweir m_xContent.set(xHier->getByHierarchicalName(sSubFolder),UNO_QUERY); 222*cdf0e10cSrcweir } 223*cdf0e10cSrcweir else // sub folder doesn't exist 224*cdf0e10cSrcweir { 225*cdf0e10cSrcweir Sequence< Any > aValues(2); 226*cdf0e10cSrcweir PropertyValue aValue; 227*cdf0e10cSrcweir aValue.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ResourceName")); 228*cdf0e10cSrcweir aValue.Value <<= sSubFolder; 229*cdf0e10cSrcweir aValues[0] <<= aValue; 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir aValue.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ResourceType")); 232*cdf0e10cSrcweir aValue.Value <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("folder")); 233*cdf0e10cSrcweir aValues[1] <<= aValue; 234*cdf0e10cSrcweir 235*cdf0e10cSrcweir InteractionClassification eClass = InteractionClassification_ERROR; 236*cdf0e10cSrcweir ::com::sun::star::ucb::IOErrorCode eError = IOErrorCode_NOT_EXISTING_PATH; 237*cdf0e10cSrcweir ::rtl::OUString sTemp; 238*cdf0e10cSrcweir InteractiveAugmentedIOException aException(sTemp,Reference<XInterface>(),eClass,eError,aValues); 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir Reference<XInitialization> xIni(m_xORB->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.InteractionHandler"))),UNO_QUERY); 242*cdf0e10cSrcweir if ( xIni.is() ) 243*cdf0e10cSrcweir { 244*cdf0e10cSrcweir aValue.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Parent")); 245*cdf0e10cSrcweir aValue.Value <<= VCLUnoHelper::GetInterface( this ); 246*cdf0e10cSrcweir Sequence< Any > aArgs(1); 247*cdf0e10cSrcweir aArgs[0] <<= makeAny(aValue); 248*cdf0e10cSrcweir xIni->initialize(aArgs); 249*cdf0e10cSrcweir OInteractionRequest* pRequest = new OInteractionRequest(makeAny(aException)); 250*cdf0e10cSrcweir Reference< XInteractionRequest > xRequest(pRequest); 251*cdf0e10cSrcweir 252*cdf0e10cSrcweir OInteractionApprove* pApprove = new OInteractionApprove; 253*cdf0e10cSrcweir pRequest->addContinuation(pApprove); 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir Reference< XInteractionHandler > xHandler(xIni,UNO_QUERY); 256*cdf0e10cSrcweir xHandler->handle(xRequest); 257*cdf0e10cSrcweir } 258*cdf0e10cSrcweir return 0; 259*cdf0e10cSrcweir } 260*cdf0e10cSrcweir } 261*cdf0e10cSrcweir } 262*cdf0e10cSrcweir Reference<XNameContainer> xNameContainer(m_xContent,UNO_QUERY); 263*cdf0e10cSrcweir if ( xNameContainer.is() ) 264*cdf0e10cSrcweir { 265*cdf0e10cSrcweir Reference< XContent> xContent; 266*cdf0e10cSrcweir if ( xNameContainer->hasByName(sName) ) 267*cdf0e10cSrcweir { 268*cdf0e10cSrcweir QueryBox aBox( this, WB_YES_NO, ModuleRes( STR_ALREADYEXISTOVERWRITE ) ); 269*cdf0e10cSrcweir if ( aBox.Execute() != RET_YES ) 270*cdf0e10cSrcweir return 0; 271*cdf0e10cSrcweir // xNameContainer->removeByName(sName); 272*cdf0e10cSrcweir } 273*cdf0e10cSrcweir m_aName.SetText(sName); 274*cdf0e10cSrcweir EndDialog( sal_True ); 275*cdf0e10cSrcweir } 276*cdf0e10cSrcweir } 277*cdf0e10cSrcweir catch( const Exception& ) 278*cdf0e10cSrcweir { 279*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 280*cdf0e10cSrcweir } 281*cdf0e10cSrcweir return 0; 282*cdf0e10cSrcweir } 283*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 284*cdf0e10cSrcweir IMPL_LINK( OCollectionView, NewFolder_Click, PushButton*, EMPTYARG ) 285*cdf0e10cSrcweir { 286*cdf0e10cSrcweir try 287*cdf0e10cSrcweir { 288*cdf0e10cSrcweir Reference<XHierarchicalNameContainer> xNameContainer(m_xContent,UNO_QUERY); 289*cdf0e10cSrcweir if ( dbaui::insertHierachyElement(this,m_xORB,xNameContainer,String(),m_bCreateForm) ) 290*cdf0e10cSrcweir m_aView.Initialize(m_xContent,String()); 291*cdf0e10cSrcweir } 292*cdf0e10cSrcweir catch( const SQLException& ) 293*cdf0e10cSrcweir { 294*cdf0e10cSrcweir showError( ::dbtools::SQLExceptionInfo( ::cppu::getCaughtException() ), this, m_xORB ); 295*cdf0e10cSrcweir } 296*cdf0e10cSrcweir catch( const Exception& ) 297*cdf0e10cSrcweir { 298*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 299*cdf0e10cSrcweir } 300*cdf0e10cSrcweir return 0; 301*cdf0e10cSrcweir } 302*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 303*cdf0e10cSrcweir IMPL_LINK( OCollectionView, Up_Click, PushButton*, EMPTYARG ) 304*cdf0e10cSrcweir { 305*cdf0e10cSrcweir try 306*cdf0e10cSrcweir { 307*cdf0e10cSrcweir Reference<XChild> xChild(m_xContent,UNO_QUERY); 308*cdf0e10cSrcweir if ( xChild.is() ) 309*cdf0e10cSrcweir { 310*cdf0e10cSrcweir Reference<XNameAccess> xNameAccess(xChild->getParent(),UNO_QUERY); 311*cdf0e10cSrcweir if ( xNameAccess.is() ) 312*cdf0e10cSrcweir { 313*cdf0e10cSrcweir m_xContent.set(xNameAccess,UNO_QUERY); 314*cdf0e10cSrcweir m_aView.Initialize(m_xContent,String()); 315*cdf0e10cSrcweir initCurrentPath(); 316*cdf0e10cSrcweir } 317*cdf0e10cSrcweir else 318*cdf0e10cSrcweir m_aUp.Disable(); 319*cdf0e10cSrcweir } 320*cdf0e10cSrcweir } 321*cdf0e10cSrcweir catch( const Exception& ) 322*cdf0e10cSrcweir { 323*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 324*cdf0e10cSrcweir } 325*cdf0e10cSrcweir return 0; 326*cdf0e10cSrcweir } 327*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 328*cdf0e10cSrcweir IMPL_LINK( OCollectionView, Dbl_Click_FileView, SvtFileView*, EMPTYARG ) 329*cdf0e10cSrcweir { 330*cdf0e10cSrcweir try 331*cdf0e10cSrcweir { 332*cdf0e10cSrcweir Reference<XNameAccess> xNameAccess(m_xContent,UNO_QUERY); 333*cdf0e10cSrcweir if ( xNameAccess.is() ) 334*cdf0e10cSrcweir { 335*cdf0e10cSrcweir ::rtl::OUString sSubFolder = m_aView.GetCurrentURL(); 336*cdf0e10cSrcweir sal_Int32 nIndex = sSubFolder.lastIndexOf('/') + 1; 337*cdf0e10cSrcweir sSubFolder = sSubFolder.getToken(0,'/',nIndex); 338*cdf0e10cSrcweir if ( sSubFolder.getLength() ) 339*cdf0e10cSrcweir { 340*cdf0e10cSrcweir Reference< XContent> xContent; 341*cdf0e10cSrcweir if ( xNameAccess->hasByName(sSubFolder) ) 342*cdf0e10cSrcweir xContent.set(xNameAccess->getByName(sSubFolder),UNO_QUERY); 343*cdf0e10cSrcweir if ( xContent.is() ) 344*cdf0e10cSrcweir { 345*cdf0e10cSrcweir m_xContent = xContent; 346*cdf0e10cSrcweir m_aView.Initialize(m_xContent,String()); 347*cdf0e10cSrcweir initCurrentPath(); 348*cdf0e10cSrcweir } 349*cdf0e10cSrcweir } 350*cdf0e10cSrcweir } 351*cdf0e10cSrcweir } 352*cdf0e10cSrcweir catch( const Exception& ) 353*cdf0e10cSrcweir { 354*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 355*cdf0e10cSrcweir } 356*cdf0e10cSrcweir return 0; 357*cdf0e10cSrcweir } 358*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 359*cdf0e10cSrcweir void OCollectionView::initCurrentPath() 360*cdf0e10cSrcweir { 361*cdf0e10cSrcweir sal_Bool bEnable = sal_False; 362*cdf0e10cSrcweir try 363*cdf0e10cSrcweir { 364*cdf0e10cSrcweir if ( m_xContent.is() ) 365*cdf0e10cSrcweir { 366*cdf0e10cSrcweir const ::rtl::OUString sCID = m_xContent->getIdentifier()->getContentIdentifier(); 367*cdf0e10cSrcweir const static ::rtl::OUString s_sFormsCID(RTL_CONSTASCII_USTRINGPARAM("private:forms")); 368*cdf0e10cSrcweir const static ::rtl::OUString s_sReportsCID(RTL_CONSTASCII_USTRINGPARAM("private:reports")); 369*cdf0e10cSrcweir m_bCreateForm = s_sFormsCID.compareTo(sCID) == 0; 370*cdf0e10cSrcweir ::rtl::OUString sPath(RTL_CONSTASCII_USTRINGPARAM("/")); 371*cdf0e10cSrcweir if ( m_bCreateForm && sCID.getLength() != s_sFormsCID.getLength()) 372*cdf0e10cSrcweir sPath = sCID.copy(s_sFormsCID.getLength()); 373*cdf0e10cSrcweir else if ( !m_bCreateForm && sCID.getLength() != s_sReportsCID.getLength() ) 374*cdf0e10cSrcweir sPath = sCID.copy(s_sReportsCID.getLength()); 375*cdf0e10cSrcweir 376*cdf0e10cSrcweir m_aFTCurrentPath.SetText(sPath); 377*cdf0e10cSrcweir Reference<XChild> xChild(m_xContent,UNO_QUERY); 378*cdf0e10cSrcweir bEnable = xChild.is() && Reference<XNameAccess>(xChild->getParent(),UNO_QUERY).is(); 379*cdf0e10cSrcweir } 380*cdf0e10cSrcweir } 381*cdf0e10cSrcweir catch( const Exception& ) 382*cdf0e10cSrcweir { 383*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 384*cdf0e10cSrcweir } 385*cdf0e10cSrcweir m_aUp.Enable(bEnable); 386*cdf0e10cSrcweir } 387*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 388*cdf0e10cSrcweir ::rtl::OUString OCollectionView::getName() const 389*cdf0e10cSrcweir { 390*cdf0e10cSrcweir return m_aName.GetText(); 391*cdf0e10cSrcweir } 392*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 393*cdf0e10cSrcweir //......................................................................... 394*cdf0e10cSrcweir } // namespace dbaui 395*cdf0e10cSrcweir //......................................................................... 396*cdf0e10cSrcweir 397*cdf0e10cSrcweir 398