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 #ifndef DBAUI_APPVIEW_HXX 28*cdf0e10cSrcweir #define DBAUI_APPVIEW_HXX 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir #ifndef DBAUI_DATAVIEW_HXX 31*cdf0e10cSrcweir #include "dataview.hxx" 32*cdf0e10cSrcweir #endif 33*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ 34*cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp> 35*cdf0e10cSrcweir #endif 36*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ 37*cdf0e10cSrcweir #include <com/sun/star/sdbc/XDatabaseMetaData.hpp> 38*cdf0e10cSrcweir #endif 39*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UCB_XCONTENT_HPP_ 40*cdf0e10cSrcweir #include <com/sun/star/ucb/XContent.hpp> 41*cdf0e10cSrcweir #endif 42*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDB_APPLICATION_NAMEDDATABASEOBJECT_HPP_ 43*cdf0e10cSrcweir #include <com/sun/star/sdb/application/NamedDatabaseObject.hpp> 44*cdf0e10cSrcweir #endif 45*cdf0e10cSrcweir #ifndef _SV_FIXED_HXX 46*cdf0e10cSrcweir #include <vcl/fixed.hxx> 47*cdf0e10cSrcweir #endif 48*cdf0e10cSrcweir #ifndef _UNOTOOLS_EVENTLISTENERADAPTER_HXX_ 49*cdf0e10cSrcweir #include <unotools/eventlisteneradapter.hxx> 50*cdf0e10cSrcweir #endif 51*cdf0e10cSrcweir #ifndef DBACCESS_TABLEDESIGN_ICLIPBOARDTEST_HXX 52*cdf0e10cSrcweir #include "IClipBoardTest.hxx" 53*cdf0e10cSrcweir #endif 54*cdf0e10cSrcweir #ifndef DBAUI_APPELEMENTTYPE_HXX 55*cdf0e10cSrcweir #include "AppElementType.hxx" 56*cdf0e10cSrcweir #endif 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir namespace com{ namespace sun { namespace star { namespace beans { class XPropertySet; } } } } 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir class Control; 61*cdf0e10cSrcweir class SvLBoxEntry; 62*cdf0e10cSrcweir class MnemonicGenerator; 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir namespace dbaui 65*cdf0e10cSrcweir { 66*cdf0e10cSrcweir class IControlActionListener; 67*cdf0e10cSrcweir class IApplicationController; 68*cdf0e10cSrcweir class OApplicationView; 69*cdf0e10cSrcweir class OApplicationDetailView; 70*cdf0e10cSrcweir class OApplicationSwapWindow; 71*cdf0e10cSrcweir class OTitleWindow; 72*cdf0e10cSrcweir //================================================================== 73*cdf0e10cSrcweir class OAppBorderWindow : public Window 74*cdf0e10cSrcweir { 75*cdf0e10cSrcweir OTitleWindow* m_pPanel; 76*cdf0e10cSrcweir OApplicationDetailView* m_pDetailView; 77*cdf0e10cSrcweir OApplicationView* m_pView; 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir void ImplInitSettings(); 80*cdf0e10cSrcweir protected: 81*cdf0e10cSrcweir // Window 82*cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 83*cdf0e10cSrcweir public: 84*cdf0e10cSrcweir OAppBorderWindow(OApplicationView* _pParent,PreviewMode _ePreviewMode); 85*cdf0e10cSrcweir virtual ~OAppBorderWindow(); 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir // window overloads 88*cdf0e10cSrcweir virtual void GetFocus(); 89*cdf0e10cSrcweir virtual void Resize(); 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir OApplicationView* getView() const; 92*cdf0e10cSrcweir OApplicationSwapWindow* getPanel() const; 93*cdf0e10cSrcweir OApplicationDetailView* getDetailView() const; 94*cdf0e10cSrcweir }; 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir //================================================================== 97*cdf0e10cSrcweir class OApplicationView : public ODataView 98*cdf0e10cSrcweir ,public IClipboardTest 99*cdf0e10cSrcweir ,public ::utl::OEventListenerAdapter 100*cdf0e10cSrcweir { 101*cdf0e10cSrcweir enum ChildFocusState 102*cdf0e10cSrcweir { 103*cdf0e10cSrcweir PANELSWAP, 104*cdf0e10cSrcweir DETAIL, 105*cdf0e10cSrcweir NONE 106*cdf0e10cSrcweir }; 107*cdf0e10cSrcweir private: 108*cdf0e10cSrcweir ::com::sun::star::lang::Locale m_aLocale; 109*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > 110*cdf0e10cSrcweir m_xObject; 111*cdf0e10cSrcweir OAppBorderWindow* m_pWin; 112*cdf0e10cSrcweir IApplicationController& m_rAppController; 113*cdf0e10cSrcweir ChildFocusState m_eChildFocus; 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir IClipboardTest* getActiveChild() const; 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir void ImplInitSettings(); 118*cdf0e10cSrcweir protected: 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir // return the Rectangle where I can paint myself 122*cdf0e10cSrcweir virtual void resizeDocumentView(Rectangle& rRect); 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir // OEventListenerAdapter 125*cdf0e10cSrcweir virtual void _disposing( const ::com::sun::star::lang::EventObject& _rSource ); 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir // Window 128*cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 129*cdf0e10cSrcweir public: 130*cdf0e10cSrcweir OApplicationView( Window* pParent 131*cdf0e10cSrcweir ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& 132*cdf0e10cSrcweir ,IApplicationController& _rAppController 133*cdf0e10cSrcweir ,PreviewMode _ePreviewMode 134*cdf0e10cSrcweir ); 135*cdf0e10cSrcweir virtual ~OApplicationView(); 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir /// automatically creates mnemonics for the icon/texts in our left hand side panel 138*cdf0e10cSrcweir void createIconAutoMnemonics( MnemonicGenerator& _rMnemonics ); 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir /// automatically creates mnemonics for the texts in our task pane 141*cdf0e10cSrcweir void setTaskExternalMnemonics( MnemonicGenerator& _rMnemonics ); 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir // window overloads 144*cdf0e10cSrcweir virtual long PreNotify( NotifyEvent& rNEvt ); 145*cdf0e10cSrcweir virtual void GetFocus(); 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir inline IApplicationController& getAppController() const { return m_rAppController; } 148*cdf0e10cSrcweir inline const ::com::sun::star::lang::Locale& getLocale() const { return m_aLocale;} 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir // IClipboardTest 151*cdf0e10cSrcweir virtual sal_Bool isCutAllowed(); 152*cdf0e10cSrcweir virtual sal_Bool isCopyAllowed(); 153*cdf0e10cSrcweir virtual sal_Bool isPasteAllowed(); 154*cdf0e10cSrcweir virtual sal_Bool hasChildPathFocus() { return HasChildPathFocus(); } 155*cdf0e10cSrcweir virtual void copy(); 156*cdf0e10cSrcweir virtual void cut(); 157*cdf0e10cSrcweir virtual void paste(); 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir /// get the left panel 160*cdf0e10cSrcweir inline OApplicationSwapWindow* getPanel() const { return m_pWin->getPanel(); } 161*cdf0e10cSrcweir /// get the detail page 162*cdf0e10cSrcweir inline OApplicationDetailView* getDetailView() const { return m_pWin->getDetailView(); } 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir /** return the qualified name. 165*cdf0e10cSrcweir @param _pEntry 166*cdf0e10cSrcweir The entry of a table, or query, form, report to get the qualified name. 167*cdf0e10cSrcweir If the entry is <NULL/>, the first selected is chosen. 168*cdf0e10cSrcweir @return 169*cdf0e10cSrcweir the qualified name 170*cdf0e10cSrcweir */ 171*cdf0e10cSrcweir ::rtl::OUString getQualifiedName( SvLBoxEntry* _pEntry ) const; 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir /** returns if an entry is a leaf 174*cdf0e10cSrcweir @param _pEntry 175*cdf0e10cSrcweir The entry to check 176*cdf0e10cSrcweir @return 177*cdf0e10cSrcweir <TRUE/> if the entry is a leaf, otherwise <FALSE/> 178*cdf0e10cSrcweir */ 179*cdf0e10cSrcweir sal_Bool isLeaf(SvLBoxEntry* _pEntry) const; 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir /** returns if one of the selected entries is a leaf 182*cdf0e10cSrcweir @return 183*cdf0e10cSrcweir <TRUE/> if the entry is a leaf, otherwise <FALSE/> 184*cdf0e10cSrcweir */ 185*cdf0e10cSrcweir sal_Bool isALeafSelected() const; 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir /** select all entries in the detail page 188*cdf0e10cSrcweir */ 189*cdf0e10cSrcweir void selectAll(); 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir /// returns <TRUE/> if it sorts ascending 192*cdf0e10cSrcweir sal_Bool isSortUp() const; 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir /// sort the entries in the detail page down 195*cdf0e10cSrcweir void sortDown(); 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir /// sort the entries in the detail page up 198*cdf0e10cSrcweir void sortUp(); 199*cdf0e10cSrcweir 200*cdf0e10cSrcweir /// returns <TRUE/> when a detail page was filled 201*cdf0e10cSrcweir sal_Bool isFilled() const; 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir /// return the element of currently select entry 204*cdf0e10cSrcweir ElementType getElementType() const; 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir /// returns the count of entries 207*cdf0e10cSrcweir sal_Int32 getElementCount(); 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir /// returns the count of selected entries 210*cdf0e10cSrcweir sal_Int32 getSelectionCount(); 211*cdf0e10cSrcweir 212*cdf0e10cSrcweir /** clears the detail page and the selection on the left side. 213*cdf0e10cSrcweir @param _bTaskAlso 214*cdf0e10cSrcweir If <TRUE/> the task window will also be cleared. 215*cdf0e10cSrcweir */ 216*cdf0e10cSrcweir void clearPages(sal_Bool _bTaskAlso = sal_True); 217*cdf0e10cSrcweir 218*cdf0e10cSrcweir /** returns the element names which are selected 219*cdf0e10cSrcweir @param _rNames 220*cdf0e10cSrcweir The list will be filled. 221*cdf0e10cSrcweir */ 222*cdf0e10cSrcweir void getSelectionElementNames( ::std::vector< ::rtl::OUString>& _rNames ) const; 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir /** describes the current selection for the given control 225*cdf0e10cSrcweir */ 226*cdf0e10cSrcweir void describeCurrentSelectionForControl( 227*cdf0e10cSrcweir const Control& _rControl, 228*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::sdb::application::NamedDatabaseObject >& _out_rSelectedObjects 229*cdf0e10cSrcweir ); 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir /** describes the current selection for the given ElementType 232*cdf0e10cSrcweir */ 233*cdf0e10cSrcweir void describeCurrentSelectionForType( 234*cdf0e10cSrcweir const ElementType _eType, 235*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::sdb::application::NamedDatabaseObject >& _out_rSelectedObjects 236*cdf0e10cSrcweir ); 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir /** select all names on the currently selected container. Non existence names where ignored. 239*cdf0e10cSrcweir * 240*cdf0e10cSrcweir * \param _aNames the element names 241*cdf0e10cSrcweir */ 242*cdf0e10cSrcweir void selectElements(const ::com::sun::star::uno::Sequence< ::rtl::OUString>& _aNames); 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir /** adds a new object to the detail page. 245*cdf0e10cSrcweir @param _eType 246*cdf0e10cSrcweir The type where the entry shold be appended. 247*cdf0e10cSrcweir @param _rName 248*cdf0e10cSrcweir The name of the object to be inserted 249*cdf0e10cSrcweir @param _rObject 250*cdf0e10cSrcweir The object to add. 251*cdf0e10cSrcweir @param _rxConn 252*cdf0e10cSrcweir If we insert a table, the connection must be set. 253*cdf0e10cSrcweir */ 254*cdf0e10cSrcweir SvLBoxEntry* elementAdded(ElementType _eType 255*cdf0e10cSrcweir ,const ::rtl::OUString& _rName 256*cdf0e10cSrcweir ,const ::com::sun::star::uno::Any& _rObject ); 257*cdf0e10cSrcweir 258*cdf0e10cSrcweir /** replaces a objects name with a new one 259*cdf0e10cSrcweir @param _eType 260*cdf0e10cSrcweir The type where the entry shold be appended. 261*cdf0e10cSrcweir @param _rOldName 262*cdf0e10cSrcweir The old name of the object to be replaced 263*cdf0e10cSrcweir @param _rNewName 264*cdf0e10cSrcweir The new name of the object to be replaced 265*cdf0e10cSrcweir @param _rxConn 266*cdf0e10cSrcweir If we insert a table, the connection must be set. 267*cdf0e10cSrcweir @param _xObject 268*cdf0e10cSrcweir The object which was replaced 269*cdf0e10cSrcweir */ 270*cdf0e10cSrcweir void elementReplaced(ElementType eType 271*cdf0e10cSrcweir ,const ::rtl::OUString& _rOldName 272*cdf0e10cSrcweir ,const ::rtl::OUString& _rNewName ); 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir /** removes an element from the detail page. 275*cdf0e10cSrcweir @param _eType 276*cdf0e10cSrcweir The type where the entry shold be appended. 277*cdf0e10cSrcweir @param _rName 278*cdf0e10cSrcweir The name of the element to be removed. 279*cdf0e10cSrcweir @param _rxConn 280*cdf0e10cSrcweir If we remove a table, the connection must be set. 281*cdf0e10cSrcweir */ 282*cdf0e10cSrcweir void elementRemoved(ElementType _eType 283*cdf0e10cSrcweir ,const ::rtl::OUString& _rName ); 284*cdf0e10cSrcweir 285*cdf0e10cSrcweir 286*cdf0e10cSrcweir /** changes the container which should be displayed. The select handler will also be called. 287*cdf0e10cSrcweir @param _eType 288*cdf0e10cSrcweir Which container to show. 289*cdf0e10cSrcweir */ 290*cdf0e10cSrcweir void selectContainer(ElementType _eType); 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir /// returns the preview mode 293*cdf0e10cSrcweir PreviewMode getPreviewMode(); 294*cdf0e10cSrcweir 295*cdf0e10cSrcweir /// <TRUE/> if the preview is enabled 296*cdf0e10cSrcweir sal_Bool isPreviewEnabled(); 297*cdf0e10cSrcweir 298*cdf0e10cSrcweir /** switches to the given preview mode 299*cdf0e10cSrcweir @param _eMode 300*cdf0e10cSrcweir the mode to set for the preview 301*cdf0e10cSrcweir */ 302*cdf0e10cSrcweir void switchPreview(PreviewMode _eMode); 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir /** shows the Preview of the content when it is enabled. 305*cdf0e10cSrcweir @param _xContent 306*cdf0e10cSrcweir The content which must support the "preview" command. 307*cdf0e10cSrcweir */ 308*cdf0e10cSrcweir void showPreview(const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent >& _xContent); 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir /** shows the Preview of a table or query 311*cdf0e10cSrcweir @param _sDataSourceName 312*cdf0e10cSrcweir the name of the data source 313*cdf0e10cSrcweir @param _xConnection 314*cdf0e10cSrcweir the connection which will be shared 315*cdf0e10cSrcweir @param _sName 316*cdf0e10cSrcweir the name of table or query 317*cdf0e10cSrcweir @param _bTable 318*cdf0e10cSrcweir <TRUE/> if it is a table, otherwise <FALSE/> 319*cdf0e10cSrcweir @return void 320*cdf0e10cSrcweir */ 321*cdf0e10cSrcweir void showPreview( const ::rtl::OUString& _sDataSourceName, 322*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection, 323*cdf0e10cSrcweir const ::rtl::OUString& _sName, 324*cdf0e10cSrcweir sal_Bool _bTable); 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir SvLBoxEntry* getEntry( const Point& _aPosPixel ) const; 327*cdf0e10cSrcweir 328*cdf0e10cSrcweir DECL_LINK( SwitchHdl, Accelerator* ); 329*cdf0e10cSrcweir }; 330*cdf0e10cSrcweir } 331*cdf0e10cSrcweir #endif // DBAUI_APPVIEW_HXX 332*cdf0e10cSrcweir 333