diff options
Diffstat (limited to 'extensions/source/bibliography')
39 files changed, 0 insertions, 10387 deletions
diff --git a/extensions/source/bibliography/bib.component b/extensions/source/bibliography/bib.component deleted file mode 100644 index 98627854d..000000000 --- a/extensions/source/bibliography/bib.component +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!--********************************************************************** -* -* 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 -* <http://www.openoffice.org/license.html> -* for a copy of the LGPLv3 License. -* -**********************************************************************--> - -<component loader="com.sun.star.loader.SharedLibrary" - xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.extensions.Bibliography"> - <service name="com.sun.star.frame.Bibliography"/> - <service name="com.sun.star.frame.FrameLoader"/> - </implementation> -</component> diff --git a/extensions/source/bibliography/bib.hrc b/extensions/source/bibliography/bib.hrc deleted file mode 100644 index 01715258d..000000000 --- a/extensions/source/bibliography/bib.hrc +++ /dev/null @@ -1,110 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef BIB_HRC -#define BIB_HRC - -#include "bibliography.hrc" -#include <svl/solar.hrc> -#ifndef RID_BIB_START -#define RID_BIB_START RID_EXTENSIONS_START -#endif - -// ResIDs - -//Dialogs (100) -#define RID_BIB_DIALOG (RID_BIB_START) -#define RID_TP_GENERAL (RID_BIB_DIALOG) -#define RID_DLG_MAPPING (RID_BIB_DIALOG + 1) -#define RID_DLG_DBCHANGE (RID_BIB_DIALOG + 2) - -//Controls(100) -#define RID_BIB_CONTROLS (RID_BIB_START + 100) -#define RID_BIB_TOOLBAR (RID_BIB_CONTROLS+ 1) -#define RID_TOOLBAR_IMGLIST (RID_BIB_CONTROLS+ 2) -// free -#define RID_TOOLBAR_BIGIMGLIST (RID_BIB_CONTROLS+ 4) - -//Menu(100) -#define RID_BIB_MENU (RID_BIB_CONTROLS + 100) -#define RID_MAIN_MENU (RID_BIB_MENU +1) -//#define RID_MAIN_ME_HIERARCHICAL (RID_BIB_MENU +2) -#define RID_MAIN_ME_NEWENTRY (RID_BIB_MENU +3) -#define RID_MAIN_ME_CHANGEENTRY (RID_BIB_MENU +4) -#define RID_MAIN_ME_REMOVEENTRY (RID_BIB_MENU +5) -#define RID_MAIN_ME_SEARCH (RID_BIB_MENU +6) -#define RID_MAIN_ME_FIELDDLG (RID_BIB_MENU +7) -//#define RID_MAIN_ME_LAYOUT (RID_BIB_MENU +8) -#define RID_MAIN_ME_MAPPING (RID_BIB_MENU +9) -#define RID_MAIN_ME_DBSOURCE (RID_BIB_MENU +10) -#define RID_MAIN_DELETE_RECORD (RID_BIB_MENU +11) -#define RID_MAIN_INSERT_RECORD (RID_BIB_MENU +12) -#define MN_TEMPLATES (RID_BIB_MENU +13) // to make makro ITEM_FILE_DOCTEMPLATE happy... - -#define RID_POPUP_ME_VIEW (RID_BIB_MENU +50) - -// Strings (500) -#define RID_BIB_STRING (RID_BIB_START + 200) - // FREE (RID_BIB_STRING + 1) -#define RID_BIB_STR_FIELDSELECTION (RID_BIB_STRING + 2) -#define RID_BIB_STR_TABWIN_PREFIX (RID_BIB_STRING + 3) -#define RID_BIB_STR_FRAME_TITLE (RID_BIB_STRING + 4) -#define RID_MAP_QUESTION (RID_BIB_STRING + 5) - -#define ST_IDENTIFIER (RID_BIB_STRING + 6) -#define ST_AUTHTYPE (RID_BIB_STRING + 7) -#define ST_AUTHOR (RID_BIB_STRING + 8) -#define ST_YEAR (RID_BIB_STRING + 9) -#define ST_ISBN (RID_BIB_STRING + 10) -#define ST_MONTH (RID_BIB_STRING + 11) -#define ST_PUBLISHER (RID_BIB_STRING + 12) -#define ST_ADDRESS (RID_BIB_STRING + 13) -#define ST_ANNOTE (RID_BIB_STRING + 14) -#define ST_BOOKTITLE (RID_BIB_STRING + 15) -#define ST_CHAPTER (RID_BIB_STRING + 16) -#define ST_EDITION (RID_BIB_STRING + 17) -#define ST_EDITOR (RID_BIB_STRING + 18) -#define ST_HOWPUBLISHED (RID_BIB_STRING + 19) -#define ST_INSTITUTION (RID_BIB_STRING + 20) -#define ST_JOURNAL (RID_BIB_STRING + 21) -#define ST_NOTE (RID_BIB_STRING + 22) -#define ST_NUMBER (RID_BIB_STRING + 23) -#define ST_ORGANIZATION (RID_BIB_STRING + 24) -#define ST_PAGE (RID_BIB_STRING + 25) -#define ST_SCHOOL (RID_BIB_STRING + 26) -#define ST_SERIES (RID_BIB_STRING + 27) -#define ST_TITLE (RID_BIB_STRING + 28) -#define ST_REPORT (RID_BIB_STRING + 29) -#define ST_VOLUME (RID_BIB_STRING + 30) -#define ST_URL (RID_BIB_STRING + 31) -#define ST_CUSTOM1 (RID_BIB_STRING + 32) -#define ST_CUSTOM2 (RID_BIB_STRING + 33) -#define ST_CUSTOM3 (RID_BIB_STRING + 34) -#define ST_CUSTOM4 (RID_BIB_STRING + 35) -#define ST_CUSTOM5 (RID_BIB_STRING + 36) - - -#endif diff --git a/extensions/source/bibliography/bib.src b/extensions/source/bibliography/bib.src deleted file mode 100644 index 1492de7b6..000000000 --- a/extensions/source/bibliography/bib.src +++ /dev/null @@ -1,74 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "bib.hrc" - -String RID_BIB_STR_FIELDSELECTION -{ - Text [ en-US ] = "Field selection:"; -}; - -String RID_BIB_STR_TABWIN_PREFIX -{ - Text [ en-US ] = "Table;Query;Sql;Sql [Native]"; -}; -String RID_BIB_STR_FRAME_TITLE -{ - Text [ en-US ] = "Bibliography Database"; -}; -String RID_MAP_QUESTION -{ - Text [ en-US ] = "Do you want to edit the column arrangement?"; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/extensions/source/bibliography/bibbeam.cxx b/extensions/source/bibliography/bibbeam.cxx deleted file mode 100644 index 4ff1ee5b1..000000000 --- a/extensions/source/bibliography/bibbeam.cxx +++ /dev/null @@ -1,322 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include <osl/mutex.hxx> -#include <tools/urlobj.hxx> -#include <toolkit/helper/vclunohelper.hxx> -#include <comphelper/processfactory.hxx> -#include <com/sun/star/awt/PosSize.hpp> -#include <com/sun/star/frame/XDispatch.hpp> -#include <com/sun/star/util/XURLTransformer.hpp> - -#include "bibliography.hrc" -#include <vcl/lstbox.hxx> -#include <vcl/edit.hxx> -#include <tools/debug.hxx> -#include "bibbeam.hxx" -#include "toolbar.hrc" -#include "bibresid.hxx" -#include "datman.hxx" -#include "bibtools.hxx" - -using namespace ::com::sun::star; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::uno; - -using ::rtl::OUString; - -#define C2U(cChar) OUString::createFromAscii(cChar) - -#define PROPERTY_FRAME 1 -#define ID_TOOLBAR 1 -#define ID_GRIDWIN 2 - -//......................................................................... -namespace bib -{ -//......................................................................... - - using namespace ::com::sun::star::uno; - - void HandleTaskPaneList( Window* pWindow, sal_Bool bAddToList ) - { - Window* pParent = pWindow->GetParent(); - - DBG_ASSERT( pParent, "-GetTaskPaneList(): everybody here should have a parent!" ); - - SystemWindow* pSysWin = pParent->GetSystemWindow(); - if( pSysWin ) - { - TaskPaneList* pTaskPaneList = pSysWin->GetTaskPaneList(); - if( pTaskPaneList ) - { - if( bAddToList ) - pTaskPaneList->AddWindow( pWindow ); - else - pTaskPaneList->RemoveWindow( pWindow ); - } - } - } - - //===================================================================== - //= BibGridwin - //===================================================================== - class BibGridwin - :public Window //DockingWindow - { - private: - Reference< awt::XWindow > m_xGridWin; - Reference< awt::XControlModel > m_xGridModel; - Reference< awt::XControl > m_xControl; - Reference< awt::XControlContainer > m_xControlContainer; - // #100312# --------- - Reference< frame::XDispatchProviderInterception> m_xDispatchProviderInterception; - - protected: - - virtual void Resize(); - - public: - - BibGridwin(Window* pParent, WinBits nStyle = WB_3DLOOK ); - ~BibGridwin(); - - void createGridWin(const Reference< awt::XControlModel > & xDbForm); - void disposeGridWin(); - - const Reference< awt::XControlContainer >& getControlContainer() const { return m_xControlContainer; } - // #100312# --------- - const Reference< frame::XDispatchProviderInterception>& getDispatchProviderInterception() const { return m_xDispatchProviderInterception; } - - virtual void GetFocus(); - }; - - //--------------------------------------------------------------------- - BibGridwin::BibGridwin( Window* _pParent, WinBits _nStyle ) : Window( _pParent, _nStyle ) - { - m_xControlContainer = VCLUnoHelper::CreateControlContainer(this); - - AddToTaskPaneList( this ); - } - - //--------------------------------------------------------------------- - BibGridwin::~BibGridwin() - { - RemoveFromTaskPaneList( this ); - - disposeGridWin(); - } - - //--------------------------------------------------------------------- - void BibGridwin::Resize() - { - if(m_xGridWin.is()) - { - ::Size aSize = GetOutputSizePixel(); - m_xGridWin->setPosSize(0, 0, aSize.Width(),aSize.Height(), awt::PosSize::SIZE); - } - } - - //--------------------------------------------------------------------- - void BibGridwin::createGridWin(const uno::Reference< awt::XControlModel > & xGModel) - { - m_xGridModel = xGModel; - - if( m_xControlContainer.is()) - { - uno::Reference< lang::XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); - - if ( m_xGridModel.is() && xMgr.is()) - { - uno::Reference< XPropertySet > xPropSet( m_xGridModel, UNO_QUERY ); - - if ( xPropSet.is() && m_xGridModel.is() ) - { - uno::Any aAny = xPropSet->getPropertyValue( C2U("DefaultControl") ); - rtl::OUString aControlName; - aAny >>= aControlName; - - m_xControl = Reference< awt::XControl > (xMgr->createInstance( aControlName ), UNO_QUERY ); - DBG_ASSERT( m_xControl.is(), "no GridControl created" ); - if ( m_xControl.is() ) - m_xControl->setModel( m_xGridModel ); - } - - if ( m_xControl.is() ) - { - // Peer als Child zu dem FrameWindow - m_xControlContainer->addControl(C2U("GridControl"), m_xControl); - m_xGridWin=uno::Reference< awt::XWindow > (m_xControl, UNO_QUERY ); - // #100312# ----- - m_xDispatchProviderInterception=uno::Reference< frame::XDispatchProviderInterception > (m_xControl, UNO_QUERY ); - m_xGridWin->setVisible( sal_True ); - m_xControl->setDesignMode( sal_True ); - // initially switch on the desing mode - switch it off _after_ loading the form - - ::Size aSize = GetOutputSizePixel(); - m_xGridWin->setPosSize(0, 0, aSize.Width(),aSize.Height(), awt::PosSize::POSSIZE); - } - } - } - } - - //--------------------------------------------------------------------- - void BibGridwin::disposeGridWin() - { - if ( m_xControl.is() ) - { - Reference< awt::XControl > xDel( m_xControl ); - m_xControl = NULL; - m_xGridWin = NULL; - - m_xControlContainer->removeControl( xDel ); - xDel->dispose(); - } - } - - //--------------------------------------------------------------------- - void BibGridwin::GetFocus() - { - if(m_xGridWin.is()) - m_xGridWin->setFocus(); - } - - //--------------------------------------------------------------------- - BibBeamer::BibBeamer( Window* _pParent, BibDataManager* _pDM, WinBits _nStyle ) - :BibSplitWindow( _pParent, _nStyle | WB_NOSPLITDRAW ) - ,pDatMan( _pDM ) - ,pToolBar( NULL ) - ,pGridWin( NULL ) - { - createToolBar(); - createGridWin(); - if ( pDatMan ) - pDatMan->SetToolbar(pToolBar); - pGridWin->Show(); - - if ( pDatMan ) - connectForm( pDatMan ); - } - - //--------------------------------------------------------------------- - BibBeamer::~BibBeamer() - { - if ( isFormConnected() ) - disconnectForm(); - - if ( m_xToolBarRef.is() ) - m_xToolBarRef->dispose(); - - if ( pToolBar ) - { - if ( pDatMan ) - pDatMan->SetToolbar(0); - - DELETEZ( pToolBar ); - } - - if( pGridWin ) - { - BibGridwin* pDel = pGridWin; - pGridWin = NULL; - pDel->disposeGridWin(); - delete pDel; - } - - } - - //--------------------------------------------------------------------- - void BibBeamer::createToolBar() - { - pToolBar= new BibToolBar(this, LINK( this, BibBeamer, RecalcLayout_Impl )); - ::Size aSize=pToolBar->GetSizePixel(); - InsertItem(ID_TOOLBAR, pToolBar, aSize.Height(), 0, 0, SWIB_FIXED ); - if ( m_xController.is() ) - pToolBar->SetXController( m_xController ); - } - - //--------------------------------------------------------------------- - void BibBeamer::createGridWin() - { - pGridWin = new BibGridwin(this,0); - - InsertItem(ID_GRIDWIN, pGridWin, 40, 1, 0, SWIB_RELATIVESIZE ); - - pGridWin->createGridWin( pDatMan->updateGridModel() ); - } - - //--------------------------------------------------------------------- - Reference< awt::XControlContainer > BibBeamer::getControlContainer() - { - Reference< awt::XControlContainer > xReturn; - if ( pGridWin ) - xReturn = pGridWin->getControlContainer(); - return xReturn; - } - - // #100312# ----------------------------------------------------------- - Reference< frame::XDispatchProviderInterception > BibBeamer::getDispatchProviderInterception() - { - Reference< frame::XDispatchProviderInterception > xReturn; - if ( pGridWin ) - xReturn = pGridWin->getDispatchProviderInterception(); - return xReturn; - } - - //--------------------------------------------------------------------- - void BibBeamer::SetXController(const uno::Reference< frame::XController > & xCtr) - { - m_xController = xCtr; - - if ( pToolBar ) - pToolBar->SetXController( m_xController ); - - } - - //--------------------------------------------------------------------- - void BibBeamer::GetFocus() - { - if( pGridWin ) - pGridWin->GrabFocus(); - } - - //--------------------------------------------------------------------- - IMPL_LINK( BibBeamer, RecalcLayout_Impl, void*, /*pVoid*/ ) - { - long nHeight = pToolBar->GetSizePixel().Height(); - SetItemSize( ID_TOOLBAR, nHeight ); - return 0L; - } - -//......................................................................... -} // namespace bib -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibbeam.hxx b/extensions/source/bibliography/bibbeam.hxx deleted file mode 100644 index c9742b38b..000000000 --- a/extensions/source/bibliography/bibbeam.hxx +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ADRBEAM_HXX -#define ADRBEAM_HXX - -#include <com/sun/star/awt/XControlContainer.hpp> -#include <com/sun/star/awt/XControl.hpp> -#include <com/sun/star/awt/XControlModel.hpp> -#include <com/sun/star/form/XForm.hpp> -// #100312# ----------------- -#include <com/sun/star/frame/XDispatchProviderInterception.hpp> -#include <cppuhelper/implbase1.hxx> // helper for implementations -#include <vcl/splitwin.hxx> -#include "toolbar.hxx" -#include "formcontrolcontainer.hxx" -#include "bibshortcuthandler.hxx" - -class BibDataManager; - -//......................................................................... -namespace bib -{ -//......................................................................... - - class BibGridwin; - class BibBeamer - :public BibSplitWindow - ,public FormControlContainer - { - private: - - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > m_xController; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xToolBarRef; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xGridRef; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xGridWin; - - BibDataManager* pDatMan; - BibToolBar* pToolBar; - BibGridwin* pGridWin; - - DECL_LINK( RecalcLayout_Impl, void* ); - - protected: - - void createToolBar(); - void createGridWin(); - - // FormControlContainer ---------- - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > - getControlContainer(); - public: - // #100312# ------------------- - virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception > - getDispatchProviderInterception(); - - BibBeamer(Window* pParent,BibDataManager* pDatMan, WinBits nStyle = WB_3DLOOK ); - ~BibBeamer(); - - void SetXController(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > &); - - virtual void GetFocus(); - }; - -//......................................................................... -} // namespace bib -//......................................................................... - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibconfig.cxx b/extensions/source/bibliography/bibconfig.cxx deleted file mode 100644 index 5cfdbcf2f..000000000 --- a/extensions/source/bibliography/bibconfig.cxx +++ /dev/null @@ -1,370 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include <bibconfig.hxx> -#include <svl/svarray.hxx> -#include <tools/debug.hxx> -#include <com/sun/star/uno/Sequence.hxx> -#include <com/sun/star/uno/Any.hxx> -#include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <comphelper/processfactory.hxx> - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; - -using ::rtl::OUString; - -typedef Mapping* MappingPtr; -SV_DECL_PTRARR_DEL(MappingArray, MappingPtr, 2, 2) -SV_IMPL_PTRARR(MappingArray, MappingPtr); - -#define C2U(cChar) OUString::createFromAscii(cChar) - -const char* cDataSourceHistory = "DataSourceHistory"; - -Sequence<OUString> BibConfig::GetPropertyNames() -{ - static Sequence<OUString> aNames; - if(!aNames.getLength()) - { - aNames.realloc(8); - OUString* pNames = aNames.getArray(); - pNames[0] = C2U("CurrentDataSource/DataSourceName"); - pNames[1] = C2U("CurrentDataSource/Command"); - pNames[2] = C2U("CurrentDataSource/CommandType"); - pNames[3] = C2U("BeamerHeight"); - pNames[4] = C2U("ViewHeight"); - pNames[5] = C2U("QueryText"); - pNames[6] = C2U("QueryField"); - pNames[7] = C2U("ShowColumnAssignmentWarning"); - } - return aNames; -} - -BibConfig::BibConfig() : - ConfigItem(C2U("Office.DataAccess/Bibliography"), CONFIG_MODE_DELAYED_UPDATE), - pMappingsArr(new MappingArray), - nBeamerSize(0), - nViewSize(0), - bShowColumnAssignmentWarning(sal_False) -{ - //Names of the default columns - aColumnDefaults[0] = C2U("Identifier"); - aColumnDefaults[1] = C2U("BibliographyType"); - aColumnDefaults[2] = C2U("Author"); - aColumnDefaults[3] = C2U("Title"); - aColumnDefaults[4] = C2U("Year"); - aColumnDefaults[5] = C2U("ISBN"); - aColumnDefaults[6] = C2U("Booktitle"); - aColumnDefaults[7] = C2U("Chapter"); - aColumnDefaults[8] = C2U("Edition"); - aColumnDefaults[9] = C2U("Editor"); - aColumnDefaults[10] = C2U("Howpublished"); - aColumnDefaults[11] = C2U("Institution"); - aColumnDefaults[12] = C2U("Journal"); - aColumnDefaults[13] = C2U("Month"); - aColumnDefaults[14] = C2U("Note"); - aColumnDefaults[15] = C2U("Annote"); - aColumnDefaults[16] = C2U("Number"); - aColumnDefaults[17] = C2U("Organizations"); - aColumnDefaults[18] = C2U("Pages"); - aColumnDefaults[19] = C2U("Publisher"); - aColumnDefaults[20] = C2U("Address"); - aColumnDefaults[21] = C2U("School"); - aColumnDefaults[22] = C2U("Series"); - aColumnDefaults[23] = C2U("ReportType"); - aColumnDefaults[24] = C2U("Volume"); - aColumnDefaults[25] = C2U("URL"); - aColumnDefaults[26] = C2U("Custom1"); - aColumnDefaults[27] = C2U("Custom2"); - aColumnDefaults[28] = C2U("Custom3"); - aColumnDefaults[29] = C2U("Custom4"); - aColumnDefaults[30] = C2U("Custom5"); - - - const Sequence< OUString > aPropertyNames = GetPropertyNames(); - const Sequence<Any> aPropertyValues = GetProperties( aPropertyNames ); - const Any* pValues = aPropertyValues.getConstArray(); - if(aPropertyValues.getLength() == aPropertyNames.getLength()) - { - for(int nProp = 0; nProp < aPropertyNames.getLength(); nProp++) - { - if(pValues[nProp].hasValue()) - { - switch(nProp) - { - case 0: pValues[nProp] >>= sDataSource; break; - case 1: pValues[nProp] >>= sTableOrQuery; break; - case 2: pValues[nProp] >>= nTblOrQuery; break; - case 3: pValues[nProp] >>= nBeamerSize; break; - case 4: pValues[nProp] >>= nViewSize ; break; - case 5: pValues[nProp] >>= sQueryText ; break; - case 6: pValues[nProp] >>= sQueryField; break; - case 7: - bShowColumnAssignmentWarning = *(sal_Bool*)pValues[nProp].getValue(); - break; - } - } - } - } - OUString sName(C2U("DataSourceName")); - OUString sTable(C2U("Command")); - OUString sCommandType(C2U("CommandType")); - Sequence< OUString > aNodeNames = GetNodeNames(C2U(cDataSourceHistory)); - const OUString* pNodeNames = aNodeNames.getConstArray(); - for(sal_Int32 nNode = 0; nNode < aNodeNames.getLength(); nNode++) - { - Sequence<OUString> aHistoryNames(3); - OUString* pHistoryNames = aHistoryNames.getArray(); - - OUString sPrefix(C2U(cDataSourceHistory)); - sPrefix += C2U("/"); - sPrefix += pNodeNames[nNode]; - sPrefix += C2U("/"); - pHistoryNames[0] = sPrefix; - pHistoryNames[0] += sName; - pHistoryNames[1] = sPrefix; - pHistoryNames[1] += sTable; - pHistoryNames[2] = sPrefix; - pHistoryNames[2] += sCommandType; - - Sequence<Any> aHistoryValues = GetProperties( aHistoryNames ); - const Any* pHistoryValues = aHistoryValues.getConstArray(); - - if(aHistoryValues.getLength() == aHistoryNames.getLength()) - { - Mapping* pMapping = new Mapping; - pHistoryValues[0] >>= pMapping->sURL; - pHistoryValues[1] >>= pMapping->sTableName; - pHistoryValues[2] >>= pMapping->nCommandType; - //field assignment is contained in another set - sPrefix += C2U("Fields"); - Sequence< OUString > aAssignmentNodeNames = GetNodeNames(sPrefix); - const OUString* pAssignmentNodeNames = aAssignmentNodeNames.getConstArray(); - Sequence<OUString> aAssignmentPropertyNames(aAssignmentNodeNames.getLength() * 2); - OUString* pAssignmentPropertyNames = aAssignmentPropertyNames.getArray(); - sal_Int16 nFieldIdx = 0; - for(sal_Int16 nField = 0; nField < aAssignmentNodeNames.getLength(); nField++) - { - OUString sSubPrefix(sPrefix); - sSubPrefix += C2U("/"); - sSubPrefix += pAssignmentNodeNames[nField]; - pAssignmentPropertyNames[nFieldIdx] = sSubPrefix; - pAssignmentPropertyNames[nFieldIdx++] += C2U("/ProgrammaticFieldName"); - pAssignmentPropertyNames[nFieldIdx] = sSubPrefix; - pAssignmentPropertyNames[nFieldIdx++] += C2U("/AssignedFieldName"); - } - Sequence<Any> aAssignmentValues = GetProperties(aAssignmentPropertyNames); - const Any* pAssignmentValues = aAssignmentValues.getConstArray(); - OUString sTempLogical; - OUString sTempReal; - sal_Int16 nSetMapping = 0; - nFieldIdx = 0; - for(sal_Int16 nFieldVal = 0; nFieldVal < aAssignmentValues.getLength() / 2; nFieldVal++) - { - pAssignmentValues[nFieldIdx++] >>= sTempLogical; - pAssignmentValues[nFieldIdx++] >>= sTempReal; - if(sTempLogical.getLength() && sTempReal.getLength()) - { - pMapping->aColumnPairs[nSetMapping].sLogicalColumnName = sTempLogical; - pMapping->aColumnPairs[nSetMapping++].sRealColumnName = sTempReal; - } - } - pMappingsArr->Insert(pMapping, pMappingsArr->Count()); - } - } -} - -BibConfig::~BibConfig() -{ - if(IsModified()) - Commit(); - delete pMappingsArr; -} - -BibDBDescriptor BibConfig::GetBibliographyURL() -{ - BibDBDescriptor aRet; - aRet.sDataSource = sDataSource; - aRet.sTableOrQuery = sTableOrQuery; - aRet.nCommandType = nTblOrQuery; - return aRet; -}; - -void BibConfig::SetBibliographyURL(const BibDBDescriptor& rDesc) -{ - sDataSource = rDesc.sDataSource; - sTableOrQuery = rDesc.sTableOrQuery; - nTblOrQuery = rDesc.nCommandType; - SetModified(); -}; -//--------------------------------------------------------------------------- -void BibConfig::Notify( const com::sun::star::uno::Sequence<rtl::OUString>& ) -{ -} - -void BibConfig::Commit() -{ - const Sequence<OUString> aPropertyNames = GetPropertyNames(); - Sequence<Any> aValues(aPropertyNames.getLength()); - Any* pValues = aValues.getArray(); - - for(int nProp = 0; nProp < aPropertyNames.getLength(); nProp++) - { - switch(nProp) - { - case 0: pValues[nProp] <<= sDataSource; break; - case 1: pValues[nProp] <<= sTableOrQuery; break; - case 2: pValues[nProp] <<= nTblOrQuery; break; - case 3: pValues[nProp] <<= nBeamerSize; break; - case 4: pValues[nProp] <<= nViewSize; break; - case 5: pValues[nProp] <<= sQueryText; break; - case 6: pValues[nProp] <<= sQueryField; break; - case 7: - pValues[nProp].setValue(&bShowColumnAssignmentWarning, ::getBooleanCppuType()); - break; - } - } - PutProperties(aPropertyNames, aValues); - ClearNodeSet( C2U(cDataSourceHistory)); - OUString sEmpty; - Sequence< PropertyValue > aNodeValues(pMappingsArr->Count() * 3); - PropertyValue* pNodeValues = aNodeValues.getArray(); - - sal_Int32 nIndex = 0; - OUString sName(C2U("DataSourceName")); - OUString sTable(C2U("Command")); - OUString sCommandType(C2U("CommandType")); - for(sal_Int32 i = 0; i < pMappingsArr->Count(); i++) - { - const Mapping* pMapping = pMappingsArr->GetObject((sal_uInt16)i); - OUString sPrefix(C2U(cDataSourceHistory)); - sPrefix += C2U("/_"); - sPrefix += OUString::valueOf(i); - sPrefix += C2U("/"); - pNodeValues[nIndex].Name = sPrefix; - pNodeValues[nIndex].Name += sName; - pNodeValues[nIndex++].Value <<= pMapping->sURL; - pNodeValues[nIndex].Name = sPrefix; - pNodeValues[nIndex].Name += sTable; - pNodeValues[nIndex++].Value <<= pMapping->sTableName; - pNodeValues[nIndex].Name = sPrefix; - pNodeValues[nIndex].Name += sCommandType; - pNodeValues[nIndex++].Value <<= pMapping->nCommandType; - SetSetProperties( C2U(cDataSourceHistory), aNodeValues); - - sPrefix += C2U("Fields"); - sal_Int32 nFieldAssignment = 0; - OUString sFieldName = C2U("/ProgrammaticFieldName"); - OUString sDatabaseFieldName = C2U("/AssignedFieldName"); - ClearNodeSet( sPrefix ); - - while(nFieldAssignment < COLUMN_COUNT && - pMapping->aColumnPairs[nFieldAssignment].sLogicalColumnName.getLength()) - { - OUString sSubPrefix(sPrefix); - sSubPrefix += C2U("/_"); - sSubPrefix += OUString::valueOf(nFieldAssignment); - Sequence< PropertyValue > aAssignmentValues(2); - PropertyValue* pAssignmentValues = aAssignmentValues.getArray(); - pAssignmentValues[0].Name = sSubPrefix; - pAssignmentValues[0].Name += sFieldName; - pAssignmentValues[0].Value <<= pMapping->aColumnPairs[nFieldAssignment].sLogicalColumnName; - pAssignmentValues[1].Name = sSubPrefix; - pAssignmentValues[1].Name += sDatabaseFieldName; - pAssignmentValues[1].Value <<= pMapping->aColumnPairs[nFieldAssignment].sRealColumnName; - SetSetProperties( sPrefix, aAssignmentValues ); - nFieldAssignment++; - } - } -} - -const Mapping* BibConfig::GetMapping(const BibDBDescriptor& rDesc) const -{ - for(sal_uInt16 i = 0; i < pMappingsArr->Count(); i++) - { - const Mapping* pMapping = pMappingsArr->GetObject(i); - sal_Bool bURLEqual = rDesc.sDataSource.equals(pMapping->sURL); - if(rDesc.sTableOrQuery == pMapping->sTableName && bURLEqual) - return pMapping; - } - return 0; -} - -void BibConfig::SetMapping(const BibDBDescriptor& rDesc, const Mapping* pSetMapping) -{ - for(sal_uInt16 i = 0; i < pMappingsArr->Count(); i++) - { - const Mapping* pMapping = pMappingsArr->GetObject(i); - sal_Bool bURLEqual = rDesc.sDataSource.equals(pMapping->sURL); - if(rDesc.sTableOrQuery == pMapping->sTableName && bURLEqual) - { - pMappingsArr->DeleteAndDestroy(i, 1); - break; - } - } - Mapping* pNew = new Mapping(*pSetMapping); - pMappingsArr->Insert(pNew, pMappingsArr->Count()); - SetModified(); -} - -DBChangeDialogConfig_Impl::DBChangeDialogConfig_Impl() -{ -} - -DBChangeDialogConfig_Impl::~DBChangeDialogConfig_Impl() -{ -} - -const Sequence<OUString>& DBChangeDialogConfig_Impl::GetDataSourceNames() -{ - if(!aSourceNames.getLength()) - { - Reference<XNameAccess> xDBContext; - Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); - if( xMgr.is() ) - { - Reference<XInterface> xInstance = xMgr->createInstance( C2U( "com.sun.star.sdb.DatabaseContext" )); - xDBContext = Reference<XNameAccess>(xInstance, UNO_QUERY) ; - } - if(xDBContext.is()) - { - aSourceNames = xDBContext->getElementNames(); - } - } - return aSourceNames; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibconfig.hxx b/extensions/source/bibliography/bibconfig.hxx deleted file mode 100644 index dd18549af..000000000 --- a/extensions/source/bibliography/bibconfig.hxx +++ /dev/null @@ -1,156 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BIBCONFIG_HXX -#define _BIBCONFIG_HXX - -#include <unotools/configitem.hxx> -class MappingArray; - -//----------------------------------------------------------------------------- -#define COLUMN_COUNT 31 -#define IDENTIFIER_POS 0 -#define AUTHORITYTYPE_POS 1 -#define AUTHOR_POS 2 -#define TITLE_POS 3 -#define YEAR_POS 4 -#define ISBN_POS 5 -#define BOOKTITLE_POS 6 -#define CHAPTER_POS 7 -#define EDITION_POS 8 -#define EDITOR_POS 9 -#define HOWPUBLISHED_POS 10 -#define INSTITUTION_POS 11 -#define JOURNAL_POS 12 -#define MONTH_POS 13 -#define NOTE_POS 14 -#define ANNOTE_POS 15 -#define NUMBER_POS 16 -#define ORGANIZATIONS_POS 17 -#define PAGES_POS 18 -#define PUBLISHER_POS 19 -#define ADDRESS_POS 20 -#define SCHOOL_POS 21 -#define SERIES_POS 22 -#define REPORTTYPE_POS 23 -#define VOLUME_POS 24 -#define URL_POS 25 -#define CUSTOM1_POS 26 -#define CUSTOM2_POS 27 -#define CUSTOM3_POS 28 -#define CUSTOM4_POS 29 -#define CUSTOM5_POS 30 -//----------------------------------------------------------------------------- -struct StringPair -{ - rtl::OUString sRealColumnName; - rtl::OUString sLogicalColumnName; -}; -//----------------------------------------------------------------------------- -struct Mapping -{ - rtl::OUString sTableName; - rtl::OUString sURL; - sal_Int16 nCommandType; - StringPair aColumnPairs[COLUMN_COUNT]; - - Mapping() : - nCommandType(0){} -}; -//----------------------------------------------------------------------------- -struct BibDBDescriptor -{ - rtl::OUString sDataSource; - rtl::OUString sTableOrQuery; - sal_Int32 nCommandType; -}; -//----------------------------------------------------------------------------- - -class BibConfig : public utl::ConfigItem -{ - rtl::OUString sDataSource; - rtl::OUString sTableOrQuery; - sal_Int32 nTblOrQuery; - - rtl::OUString sQueryField; - rtl::OUString sQueryText; - MappingArray* pMappingsArr; - long nBeamerSize; - long nViewSize; - sal_Bool bShowColumnAssignmentWarning; - - rtl::OUString aColumnDefaults[COLUMN_COUNT]; - - com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames(); -public: - BibConfig(); - ~BibConfig(); - - virtual void Commit(); - virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames); - - BibDBDescriptor GetBibliographyURL(); - void SetBibliographyURL(const BibDBDescriptor& rDesc); - - const Mapping* GetMapping(const BibDBDescriptor& rDesc) const; - void SetMapping(const BibDBDescriptor& rDesc, const Mapping* pMapping); - - const rtl::OUString& GetDefColumnName(sal_uInt16 nIndex) const - {return aColumnDefaults[nIndex];} - - - void setBeamerSize(long nSize) {SetModified(); nBeamerSize = nSize;} - long getBeamerSize()const {return nBeamerSize;} - void setViewSize(long nSize) {SetModified(); nViewSize = nSize;} - long getViewSize() {return nViewSize;} - - const rtl::OUString& getQueryField() const {return sQueryField;} - void setQueryField(const rtl::OUString& rSet) {SetModified(); sQueryField = rSet;} - - const rtl::OUString& getQueryText() const {return sQueryText;} - void setQueryText(const rtl::OUString& rSet) {SetModified(); sQueryText = rSet;} - - sal_Bool IsShowColumnAssignmentWarning() const - { return bShowColumnAssignmentWarning;} - void SetShowColumnAssignmentWarning(sal_Bool bSet) - { bShowColumnAssignmentWarning = bSet;} -}; - -class DBChangeDialogConfig_Impl -{ - com::sun::star::uno::Sequence<rtl::OUString> aSourceNames; -public: - DBChangeDialogConfig_Impl(); - ~DBChangeDialogConfig_Impl(); - - const com::sun::star::uno::Sequence<rtl::OUString>& GetDataSourceNames(); - -}; -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibcont.cxx b/extensions/source/bibliography/bibcont.cxx deleted file mode 100644 index 846a2edf3..000000000 --- a/extensions/source/bibliography/bibcont.cxx +++ /dev/null @@ -1,278 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include <osl/mutex.hxx> -#include <tools/urlobj.hxx> -#include <cppuhelper/weak.hxx> -#include <unotools/processfactory.hxx> -#include <toolkit/helper/vclunohelper.hxx> -#include <com/sun/star/awt/XWindow.hpp> -#include <com/sun/star/awt/XWindowPeer.hpp> -#include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/frame/FrameSearchFlag.hpp> -#include <com/sun/star/util/XURLTransformer.hpp> -#include "bibconfig.hxx" - - -#include "datman.hxx" -#include "bibcont.hxx" - - -BibShortCutHandler::~BibShortCutHandler() -{ -} - -sal_Bool BibShortCutHandler::HandleShortCutKey( const KeyEvent& ) -{ - return sal_False; -} - - -BibWindow::BibWindow( Window* pParent, WinBits nStyle ) : Window( pParent, nStyle ), BibShortCutHandler( this ) -{ -} - -BibWindow::~BibWindow() -{ -} - - -BibSplitWindow::BibSplitWindow( Window* pParent, WinBits nStyle ) : SplitWindow( pParent, nStyle ), BibShortCutHandler( this ) -{ -} - -BibSplitWindow::~BibSplitWindow() -{ -} - - -BibTabPage::BibTabPage( Window* pParent, const ResId& rResId ) : TabPage( pParent, rResId ), BibShortCutHandler( this ) -{ -} - -BibTabPage::~BibTabPage() -{ -} - - -using namespace osl; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::frame; -using namespace ::rtl; - -#define C2U(cChar) OUString::createFromAscii(cChar) -#define PROPERTY_FRAME 1 -//split window size is a percent value -#define WIN_MIN_HEIGHT 10 -#define WIN_STEP_SIZE 5 - -BibWindowContainer::BibWindowContainer( Window* pParent, BibShortCutHandler* pChildWin, WinBits nStyle ) : - BibWindow( pParent, nStyle ), - pChild( pChildWin ) -{ - if(pChild!=NULL) - { - Window* pChildWindow = GetChild(); - pChildWindow->SetParent(this); - pChildWindow->Show(); - pChildWindow->SetPosPixel(Point(0,0)); - } -} - -BibWindowContainer::~BibWindowContainer() -{ - if( pChild ) - { - Window* pDel = GetChild(); - pChild = NULL; // prevents GetFocus for child while deleting! - delete pDel; - } -} - -void BibWindowContainer::Resize() -{ - if( pChild ) - GetChild()->SetSizePixel( GetOutputSizePixel() ); -} - -void BibWindowContainer::GetFocus() -{ - if( pChild ) - GetChild()->GrabFocus(); -} - -sal_Bool BibWindowContainer::HandleShortCutKey( const KeyEvent& rKeyEvent ) -{ - return pChild? pChild->HandleShortCutKey( rKeyEvent ) : sal_False; -} - - -BibBookContainer::BibBookContainer(Window* pParent,BibDataManager* pDtMn, WinBits nStyle): - BibSplitWindow(pParent,nStyle), - pDatMan(pDtMn), - pTopWin(NULL), - pBottomWin(NULL), - bFirstTime(sal_True) -{ - pBibMod = OpenBibModul(); - aTimer.SetTimeoutHdl(LINK( this, BibBookContainer, SplitHdl)); - aTimer.SetTimeout(400); -} - -BibBookContainer::~BibBookContainer() -{ - if( xTopFrameRef.is() ) - xTopFrameRef->dispose(); - if( xBottomFrameRef.is() ) - xBottomFrameRef->dispose(); - - if( pTopWin ) - { - Window* pDel = pTopWin; - pTopWin = NULL; // prevents GetFocus for child while deleting! - delete pDel; - } - - if( pBottomWin ) - { - Window* pDel = pBottomWin; - pBottomWin = NULL; // prevents GetFocus for child while deleting! - delete pDel; - } - - CloseBibModul( pBibMod ); -} - -void BibBookContainer::Split() -{ - aTimer.Start(); -} -IMPL_LINK( BibBookContainer, SplitHdl, Timer*,/*pT*/) -{ - long nSize= GetItemSize( TOP_WINDOW); - BibConfig* pConfig = BibModul::GetConfig(); - pConfig->setBeamerSize(nSize); - nSize = GetItemSize( BOTTOM_WINDOW); - pConfig->setViewSize(nSize); - return 0; -} - -void BibBookContainer::createTopFrame( BibShortCutHandler* pWin ) -{ - if ( xTopFrameRef.is() ) xTopFrameRef->dispose(); - - if(pTopWin) - { - RemoveItem(TOP_WINDOW); - delete pTopWin; - } - pTopWin=new BibWindowContainer(this,pWin); - pTopWin->Show(); - BibConfig* pConfig = BibModul::GetConfig(); - long nSize = pConfig->getBeamerSize(); - InsertItem(TOP_WINDOW, pTopWin, nSize, 1, 0, SWIB_PERCENTSIZE ); - -} - -void BibBookContainer::createBottomFrame( BibShortCutHandler* pWin ) -{ - if ( xBottomFrameRef.is() ) xBottomFrameRef->dispose(); - - if(pBottomWin) - { - RemoveItem(BOTTOM_WINDOW); - delete pBottomWin; - } - - pBottomWin=new BibWindowContainer(this,pWin); - - BibConfig* pConfig = BibModul::GetConfig(); - long nSize = pConfig->getViewSize(); - InsertItem(BOTTOM_WINDOW, pBottomWin, nSize, 1, 0, SWIB_PERCENTSIZE ); - -} - -void BibBookContainer::GetFocus() -{ - if( pBottomWin ) - pBottomWin->GrabFocus(); -} - -long BibBookContainer::PreNotify( NotifyEvent& rNEvt ) -{ - long nHandled = 0; - if( EVENT_KEYINPUT == rNEvt.GetType() ) - { - const KeyEvent* pKEvt = rNEvt.GetKeyEvent(); - const KeyCode aKeyCode = pKEvt->GetKeyCode(); - sal_uInt16 nKey = aKeyCode.GetCode(); - const sal_uInt16 nModifier = aKeyCode.GetModifier(); - - if( KEY_MOD2 == nModifier ) - { - if( KEY_UP == nKey || KEY_DOWN == nKey ) - { - if(pTopWin && pBottomWin) - { - sal_uInt16 nFirstWinId = KEY_UP == nKey ? TOP_WINDOW : BOTTOM_WINDOW; - sal_uInt16 nSecondWinId = KEY_UP == nKey ? BOTTOM_WINDOW : TOP_WINDOW; - long nHeight = GetItemSize( nFirstWinId ); - nHeight -= WIN_STEP_SIZE; - if(nHeight < WIN_MIN_HEIGHT) - nHeight = WIN_MIN_HEIGHT; - SetItemSize( nFirstWinId, nHeight ); - SetItemSize( nSecondWinId, 100 - nHeight ); - } - nHandled = 1; - } - else if( pKEvt->GetCharCode() && HandleShortCutKey( *pKEvt ) ) - nHandled = 1; - } - } - - return nHandled; -} - -sal_Bool BibBookContainer::HandleShortCutKey( const KeyEvent& rKeyEvent ) -{ - sal_Bool bRet = sal_False; - - if( pTopWin ) - bRet = pTopWin->HandleShortCutKey( rKeyEvent ); - - if( !bRet && pBottomWin ) - bRet = pBottomWin->HandleShortCutKey( rKeyEvent ); - - return bRet; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibcont.hxx b/extensions/source/bibliography/bibcont.hxx deleted file mode 100644 index cd86a9190..000000000 --- a/extensions/source/bibliography/bibcont.hxx +++ /dev/null @@ -1,117 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ADDRCONT_HXX -#define ADDRCONT_HXX - -#include <com/sun/star/frame/XFrame.hpp> -#include <vcl/splitwin.hxx> -#include <vcl/timer.hxx> -#include "bibshortcuthandler.hxx" - -#include "bibmod.hxx" - -#define TOP_WINDOW 1 -#define BOTTOM_WINDOW 2 - -class BibDataManager; - -class BibWindowContainer : public BibWindow //Window -{ - private: - // !BibShortCutHandler is also always a Window! - BibShortCutHandler* pChild; - - protected: - virtual void Resize(); - - public: - BibWindowContainer( Window* pParent, BibShortCutHandler* pChild, WinBits nStyle = WB_3DLOOK); - ~BibWindowContainer(); - - inline Window* GetChild(); - - virtual void GetFocus(); - - virtual sal_Bool HandleShortCutKey( const KeyEvent& rKeyEvent ); // returns true, if key was handled - - using Window::GetChild; -}; - -inline Window* BibWindowContainer::GetChild() -{ - return pChild? pChild->GetWindow() : NULL; -} - - -class BibBookContainer: public BibSplitWindow -{ - private: - - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xTopFrameRef; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xBottomFrameRef; - - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xTopPeerRef; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xBottomPeerRef; - - BibDataManager* pDatMan; - BibWindowContainer* pTopWin; - BibWindowContainer* pBottomWin; - sal_Bool bFirstTime; - HdlBibModul pBibMod; - Timer aTimer; - - DECL_LINK( SplitHdl, Timer*); - - protected: - - virtual void Split(); - - virtual long PreNotify( NotifyEvent& rNEvt ); - - public: - - BibBookContainer(Window* pParent,BibDataManager*, WinBits nStyle = WB_3DLOOK ); - ~BibBookContainer(); - - inline BibWindow* GetTopWin() {return pTopWin;} - inline BibWindow* GetBottomWin() {return pBottomWin;} - - // !BibShortCutHandler is also always a Window! - void createTopFrame( BibShortCutHandler* pWin ); - - void createBottomFrame( BibShortCutHandler* pWin ); - - virtual void GetFocus(); - - virtual sal_Bool HandleShortCutKey( const KeyEvent& rKeyEvent ); // returns true, if key was handled -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx deleted file mode 100644 index 22b43a077..000000000 --- a/extensions/source/bibliography/bibload.cxx +++ /dev/null @@ -1,707 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - - -#include <osl/mutex.hxx> -#include <tools/urlobj.hxx> -#include <tools/diagnose_ex.h> -#include <cppuhelper/weak.hxx> -#include <svl/itemprop.hxx> -#include <uno/environment.h> -#include <svl/urihelper.hxx> -#include <toolkit/helper/vclunohelper.hxx> -#include <comphelper/processfactory.hxx> -#include <cppuhelper/factory.hxx> // helper for factories -#include <com/sun/star/sdbc/ResultSetType.hpp> -#include <com/sun/star/sdbc/ResultSetConcurrency.hpp> -#include <com/sun/star/sdb/XColumn.hpp> -#include <com/sun/star/util/XURLTransformer.hpp> -#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> -#include <com/sun/star/sdbc/XRowSet.hpp> -#include <com/sun/star/sdb/CommandType.hpp> -#include <com/sun/star/frame/XFrameLoader.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include <com/sun/star/beans/PropertyAttribute.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/text/BibliographyDataField.hpp> -#include <com/sun/star/form/XLoadListener.hpp> -#include <com/sun/star/frame/XLayoutManager.hpp> -#include <toolkit/awt/vclxwindow.hxx> -#include <vcl/window.hxx> -#include <vcl/edit.hxx> -#include <vcl/svapp.hxx> -#include <vcl/group.hxx> -#include <svtools/svmedit.hxx> - -#include "bibresid.hxx" -#include "bib.hrc" -#include "bibcont.hxx" -#include "bibbeam.hxx" -#include "bibmod.hxx" -#include "bibview.hxx" -#include "framectr.hxx" -#include "datman.hxx" -#include <bibconfig.hxx> -#include <cppuhelper/implbase4.hxx> // helper for implementations - -using namespace ::rtl; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::frame; - -#define C2U(cChar) OUString::createFromAscii(cChar) - - -//----------------------------------------------------------------------------- - -#define PROPERTY_FRAME 1 - -class BibliographyLoader : public cppu::WeakImplHelper4 - < XServiceInfo, XNameAccess, XPropertySet, XFrameLoader > -{ - HdlBibModul m_pBibMod; - Reference< XLoadable > m_xDatMan; - BibDataManager* m_pDatMan; - Reference< XNameAccess > m_xColumns; - Reference< XResultSet > m_xCursor; - -private: - - void loadView(const Reference< XFrame > & aFrame, const rtl::OUString& aURL, - const Sequence< PropertyValue >& aArgs, - const Reference< XLoadEventListener > & aListener); - - BibDataManager* GetDataManager()const; - Reference< XNameAccess > GetDataColumns() const; - Reference< XResultSet > GetDataCursor() const; - Reference< sdb::XColumn > GetIdentifierColumn() const; - -public: - BibliographyLoader(); - ~BibliographyLoader(); - - // XServiceInfo - rtl::OUString SAL_CALL getImplementationName() throw( ); - sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ); - Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ); - static rtl::OUString getImplementationName_Static() throw( ) - - { - //! - return C2U("com.sun.star.extensions.Bibliography"); - //! - } - - //XNameAccess - virtual Any SAL_CALL getByName(const rtl::OUString& aName) throw ( NoSuchElementException, WrappedTargetException, RuntimeException ); - virtual Sequence< rtl::OUString > SAL_CALL getElementNames(void) throw ( RuntimeException ); - virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& aName) throw ( RuntimeException ); - - //XElementAccess - virtual Type SAL_CALL getElementType(void) throw ( RuntimeException ); - virtual sal_Bool SAL_CALL hasElements(void) throw ( RuntimeException ); - - //XPropertySet - virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo(void) throw ( RuntimeException ); - virtual void SAL_CALL setPropertyValue(const rtl::OUString& PropertyName, const Any& aValue) throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException ); - virtual Any SAL_CALL getPropertyValue(const rtl::OUString& PropertyName) throw ( UnknownPropertyException, WrappedTargetException, RuntimeException ); - virtual void SAL_CALL addPropertyChangeListener(const rtl::OUString& PropertyName, const Reference< XPropertyChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException ); - virtual void SAL_CALL removePropertyChangeListener(const rtl::OUString& PropertyName, const Reference< XPropertyChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException ); - virtual void SAL_CALL addVetoableChangeListener(const rtl::OUString& PropertyName, const Reference< XVetoableChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException ); - virtual void SAL_CALL removeVetoableChangeListener(const rtl::OUString& PropertyName, const Reference< XVetoableChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException ); - - static Sequence<rtl::OUString> SAL_CALL getSupportedServiceNames_Static(void) throw( ); - - friend Reference< XInterface > SAL_CALL BibliographyLoader_CreateInstance( const Reference< XMultiServiceFactory > & rSMgr ) throw( Exception ); - - // XLoader - virtual void SAL_CALL load(const Reference< XFrame > & aFrame, const rtl::OUString& aURL, - const Sequence< PropertyValue >& aArgs, - const Reference< XLoadEventListener > & aListener) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL cancel(void) throw (::com::sun::star::uno::RuntimeException); -}; - -BibliographyLoader::BibliographyLoader() : - m_pBibMod(0), - m_pDatMan(0) -{ -} - -BibliographyLoader::~BibliographyLoader() -{ - Reference< lang::XComponent > xComp(m_xCursor, UNO_QUERY); - if (xComp.is()) - xComp->dispose(); - if(m_pBibMod) - CloseBibModul(m_pBibMod); -} - - -Reference< XInterface > SAL_CALL BibliographyLoader_CreateInstance( const Reference< XMultiServiceFactory > & /*rSMgr*/ ) throw( Exception ) -{ - return *(new BibliographyLoader); -} - - -// XServiceInfo -rtl::OUString BibliographyLoader::getImplementationName() throw( ) - -{ - return getImplementationName_Static(); -} - -// XServiceInfo -sal_Bool BibliographyLoader::supportsService(const rtl::OUString& ServiceName) throw( ) -{ - Sequence< rtl::OUString > aSNL = getSupportedServiceNames(); - const rtl::OUString * pArray = aSNL.getConstArray(); - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return sal_True; - return sal_False; -} - -// XServiceInfo -Sequence< rtl::OUString > BibliographyLoader::getSupportedServiceNames(void) throw( ) -{ - return getSupportedServiceNames_Static(); -} - -// ORegistryServiceManager_Static -Sequence< rtl::OUString > BibliographyLoader::getSupportedServiceNames_Static(void) throw( ) -{ - Sequence< rtl::OUString > aSNS( 2 ); - aSNS.getArray()[0] = C2U("com.sun.star.frame.FrameLoader"); - //! - aSNS.getArray()[1] = C2U("com.sun.star.frame.Bibliography"); - //! - return aSNS; -} - -extern "C" -{ - SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( - const sal_Char * pImplName, XMultiServiceFactory * pServiceManager, void * /*pRegistryKey*/ ) - { - void * pRet = 0; - if (!BibliographyLoader::getImplementationName_Static().compareToAscii( pImplName ) ) - { - // create the factory - Reference< XSingleServiceFactory > xFactory = - cppu::createSingleFactory( - pServiceManager, - BibliographyLoader::getImplementationName_Static(), - BibliographyLoader_CreateInstance, - BibliographyLoader::getSupportedServiceNames_Static() ); - // acquire, because we return an interface pointer instead of a reference - xFactory->acquire(); - pRet = xFactory.get(); - } - return pRet; - } - -} -// ----------------------------------------------------------------------- -void BibliographyLoader::cancel(void) throw (::com::sun::star::uno::RuntimeException) -{ - //! - //! -} - -// ----------------------------------------------------------------------- -void BibliographyLoader::load(const Reference< XFrame > & rFrame, const rtl::OUString& rURL, - const Sequence< PropertyValue >& rArgs, - const Reference< XLoadEventListener > & rListener) throw (::com::sun::star::uno::RuntimeException) -{ - //! - - SolarMutexGuard aGuard; - m_pBibMod = OpenBibModul(); - - String aURLStr( rURL ); - String aPartName = aURLStr.GetToken( 1, '/' ); - Reference<XPropertySet> xPrSet(rFrame, UNO_QUERY); - if(xPrSet.is()) - { - Any aTitle; - aTitle <<= OUString(String(BibResId(RID_BIB_STR_FRAME_TITLE))); - xPrSet->setPropertyValue(C2U("Title"), aTitle); - } - if(aPartName.EqualsAscii("View") || aPartName.EqualsAscii("View1")) - { - loadView(rFrame, rURL, rArgs, rListener); - } -} - -// ----------------------------------------------------------------------- -void BibliographyLoader::loadView(const Reference< XFrame > & rFrame, const rtl::OUString& /*rURL*/, - const Sequence< PropertyValue >& /*rArgs*/, - const Reference< XLoadEventListener > & rListener) -{ - SolarMutexGuard aGuard; - //! - if(!m_pBibMod) - m_pBibMod = OpenBibModul(); - - m_pDatMan = (*m_pBibMod)->createDataManager(); - m_xDatMan = m_pDatMan; - BibDBDescriptor aBibDesc = BibModul::GetConfig()->GetBibliographyURL(); - - if(!aBibDesc.sDataSource.getLength()) - { - DBChangeDialogConfig_Impl aConfig; - const Sequence<OUString> aSources = aConfig.GetDataSourceNames(); - if(aSources.getLength()) - aBibDesc.sDataSource = aSources.getConstArray()[0]; - } - - Reference< XForm > xForm = m_pDatMan->createDatabaseForm( aBibDesc ); - - Reference< awt::XWindow > aWindow = rFrame->getContainerWindow(); - VCLXWindow* pParentComponent = VCLXWindow::GetImplementation(aWindow); - - Window* pParent = VCLUnoHelper::GetWindow( aWindow ); - - BibBookContainer *pMyWindow = new BibBookContainer( pParent, m_pDatMan ); - pMyWindow->Show(); - - ::bib::BibView* pView = new ::bib::BibView( pMyWindow, m_pDatMan, WB_VSCROLL | WB_HSCROLL | WB_3DLOOK ); - pView->Show(); - m_pDatMan->SetView( pView ); - - ::bib::BibBeamer* pBeamer = new ::bib::BibBeamer( pMyWindow, m_pDatMan ); - pBeamer->Show(); - pMyWindow->createTopFrame(pBeamer); - - pMyWindow->createBottomFrame(pView); - - Reference< awt::XWindow > xWin ( pMyWindow->GetComponentInterface(), UNO_QUERY ); - - Reference< XController > xCtrRef( new BibFrameController_Impl( xWin, m_pDatMan ) ); - - xCtrRef->attachFrame(rFrame); - rFrame->setComponent( xWin, xCtrRef); - pBeamer->SetXController(xCtrRef); - //! - - // not earlier because SetFocus() is triggered in setVisible() - pParentComponent->setVisible(sal_True); - - m_xDatMan->load(); - // #100312# ---------- - m_pDatMan->RegisterInterceptor(pBeamer); - - if ( rListener.is() ) - rListener->loadFinished( this ); - - // attach menu bar - Reference< XPropertySet > xPropSet( rFrame, UNO_QUERY ); - Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; - if ( xPropSet.is() ) - { - try - { - Any a = xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))); - a >>= xLayoutManager; - } - catch ( uno::Exception& ) - { - } - } - - if ( xLayoutManager.is() ) - xLayoutManager->createElement( OUString( RTL_CONSTASCII_USTRINGPARAM( "private:resource/menubar/menubar" ))); -} - -BibDataManager* BibliographyLoader::GetDataManager()const -{ - if(!m_pDatMan) - { - if(!m_pBibMod) - const_cast< BibliographyLoader* >( this )->m_pBibMod = OpenBibModul(); - const_cast< BibliographyLoader* >( this )->m_pDatMan = (*m_pBibMod)->createDataManager(); - const_cast< BibliographyLoader* >( this )->m_xDatMan = m_pDatMan; - } - return m_pDatMan; -} - -Reference< XNameAccess > BibliographyLoader::GetDataColumns() const -{ - if (!m_xColumns.is()) - { - Reference< XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); - Reference< XRowSet > xRowSet(xMgr->createInstance(C2U("com.sun.star.sdb.RowSet")), UNO_QUERY); - Reference< XPropertySet > xResultSetProps(xRowSet, UNO_QUERY); - DBG_ASSERT(xResultSetProps.is() , "BibliographyLoader::GetDataCursor : invalid row set (no XResultSet or no XPropertySet) !"); - - BibDBDescriptor aBibDesc = BibModul::GetConfig()->GetBibliographyURL(); - - Any aBibUrlAny; aBibUrlAny <<= aBibDesc.sDataSource; - xResultSetProps->setPropertyValue(C2U("DataSourceName"), aBibUrlAny); - Any aCommandType; aCommandType <<= aBibDesc.nCommandType; - xResultSetProps->setPropertyValue(C2U("CommandType"), aCommandType); - Any aTableName; aTableName <<= aBibDesc.sTableOrQuery; - xResultSetProps->setPropertyValue(C2U("Command"), aTableName); - Any aResultSetType; aResultSetType <<= (sal_Int32)(ResultSetType::SCROLL_INSENSITIVE); - xResultSetProps->setPropertyValue(C2U("ResultSetType"), aResultSetType); - Any aResultSetCurrency; aResultSetCurrency <<= (sal_Int32)(ResultSetConcurrency::UPDATABLE); - xResultSetProps->setPropertyValue(C2U("ResultSetConcurrency"), aResultSetCurrency); - - sal_Bool bSuccess = sal_False; - try - { - xRowSet->execute(); - bSuccess = sal_True; - } - catch(const SQLException&) - { - DBG_UNHANDLED_EXCEPTION(); - } - catch(const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - bSuccess = sal_False; - } - - if (!bSuccess) - { - Reference< XComponent > xSetComp(xRowSet, UNO_QUERY); - if (xSetComp.is()) - xSetComp->dispose(); - xRowSet = NULL; - } - else - ((BibliographyLoader*)this)->m_xCursor = xRowSet.get(); - - Reference< sdbcx::XColumnsSupplier > xSupplyCols(m_xCursor, UNO_QUERY); - if (xSupplyCols.is()) - ((BibliographyLoader*)this)->m_xColumns = xSupplyCols->getColumns(); - } - - return m_xColumns; -} - -Reference< sdb::XColumn > BibliographyLoader::GetIdentifierColumn() const -{ - BibDataManager* pDatMan = GetDataManager(); - Reference< XNameAccess > xColumns = GetDataColumns(); - rtl::OUString sIdentifierColumnName = pDatMan->GetIdentifierMapping(); - - Reference< sdb::XColumn > xReturn; - if (xColumns.is() && xColumns->hasByName(sIdentifierColumnName)) - { - xReturn = Reference< XColumn > (*(Reference< XInterface > *) - xColumns->getByName(sIdentifierColumnName).getValue(), UNO_QUERY); - } - return xReturn; -} - -Reference< XResultSet > BibliographyLoader::GetDataCursor() const -{ - if (!m_xCursor.is()) - GetDataColumns(); - if (m_xCursor.is()) - m_xCursor->first(); - return m_xCursor; -} - -rtl::OUString lcl_AddProperty(Reference< XNameAccess > xColumns, - const Mapping* pMapping, const String& rColumnName) -{ - String sColumnName(rColumnName); - if(pMapping) - { - for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++) - { - if(pMapping->aColumnPairs[nEntry].sLogicalColumnName == OUString(rColumnName)) - { - sColumnName = pMapping->aColumnPairs[nEntry].sRealColumnName; - break; - } - } - } - rtl::OUString uColumnName(sColumnName); - rtl::OUString uRet; - Reference< sdb::XColumn > xCol; - if (xColumns->hasByName(uColumnName)) - xCol = Reference< sdb::XColumn > (*(Reference< XInterface > *)xColumns->getByName(uColumnName).getValue(), UNO_QUERY); - if (xCol.is()) - uRet = xCol->getString(); - return uRet; -} -//----------------------------------------------------------------------------- -Any BibliographyLoader::getByName(const rtl::OUString& rName) throw - ( NoSuchElementException, WrappedTargetException, RuntimeException ) -{ - Any aRet; - try - { - BibDataManager* pDatMan = ((BibliographyLoader*)this)->GetDataManager(); - Reference< XResultSet > xCursor = GetDataCursor(); - Reference< sdbcx::XColumnsSupplier > xSupplyCols(xCursor, UNO_QUERY); - Reference< XNameAccess > xColumns; - if (!xSupplyCols.is()) - return aRet; - xColumns = xSupplyCols->getColumns(); - DBG_ASSERT(xSupplyCols.is(), "BibliographyLoader::getByName : invalid columns returned by the data cursor (may be the result set is not alive ?) !"); - if (!xColumns.is()) - return aRet; - - String sIdentifierMapping = pDatMan->GetIdentifierMapping(); - rtl::OUString sId = sIdentifierMapping; - Reference< sdb::XColumn > xColumn; - if (xColumns->hasByName(sId)) - xColumn = Reference< sdb::XColumn > (*(Reference< XInterface > *)xColumns->getByName(sId).getValue(), UNO_QUERY); - if (xColumn.is()) - { - do - { - if ((rName == xColumn->getString()) && !xColumn->wasNull()) - { - Sequence<PropertyValue> aPropSequ(COLUMN_COUNT); - PropertyValue* pValues = aPropSequ.getArray(); - BibConfig* pConfig = BibModul::GetConfig(); - BibDBDescriptor aBibDesc = BibModul::GetConfig()->GetBibliographyURL(); - const Mapping* pMapping = pConfig->GetMapping(aBibDesc); - for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++) - { - const String sColName = pConfig->GetDefColumnName( - nEntry); - pValues[nEntry].Name = sColName; - pValues[nEntry].Value <<= lcl_AddProperty(xColumns, pMapping, sColName); - } - aRet.setValue(&aPropSequ, ::getCppuType((Sequence<PropertyValue>*)0)); - - break; - } - } - while(xCursor->next()); - } - } - catch(const Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } - return aRet; -} - -Sequence< rtl::OUString > BibliographyLoader::getElementNames(void) throw ( RuntimeException ) -{ - Sequence< rtl::OUString > aRet(10); - int nRealNameCount = 0; - try - { - Reference< XResultSet > xCursor(GetDataCursor()); - Reference< sdb::XColumn > xIdColumn(GetIdentifierColumn()); - if (xIdColumn.is()) // implies xCursor.is() - { - do - { - rtl::OUString sTemp = xIdColumn->getString(); - if (sTemp.getLength() && !xIdColumn->wasNull()) - { - int nLen = aRet.getLength(); - if(nLen == nRealNameCount) - aRet.realloc(nLen + 10); - rtl::OUString* pArray = aRet.getArray(); - pArray[nRealNameCount] = sTemp; - nRealNameCount++; - } - } - while (xCursor->next()); - } - } - catch(const Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } - - aRet.realloc(nRealNameCount); - return aRet; -} - -sal_Bool BibliographyLoader::hasByName(const rtl::OUString& rName) throw ( RuntimeException ) -{ - sal_Bool bRet = sal_False; - try - { - Reference< XResultSet > xCursor = GetDataCursor(); - Reference< sdb::XColumn > xIdColumn = GetIdentifierColumn(); - - if (xIdColumn.is()) // implies xCursor.is() - { - do - { - rtl::OUString sCurrentId = xIdColumn->getString(); - if (!xIdColumn->wasNull() && (rName.compareTo(sCurrentId) == COMPARE_EQUAL)) - { - bRet = sal_True; - break; - } - } - while(xCursor->next()); - } - } - catch(const Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } - return bRet; -} - -Type BibliographyLoader::getElementType(void) throw ( RuntimeException ) -{ - return ::getCppuType((Sequence<PropertyValue>*)0); -} - -sal_Bool BibliographyLoader::hasElements(void) throw ( RuntimeException ) -{ - Reference< XResultSet > xCursor = GetDataCursor(); - Reference< XNameAccess > xColumns = GetDataColumns(); - return xColumns.is() && (xColumns->getElementNames().getLength() != 0); -} - -Reference< XPropertySetInfo > BibliographyLoader::getPropertySetInfo(void) throw - ( RuntimeException ) -{ - static SfxItemPropertyMapEntry aBibProps_Impl[] = - { - { MAP_CHAR_LEN("BibliographyDataFieldNames"), 0, &::getCppuType((Sequence<PropertyValue>*)0), PropertyAttribute::READONLY, 0}, - {0,0,0,0,0,0} - }; - static Reference< XPropertySetInfo > xRet = - SfxItemPropertySet(aBibProps_Impl).getPropertySetInfo(); - return xRet; -} - -void BibliographyLoader::setPropertyValue(const rtl::OUString& /*PropertyName*/, - const Any& /*aValue*/) - throw( UnknownPropertyException, PropertyVetoException, - IllegalArgumentException, WrappedTargetException, RuntimeException) -{ - throw UnknownPropertyException(); - //no changeable properties -} - -Any BibliographyLoader::getPropertyValue(const rtl::OUString& rPropertyName) - throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) -{ - Any aRet; - static const sal_uInt16 aInternalMapping[] = - { - IDENTIFIER_POS , // BibliographyDataField_IDENTIFIER - AUTHORITYTYPE_POS , // BibliographyDataField_BIBILIOGRAPHIC_TYPE - ADDRESS_POS , // BibliographyDataField_ADDRESS - ANNOTE_POS , // BibliographyDataField_ANNOTE - AUTHOR_POS , // BibliographyDataField_AUTHOR - BOOKTITLE_POS , // BibliographyDataField_BOOKTITLE - CHAPTER_POS , // BibliographyDataField_CHAPTER - EDITION_POS , // BibliographyDataField_EDITION - EDITOR_POS , // BibliographyDataField_EDITOR - HOWPUBLISHED_POS , // BibliographyDataField_HOWPUBLISHED - INSTITUTION_POS , // BibliographyDataField_INSTITUTION - JOURNAL_POS , // BibliographyDataField_JOURNAL - MONTH_POS , // BibliographyDataField_MONTH - NOTE_POS , // BibliographyDataField_NOTE - NUMBER_POS , // BibliographyDataField_NUMBER - ORGANIZATIONS_POS , // BibliographyDataField_ORGANIZATIONS - PAGES_POS , // BibliographyDataField_PAGES - PUBLISHER_POS , // BibliographyDataField_PUBLISHER - SCHOOL_POS , // BibliographyDataField_SCHOOL - SERIES_POS , // BibliographyDataField_SERIES - TITLE_POS , // BibliographyDataField_TITLE - REPORTTYPE_POS , // BibliographyDataField_REPORT_TYPE - VOLUME_POS , // BibliographyDataField_VOLUME - YEAR_POS , // BibliographyDataField_YEAR - URL_POS , // BibliographyDataField_URL - CUSTOM1_POS , // BibliographyDataField_CUSTOM1 - CUSTOM2_POS , // BibliographyDataField_CUSTOM2 - CUSTOM3_POS , // BibliographyDataField_CUSTOM3 - CUSTOM4_POS , // BibliographyDataField_CUSTOM4 - CUSTOM5_POS , // BibliographyDataField_CUSTOM5 - ISBN_POS //BibliographyDataField_ISBN - }; - if(C2U("BibliographyDataFieldNames") == rPropertyName) - { - Sequence<PropertyValue> aSeq(COLUMN_COUNT); - PropertyValue* pArray = aSeq.getArray(); - BibConfig* pConfig = BibModul::GetConfig(); - for(sal_uInt16 i = 0; i <= text::BibliographyDataField::ISBN ; i++) - { - pArray[i].Name = pConfig->GetDefColumnName(aInternalMapping[i]); - pArray[i].Value <<= (sal_Int16) i; - } - aRet.setValue(&aSeq, ::getCppuType((Sequence<PropertyValue>*)0)); - } - else - throw UnknownPropertyException(); - return aRet; -} - -void BibliographyLoader::addPropertyChangeListener( - const rtl::OUString& /*PropertyName*/, const Reference< XPropertyChangeListener > & /*aListener*/) - throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) -{ - //no bound properties -} - -void BibliographyLoader::removePropertyChangeListener( - const rtl::OUString& /*PropertyName*/, const Reference< XPropertyChangeListener > & /*aListener*/) - throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) -{ - //no bound properties -} - -void BibliographyLoader::addVetoableChangeListener( - const rtl::OUString& /*PropertyName*/, const Reference< XVetoableChangeListener > & /*aListener*/) - throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) -{ - //no vetoable properties -} - -void BibliographyLoader::removeVetoableChangeListener( - const rtl::OUString& /*PropertyName*/, const Reference< XVetoableChangeListener > & /*aListener*/) - throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) -{ - //no vetoable properties -} - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibmod.cxx b/extensions/source/bibliography/bibmod.cxx deleted file mode 100644 index 2db648da6..000000000 --- a/extensions/source/bibliography/bibmod.cxx +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - - -#include <tools/resmgr.hxx> -#include <tools/urlobj.hxx> -#include <svl/urihelper.hxx> -#include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/util/XLocalizedAliases.hpp> -#include <com/sun/star/lang/XLocalizable.hpp> -#include <tools/debug.hxx> - -#include "bibmod.hxx" -#include "bibresid.hxx" -#include "datman.hxx" -#include "bibconfig.hxx" -static PtrBibModul pBibModul=NULL; -static sal_uInt32 nBibModulCount=0; -#include <ucbhelper/content.hxx> - -using namespace ::rtl; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::util; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::ucb; - -#define C2U(cChar) OUString::createFromAscii(cChar) -#define C2S(cChar) String::CreateFromAscii(cChar) - -HdlBibModul OpenBibModul() -{ - if(pBibModul==NULL) - { - pBibModul=new BibModul(); - } - nBibModulCount++; - return &pBibModul; -} - -void CloseBibModul(HdlBibModul ppBibModul) -{ - nBibModulCount--; - if(nBibModulCount==0 && ppBibModul!=NULL) - { - delete pBibModul; - pBibModul=NULL; - } -} - -BibResId::BibResId( sal_uInt16 nId ) : - ResId( nId, *pBibModul->GetResMgr() ) -{ -} -BibConfig* BibModul::pBibConfig = 0; -BibModul::BibModul() -{ - pResMgr = ResMgr::CreateResMgr( "bib" ); -} - -BibModul::~BibModul() -{ - delete pResMgr; - delete pBibConfig; - pBibConfig = 0; -} - -BibDataManager* BibModul::createDataManager() -{ - return new BibDataManager(); -} -//----------------------------------------------------------------------------- -BibConfig* BibModul::GetConfig() -{ - if(! pBibConfig) - pBibConfig = new BibConfig; - return pBibConfig; -} - - -// PropertyNames -#define STATIC_USTRING(a,b) rtl::OUString a(b) -STATIC_USTRING(FM_PROP_LABEL,C2U("Label")); -STATIC_USTRING(FM_PROP_CONTROLSOURCE,C2U("DataField")); -STATIC_USTRING(FM_PROP_NAME,C2U("Name")); -STATIC_USTRING(FM_PROP_FORMATKEY,C2U("FormatKey")); -STATIC_USTRING(FM_PROP_EDITMODE,C2U("RecordMode")); -STATIC_USTRING(FM_PROP_CURSORSOURCETYPE,C2U("DataSelectionType")); -STATIC_USTRING(FM_PROP_CURSORSOURCE,C2U("DataSelection")); -STATIC_USTRING(FM_PROP_DATASOURCE, C2U("DataSource")); -STATIC_USTRING(FM_PROP_VALUE,C2U("Value")); -STATIC_USTRING(FM_PROP_TEXT,C2U("Text")); - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibmod.hxx b/extensions/source/bibliography/bibmod.hxx deleted file mode 100644 index 0e2f04854..000000000 --- a/extensions/source/bibliography/bibmod.hxx +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef BIBMOD_HXX -#define BIBMOD_HXX - - -class ResMgr; -class BibDataManager; -class BibConfig; - -#define BIBLIOGRAPHY_INI_GROUP "Bibliography" -#define BIBLIOGRAPHY_INI_CUR_NAME "BibliographyCurrent" -#define BIBLIOGRAPHY_INI_DB_ENTRY "Bibliography" -#define BIBLIOGRAPHY_INI_MAPPING "BibliographyFields" -#define BIBLIOGRAPHY_TYPE_NAMES "BibliographyTypeNames" - -class BibModul -{ - private: - ResMgr* pResMgr; - static BibConfig* pBibConfig; - - public: - BibModul(); - ~BibModul(); - - ResMgr* GetResMgr(){return pResMgr;} - static BibConfig* GetConfig(); - - BibDataManager* createDataManager(); - -}; - -typedef BibModul* PtrBibModul; -typedef PtrBibModul* HdlBibModul; - -HdlBibModul OpenBibModul(); -void CloseBibModul(HdlBibModul ppBibModul); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibprop.hrc b/extensions/source/bibliography/bibprop.hrc deleted file mode 100644 index 7c51ec071..000000000 --- a/extensions/source/bibliography/bibprop.hrc +++ /dev/null @@ -1,42 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _BIB_FMPROP_HRC -#define _BIB_FMPROP_HRC - -extern rtl::OUString FM_PROP_LABEL; -extern rtl::OUString FM_PROP_NAME; -extern rtl::OUString FM_PROP_CONTROLSOURCE; -extern rtl::OUString FM_PROP_FORMATKEY; -extern rtl::OUString FM_PROP_VALUE; -extern rtl::OUString FM_PROP_EDITMODE; -extern rtl::OUString FM_PROP_DATASOURCE; -extern rtl::OUString FM_PROP_CURSORSOURCE; -extern rtl::OUString FM_PROP_CURSORSOURCETYPE; -extern rtl::OUString FM_PROP_TEXT; - -#endif // _SVX_FMPROP_HRC - diff --git a/extensions/source/bibliography/bibresid.hxx b/extensions/source/bibliography/bibresid.hxx deleted file mode 100644 index ea8576779..000000000 --- a/extensions/source/bibliography/bibresid.hxx +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ADRRESID_HXX -#define ADRRESID_HXX - -#include <tools/resid.hxx> - -//=================================================================== - -class BibResId : public ResId -{ - public: - BibResId( sal_uInt16 nId ); -}; - - - -#endif // ADRRESID_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibshortcuthandler.hxx b/extensions/source/bibliography/bibshortcuthandler.hxx deleted file mode 100644 index fb33b2623..000000000 --- a/extensions/source/bibliography/bibshortcuthandler.hxx +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BIBSHORTCUTHANDLER_HXX -#define _BIBSHORTCUTHANDLER_HXX - -#include <vcl/window.hxx> -#include <vcl/splitwin.hxx> -#include <vcl/tabpage.hxx> - -// additional classes to handle shortcuts -// code in bibcont.cxx - - -class BibShortCutHandler -{ -private: - Window* pBaseClass; // in cases, where BibShortCutHandler also has to be a window - -protected: - inline BibShortCutHandler( Window* pBaseClass ); - -public: - virtual ~BibShortCutHandler(); - virtual sal_Bool HandleShortCutKey( const KeyEvent& rKeyEvent ); // returns true, if key was handled - - inline Window* GetWindow( void ); -}; - -inline BibShortCutHandler::BibShortCutHandler( Window* _pBaseClass ) : pBaseClass( _pBaseClass ) -{ -} - -inline Window* BibShortCutHandler::GetWindow( void ) -{ - return pBaseClass; -} - - -class BibWindow : public Window, public BibShortCutHandler -{ -public: - BibWindow( Window* pParent,WinBits nStyle = WB_3DLOOK); - virtual ~BibWindow(); -}; - - -class BibSplitWindow : public SplitWindow, public BibShortCutHandler -{ -public: - BibSplitWindow( Window* pParent,WinBits nStyle = WB_3DLOOK); - virtual ~BibSplitWindow(); -}; - - -class BibTabPage : public TabPage, public BibShortCutHandler -{ -public: - BibTabPage( Window* pParent, const ResId& rResId ); - virtual ~BibTabPage(); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibtools.hxx b/extensions/source/bibliography/bibtools.hxx deleted file mode 100644 index dff45ec1b..000000000 --- a/extensions/source/bibliography/bibtools.hxx +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef BIBTOOLS_HXX - -#include <vcl/taskpanelist.hxx> // includes also vcl/window.hxx - -namespace bib -{ - // source in bibbeam.cxx - - void HandleTaskPaneList( Window* pWindow, sal_Bool bAddToList ); - // pWindow: just an system window or something wich is child of a system window - - inline void AddToTaskPaneList( Window* pWindowToBeHandled ) - { - HandleTaskPaneList( pWindowToBeHandled, sal_True ); - } - - inline void RemoveFromTaskPaneList( Window* pWindowToBeHandled ) - { - HandleTaskPaneList( pWindowToBeHandled, sal_False ); - } -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibview.cxx b/extensions/source/bibliography/bibview.cxx deleted file mode 100644 index 22455a009..000000000 --- a/extensions/source/bibliography/bibview.cxx +++ /dev/null @@ -1,219 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "bib.hrc" -#include "bibcont.hxx" -#include "bibbeam.hxx" -#include "general.hxx" -#include "bibview.hxx" -#include "datman.hxx" -#include "bibresid.hxx" -#include "bibmod.hxx" -#include "sections.hrc" -#include "bibconfig.hxx" - - -#include <vcl/svapp.hxx> -#include <com/sun/star/sdbc/XResultSetUpdate.hpp> -#include <com/sun/star/form/XLoadable.hpp> -#include <vcl/msgbox.hxx> -#include <tools/debug.hxx> - -using namespace ::com::sun::star; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; - -#define C2U( cChar ) ::rtl::OUString::createFromAscii( cChar ) - -//......................................................................... -namespace bib -{ -//......................................................................... - - // ----------------------------------------------------------------------- - BibView::BibView( Window* _pParent, BibDataManager* _pManager, WinBits _nStyle ) - :BibWindow( _pParent, _nStyle ) - ,m_pDatMan( _pManager ) - ,m_xDatMan( _pManager ) - ,m_pGeneralPage( NULL ) - { - if ( m_xDatMan.is() ) - connectForm( m_xDatMan ); - } - - // ----------------------------------------------------------------------- - BibView::~BibView() - { - BibGeneralPage* pGeneralPage = m_pGeneralPage; - m_pGeneralPage = NULL; - - pGeneralPage->CommitActiveControl(); - Reference< XForm > xForm = m_pDatMan->getForm(); - Reference< XPropertySet > xProps( xForm, UNO_QUERY ); - Reference< sdbc::XResultSetUpdate > xResUpd( xProps, UNO_QUERY ); - DBG_ASSERT( xResUpd.is(), "BibView::~BibView: invalid form!" ); - - if ( xResUpd.is() ) - { - Any aModified = xProps->getPropertyValue( C2U( "IsModified" ) ); - sal_Bool bFlag = sal_False; - if ( ( aModified >>= bFlag ) && bFlag ) - { - - try - { - Any aNew = xProps->getPropertyValue( C2U( "IsNew" ) ); - aNew >>= bFlag; - if ( bFlag ) - xResUpd->insertRow(); - else - xResUpd->updateRow(); - } - catch( const uno::Exception& rEx) - { - (void) rEx; - } - } - } - - if ( isFormConnected() ) - disconnectForm(); - - pGeneralPage->RemoveListeners(); - m_xGeneralPage = NULL; - } - - void BibView::UpdatePages() - { - // TODO: - // this is _strange_: Why not updating the existent general page? - // I consider the current behaviour a HACK. - // frank.schoenheit@sun.com - if ( m_pGeneralPage ) - { - m_pGeneralPage->Hide(); - m_pGeneralPage->RemoveListeners(); - m_xGeneralPage = 0; - } - - m_xGeneralPage = m_pGeneralPage = new BibGeneralPage( this, m_pDatMan ); - - Resize(); - - if( HasFocus() ) - // "delayed" GetFocus() because GetFocus() is initially called before GeneralPage is created - m_pGeneralPage->GrabFocus(); - - String sErrorString( m_pGeneralPage->GetErrorString() ); - if ( sErrorString.Len() ) - { - sal_Bool bExecute = BibModul::GetConfig()->IsShowColumnAssignmentWarning(); - if(!m_pDatMan->HasActiveConnection()) - { - //no connection is available -> the data base has to be assigned - m_pDatMan->DispatchDBChangeDialog(); - bExecute = sal_False; - } - else if(bExecute) - { - sErrorString += '\n'; - sErrorString += String( BibResId( RID_MAP_QUESTION ) ); - QueryBox aQuery( this, WB_YES_NO, sErrorString ); - aQuery.SetDefaultCheckBoxText(); - short nResult = aQuery.Execute(); - BibModul::GetConfig()->SetShowColumnAssignmentWarning( - !aQuery.GetCheckBoxState()); - if( RET_YES != nResult ) - { - bExecute = sal_False; - } - } - if(bExecute) - { - Application::PostUserEvent( STATIC_LINK( this, BibView, CallMappingHdl ) ); - } - } - } - - void BibView::_loaded( const EventObject& _rEvent ) - { - UpdatePages(); - FormControlContainer::_loaded( _rEvent ); - } - - void BibView::_reloaded( const EventObject& _rEvent ) - { - UpdatePages(); - FormControlContainer::_loaded( _rEvent ); - } - - IMPL_STATIC_LINK( BibView, CallMappingHdl, BibView*, EMPTYARG ) - { - pThis->m_pDatMan->CreateMappingDialog( pThis ); - return 0; - } - - void BibView::Resize() - { - if ( m_pGeneralPage ) - { - ::Size aSz( GetOutputSizePixel() ); - m_pGeneralPage->SetSizePixel( aSz ); - } - Window::Resize(); - } - - Reference< awt::XControlContainer > BibView::getControlContainer() - { - Reference< awt::XControlContainer > xReturn; - if ( m_pGeneralPage ) - xReturn = m_pGeneralPage->GetControlContainer(); - return xReturn; - } - - void BibView::GetFocus() - { - if( m_pGeneralPage ) - m_pGeneralPage->GrabFocus(); - } - - sal_Bool BibView::HandleShortCutKey( const KeyEvent& rKeyEvent ) - { - return m_pGeneralPage? m_pGeneralPage->HandleShortCutKey( rKeyEvent ) : sal_False; - } - -//......................................................................... -} // namespace bib -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibview.hxx b/extensions/source/bibliography/bibview.hxx deleted file mode 100644 index 6ddb43f09..000000000 --- a/extensions/source/bibliography/bibview.hxx +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _BIB_VIEW_HXX -#define _BIB_VIEW_HXX - -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/awt/XControlContainer.hpp> -#include "formcontrolcontainer.hxx" -#include "bibshortcuthandler.hxx" - -class BibGeneralPage; -class BibDataManager; - -namespace com{ namespace sun{ namespace star{ namespace awt{ class XFocusListener;}}}} - -//......................................................................... -namespace bib -{ -//......................................................................... - - // ----------------------------------------------------------------------- - class BibView : public BibWindow, public FormControlContainer - { - private: - BibDataManager* m_pDatMan; - ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable> m_xDatMan; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener> m_xGeneralPage; - BibGeneralPage* m_pGeneralPage; - - private: - DECL_STATIC_LINK(BibView, CallMappingHdl, BibView*); - - protected: - // Window overridables - virtual void Resize(); - - // FormControlContainer - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > - getControlContainer(); - - // XLoadListener equivalents - virtual void _loaded( const ::com::sun::star::lang::EventObject& _rEvent ); - virtual void _reloaded( const ::com::sun::star::lang::EventObject& _rEvent ); - - public: - BibView( Window* _pParent, BibDataManager* _pDatMan, WinBits nStyle = WB_3DLOOK ); - ~BibView(); - - void UpdatePages(); - - virtual void GetFocus(); - - virtual sal_Bool HandleShortCutKey( const KeyEvent& rKeyEvent ); // returns true, if key was handled - }; - -//......................................................................... -} // namespace bib -//......................................................................... - -#endif - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx deleted file mode 100644 index fe17033a9..000000000 --- a/extensions/source/bibliography/datman.cxx +++ /dev/null @@ -1,1739 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include <osl/mutex.hxx> -#include <tools/diagnose_ex.h> -#include <tools/urlobj.hxx> -#include <comphelper/processfactory.hxx> -#include <com/sun/star/io/XPersistObject.hpp> -#include <com/sun/star/sdbc/ResultSetType.hpp> -#include <com/sun/star/sdbc/ResultSetConcurrency.hpp> -#include <com/sun/star/sdbc/XResultSetUpdate.hpp> -#include <com/sun/star/sdbcx/XRowLocate.hpp> -#include <com/sun/star/sdbc/DataType.hpp> -#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp> -#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> -#include <com/sun/star/sdb/XDatabaseEnvironment.hpp> -#include <com/sun/star/uno/XNamingService.hpp> -#include <com/sun/star/sdbc/XDataSource.hpp> -#include <com/sun/star/sdb/CommandType.hpp> -#include <com/sun/star/sdbcx/XTablesSupplier.hpp> -#include <com/sun/star/sdbc/XConnection.hpp> -#include <com/sun/star/sdb/XCompletedConnection.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> -#include <com/sun/star/form/XLoadable.hpp> -#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> -#include <com/sun/star/form/XGridColumnFactory.hpp> -#include <com/sun/star/io/XDataInputStream.hpp> -#include <com/sun/star/container/XNameContainer.hpp> -#include <com/sun/star/ucb/XContentProvider.hpp> -#include <com/sun/star/ucb/XContentAccess.hpp> -#include <ucbhelper/contentbroker.hxx> -#include <ucbhelper/content.hxx> -#include <ucbhelper/contentidentifier.hxx> -#include <comphelper/container.hxx> -#include <svl/urihelper.hxx> -#include <svtools/svtabbx.hxx> -#include <svtools/headbar.hxx> -#include <vcl/dialog.hxx> -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> -#include <vcl/group.hxx> -#include <vcl/lstbox.hxx> -#include <vcl/edit.hxx> -#include <vcl/msgbox.hxx> -#include <tools/debug.hxx> -#include "datman.hxx" -#include "bibresid.hxx" -#include "bibmod.hxx" -#include "bibview.hxx" -// #100312# --------- -#include "bibprop.hrc" -#include "toolbar.hxx" -#include "toolbar.hrc" -#include "bibconfig.hxx" -#include "bibbeam.hxx" -#include "bib.hrc" -#include "datman.hrc" -#include "bibliography.hrc" -#include <connectivity/dbtools.hxx> - -using namespace ::com::sun::star; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::frame; -using namespace ::com::sun::star::ucb; -using namespace ::com::sun::star::lang; -using namespace ::ucb; - -#define C2U(cChar) ::rtl::OUString::createFromAscii(cChar) -#define C2S(cChar) String::CreateFromAscii(cChar) -#define MAP_TOKEN ';' -#define PAIR_TOKEN ':' - -Reference< XConnection > getConnection(const ::rtl::OUString& _rURL) -{ - // first get the sdb::DataSource corresponding to the url - Reference< XDataSource > xDataSource; - // is it a favorite title ? - Reference< XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); - Reference<XInterface> xNamingContextIfc = xMgr->createInstance(C2U("com.sun.star.sdb.DatabaseContext")); - Reference< XNameAccess > xNamingContext(xNamingContextIfc, UNO_QUERY); - if (xNamingContext.is() && xNamingContext->hasByName(_rURL)) - { - DBG_ASSERT(Reference< XNamingService > (xNamingContext, UNO_QUERY).is(), "::getDataSource : no NamingService interface on the sdb::DatabaseAccessContext !"); - try - { - xDataSource = Reference< XDataSource > (Reference< XNamingService > (xNamingContext, UNO_QUERY)->getRegisteredObject(_rURL), UNO_QUERY); - } - catch(Exception &) - { - OSL_FAIL("Exception caught in ODatabaseContext::getRegisteredObject()"); - } - } - // build the connection from the data source - Reference< XConnection > xConn; - if (xDataSource.is()) - { - // need user/pwd for this - ::rtl::OUString sUser, sPwd; - Reference< XPropertySet > xDataSourceProps(xDataSource, UNO_QUERY); - Reference< XCompletedConnection > xComplConn(xDataSource, UNO_QUERY); - try - { - - Reference<XInterface> xHdl = xMgr->createInstance(C2U("com.sun.star.task.InteractionHandler")); - Reference<task::XInteractionHandler> xIHdl(xHdl, UNO_QUERY); - xConn = xComplConn->connectWithCompletion(xIHdl); - } - catch(SQLException&) - { - // TODO : a real error handling - } - catch(Exception& e ) - { - (void) e; // make compiler happy - } - - } - return xConn; -} - -Reference< XConnection > getConnection(const Reference< XInterface > & xRowSet) -{ - Reference< XConnection > xConn; - try - { - Reference< XPropertySet > xFormProps(xRowSet, UNO_QUERY); - if (!xFormProps.is()) - return xConn; - - xConn = Reference< XConnection > (*(Reference< XInterface > *)xFormProps->getPropertyValue(C2U("ActiveConnection")).getValue(), UNO_QUERY); - if (!xConn.is()) - { - DBG_WARNING("no active connection"); - } - } - catch(Exception& e ) - { - (void) e; // make compiler happy - OSL_FAIL("exception in getConnection"); - } - - return xConn; -} - -Reference< XNameAccess > getColumns(const Reference< XForm > & _rxForm) -{ - Reference< XNameAccess > xReturn; - // check if the form is alive - Reference< XColumnsSupplier > xSupplyCols( _rxForm, UNO_QUERY ); - if (xSupplyCols.is()) - xReturn = xSupplyCols->getColumns(); - - if (!xReturn.is() || (xReturn->getElementNames().getLength() == 0)) - { // no .... - xReturn = NULL; - // -> get the table the form is bound to and ask it for their columns - Reference< XTablesSupplier > xSupplyTables( getConnection( _rxForm ), UNO_QUERY ); - Reference< XPropertySet > xFormProps( _rxForm, UNO_QUERY ); - if (xFormProps.is() && xSupplyTables.is()) - { - try - { - DBG_ASSERT((*(sal_Int32*)xFormProps->getPropertyValue(C2U("CommandType")).getValue()) == CommandType::TABLE, - "::getColumns : invalid form (has no table as data source) !"); - ::rtl::OUString sTable; - xFormProps->getPropertyValue(C2U("Command")) >>= sTable; - Reference< XNameAccess > xTables = xSupplyTables->getTables(); - if (xTables.is() && xTables->hasByName(sTable)) - xSupplyCols = Reference< XColumnsSupplier > ( - *(Reference< XInterface > *)xTables->getByName(sTable).getValue(), UNO_QUERY); - if (xSupplyCols.is()) - xReturn = xSupplyCols->getColumns(); - } -#ifdef DBG_UTIL - catch(Exception& e ) -#else - catch(Exception&) -#endif - { -#ifdef DBG_UTIL - String sMsg(String::CreateFromAscii("::getColumns : catched an exception (")); - sMsg += String(e.Message); - sMsg.AppendAscii(") ..."); - OSL_FAIL( ByteString(sMsg, RTL_TEXTENCODING_ASCII_US ).GetBuffer()); -#endif - } - - } - } - return xReturn; -} - -class MappingDialog_Impl : public ModalDialog -{ - BibDataManager* pDatMan; - OKButton aOKBT; - CancelButton aCancelBT; - HelpButton aHelpBT; - FixedLine aMapGB; - FixedText aIdentifierFT; - ListBox aIdentifierLB; - FixedText aAuthorityTypeFT; - ListBox aAuthorityTypeLB; - FixedText aAuthorFT; - ListBox aAuthorLB; - FixedText aTitleFT; - ListBox aTitleLB; - FixedText aMonthFT; - ListBox aMonthLB; - FixedText aYearFT; - ListBox aYearLB; - FixedText aISBNFT; - ListBox aISBNLB; - FixedText aBooktitleFT; - ListBox aBooktitleLB; - FixedText aChapterFT; - ListBox aChapterLB; - FixedText aEditionFT; - ListBox aEditionLB; - FixedText aEditorFT; - ListBox aEditorLB; - FixedText aHowpublishedFT; - ListBox aHowpublishedLB; - FixedText aInstitutionFT; - ListBox aInstitutionLB; - FixedText aJournalFT; - ListBox aJournalLB; - FixedText aNoteFT; - ListBox aNoteLB; - FixedText aAnnoteFT; - ListBox aAnnoteLB; - FixedText aNumberFT; - ListBox aNumberLB; - FixedText aOrganizationsFT; - ListBox aOrganizationsLB; - FixedText aPagesFT; - ListBox aPagesLB; - FixedText aPublisherFT; - ListBox aPublisherLB; - FixedText aAddressFT; - ListBox aAddressLB; - FixedText aSchoolFT; - ListBox aSchoolLB; - FixedText aSeriesFT; - ListBox aSeriesLB; - FixedText aReportTypeFT; - ListBox aReportTypeLB; - FixedText aVolumeFT; - ListBox aVolumeLB; - FixedText aURLFT; - ListBox aURLLB; - FixedText aCustom1FT; - ListBox aCustom1LB; - FixedText aCustom2FT; - ListBox aCustom2LB; - FixedText aCustom3FT; - ListBox aCustom3LB; - FixedText aCustom4FT; - ListBox aCustom4LB; - FixedText aCustom5FT; - ListBox aCustom5LB; - ListBox* aListBoxes[COLUMN_COUNT]; - String sNone; - - sal_Bool bModified; - - - - DECL_LINK(OkHdl, OKButton*); - DECL_LINK(ListBoxSelectHdl, ListBox*); - -public: - MappingDialog_Impl(Window* pParent, BibDataManager* pDatMan); - ~MappingDialog_Impl(); - - void SetModified() {bModified = sal_True;} - -}; - -sal_uInt16 lcl_FindLogicalName(BibConfig* pConfig , - const ::rtl::OUString& rLogicalColumnName) -{ - for(sal_uInt16 i = 0; i < COLUMN_COUNT; i++) - { - if(rLogicalColumnName == pConfig->GetDefColumnName(i)) - return i; - } - return USHRT_MAX; -} -//----------------------------------------------------------------------------- -MappingDialog_Impl::MappingDialog_Impl(Window* pParent, BibDataManager* pMan) : - ModalDialog(pParent, BibResId(RID_DLG_MAPPING) ), - pDatMan(pMan), - aOKBT(this, BibResId( BT_OK )), - aCancelBT(this, BibResId( BT_CANCEL )), - aHelpBT(this, BibResId( BT_HELP )), - - aMapGB(this, BibResId( GB_MAPPING )), - - aIdentifierFT(this, BibResId( FT_IDENTIFIER )), - aIdentifierLB(this, BibResId( LB_IDENTIFIER )), - aAuthorityTypeFT(this, BibResId( FT_AUTHORITYTYPE )), - aAuthorityTypeLB(this, BibResId( LB_AUTHORITYTYPE )), - aAuthorFT(this, BibResId( FT_AUTHOR )), - aAuthorLB(this, BibResId( LB_AUTHOR )), - aTitleFT(this, BibResId( FT_TITLE )), - aTitleLB(this, BibResId( LB_TITLE )), - aMonthFT(this, BibResId( FT_MONTH )), - aMonthLB(this, BibResId( LB_MONTH )), - aYearFT(this, BibResId( FT_YEAR )), - aYearLB(this, BibResId( LB_YEAR )), - aISBNFT(this, BibResId( FT_ISBN )), - aISBNLB(this, BibResId( LB_ISBN )), - aBooktitleFT(this, BibResId( FT_BOOKTITLE )), - aBooktitleLB(this, BibResId( LB_BOOKTITLE )), - aChapterFT(this, BibResId( FT_CHAPTER )), - aChapterLB(this, BibResId( LB_CHAPTER )), - aEditionFT(this, BibResId( FT_EDITION )), - aEditionLB(this, BibResId( LB_EDITION )), - aEditorFT(this, BibResId( FT_EDITOR )), - aEditorLB(this, BibResId( LB_EDITOR )), - aHowpublishedFT(this, BibResId( FT_HOWPUBLISHED )), - aHowpublishedLB(this, BibResId( LB_HOWPUBLISHED )), - aInstitutionFT(this, BibResId( FT_INSTITUTION )), - aInstitutionLB(this, BibResId( LB_INSTITUTION )), - aJournalFT(this, BibResId( FT_JOURNAL )), - aJournalLB(this, BibResId( LB_JOURNAL )), - aNoteFT(this, BibResId( FT_NOTE )), - aNoteLB(this, BibResId( LB_NOTE )), - aAnnoteFT(this, BibResId( FT_ANNOTE )), - aAnnoteLB(this, BibResId( LB_ANNOTE )), - aNumberFT(this, BibResId( FT_NUMBER )), - aNumberLB(this, BibResId( LB_NUMBER )), - aOrganizationsFT(this, BibResId( FT_ORGANIZATIONS )), - aOrganizationsLB(this, BibResId( LB_ORGANIZATIONS )), - aPagesFT(this, BibResId( FT_PAGES )), - aPagesLB(this, BibResId( LB_PAGES )), - aPublisherFT(this, BibResId( FT_PUBLISHER )), - aPublisherLB(this, BibResId( LB_PUBLISHER )), - aAddressFT(this, BibResId( FT_ADDRESS )), - aAddressLB(this, BibResId( LB_ADDRESS )), - aSchoolFT(this, BibResId( FT_SCHOOL )), - aSchoolLB(this, BibResId( LB_SCHOOL )), - aSeriesFT(this, BibResId( FT_SERIES )), - aSeriesLB(this, BibResId( LB_SERIES )), - aReportTypeFT(this, BibResId( FT_REPORTTYPE )), - aReportTypeLB(this, BibResId( LB_REPORTTYPE )), - aVolumeFT(this, BibResId( FT_VOLUME )), - aVolumeLB(this, BibResId( LB_VOLUME )), - aURLFT(this, BibResId( FT_URL )), - aURLLB(this, BibResId( LB_URL )), - aCustom1FT(this, BibResId( FT_CUSTOM1 )), - aCustom1LB(this, BibResId( LB_CUSTOM1 )), - aCustom2FT(this, BibResId( FT_CUSTOM2 )), - aCustom2LB(this, BibResId( LB_CUSTOM2 )), - aCustom3FT(this, BibResId( FT_CUSTOM3 )), - aCustom3LB(this, BibResId( LB_CUSTOM3 )), - aCustom4FT(this, BibResId( FT_CUSTOM4 )), - aCustom4LB(this, BibResId( LB_CUSTOM4 )), - aCustom5FT(this, BibResId( FT_CUSTOM5 )), - aCustom5LB(this, BibResId( LB_CUSTOM5 )), - sNone(BibResId(ST_NONE)), - bModified(sal_False) -{ - FreeResource(); - - aIdentifierFT.SetText(String( BibResId( ST_IDENTIFIER ))); - aAuthorityTypeFT.SetText(String( BibResId( ST_AUTHTYPE ))); - aAuthorFT.SetText(String( BibResId( ST_AUTHOR ))); - aTitleFT.SetText(String( BibResId( ST_TITLE ))); - aMonthFT.SetText(String( BibResId( ST_MONTH ))); - aYearFT.SetText(String( BibResId( ST_YEAR ))); - aISBNFT.SetText(String( BibResId( ST_ISBN ))); - aBooktitleFT.SetText(String( BibResId( ST_BOOKTITLE ))); - aChapterFT.SetText(String( BibResId( ST_CHAPTER ))); - aEditionFT.SetText(String( BibResId( ST_EDITION ))); - aEditorFT.SetText(String( BibResId( ST_EDITOR ))); - aHowpublishedFT.SetText(String( BibResId( ST_HOWPUBLISHED ))); - aInstitutionFT.SetText(String( BibResId( ST_INSTITUTION ))); - aJournalFT.SetText(String( BibResId( ST_JOURNAL ))); - aNoteFT.SetText(String( BibResId( ST_NOTE ))); - aAnnoteFT.SetText(String( BibResId( ST_ANNOTE ))); - aNumberFT.SetText(String( BibResId( ST_NUMBER ))); - aOrganizationsFT.SetText(String( BibResId( ST_ORGANIZATION ))); - aPagesFT.SetText(String( BibResId( ST_PAGE ))); - aPublisherFT.SetText(String( BibResId( ST_PUBLISHER ))); - aAddressFT.SetText(String( BibResId( ST_ADDRESS ))); - aSchoolFT.SetText(String( BibResId( ST_SCHOOL ))); - aSeriesFT.SetText(String( BibResId( ST_SERIES ))); - aReportTypeFT.SetText(String( BibResId( ST_REPORT ))); - aVolumeFT.SetText(String( BibResId( ST_VOLUME ))); - aURLFT.SetText(String( BibResId( ST_URL ))); - aCustom1FT.SetText(String( BibResId( ST_CUSTOM1 ))); - aCustom2FT.SetText(String( BibResId( ST_CUSTOM2 ))); - aCustom3FT.SetText(String( BibResId( ST_CUSTOM3 ))); - aCustom4FT.SetText(String( BibResId( ST_CUSTOM4 ))); - aCustom5FT.SetText(String( BibResId( ST_CUSTOM5 ))); - - aOKBT.SetClickHdl(LINK(this, MappingDialog_Impl, OkHdl)); - String sTitle = GetText(); - sTitle.SearchAndReplace(C2S("%1"), pDatMan->getActiveDataTable(), 0); - SetText(sTitle); - - aListBoxes[0] = &aIdentifierLB; - aListBoxes[1] = &aAuthorityTypeLB; - aListBoxes[2] = &aAuthorLB; - aListBoxes[3] = &aTitleLB; - aListBoxes[4] = &aYearLB; - aListBoxes[5] = &aISBNLB; - aListBoxes[6] = &aBooktitleLB; - aListBoxes[7] = &aChapterLB; - aListBoxes[8] = &aEditionLB; - aListBoxes[9] = &aEditorLB; - aListBoxes[10] = &aHowpublishedLB; - aListBoxes[11] = &aInstitutionLB; - aListBoxes[12] = &aJournalLB; - aListBoxes[13] = &aMonthLB; - aListBoxes[14] = &aNoteLB; - aListBoxes[15] = &aAnnoteLB; - aListBoxes[16] = &aNumberLB; - aListBoxes[17] = &aOrganizationsLB; - aListBoxes[18] = &aPagesLB; - aListBoxes[19] = &aPublisherLB; - aListBoxes[20] = &aAddressLB; - aListBoxes[21] = &aSchoolLB; - aListBoxes[22] = &aSeriesLB; - aListBoxes[23] = &aReportTypeLB; - aListBoxes[24] = &aVolumeLB; - aListBoxes[25] = &aURLLB; - aListBoxes[26] = &aCustom1LB; - aListBoxes[27] = &aCustom2LB; - aListBoxes[28] = &aCustom3LB; - aListBoxes[29] = &aCustom4LB; - aListBoxes[30] = &aCustom5LB; - - aListBoxes[0]->InsertEntry(sNone); - Reference< XNameAccess > xFields = getColumns( pDatMan->getForm() ); - DBG_ASSERT(xFields.is(), "MappingDialog_Impl::MappingDialog_Impl : gave me an invalid form !"); - if(xFields.is()) - { - Sequence< ::rtl::OUString > aNames = xFields->getElementNames(); - sal_Int32 nFieldsCount = aNames.getLength(); - const ::rtl::OUString* pNames = aNames.getConstArray(); - - for(sal_Int32 nField = 0; nField < nFieldsCount; nField++) - aListBoxes[0]->InsertEntry(pNames[nField]); - } - - Link aLnk = LINK(this, MappingDialog_Impl, ListBoxSelectHdl); - - aListBoxes[0]->SelectEntryPos(0); - aListBoxes[0]->SetSelectHdl(aLnk); - for(sal_uInt16 i = 1; i < COLUMN_COUNT; i++) - { - for(sal_uInt16 j = 0; j < aListBoxes[0]->GetEntryCount();j++) - aListBoxes[i]->InsertEntry(aListBoxes[0]->GetEntry(j)); - aListBoxes[i]->SelectEntryPos(0); - aListBoxes[i]->SetSelectHdl(aLnk); - } - BibConfig* pConfig = BibModul::GetConfig(); - BibDBDescriptor aDesc; - aDesc.sDataSource = pDatMan->getActiveDataSource(); - aDesc.sTableOrQuery = pDatMan->getActiveDataTable(); - aDesc.nCommandType = CommandType::TABLE; - const Mapping* pMapping = pConfig->GetMapping(aDesc); - if(pMapping) - { - for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++) - { - sal_uInt16 nListBoxIndex = lcl_FindLogicalName( pConfig, pMapping->aColumnPairs[nEntry].sLogicalColumnName); - if(nListBoxIndex < COLUMN_COUNT) - { - aListBoxes[nListBoxIndex]->SelectEntry(pMapping->aColumnPairs[nEntry].sRealColumnName); - } - } - } -} - -MappingDialog_Impl::~MappingDialog_Impl() -{} - -IMPL_LINK(MappingDialog_Impl, ListBoxSelectHdl, ListBox*, pListBox) -{ - sal_uInt16 nEntryPos = pListBox->GetSelectEntryPos(); - if(0 < nEntryPos) - { - for(sal_uInt16 i = 0; i < COLUMN_COUNT; i++) - { - if(pListBox != aListBoxes[i] && aListBoxes[i]->GetSelectEntryPos() == nEntryPos) - aListBoxes[i]->SelectEntryPos(0); - } - } - SetModified(); - return 0; -} - -IMPL_LINK(MappingDialog_Impl, OkHdl, OKButton*, EMPTYARG) -{ - if(bModified) - { - Mapping aNew; - aNew.sTableName = String(pDatMan->getActiveDataTable()); - aNew.sURL = String(pDatMan->getActiveDataSource()); - - sal_uInt16 nWriteIndex = 0; - BibConfig* pConfig = BibModul::GetConfig(); - for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++) - { - String sSel = aListBoxes[nEntry]->GetSelectEntry(); - if(sSel != sNone) - { - aNew.aColumnPairs[nWriteIndex].sRealColumnName = sSel; - aNew.aColumnPairs[nWriteIndex].sLogicalColumnName = pConfig->GetDefColumnName(nEntry); - nWriteIndex++; - } - } - BibDBDescriptor aDesc; - aDesc.sDataSource = pDatMan->getActiveDataSource(); - aDesc.sTableOrQuery = pDatMan->getActiveDataTable(); - aDesc.nCommandType = CommandType::TABLE; - pDatMan->ResetIdentifierMapping(); - pConfig->SetMapping(aDesc, &aNew); - } - EndDialog(bModified ? RET_OK : RET_CANCEL); - return 0; -} - -class DBChangeDialog_Impl : public ModalDialog -{ - OKButton aOKBT; - CancelButton aCancelBT; - HelpButton aHelpBT; - FixedLine aSelectionGB; - SvTabListBox aSelectionLB; - HeaderBar aSelectionHB; - DBChangeDialogConfig_Impl aConfig; - String aEntryST; - String aURLST; - - BibDataManager* pDatMan; - - DECL_LINK(DoubleClickHdl, SvTabListBox*); -public: - DBChangeDialog_Impl(Window* pParent, BibDataManager* pMan ); - ~DBChangeDialog_Impl(); - - String GetCurrentURL()const; -}; - -DBChangeDialog_Impl::DBChangeDialog_Impl(Window* pParent, BibDataManager* pMan ) : - ModalDialog(pParent, BibResId(RID_DLG_DBCHANGE) ), - aOKBT(this, BibResId( BT_OK )), - aCancelBT(this, BibResId( BT_CANCEL )), - aHelpBT(this, BibResId( BT_HELP )), - aSelectionGB(this, BibResId( GB_SELECTION )), - aSelectionLB(this, BibResId( LB_SELECTION )), - aSelectionHB(this, BibResId( HB_SELECTION )), - aEntryST(BibResId(ST_ENTRY)), - aURLST( BibResId(ST_URL)), - pDatMan(pMan) -{ - FreeResource(); - aSelectionLB.SetDoubleClickHdl( LINK(this, DBChangeDialog_Impl, DoubleClickHdl)); - try - { - Reference< XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); - - ::Size aSize = aSelectionHB.GetSizePixel(); - long nTabs[2]; - nTabs[0] = 1;// Number of Tabs - nTabs[1] = aSize.Width() / 4; - - aSelectionHB.SetStyle(aSelectionHB.GetStyle()|WB_STDHEADERBAR); - aSelectionHB.InsertItem( 1, aEntryST, aSize.Width()); - aSelectionHB.SetSizePixel(aSelectionHB.CalcWindowSizePixel()); - aSelectionHB.Show(); - - aSelectionLB.SetTabs( &nTabs[0], MAP_PIXEL ); - aSelectionLB.SetStyle(aSelectionLB.GetStyle()|WB_CLIPCHILDREN|WB_SORT); - aSelectionLB.GetModel()->SetSortMode(SortAscending); - - ::rtl::OUString sActiveSource = pDatMan->getActiveDataSource(); - const Sequence< ::rtl::OUString >& rSources = aConfig.GetDataSourceNames(); - const ::rtl::OUString* pSourceNames = rSources.getConstArray(); - for(int i = 0; i < rSources.getLength(); i++) - { - SvLBoxEntry* pEntry = aSelectionLB.InsertEntry(pSourceNames[i]); - if(pSourceNames[i] == sActiveSource) - { - aSelectionLB.Select(pEntry); - } - } - aSelectionLB.GetModel()->Resort(); - } - catch(Exception& e ) - { - (void) e; // make compiler happy - OSL_FAIL("Exception in BibDataManager::DBChangeDialog_Impl::DBChangeDialog_Impl"); - } - - -} - -IMPL_LINK(DBChangeDialog_Impl, DoubleClickHdl, SvTabListBox*, /*pLB*/) -{ - EndDialog(RET_OK); - return 0; -} - -DBChangeDialog_Impl::~DBChangeDialog_Impl() -{ -} - -String DBChangeDialog_Impl::GetCurrentURL()const -{ - String sRet; - SvLBoxEntry* pEntry = aSelectionLB.FirstSelected(); - if(pEntry) - { - sRet = aSelectionLB.GetEntryText(pEntry, 0); - } - return sRet; -} - -// XDispatchProvider -BibInterceptorHelper::BibInterceptorHelper( ::bib::BibBeamer* pBibBeamer, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch) -{ - if( pBibBeamer ) - { - xInterception = pBibBeamer->getDispatchProviderInterception(); - if( xInterception.is() ) - xInterception->registerDispatchProviderInterceptor( this ); - } - if( xDispatch.is() ) - xFormDispatch = xDispatch; -} - -BibInterceptorHelper::~BibInterceptorHelper( ) -{ -} - -void BibInterceptorHelper::ReleaseInterceptor() -{ - if ( xInterception.is() ) - xInterception->releaseDispatchProviderInterceptor( this ); - xInterception.clear(); -} - -::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL - BibInterceptorHelper::queryDispatch( const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags ) throw (::com::sun::star::uno::RuntimeException) -{ - Reference< XDispatch > xReturn; - - String aCommand( aURL.Path ); - if ( aCommand.EqualsAscii("FormSlots/ConfirmDeletion") ) - xReturn = xFormDispatch; - else - if ( xSlaveDispatchProvider.is() ) - xReturn = xSlaveDispatchProvider->queryDispatch( aURL, aTargetFrameName, nSearchFlags); - - return xReturn; -} - -::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL - BibInterceptorHelper::queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& aDescripts ) throw (::com::sun::star::uno::RuntimeException) -{ - Sequence< Reference< XDispatch> > aReturn( aDescripts.getLength() ); - Reference< XDispatch >* pReturn = aReturn.getArray(); - const DispatchDescriptor* pDescripts = aDescripts.getConstArray(); - for ( sal_Int16 i=0; i<aDescripts.getLength(); ++i, ++pReturn, ++pDescripts ) - { - *pReturn = queryDispatch( pDescripts->FeatureURL, pDescripts->FrameName, pDescripts->SearchFlags ); - } - return aReturn; -} - -// XDispatchProviderInterceptor -::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL - BibInterceptorHelper::getSlaveDispatchProvider( ) throw (::com::sun::star::uno::RuntimeException) -{ - return xSlaveDispatchProvider; -} - -void SAL_CALL BibInterceptorHelper::setSlaveDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewSlaveDispatchProvider ) throw (::com::sun::star::uno::RuntimeException) -{ - xSlaveDispatchProvider = xNewSlaveDispatchProvider; -} - -::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL - BibInterceptorHelper::getMasterDispatchProvider( ) throw (::com::sun::star::uno::RuntimeException) -{ - return xMasterDispatchProvider; -} - -void SAL_CALL BibInterceptorHelper::setMasterDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewMasterDispatchProvider ) throw (::com::sun::star::uno::RuntimeException) -{ - xMasterDispatchProvider = xNewMasterDispatchProvider; -} - -//----------------------------------------------------------------------------- -#define STR_UID "uid" -::rtl::OUString gGridName(C2U("theGrid")); -::rtl::OUString gViewName(C2U("theView")); -::rtl::OUString gGlobalName(C2U("theGlobals")); -::rtl::OUString gBeamerSize(C2U("theBeamerSize")); -::rtl::OUString gViewSize(C2U("theViewSize")); - -BibDataManager::BibDataManager() - :BibDataManager_Base( GetMutex() ) - ,m_pInterceptorHelper( NULL ) - ,m_aLoadListeners(m_aMutex) - ,pBibView( NULL ) - ,pToolbar(0) -{ -} - - -BibDataManager::~BibDataManager() -{ - Reference< XLoadable > xLoad( m_xForm, UNO_QUERY ); - Reference< XPropertySet > xPrSet( m_xForm, UNO_QUERY ); - Reference< XComponent > xComp( m_xForm, UNO_QUERY ); - if ( m_xForm.is() ) - { - Reference< XComponent > xConnection; - xPrSet->getPropertyValue(C2U("ActiveConnection")) >>= xConnection; - RemoveMeAsUidListener(); - if (xLoad.is()) - xLoad->unload(); - if (xComp.is()) - xComp->dispose(); - if(xConnection.is()) - xConnection->dispose(); - m_xForm = NULL; - } - if( m_pInterceptorHelper ) - { - m_pInterceptorHelper->ReleaseInterceptor(); - m_pInterceptorHelper->release(); - m_pInterceptorHelper = NULL; - } -} -//------------------------------------------------------------------------ -void BibDataManager::InsertFields(const Reference< XFormComponent > & _rxGrid) -{ - if ( !_rxGrid.is() ) - return; - - try - { - Reference< XNameContainer > xColContainer( _rxGrid, UNO_QUERY ); - // remove the old fields - if ( xColContainer->hasElements() ) - { - Sequence< ::rtl::OUString > aNames = xColContainer->getElementNames(); - const ::rtl::OUString* pNames = aNames.getConstArray(); - const ::rtl::OUString* pNamesEnd = pNames + aNames.getLength(); - for ( ; pNames != pNamesEnd; ++pNames ) - xColContainer->removeByName( *pNames ); - } - - Reference< XNameAccess > xFields = getColumns( m_xForm ); - if (!xFields.is()) - return; - - Reference< XGridColumnFactory > xColFactory( _rxGrid, UNO_QUERY ); - - Reference< XPropertySet > xField; - - Sequence< ::rtl::OUString > aFields( xFields->getElementNames() ); - const ::rtl::OUString* pFields = aFields.getConstArray(); - const ::rtl::OUString* pFieldsEnd = pFields + aFields.getLength(); - - for ( ; pFields != pFieldsEnd; ++pFields ) - { - xFields->getByName( *pFields ) >>= xField; - - ::rtl::OUString sCurrentModelType; - const ::rtl::OUString sType(C2U("Type")); - sal_Int32 nType = 0; - sal_Bool bIsFormatted = sal_False; - sal_Bool bFormattedIsNumeric = sal_True; - xField->getPropertyValue(sType) >>= nType; - switch(nType) - { - case DataType::BIT: - case DataType::BOOLEAN: - sCurrentModelType = C2U("CheckBox"); - break; - - case DataType::BINARY: - case DataType::VARBINARY: - case DataType::LONGVARBINARY: - case DataType::BLOB: - sCurrentModelType = C2U("TextField"); - break; - - case DataType::VARCHAR: - case DataType::LONGVARCHAR: - case DataType::CHAR: - case DataType::CLOB: - bFormattedIsNumeric = sal_False; - // _NO_ break ! - default: - sCurrentModelType = C2U("FormattedField"); - bIsFormatted = sal_True; - break; - } - - Reference< XPropertySet > xCurrentCol = xColFactory->createColumn(sCurrentModelType); - if (bIsFormatted) - { - ::rtl::OUString sFormatKey(C2U("FormatKey")); - xCurrentCol->setPropertyValue(sFormatKey, xField->getPropertyValue(sFormatKey)); - Any aFormatted(&bFormattedIsNumeric, ::getBooleanCppuType()); - xCurrentCol->setPropertyValue(C2U("TreatAsNumber"), aFormatted); - } - Any aColName = makeAny( *pFields ); - xCurrentCol->setPropertyValue(FM_PROP_CONTROLSOURCE, aColName); - xCurrentCol->setPropertyValue(FM_PROP_LABEL, aColName); - - xColContainer->insertByName( *pFields, makeAny( xCurrentCol ) ); - } - } - catch(Exception& e ) - { - (void) e; // make compiler happy - OSL_FAIL("Exception in BibDataManager::InsertFields"); - } -} - -Reference< awt::XControlModel > BibDataManager::updateGridModel() -{ - return updateGridModel( m_xForm ); -} - -Reference< awt::XControlModel > BibDataManager::updateGridModel(const Reference< XForm > & xDbForm) -{ - try - { - Reference< XPropertySet > aFormPropSet( xDbForm, UNO_QUERY ); - ::rtl::OUString sName; - aFormPropSet->getPropertyValue(C2U("Command")) >>= sName; - - if ( !m_xGridModel.is() ) - { - m_xGridModel = createGridModel( gGridName ); - - Reference< XNameContainer > xNameCont(xDbForm, UNO_QUERY); - xNameCont->insertByName( sName, makeAny( m_xGridModel ) ); - } - - // insert the fields - Reference< XFormComponent > xFormComp( m_xGridModel, UNO_QUERY ); - InsertFields( xFormComp ); - } - catch(Exception& e ) - { - (void) e; // make compiler happy - OSL_FAIL("::updateGridModel: something went wrong !"); - } - - - return m_xGridModel; -} - -Reference< XForm > BibDataManager::createDatabaseForm(BibDBDescriptor& rDesc) -{ - Reference< XForm > xResult; - try - { - Reference< XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); - m_xForm = Reference< XForm > ( xMgr->createInstance( C2U("com.sun.star.form.component.Form") ), UNO_QUERY ); - - Reference< XPropertySet > aPropertySet( m_xForm, UNO_QUERY ); - - aDataSourceURL = rDesc.sDataSource; - if(aPropertySet.is()) - { - Any aVal; - aVal <<= (sal_Int32)ResultSetType::SCROLL_INSENSITIVE; - aPropertySet->setPropertyValue(C2U("ResultSetType"),aVal ); - aVal <<= (sal_Int32)ResultSetConcurrency::READ_ONLY; - aPropertySet->setPropertyValue(C2U("ResultSetConcurrency"), aVal); - - //Caching for Performance - aVal <<= (sal_Int32)50; - aPropertySet->setPropertyValue(C2U("FetchSize"), aVal); - - Reference< XConnection > xConnection = getConnection(rDesc.sDataSource); - aVal <<= xConnection; - aPropertySet->setPropertyValue(C2U("ActiveConnection"), aVal); - - Reference< XTablesSupplier > xSupplyTables(xConnection, UNO_QUERY); - Reference< XNameAccess > xTables = xSupplyTables.is() ? - xSupplyTables->getTables() : Reference< XNameAccess > (); - - Sequence< ::rtl::OUString > aTableNameSeq; - if (xTables.is()) - aTableNameSeq = xTables->getElementNames(); - - if(aTableNameSeq.getLength() > 0) - { - const ::rtl::OUString* pTableNames = aTableNameSeq.getConstArray(); - if(rDesc.sTableOrQuery.getLength()) - aActiveDataTable = rDesc.sTableOrQuery; - else - { - rDesc.sTableOrQuery = aActiveDataTable = pTableNames[0]; - rDesc.nCommandType = CommandType::TABLE; - } - - aVal <<= aActiveDataTable; - aPropertySet->setPropertyValue(C2U("Command"), aVal); - aVal <<= rDesc.nCommandType; - aPropertySet->setPropertyValue(C2U("CommandType"), aVal); - - - Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData(); - aQuoteChar = xMetaData->getIdentifierQuoteString(); - - Reference< XMultiServiceFactory > xFactory(xConnection, UNO_QUERY); - if ( xFactory.is() ) - m_xParser.set( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.SingleSelectQueryComposer" ) ) ), UNO_QUERY ); - - ::rtl::OUString aString(C2U("SELECT * FROM ")); - - ::rtl::OUString sCatalog, sSchema, sName; - ::dbtools::qualifiedNameComponents( xMetaData, aActiveDataTable, sCatalog, sSchema, sName, ::dbtools::eInDataManipulation ); - aString += ::dbtools::composeTableNameForSelect( xConnection, sCatalog, sSchema, sName ); - - m_xParser->setElementaryQuery(aString); - BibConfig* pConfig = BibModul::GetConfig(); - pConfig->setQueryField(getQueryField()); - startQueryWith(pConfig->getQueryText()); - - xResult = m_xForm; - } - } - } - catch(Exception& e ) - { - (void) e; // make compiler happy - OSL_FAIL("::createDatabaseForm: something went wrong !"); - } - - - return xResult; -} -//------------------------------------------------------------------------ -Sequence< ::rtl::OUString > BibDataManager::getDataSources() -{ - Sequence< ::rtl::OUString > aTableNameSeq; - - try - { - Reference< XTablesSupplier > xSupplyTables( getConnection( m_xForm ), UNO_QUERY ); - Reference< XNameAccess > xTables; - if (xSupplyTables.is()) - xTables = xSupplyTables->getTables(); - if (xTables.is()) - aTableNameSeq = xTables->getElementNames(); - } - catch(Exception& e ) - { - (void) e; // make compiler happy - OSL_FAIL("::getDataSources: something went wrong !"); - } - - - return aTableNameSeq; -} -//------------------------------------------------------------------------ -::rtl::OUString BibDataManager::getActiveDataTable() -{ - return aActiveDataTable; -} -//------------------------------------------------------------------------ -void BibDataManager::setFilter(const ::rtl::OUString& rQuery) -{ - if(!m_xParser.is()) - return; - try - { - m_xParser->setFilter( rQuery ); - ::rtl::OUString aQuery = m_xParser->getFilter(); - Reference< XPropertySet > xFormProps( m_xForm, UNO_QUERY_THROW ); - xFormProps->setPropertyValue( C2U( "Filter" ), makeAny( aQuery ) ); - xFormProps->setPropertyValue( C2U( "ApplyFilter" ), makeAny( sal_True ) ); - reload(); - } - catch(Exception& e ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - -} -//------------------------------------------------------------------------ -::rtl::OUString BibDataManager::getFilter() -{ - - ::rtl::OUString aQueryString; - try - { - Reference< XPropertySet > xFormProps( m_xForm, UNO_QUERY_THROW ); - OSL_VERIFY( xFormProps->getPropertyValue( C2U( "Filter" ) ) >>= aQueryString ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - - return aQueryString; - -} -//------------------------------------------------------------------------ -Sequence< ::rtl::OUString > BibDataManager::getQueryFields() -{ - Sequence< ::rtl::OUString > aFieldSeq; - Reference< XNameAccess > xFields = getColumns( m_xForm ); - if (xFields.is()) - aFieldSeq = xFields->getElementNames(); - return aFieldSeq; -} -//------------------------------------------------------------------------ -::rtl::OUString BibDataManager::getQueryField() -{ - BibConfig* pConfig = BibModul::GetConfig(); - ::rtl::OUString aFieldString = pConfig->getQueryField(); - if(!aFieldString.getLength()) - { - Sequence< ::rtl::OUString > aSeq = getQueryFields(); - const ::rtl::OUString* pFields = aSeq.getConstArray(); - if(aSeq.getLength()>0) - { - aFieldString=pFields[0]; - } - } - return aFieldString; -} -//------------------------------------------------------------------------ -void BibDataManager::startQueryWith(const ::rtl::OUString& rQuery) -{ - BibConfig* pConfig = BibModul::GetConfig(); - pConfig->setQueryText( rQuery ); - - ::rtl::OUString aQueryString; - if(rQuery.getLength()>0) - { - aQueryString=aQuoteChar; - aQueryString+=getQueryField(); - aQueryString+=aQuoteChar; - aQueryString+=C2U(" like '"); - String sQuery(rQuery); - sQuery.SearchAndReplaceAll('?','_'); - sQuery.SearchAndReplaceAll('*','%'); - aQueryString += sQuery; - aQueryString+=C2U("%'"); - } - setFilter(aQueryString); -} - -void BibDataManager::setActiveDataSource(const ::rtl::OUString& rURL) -{ - ::rtl::OUString uTable; - ::rtl::OUString sTmp(aDataSourceURL); - aDataSourceURL = rURL; - - Reference< XPropertySet > aPropertySet( m_xForm, UNO_QUERY ); - if(aPropertySet.is()) - { - unload(); - - Reference< XComponent > xOldConnection; - aPropertySet->getPropertyValue(C2U("ActiveConnection")) >>= xOldConnection; - - Reference< XConnection > xConnection = getConnection(rURL); - if(!xConnection.is()) - { - aDataSourceURL = sTmp; - return; - } - Any aVal; aVal <<= xConnection; - aPropertySet->setPropertyValue(C2U("ActiveConnection"), aVal); - Reference< XMultiServiceFactory > xFactory(xConnection, UNO_QUERY); - if ( xFactory.is() ) - m_xParser.set( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.SingleSelectQueryComposer" ) ) ), UNO_QUERY ); - - if(xOldConnection.is()) - xOldConnection->dispose(); - - Sequence< ::rtl::OUString > aTableNameSeq; - Reference< XTablesSupplier > xSupplyTables(xConnection, UNO_QUERY); - if(xSupplyTables.is()) - { - Reference< XNameAccess > xAccess = xSupplyTables->getTables(); - aTableNameSeq = xAccess->getElementNames(); - } - if(aTableNameSeq.getLength() > 0) - { - const ::rtl::OUString* pTableNames = aTableNameSeq.getConstArray(); - aActiveDataTable = pTableNames[0]; - aVal <<= aActiveDataTable; - aPropertySet->setPropertyValue(C2U("Command"), aVal); - aPropertySet->setPropertyValue(C2U("CommandType"), makeAny(CommandType::TABLE)); - //Caching for Performance - aVal <<= (sal_Int32)50; - aPropertySet->setPropertyValue(C2U("FetchSize"), aVal); - ::rtl::OUString aString(C2U("SELECT * FROM ")); - // quote the table name which may contain catalog.schema.table - Reference<XDatabaseMetaData> xMetaData(xConnection->getMetaData(),UNO_QUERY); - aQuoteChar = xMetaData->getIdentifierQuoteString(); - - ::rtl::OUString sCatalog, sSchema, sName; - ::dbtools::qualifiedNameComponents( xMetaData, aActiveDataTable, sCatalog, sSchema, sName, ::dbtools::eInDataManipulation ); - aString += ::dbtools::composeTableNameForSelect( xConnection, sCatalog, sSchema, sName ); - - m_xParser->setElementaryQuery(aString); - BibConfig* pConfig = BibModul::GetConfig(); - pConfig->setQueryField(getQueryField()); - startQueryWith(pConfig->getQueryText()); - setActiveDataTable(aActiveDataTable); - } - FeatureStateEvent aEvent; - util::URL aURL; - aEvent.IsEnabled = sal_True; - aEvent.Requery = sal_False; - aEvent.FeatureDescriptor = getActiveDataTable(); - - aEvent.State = makeAny( getDataSources() ); - - if(pToolbar) - { - aURL.Complete =C2U(".uno:Bib/source"); - aEvent.FeatureURL = aURL; - pToolbar->statusChanged( aEvent ); - } - - updateGridModel(); - load(); - } -} - - -void BibDataManager::setActiveDataTable(const ::rtl::OUString& rTable) -{ - ResetIdentifierMapping(); - try - { - Reference< XPropertySet > aPropertySet( m_xForm, UNO_QUERY ); - - if(aPropertySet.is()) - { - Reference< XConnection > xConnection = getConnection( m_xForm ); - Reference< XTablesSupplier > xSupplyTables(xConnection, UNO_QUERY); - Reference< XNameAccess > xAccess = xSupplyTables->getTables(); - Sequence< ::rtl::OUString > aTableNameSeq = xAccess->getElementNames(); - sal_uInt32 nCount = aTableNameSeq.getLength(); - - const ::rtl::OUString* pTableNames = aTableNameSeq.getConstArray(); - const ::rtl::OUString* pTableNamesEnd = pTableNames + nCount; - - for ( ; pTableNames != pTableNamesEnd; ++pTableNames ) - { - if ( rTable == *pTableNames ) - { - aActiveDataTable = rTable; - Any aVal; aVal <<= rTable; - aPropertySet->setPropertyValue( C2U("Command"), aVal ); - break; - } - } - if (pTableNames != pTableNamesEnd) - { - Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData(); - aQuoteChar = xMetaData->getIdentifierQuoteString(); - - Reference< XMultiServiceFactory > xFactory(xConnection, UNO_QUERY); - if ( xFactory.is() ) - m_xParser.set( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.SingleSelectQueryComposer" ) ) ), UNO_QUERY ); - - ::rtl::OUString aString(C2U("SELECT * FROM ")); - - ::rtl::OUString sCatalog, sSchema, sName; - ::dbtools::qualifiedNameComponents( xMetaData, aActiveDataTable, sCatalog, sSchema, sName, ::dbtools::eInDataManipulation ); - aString += ::dbtools::composeTableNameForSelect( xConnection, sCatalog, sSchema, sName ); - - m_xParser->setElementaryQuery(aString); - - BibConfig* pConfig = BibModul::GetConfig(); - pConfig->setQueryField(getQueryField()); - startQueryWith(pConfig->getQueryText()); - - BibDBDescriptor aDesc; - aDesc.sDataSource = aDataSourceURL; - aDesc.sTableOrQuery = aActiveDataTable; - aDesc.nCommandType = CommandType::TABLE; - BibModul::GetConfig()->SetBibliographyURL(aDesc); - } - } - } - catch(Exception& e ) - { - (void) e; // make compiler happy - OSL_FAIL("::setActiveDataTable: something went wrong !"); - } - -} - -//------------------------------------------------------------------------ -void SAL_CALL BibDataManager::load( ) throw (RuntimeException) -{ - if ( isLoaded() ) - // nothing to do - return; - - Reference< XLoadable > xFormAsLoadable( m_xForm, UNO_QUERY ); - DBG_ASSERT( xFormAsLoadable.is() || !m_xForm.is(), "BibDataManager::load: invalid form!"); - if ( xFormAsLoadable.is() ) - { - xFormAsLoadable->load(); - SetMeAsUidListener(); - - EventObject aEvt( static_cast< XWeak* >( this ) ); - m_aLoadListeners.notifyEach( &XLoadListener::loaded, aEvt ); - } -} - -//------------------------------------------------------------------------ -void SAL_CALL BibDataManager::unload( ) throw (RuntimeException) -{ - if ( !isLoaded() ) - // nothing to do - return; - - Reference< XLoadable >xFormAsLoadable( m_xForm, UNO_QUERY ); - DBG_ASSERT( xFormAsLoadable.is() || !m_xForm.is(), "BibDataManager::unload: invalid form!"); - if ( xFormAsLoadable.is() ) - { - EventObject aEvt( static_cast< XWeak* >( this ) ); - - { - m_aLoadListeners.notifyEach( &XLoadListener::unloading, aEvt ); - } - - RemoveMeAsUidListener(); - xFormAsLoadable->unload(); - - { - m_aLoadListeners.notifyEach( &XLoadListener::unloaded, aEvt ); - } - } -} - -//------------------------------------------------------------------------ -void SAL_CALL BibDataManager::reload( ) throw (RuntimeException) -{ - if ( !isLoaded() ) - // nothing to do - return; - - Reference< XLoadable >xFormAsLoadable( m_xForm, UNO_QUERY ); - DBG_ASSERT( xFormAsLoadable.is() || !m_xForm.is(), "BibDataManager::unload: invalid form!"); - if ( xFormAsLoadable.is() ) - { - EventObject aEvt( static_cast< XWeak* >( this ) ); - - { - m_aLoadListeners.notifyEach( &XLoadListener::reloading, aEvt ); - } - - xFormAsLoadable->reload(); - - { - m_aLoadListeners.notifyEach( &XLoadListener::reloaded, aEvt ); - } - } -} - -//------------------------------------------------------------------------ -sal_Bool SAL_CALL BibDataManager::isLoaded( ) throw (RuntimeException) -{ - Reference< XLoadable >xFormAsLoadable( m_xForm, UNO_QUERY ); - DBG_ASSERT( xFormAsLoadable.is() || !m_xForm.is(), "BibDataManager::isLoaded: invalid form!"); - - sal_Bool bLoaded = sal_False; - if ( xFormAsLoadable.is() ) - bLoaded = xFormAsLoadable->isLoaded(); - return bLoaded; -} - -//------------------------------------------------------------------------ -void SAL_CALL BibDataManager::addLoadListener( const Reference< XLoadListener >& aListener ) throw (RuntimeException) -{ - m_aLoadListeners.addInterface( aListener ); -} - -//------------------------------------------------------------------------ -void SAL_CALL BibDataManager::removeLoadListener( const Reference< XLoadListener >& aListener ) throw (RuntimeException) -{ - m_aLoadListeners.removeInterface( aListener ); -} - -//------------------------------------------------------------------------ -Reference< awt::XControlModel > BibDataManager::createGridModel(const ::rtl::OUString& rName) -{ - Reference< awt::XControlModel > xModel; - - try - { - // create the control model - Reference< XMultiServiceFactory > xMgr = ::comphelper::getProcessServiceFactory(); - Reference< XInterface > xObject = xMgr->createInstance(C2U("com.sun.star.form.component.GridControl")); - xModel=Reference< awt::XControlModel > ( xObject, UNO_QUERY ); - - // set the - Reference< XPropertySet > xPropSet( xModel, UNO_QUERY ); - xPropSet->setPropertyValue( C2U("Name"), makeAny( rName ) ); - - // set the name of the to-be-created control - ::rtl::OUString aControlName(C2U("com.sun.star.form.control.InteractionGridControl")); - Any aAny; aAny <<= aControlName; - xPropSet->setPropertyValue( C2U("DefaultControl"),aAny ); - - // the the helpURL - ::rtl::OUString uProp(C2U("HelpURL")); - Reference< XPropertySetInfo > xPropInfo = xPropSet->getPropertySetInfo(); - if (xPropInfo->hasPropertyByName(uProp)) - { - ::rtl::OUString sId(RTL_CONSTASCII_USTRINGPARAM( INET_HID_SCHEME )); - sId += ::rtl::OUString::createFromAscii( HID_BIB_DB_GRIDCTRL ); - xPropSet->setPropertyValue( uProp, makeAny( sId ) ); - } - } - catch(Exception& e ) - { - (void) e; // make compiler happy - OSL_FAIL("::createGridModel: something went wrong !"); - } - - - return xModel; -} -//------------------------------------------------------------------------ -::rtl::OUString BibDataManager::getControlName(sal_Int32 nFormatKey ) -{ - ::rtl::OUString aResStr; - switch (nFormatKey) - { - case DataType::BIT: - case DataType::BOOLEAN: - aResStr=C2U("CheckBox"); - break; - case DataType::TINYINT: - case DataType::SMALLINT: - case DataType::INTEGER: - aResStr=C2U("NumericField"); ; - break; - case DataType::REAL: - case DataType::DOUBLE: - case DataType::NUMERIC: - case DataType::DECIMAL: - aResStr=C2U("FormattedField"); - break; - case DataType::TIMESTAMP: - aResStr=C2U("FormattedField"); - break; - case DataType::DATE: - aResStr=C2U("DateField"); - break; - case DataType::TIME: - aResStr=C2U("TimeField"); - break; - case DataType::CHAR: - case DataType::VARCHAR: - case DataType::LONGVARCHAR: - default: - aResStr=C2U("TextField"); - break; - } - return aResStr; -} -//------------------------------------------------------------------------ -Reference< awt::XControlModel > BibDataManager::loadControlModel( - const ::rtl::OUString& rName, sal_Bool bForceListBox) -{ - Reference< awt::XControlModel > xModel; - ::rtl::OUString aName(C2U("View_")); - aName += rName; - - try - { - Reference< XNameAccess > xFields = getColumns( m_xForm ); - if (!xFields.is()) - return xModel; - Reference< XPropertySet > xField; - - Any aElement; - - if(xFields->hasByName(rName)) - { - aElement = xFields->getByName(rName); - aElement >>= xField; - Reference< XPropertySetInfo > xInfo = xField.is() ? xField->getPropertySetInfo() : Reference< XPropertySetInfo > (); - - ::rtl::OUString sCurrentModelType; - const ::rtl::OUString sType(C2U("Type")); - sal_Int32 nFormatKey = 0; - xField->getPropertyValue(sType) >>= nFormatKey; - - ::rtl::OUString aInstanceName(C2U("com.sun.star.form.component.")); - - if (bForceListBox) - aInstanceName += C2U("ListBox"); - else - aInstanceName += getControlName(nFormatKey); - - Reference< XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); - Reference< XInterface > xObject = xMgr->createInstance(aInstanceName); - xModel=Reference< awt::XControlModel > ( xObject, UNO_QUERY ); - Reference< XPropertySet > xPropSet( xModel, UNO_QUERY ); - Any aFieldName; aFieldName <<= aName; - - xPropSet->setPropertyValue( FM_PROP_NAME,aFieldName); - xPropSet->setPropertyValue( FM_PROP_CONTROLSOURCE, makeAny( rName ) ); - xPropSet->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NativeWidgetLook" ) ), makeAny( (sal_Bool)sal_True ) ); - - Reference< XFormComponent > aFormComp(xModel,UNO_QUERY ); - - Reference< XNameContainer > xNameCont( m_xForm, UNO_QUERY ); - xNameCont->insertByName(aName, makeAny( aFormComp ) ); - - // now if the form where we inserted the new model is already loaded, notify the model of this - // Note that this implementation below is a HACK as it relies on the fact that the model adds itself - // as load listener to it's parent, which is an implementation detail of the model. - // - // the better solution would be the following: - // in the current scenario, we insert a control model into a form. This results in the control model - // adding itself as load listener to the form. Now, the form should realize that it's already loaded - // and notify the model (which it knows as XLoadListener only) immediately. This seems to make sense. - // (as an anologon to the XStatusListener semantics). - // - // But this would be way too risky for this last-day fix here. - Reference< XLoadable > xLoad( m_xForm, UNO_QUERY ); - if ( xLoad.is() && xLoad->isLoaded() ) - { - Reference< XLoadListener > xListener( aFormComp, UNO_QUERY ); - if ( xListener.is() ) - { - EventObject aLoadSource; - aLoadSource.Source = xLoad; - xListener->loaded( aLoadSource ); - } - } - } - } - catch(Exception& e ) - { - (void) e; // make compiler happy - OSL_FAIL("::loadControlModel: something went wrong !"); - } - return xModel; -} -//------------------------------------------------------------------------ -void SAL_CALL BibDataManager::disposing() -{ - BibDataManager_Base::WeakComponentImplHelperBase::disposing(); -} - -//------------------------------------------------------------------------ -void BibDataManager::disposing( const EventObject& /*Source*/ ) throw( ::com::sun::star::uno::RuntimeException ) -{ - // not interested in -} - -//------------------------------------------------------------------------ -void BibDataManager::propertyChange(const beans::PropertyChangeEvent& evt) throw( RuntimeException ) -{ - try - { - if(evt.PropertyName == FM_PROP_VALUE) - { - if( evt.NewValue.getValueType() == ::getCppuType((Reference<io::XInputStream>*)0) ) - { - Reference< io::XDataInputStream > xStream( - *(const Reference< io::XInputStream > *)evt.NewValue.getValue(), UNO_QUERY ); - aUID <<= xStream->readUTF(); - } - else - aUID = evt.NewValue; - - Reference< XRowLocate > xLocate(xBibCursor, UNO_QUERY); - DBG_ASSERT(xLocate.is(), "BibDataManager::propertyChange : invalid cursor !"); - xLocate->moveToBookmark(aUID); - } - } - catch(Exception& e ) - { - (void) e; // make compiler happy - OSL_FAIL("::propertyChange: something went wrong !"); - } - - -} -//------------------------------------------------------------------------ -void BibDataManager::SetMeAsUidListener() -{ -try -{ - Reference< XNameAccess > xFields = getColumns( m_xForm ); - if (!xFields.is()) - return; - - Sequence< ::rtl::OUString > aFields(xFields->getElementNames()); - const ::rtl::OUString* pFields = aFields.getConstArray(); - sal_Int32 nCount=aFields.getLength(); - String StrUID(C2S(STR_UID)); - ::rtl::OUString theFieldName; - for( sal_Int32 i=0; i<nCount; i++ ) - { - String aName= pFields[i]; - - if(aName.EqualsIgnoreCaseAscii(StrUID)) - { - theFieldName=pFields[i]; - break; - } - } - - if(theFieldName.getLength()>0) - { - Reference< XPropertySet > xPropSet; - Any aElement; - - aElement = xFields->getByName(theFieldName); - xPropSet = *(Reference< XPropertySet > *)aElement.getValue(); - - xPropSet->addPropertyChangeListener(FM_PROP_VALUE, this); - } - -} -catch(Exception& e ) -{ - (void) e; // make compiler happy - OSL_FAIL("Exception in BibDataManager::SetMeAsUidListener"); -} - - -} -//------------------------------------------------------------------------ -void BibDataManager::RemoveMeAsUidListener() -{ -try -{ - Reference< XNameAccess > xFields = getColumns( m_xForm ); - if (!xFields.is()) - return; - - - Sequence< ::rtl::OUString > aFields(xFields->getElementNames()); - const ::rtl::OUString* pFields = aFields.getConstArray(); - sal_Int32 nCount=aFields.getLength(); - String StrUID(C2S(STR_UID)); - ::rtl::OUString theFieldName; - for( sal_Int32 i=0; i<nCount; i++ ) - { - String aName= pFields[i]; - - if(aName.EqualsIgnoreCaseAscii(StrUID)) - { - theFieldName=pFields[i]; - break; - } - } - - if(theFieldName.getLength()>0) - { - Reference< XPropertySet > xPropSet; - Any aElement; - - aElement = xFields->getByName(theFieldName); - xPropSet = *(Reference< XPropertySet > *)aElement.getValue(); - - xPropSet->removePropertyChangeListener(FM_PROP_VALUE, this); - } - -} -catch(Exception& e ) -{ - (void) e; // make compiler happy - OSL_FAIL("Exception in BibDataManager::RemoveMeAsUidListener"); -} - - -} - -void BibDataManager::CreateMappingDialog(Window* pParent) -{ - MappingDialog_Impl* pDlg = new MappingDialog_Impl(pParent, this); - if(RET_OK == pDlg->Execute() && pBibView) - { - reload(); - } - delete pDlg; -} - -::rtl::OUString BibDataManager::CreateDBChangeDialog(Window* pParent) -{ - ::rtl::OUString uRet; - DBChangeDialog_Impl * pDlg = new DBChangeDialog_Impl(pParent, this ); - if(RET_OK == pDlg->Execute()) - { - String sNewURL = pDlg->GetCurrentURL(); - if(sNewURL != String(getActiveDataSource())) - { - uRet = sNewURL; - } - } - delete pDlg; - return uRet; -} - -void BibDataManager::DispatchDBChangeDialog() -{ - if(pToolbar) - pToolbar->SendDispatch(TBC_BT_CHANGESOURCE, Sequence< PropertyValue >()); -} - -const ::rtl::OUString& BibDataManager::GetIdentifierMapping() -{ - if(!sIdentifierMapping.getLength()) - { - BibConfig* pConfig = BibModul::GetConfig(); - BibDBDescriptor aDesc; - aDesc.sDataSource = getActiveDataSource(); - aDesc.sTableOrQuery = getActiveDataTable(); - aDesc.nCommandType = CommandType::TABLE; - const Mapping* pMapping = pConfig->GetMapping(aDesc); - sIdentifierMapping = pConfig->GetDefColumnName(IDENTIFIER_POS); - if(pMapping) - { - for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++) - { - if(pMapping->aColumnPairs[nEntry].sLogicalColumnName == sIdentifierMapping) - { - sIdentifierMapping = pMapping->aColumnPairs[nEntry].sRealColumnName; - break; - } - } - } - } - return sIdentifierMapping; -} - -void BibDataManager::SetToolbar(BibToolBar* pSet) -{ - pToolbar = pSet; - if(pToolbar) - pToolbar->SetDatMan(*this); -} - -uno::Reference< form::runtime::XFormController > BibDataManager::GetFormController() -{ - if(!m_xFormCtrl.is()) - { - Reference< lang::XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); - m_xFormCtrl = uno::Reference< form::runtime::XFormController > ( - xMgr->createInstance(C2U("com.sun.star.form.runtime.FormController")), UNO_QUERY); - m_xFormCtrl->setModel(uno::Reference< awt::XTabControllerModel > (getForm(), UNO_QUERY)); - m_xFormDispatch = uno::Reference< frame::XDispatch > ( m_xFormCtrl, UNO_QUERY); - } - return m_xFormCtrl; -} - -void BibDataManager::RegisterInterceptor( ::bib::BibBeamer* pBibBeamer) -{ - DBG_ASSERT( !m_pInterceptorHelper, "BibDataManager::RegisterInterceptor: called twice!" ); - - if( pBibBeamer ) - m_pInterceptorHelper = new BibInterceptorHelper( pBibBeamer, m_xFormDispatch); - if( m_pInterceptorHelper ) - m_pInterceptorHelper->acquire(); -} - - -sal_Bool BibDataManager::HasActiveConnection()const -{ - sal_Bool bRet = sal_False; - Reference< XPropertySet > xPrSet( m_xForm, UNO_QUERY ); - if( xPrSet.is() ) - { - Reference< XComponent > xConnection; - xPrSet->getPropertyValue(C2U("ActiveConnection")) >>= xConnection; - bRet = xConnection.is(); - } - return bRet; -} - -sal_Bool BibDataManager::HasActiveConnection() -{ - return getConnection( m_xForm ).is(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/datman.hrc b/extensions/source/bibliography/datman.hrc deleted file mode 100644 index 5ea4749ee..000000000 --- a/extensions/source/bibliography/datman.hrc +++ /dev/null @@ -1,102 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#define BT_OK 1 -#define BT_CANCEL 2 -#define BT_HELP 3 -#define GB_MAPPING 4 -#define FT_IDENTIFIER 5 -#define LB_IDENTIFIER 6 -#define ST_NONE 7 - -#define FT_AUTHORITYTYPE 8 -#define LB_AUTHORITYTYPE 9 -#define FT_ADDRESS 10 -#define LB_ADDRESS 11 -#define FT_ANNOTE 12 -#define LB_ANNOTE 13 -#define FT_AUTHOR 14 -#define LB_AUTHOR 15 -#define FT_TITLE 16 -#define LB_TITLE 17 -#define FT_MONTH 18 -#define LB_MONTH 19 -#define FT_YEAR 20 -#define LB_YEAR 21 -#define FT_ISBN 22 -#define LB_ISBN 23 -#define FT_BOOKTITLE 24 -#define LB_BOOKTITLE 25 -#define FT_CHAPTER 26 -#define LB_CHAPTER 27 -#define FT_EDITION 28 -#define LB_EDITION 29 -#define FT_EDITOR 30 -#define LB_EDITOR 31 -#define FT_HOWPUBLISHED 32 -#define LB_HOWPUBLISHED 33 -#define FT_INSTITUTION 34 -#define LB_INSTITUTION 35 -#define FT_JOURNAL 36 -#define LB_JOURNAL 37 -#define FT_NOTE 38 -#define LB_NOTE 39 -#define FT_NUMBER 40 -#define LB_NUMBER 41 -#define FT_ORGANIZATIONS 42 -#define LB_ORGANIZATIONS 43 -#define FT_PAGES 44 -#define LB_PAGES 45 -#define FT_PUBLISHER 46 -#define LB_PUBLISHER 47 -#define FT_SCHOOL 48 -#define LB_SCHOOL 49 -#define FT_SERIES 50 -#define LB_SERIES 51 -#define FT_REPORTTYPE 52 -#define LB_REPORTTYPE 53 -#define FT_VOLUME 54 -#define LB_VOLUME 55 -#define FT_URL 56 -#define LB_URL 57 -#define FT_CUSTOM1 58 -#define LB_CUSTOM1 59 -#define FT_CUSTOM2 60 -#define LB_CUSTOM2 61 -#define FT_CUSTOM3 62 -#define LB_CUSTOM3 63 -#define FT_CUSTOM4 64 -#define LB_CUSTOM4 65 -#define FT_CUSTOM5 66 -#define LB_CUSTOM5 67 - -#define GB_SELECTION 68 -#define ST_ENTRY 69 -#define LB_SELECTION 71 -#define HB_SELECTION 72 - diff --git a/extensions/source/bibliography/datman.hxx b/extensions/source/bibliography/datman.hxx deleted file mode 100644 index 4f485641e..000000000 --- a/extensions/source/bibliography/datman.hxx +++ /dev/null @@ -1,202 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BIB_DATMAN_HXX -#define _BIB_DATMAN_HXX - -#include <com/sun/star/awt/XControlModel.hpp> -#include <com/sun/star/form/XForm.hpp> -#include <com/sun/star/sdbc/XResultSet.hpp> -#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp> -#include <com/sun/star/form/runtime/XFormController.hpp> -#include <cppuhelper/compbase2.hxx> -#include <cppuhelper/interfacecontainer.h> -#include <com/sun/star/form/XLoadable.hpp> -#include <comphelper/broadcasthelper.hxx> -// #100312# -------------------- -#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> -#include <com/sun/star/frame/XDispatchProviderInterception.hpp> -#include <cppuhelper/implbase1.hxx> - -class Window; - -//----------------------------------------------------------------------------- -namespace bib -{ - class BibView; - // #100312# ----------- - class BibBeamer; -} - -class BibToolBar; -struct BibDBDescriptor; - -// #100312# --------------------- -class BibInterceptorHelper - :public cppu::WeakImplHelper1< ::com::sun::star::frame::XDispatchProviderInterceptor > -{ -private: - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > xMasterDispatchProvider; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > xSlaveDispatchProvider; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xFormDispatch; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception > xInterception; - -protected: - ~BibInterceptorHelper( ); - -public: - BibInterceptorHelper( ::bib::BibBeamer* pBibBeamer, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch); - - void ReleaseInterceptor(); - - // XDispatchProvider - virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& aDescripts ) throw (::com::sun::star::uno::RuntimeException); - // XDispatchProviderInterceptor - virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getSlaveDispatchProvider( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setSlaveDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewSlaveDispatchProvider ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getMasterDispatchProvider( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setMasterDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewMasterDispatchProvider ) throw (::com::sun::star::uno::RuntimeException); -}; - -typedef cppu::WeakComponentImplHelper2 < ::com::sun::star::beans::XPropertyChangeListener - , ::com::sun::star::form::XLoadable - > BibDataManager_Base; -class BibDataManager - :public ::comphelper::OMutexAndBroadcastHelper - ,public BibDataManager_Base -{ -private: - ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > m_xForm; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > m_xGridModel; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xSourceProps; - ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer > m_xParser; - ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > m_xFormCtrl; - // #100312# ------------------- - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xFormDispatch; - BibInterceptorHelper* m_pInterceptorHelper; - - ::rtl::OUString aActiveDataTable; - ::rtl::OUString aDataSourceURL; - ::rtl::OUString aQuoteChar; - ::com::sun::star::uno::Any aUID; - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > xBibCursor; - - ::cppu::OInterfaceContainerHelper m_aLoadListeners; - - ::bib::BibView* pBibView; - BibToolBar* pToolbar; - - rtl::OUString sIdentifierMapping; -protected: - - void InsertFields(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > & xGrid); - void SetMeAsUidListener(); - void RemoveMeAsUidListener(); - - void UpdateAddressbookCursor(::rtl::OUString aSourceName); - - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > - updateGridModel(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > & xDbForm); - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > - createGridModel( const ::rtl::OUString& rName ); - - // XLoadable - virtual void SAL_CALL load( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL unload( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL reload( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isLoaded( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addLoadListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeLoadListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); - - virtual void SAL_CALL disposing(); - -public: - - BibDataManager(); - ~BibDataManager(); - - virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) - throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) - throw( ::com::sun::star::uno::RuntimeException ); - - - - ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > createDatabaseForm( BibDBDescriptor& aDesc); - - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > updateGridModel(); - - ::com::sun::star::uno::Sequence< ::rtl::OUString> getDataSources(); - - ::rtl::OUString getActiveDataSource() {return aDataSourceURL;} - void setActiveDataSource(const ::rtl::OUString& rURL); - - ::rtl::OUString getActiveDataTable(); - void setActiveDataTable(const ::rtl::OUString& rTable); - - void setFilter(const ::rtl::OUString& rQuery); - ::rtl::OUString getFilter(); - - ::com::sun::star::uno::Sequence< ::rtl::OUString> getQueryFields(); - ::rtl::OUString getQueryField(); - void startQueryWith(const ::rtl::OUString& rQuery); - - const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer >& getParser() { return m_xParser; } - const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& getForm() { return m_xForm; } - - - ::rtl::OUString getControlName(sal_Int32 nFormatKey ); - - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > loadControlModel(const ::rtl::OUString& rName, - sal_Bool bForceListBox = sal_False); - - void CreateMappingDialog(Window* pParent); - ::rtl::OUString CreateDBChangeDialog(Window* pParent); - - void DispatchDBChangeDialog(); - sal_Bool HasActiveConnection() const; - - void SetView( ::bib::BibView* pView ) { pBibView = pView; } - - void SetToolbar(BibToolBar* pSet); - - const rtl::OUString& GetIdentifierMapping(); - void ResetIdentifierMapping() {sIdentifierMapping = rtl::OUString();} - - ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > GetFormController(); - // #100312# ---------- - void RegisterInterceptor( ::bib::BibBeamer* pBibBeamer); - - sal_Bool HasActiveConnection(); -}; - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/datman.src b/extensions/source/bibliography/datman.src deleted file mode 100644 index 639e6640d..000000000 --- a/extensions/source/bibliography/datman.src +++ /dev/null @@ -1,500 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "bib.hrc" -#include "datman.hrc" -ModalDialog RID_DLG_MAPPING -{ - HelpID = HID_DLG_MAPPING; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 391 , 195 ) ; - Moveable = TRUE ; - - OKButton BT_OK - { - Pos = MAP_APPFONT ( 338 , 3 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - }; - CancelButton BT_CANCEL - { - Pos = MAP_APPFONT ( 338 , 18 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - }; - HelpButton BT_HELP - { - Pos = MAP_APPFONT ( 338 , 36 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - }; - FixedLine GB_MAPPING - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 329 , 8 ) ; - Text [ en-US ] = "Column names"; - }; - FixedText FT_IDENTIFIER - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_IDENTIFIER - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_IDENTIFIER"; - Pos = MAP_APPFONT ( 65 , 13 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_AUTHORITYTYPE - { - Pos = MAP_APPFONT ( 118 , 14 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_AUTHORITYTYPE - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_AUTHORITYTYPE"; - Pos = MAP_APPFONT ( 171 , 13 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_YEAR - { - Pos = MAP_APPFONT ( 229 , 14 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_YEAR - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_YEAR"; - Pos = MAP_APPFONT ( 282 , 13 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_AUTHOR - { - Pos = MAP_APPFONT ( 12 , 29 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_AUTHOR - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_AUTHOR"; - Pos = MAP_APPFONT ( 65 , 28 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_TITLE - { - Pos = MAP_APPFONT ( 118 , 29 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_TITLE - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_TITLE"; - Pos = MAP_APPFONT ( 171 , 28 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_PUBLISHER - { - Pos = MAP_APPFONT ( 12 , 44 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_PUBLISHER - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_PUBLISHER"; - Pos = MAP_APPFONT ( 65 , 43 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_ADDRESS - { - Pos = MAP_APPFONT ( 118 , 44 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_ADDRESS - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_ADDRESS"; - Pos = MAP_APPFONT ( 171, 43 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_ISBN - { - Pos = MAP_APPFONT ( 229 , 44 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_ISBN - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_ISBN"; - Pos = MAP_APPFONT ( 282 , 43 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_CHAPTER - { - Pos = MAP_APPFONT ( 12 , 59 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_CHAPTER - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_CHAPTER"; - Pos = MAP_APPFONT ( 65 , 58 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_PAGES - { - Pos = MAP_APPFONT ( 118 , 59 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_PAGES - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_PAGES"; - Pos = MAP_APPFONT ( 171, 58) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_EDITOR - { - Pos = MAP_APPFONT ( 12 , 74 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_EDITOR - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_EDITOR"; - Pos = MAP_APPFONT ( 65 , 73 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_EDITION - { - Pos = MAP_APPFONT ( 118 , 74 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_EDITION - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_EDITION"; - Pos = MAP_APPFONT ( 171 , 73 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_BOOKTITLE - { - Pos = MAP_APPFONT ( 12, 89 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_BOOKTITLE - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_BOOKTITLE"; - Pos = MAP_APPFONT ( 65, 88 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_VOLUME - { - Pos = MAP_APPFONT ( 118 , 89 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_VOLUME - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_VOLUME"; - Pos = MAP_APPFONT ( 171 , 88 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_HOWPUBLISHED - { - Pos = MAP_APPFONT ( 229 , 89 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_HOWPUBLISHED - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_HOWPUBLISHED"; - Pos = MAP_APPFONT ( 282, 88 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_ORGANIZATIONS - { - Pos = MAP_APPFONT ( 12 , 104 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_ORGANIZATIONS - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_ORGANIZATIONS"; - Pos = MAP_APPFONT ( 65 , 103 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_INSTITUTION - { - Pos = MAP_APPFONT ( 118 , 104 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_INSTITUTION - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_INSTITUTION"; - Pos = MAP_APPFONT ( 171 , 103) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_SCHOOL - { - Pos = MAP_APPFONT ( 229 , 104 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_SCHOOL - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_SCHOOL"; - Pos = MAP_APPFONT ( 282 , 103 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_REPORTTYPE - { - Pos = MAP_APPFONT ( 12 , 119 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_REPORTTYPE - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_REPORTTYPE"; - Pos = MAP_APPFONT ( 65 , 118 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_MONTH - { - Pos = MAP_APPFONT ( 118 , 119 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_MONTH - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_MONTH"; - Pos = MAP_APPFONT ( 171 , 118) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_JOURNAL - { - Pos = MAP_APPFONT ( 12 , 134 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_JOURNAL - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_JOURNAL"; - Pos = MAP_APPFONT ( 65 , 133) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_NUMBER - { - Pos = MAP_APPFONT ( 118 , 134 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_NUMBER - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_NUMBER"; - Pos = MAP_APPFONT ( 171 , 133 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_SERIES - { - Pos = MAP_APPFONT ( 229 , 134 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_SERIES - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_SERIES"; - Pos = MAP_APPFONT ( 282 , 133 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_ANNOTE - { - Pos = MAP_APPFONT ( 12 , 149 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_ANNOTE - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_ANNOTE"; - Pos = MAP_APPFONT ( 65 , 148 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_NOTE - { - Pos = MAP_APPFONT ( 118 , 149 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_NOTE - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_NOTE"; - Pos = MAP_APPFONT ( 171 , 148 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_URL - { - Pos = MAP_APPFONT ( 229 , 149 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_URL - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_URL"; - Pos = MAP_APPFONT ( 282, 148 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_CUSTOM1 - { - Pos = MAP_APPFONT ( 12 , 164 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_CUSTOM1 - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_CUSTOM1"; - Pos = MAP_APPFONT ( 65 , 163 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_CUSTOM2 - { - Pos = MAP_APPFONT ( 118 , 164 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_CUSTOM2 - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_CUSTOM2"; - Pos = MAP_APPFONT ( 171 , 163 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_CUSTOM3 - { - Pos = MAP_APPFONT ( 229, 164 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_CUSTOM3 - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_CUSTOM3"; - Pos = MAP_APPFONT ( 282 , 163 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_CUSTOM4 - { - Pos = MAP_APPFONT ( 12 , 178 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_CUSTOM4 - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_CUSTOM4"; - Pos = MAP_APPFONT ( 65 , 177 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_CUSTOM5 - { - Pos = MAP_APPFONT ( 118 , 178 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_CUSTOM5 - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_CUSTOM5"; - Pos = MAP_APPFONT ( 171 , 177 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - String ST_NONE - { - Text [ en-US ] = "<none>"; - }; - Text [ en-US ] = "Column Layout for Table %1"; -}; -ModalDialog RID_DLG_DBCHANGE -{ - HelpID = HID_DLG_DBCHANGE; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 291 , 131 ) ; - Moveable = TRUE ; - Text [ en-US ] = "Choose Data Source"; - OKButton BT_OK - { - Pos = MAP_APPFONT ( 238 , 3 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - }; - CancelButton BT_CANCEL - { - Pos = MAP_APPFONT ( 238 , 18 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - }; - HelpButton BT_HELP - { - Pos = MAP_APPFONT ( 238 , 36 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - }; - FixedLine GB_SELECTION - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 229 , 8 ) ; - }; - String ST_ENTRY - { - Text [ en-US ] = "Entry"; - }; - Control LB_SELECTION - { - Pos = MAP_APPFONT ( 9 , 24 ) ; - Size = MAP_APPFONT ( 223 , 100 ) ; - Border = TRUE; - TabStop = TRUE; - HelpId = HID_SELECTION_TLB; - }; - Window HB_SELECTION - { - Pos = MAP_APPFONT ( 9 , 12 ) ; - Size = MAP_APPFONT ( 223 , 12 ) ; - Border = TRUE; - }; -}; - - - - - - - - - - - - - - - - - - diff --git a/extensions/source/bibliography/formcontrolcontainer.cxx b/extensions/source/bibliography/formcontrolcontainer.cxx deleted file mode 100644 index c41007186..000000000 --- a/extensions/source/bibliography/formcontrolcontainer.cxx +++ /dev/null @@ -1,160 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "formcontrolcontainer.hxx" -#include <tools/debug.hxx> - -#include <algorithm> -#include <functional> - -//......................................................................... -namespace bib -{ -//......................................................................... - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::form; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::awt; - - //===================================================================== - //= FormControlContainer - //===================================================================== - //--------------------------------------------------------------------- - FormControlContainer::FormControlContainer( ) - :OLoadListener( m_aMutex ) - ,m_pFormAdapter( NULL ) - { - } - - FormControlContainer::~FormControlContainer( ) - { - DBG_ASSERT( !isFormConnected(), "FormControlContainer::~FormControlContainer: you should disconnect in your derived class!" ); - if ( isFormConnected() ) - disconnectForm(); - } - - void FormControlContainer::disconnectForm() - { - ::osl::MutexGuard aGuard( m_aMutex ); - DBG_ASSERT( isFormConnected(), "FormControlContainer::connectForm: not connected!" ); - if ( isFormConnected() ) - { - m_pFormAdapter->dispose(); - m_pFormAdapter->release(); - m_pFormAdapter = NULL; - } - } - - void FormControlContainer::connectForm( const Reference< XLoadable >& _rxForm ) - { - DBG_ASSERT( !isFormConnected(), "FormControlContainer::connectForm: already connected!" ); - - DBG_ASSERT( _rxForm.is(), "FormControlContainer::connectForm: invalid form!" ); - if ( !isFormConnected() && _rxForm.is() ) - { - m_pFormAdapter = new OLoadListenerAdapter( _rxForm ); - m_pFormAdapter->acquire(); - m_pFormAdapter->Init( this ); - - ensureDesignMode(); - } - - m_xForm = _rxForm; - } - - struct ControlModeSwitch : public ::std::unary_function< Reference< XControl >, void > - { - sal_Bool bDesign; - ControlModeSwitch( sal_Bool _bDesign ) : bDesign( _bDesign ) { } - - void operator() ( const Reference< XControl >& _rxControl ) const - { - if ( _rxControl.is() ) - _rxControl->setDesignMode( bDesign ); - } - }; - - void FormControlContainer::implSetDesignMode( sal_Bool _bDesign ) - { - try - { - Reference< XControlContainer > xControlCont = getControlContainer(); - Sequence< Reference< XControl > > aControls; - if ( xControlCont.is() ) - aControls = xControlCont->getControls(); - - ::std::for_each( - aControls.getConstArray(), - aControls.getConstArray() + aControls.getLength(), - ControlModeSwitch( _bDesign ) - ); - } - catch( const Exception& e) - { - (void) e; // make compiler happy - OSL_FAIL( "FormControlContainer::implSetDesignMode: caught an exception!" ); - } - } - - void FormControlContainer::ensureDesignMode() - { - implSetDesignMode( !m_xForm.is() || !m_xForm->isLoaded() ); - } - - void FormControlContainer::_loaded( const ::com::sun::star::lang::EventObject& /*_rEvent*/ ) - { - implSetDesignMode( sal_False ); - } - - void FormControlContainer::_unloading( const ::com::sun::star::lang::EventObject& /*_rEvent*/ ) - { - implSetDesignMode( sal_True ); - } - - void FormControlContainer::_unloaded( const ::com::sun::star::lang::EventObject& /*_rEvent*/ ) - { - } - - void FormControlContainer::_reloading( const ::com::sun::star::lang::EventObject& /*_rEvent*/ ) - { - implSetDesignMode( sal_True ); - } - - void FormControlContainer::_reloaded( const ::com::sun::star::lang::EventObject& /*_rEvent*/ ) - { - implSetDesignMode( sal_False ); - } - -//......................................................................... -} // namespace bib -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/formcontrolcontainer.hxx b/extensions/source/bibliography/formcontrolcontainer.hxx deleted file mode 100644 index a1e72b11a..000000000 --- a/extensions/source/bibliography/formcontrolcontainer.hxx +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_BIB_FORMCONTROLCONTAINER_HXX -#define EXTENSIONS_BIB_FORMCONTROLCONTAINER_HXX - -#include <comphelper/broadcasthelper.hxx> -#include "loadlisteneradapter.hxx" -#include <com/sun/star/awt/XControlContainer.hpp> - -class BibDataManager; - -//......................................................................... -namespace bib -{ -//......................................................................... - - //===================================================================== - //= FormControlContainer - //===================================================================== - class FormControlContainer - :public ::comphelper::OBaseMutex - ,public ::bib::OLoadListener - { - private: - OLoadListenerAdapter* m_pFormAdapter; - ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable > - m_xForm; - private: - void implSetDesignMode( sal_Bool _bDesign ); - - protected: - FormControlContainer( ); - ~FormControlContainer( ); - - sal_Bool isFormConnected() const { return NULL != m_pFormAdapter; } - void connectForm( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable >& _rxForm ); - void disconnectForm(); - - void ensureDesignMode(); - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > - getControlContainer() = 0; - - protected: - // XLoadListener equivalents - virtual void _loaded( const ::com::sun::star::lang::EventObject& _rEvent ); - virtual void _unloading( const ::com::sun::star::lang::EventObject& _rEvent ); - virtual void _unloaded( const ::com::sun::star::lang::EventObject& _rEvent ); - virtual void _reloading( const ::com::sun::star::lang::EventObject& _rEvent ); - virtual void _reloaded( const ::com::sun::star::lang::EventObject& _rEvent ); - - }; - -//......................................................................... -} // namespace bib -//......................................................................... - -#endif // EXTENSIONS_BIB_FORMCONTROLCONTAINER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx deleted file mode 100644 index 7c5c435c2..000000000 --- a/extensions/source/bibliography/framectr.cxx +++ /dev/null @@ -1,974 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include <vcl/waitobj.hxx> -#include <cppuhelper/interfacecontainer.hxx> -#include <com/sun/star/util/URL.hpp> -#include <vcl/msgbox.hxx> -#include <tools/debug.hxx> -#include <vcl/stdtext.hxx> -#include <comphelper/types.hxx> -#include <comphelper/sequence.hxx> -#include "framectr.hxx" -#include "datman.hxx" -#include "bibresid.hxx" -#include "bib.hrc" -#include <toolkit/helper/vclunohelper.hxx> -#include "bibconfig.hxx" -#include <cppuhelper/implbase1.hxx> // helper for implementations -#include <vcl/svapp.hxx> -#include "bibliography.hrc" -#include <comphelper/processfactory.hxx> -#include <com/sun/star/form/XConfirmDeleteListener.hpp> -#include <com/sun/star/form/runtime/XFormController.hpp> -#include <com/sun/star/beans/PropertyState.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> -#include <com/sun/star/sdbcx/Privilege.hpp> -#include <com/sun/star/sdbc/XResultSetUpdate.hpp> -#include <com/sun/star/sdb/RowChangeAction.hpp> -#include <com/sun/star/frame/CommandGroup.hpp> -#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> -#include <sot/exchange.hxx> -#include <sot/formats.hxx> -#include <vcl/edit.hxx> -#include <osl/mutex.hxx> - -#include <boost/unordered_map.hpp> - -using namespace osl; -using namespace cppu; -using namespace com::sun::star::sdbc; -using namespace com::sun::star::frame; -using namespace com::sun::star::uno; -using namespace com::sun::star; - -using ::rtl::OUString; - -#define C2U(cChar) OUString::createFromAscii(cChar) - -struct DispatchInfo -{ - const char* pCommand; - sal_Int16 nGroupId; - sal_Bool bActiveConnection; -}; - -struct CacheDispatchInfo -{ - sal_Int16 nGroupId; - sal_Bool bActiveConnection; -}; - -// Attention: commands must be sorted by command groups. Implementation is dependent -// on this!! -static DispatchInfo SupportedCommandsArray[] = -{ - { ".uno:Undo" , frame::CommandGroup::EDIT , sal_False }, - { ".uno:Cut" , frame::CommandGroup::EDIT , sal_False }, - { ".uno:Copy" , frame::CommandGroup::EDIT , sal_False }, - { ".uno:Paste" , frame::CommandGroup::EDIT , sal_False }, - { ".uno:SelectAll" , frame::CommandGroup::EDIT , sal_False }, - { ".uno:CloseDoc" , frame::CommandGroup::DOCUMENT , sal_False }, - { ".uno:StatusBarVisible" , frame::CommandGroup::VIEW , sal_False }, - { ".uno:AvailableToolbars" , frame::CommandGroup::VIEW , sal_False }, - { ".uno:Bib/standardFilter" , frame::CommandGroup::DATA , sal_True }, - { ".uno:Bib/DeleteRecord" , frame::CommandGroup::DATA , sal_True }, - { ".uno:Bib/InsertRecord" , frame::CommandGroup::DATA , sal_True }, - { ".uno:Bib/query" , frame::CommandGroup::DATA , sal_True }, - { ".uno:Bib/autoFilter" , frame::CommandGroup::DATA , sal_True }, - { ".uno:Bib/source" , frame::CommandGroup::DATA , sal_True }, - { ".uno:Bib/removeFilter" , frame::CommandGroup::DATA , sal_True }, - { ".uno:Bib/sdbsource" , frame::CommandGroup::DATA , sal_True }, - { ".uno:Bib/Mapping" , frame::CommandGroup::DATA , sal_True }, - { 0 , 0 , sal_False } -}; - -typedef ::boost::unordered_map< ::rtl::OUString, CacheDispatchInfo, rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > CmdToInfoCache; - -SV_IMPL_PTRARR( BibStatusDispatchArr, BibStatusDispatchPtr ); - -const CmdToInfoCache& GetCommandToInfoCache() -{ - static sal_Bool bCacheInitialized = sal_False; - static CmdToInfoCache aCmdToInfoCache; - - if ( !bCacheInitialized ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !bCacheInitialized ) - { - sal_Int32 i( 0 ); - while ( SupportedCommandsArray[i].pCommand != 0 ) - { - rtl::OUString aCommand( rtl::OUString::createFromAscii( SupportedCommandsArray[i].pCommand )); - - CacheDispatchInfo aDispatchInfo; - aDispatchInfo.nGroupId = SupportedCommandsArray[i].nGroupId; - aDispatchInfo.bActiveConnection = SupportedCommandsArray[i].bActiveConnection; - aCmdToInfoCache.insert( CmdToInfoCache::value_type( aCommand, aDispatchInfo )); - ++i; - } - bCacheInitialized = sal_True; - } - } - - return aCmdToInfoCache; -} - - -class BibFrameCtrl_Impl : public cppu::WeakImplHelper1 < XFrameActionListener > -{ -public: - Mutex aMutex; - OMultiTypeInterfaceContainerHelper aLC; - - BibFrameController_Impl* pController; - - BibFrameCtrl_Impl() - : aLC( aMutex ) - , pController(0) - {} - - ~BibFrameCtrl_Impl(); - - virtual void SAL_CALL frameAction(const FrameActionEvent& aEvent) throw( RuntimeException ); - virtual void SAL_CALL disposing( const lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); -}; - - -BibFrameCtrl_Impl::~BibFrameCtrl_Impl() -{ -} - -void BibFrameCtrl_Impl::frameAction(const FrameActionEvent& aEvent) throw( uno::RuntimeException ) -{ - if ( pController && aEvent.Frame == pController->getFrame()) - { - if(aEvent.Action == FrameAction_FRAME_ACTIVATED) - { - pController->activate(); - } - else if(aEvent.Action == FrameAction_FRAME_DEACTIVATING) - { - pController->deactivate(); - } - } -} - -void BibFrameCtrl_Impl::disposing( const lang::EventObject& /*Source*/ ) - throw (::com::sun::star::uno::RuntimeException) -{ - ::SolarMutexGuard aGuard; - if ( pController ) - pController->getFrame()->removeFrameActionListener( this ); -} - -BibFrameController_Impl::BibFrameController_Impl( const uno::Reference< awt::XWindow > & xComponent, - BibDataManager* pDataManager) - :xWindow( xComponent ) - ,m_xDatMan( pDataManager ) - ,pDatMan( pDataManager ) - ,pBibMod(NULL) -{ - Window* pParent = VCLUnoHelper::GetWindow( xWindow ); - pParent->SetUniqueId(UID_BIB_FRAME_WINDOW); - bDisposing=sal_False; - bHierarchical=sal_True; - pImp = new BibFrameCtrl_Impl; - pImp->pController = this; - pImp->acquire(); -} - -BibFrameController_Impl::~BibFrameController_Impl() -{ - pImp->pController = NULL; - pImp->release(); - delete pDatMan; - if(pBibMod) - CloseBibModul(pBibMod); -} - -::rtl::OUString SAL_CALL BibFrameController_Impl::getImplementationName() throw (::com::sun::star::uno::RuntimeException) -{ - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.extensions.Bibliography")); -} - -sal_Bool SAL_CALL BibFrameController_Impl::supportsService( const ::rtl::OUString& sServiceName ) throw (::com::sun::star::uno::RuntimeException) -{ - return ( - sServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.frame.Bibliography")) || - sServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.frame.Controller")) - ); -} - -::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL BibFrameController_Impl::getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException) -{ - // return only top level services ... - // base services are included there and should be asked by uno-rtti. - ::com::sun::star::uno::Sequence< ::rtl::OUString > lNames(1); - lNames[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Bibliography")); - return lNames; -} - -void BibFrameController_Impl::attachFrame( const uno::Reference< XFrame > & xArg ) throw (::com::sun::star::uno::RuntimeException) -{ - xFrame = xArg; - xFrame->addFrameActionListener( pImp ); -} - -sal_Bool BibFrameController_Impl::attachModel( const uno::Reference< XModel > & /*xModel*/ ) throw (::com::sun::star::uno::RuntimeException) -{ - return sal_False; -} - -sal_Bool BibFrameController_Impl::suspend( sal_Bool bSuspend ) throw (::com::sun::star::uno::RuntimeException) -{ - if ( bSuspend ) - getFrame()->removeFrameActionListener( pImp ); - else - getFrame()->addFrameActionListener( pImp ); - return sal_True; -} - -uno::Any BibFrameController_Impl::getViewData() throw (::com::sun::star::uno::RuntimeException) -{ - return uno::Any(); -} - -void BibFrameController_Impl::restoreViewData( const uno::Any& /*Value*/ ) throw (::com::sun::star::uno::RuntimeException) -{ -} - -uno::Reference< XFrame > BibFrameController_Impl::getFrame() throw (::com::sun::star::uno::RuntimeException) -{ - return xFrame; -} - -uno::Reference< XModel > BibFrameController_Impl::getModel() throw (::com::sun::star::uno::RuntimeException) -{ - return uno::Reference< XModel > (); -} - -void BibFrameController_Impl::dispose() throw (::com::sun::star::uno::RuntimeException) -{ - bDisposing = sal_True; - lang::EventObject aObject; - aObject.Source = (XController*)this; - pImp->aLC.disposeAndClear(aObject); - m_xDatMan = 0; - pDatMan = 0; - aStatusListeners.DeleteAndDestroy( 0, aStatusListeners.Count() ); - } - -void BibFrameController_Impl::addEventListener( const uno::Reference< lang::XEventListener > & aListener ) throw (::com::sun::star::uno::RuntimeException) -{ - pImp->aLC.addInterface( ::getCppuType((const Reference< lang::XEventListener >*)0), aListener ); -} - -void BibFrameController_Impl::removeEventListener( const uno::Reference< lang::XEventListener > & aListener ) throw (::com::sun::star::uno::RuntimeException) -{ - pImp->aLC.removeInterface( ::getCppuType((const Reference< lang::XEventListener >*)0), aListener ); -} - -uno::Reference< frame::XDispatch > BibFrameController_Impl::queryDispatch( const util::URL& aURL, const rtl::OUString& /*aTarget*/, sal_Int32 /*nSearchFlags*/ ) throw (::com::sun::star::uno::RuntimeException) -{ - if ( !bDisposing ) - { - const CmdToInfoCache& rCmdCache = GetCommandToInfoCache(); - CmdToInfoCache::const_iterator pIter = rCmdCache.find( aURL.Complete ); - if ( pIter != rCmdCache.end() ) - { - if (( pDatMan->HasActiveConnection() ) || - ( !pIter->second.bActiveConnection )) - return (frame::XDispatch*) this; - } - } - - return uno::Reference< frame::XDispatch > (); -} - -uno::Sequence<uno::Reference< XDispatch > > BibFrameController_Impl::queryDispatches( const uno::Sequence<DispatchDescriptor>& aDescripts ) throw (::com::sun::star::uno::RuntimeException) -{ - uno::Sequence< uno::Reference< XDispatch > > aDispatches( aDescripts.getLength() ); - for ( sal_Int32 i=0; i<aDescripts.getLength(); ++i ) - aDispatches[i] = queryDispatch( aDescripts[i].FeatureURL, aDescripts[i].FrameName, aDescripts[i].SearchFlags ); - return aDispatches; -} - -uno::Sequence< ::sal_Int16 > SAL_CALL BibFrameController_Impl::getSupportedCommandGroups() -throw (::com::sun::star::uno::RuntimeException) -{ - uno::Sequence< ::sal_Int16 > aDispatchInfo( 4 ); - - aDispatchInfo[0] = frame::CommandGroup::EDIT; - aDispatchInfo[1] = frame::CommandGroup::DOCUMENT; - aDispatchInfo[2] = frame::CommandGroup::DATA; - aDispatchInfo[3] = frame::CommandGroup::VIEW; - - return aDispatchInfo; -} - -uno::Sequence< frame::DispatchInformation > SAL_CALL BibFrameController_Impl::getConfigurableDispatchInformation( ::sal_Int16 nCommandGroup ) -throw (::com::sun::star::uno::RuntimeException) -{ - const CmdToInfoCache& rCmdCache = GetCommandToInfoCache(); - - sal_Bool bGroupFound( sal_False ); - frame::DispatchInformation aDispatchInfo; - std::list< frame::DispatchInformation > aDispatchInfoList; - - if (( nCommandGroup == frame::CommandGroup::EDIT ) || - ( nCommandGroup == frame::CommandGroup::DOCUMENT ) || - ( nCommandGroup == frame::CommandGroup::DATA ) || - ( nCommandGroup == frame::CommandGroup::VIEW )) - { - CmdToInfoCache::const_iterator pIter = rCmdCache.begin(); - while ( pIter != rCmdCache.end() ) - { - if ( pIter->second.nGroupId == nCommandGroup ) - { - bGroupFound = sal_True; - aDispatchInfo.Command = pIter->first; - aDispatchInfo.GroupId = pIter->second.nGroupId; - aDispatchInfoList.push_back( aDispatchInfo ); - } - else if ( bGroupFound ) - break; - - ++pIter; - } - } - - ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchInformation > aSeq = - comphelper::containerToSequence< ::com::sun::star::frame::DispatchInformation, std::list< ::com::sun::star::frame::DispatchInformation > >( aDispatchInfoList ); - - return aSeq; -} - -sal_Bool canInsertRecords(const Reference< beans::XPropertySet>& _rxCursorSet) -{ - sal_Int32 nPriv = 0; - _rxCursorSet->getPropertyValue(C2U("Privileges")) >>= nPriv; - return ((_rxCursorSet.is() && (nPriv & sdbcx::Privilege::INSERT) != 0)); -} - -sal_Bool BibFrameController_Impl::SaveModified(const Reference< form::runtime::XFormController>& xController) -{ - if (!xController.is()) - return sal_False; - - Reference< XResultSetUpdate> _xCursor = Reference< XResultSetUpdate>(xController->getModel(), UNO_QUERY); - - if (!_xCursor.is()) - return sal_False; - - Reference< beans::XPropertySet> _xSet = Reference< beans::XPropertySet>(_xCursor, UNO_QUERY); - if (!_xSet.is()) - return sal_False; - - // need to save? - sal_Bool bIsNew = ::comphelper::getBOOL(_xSet->getPropertyValue(C2U("IsNew"))); - sal_Bool bIsModified = ::comphelper::getBOOL(_xSet->getPropertyValue(C2U("IsModified"))); - sal_Bool bResult = !bIsModified; - if (bIsModified) - { - try - { - if (bIsNew) - _xCursor->insertRow(); - else - _xCursor->updateRow(); - bResult = sal_True; - } - catch(Exception&) - { - OSL_FAIL("SaveModified: Exception occurred!"); - } - } - return bResult; -} - -Window* lcl_GetFocusChild( Window* pParent ) -{ - sal_uInt16 nChildren = pParent->GetChildCount(); - for( sal_uInt16 nChild = 0; nChild < nChildren; ++nChild) - { - Window* pChild = pParent->GetChild( nChild ); - if(pChild->HasFocus()) - return pChild; - Window* pSubChild = lcl_GetFocusChild( pChild ); - if(pSubChild) - return pSubChild; - } - return 0; -} - -//class XDispatch -void BibFrameController_Impl::dispatch(const util::URL& _rURL, const uno::Sequence< beans::PropertyValue >& aArgs) throw (::com::sun::star::uno::RuntimeException) -{ - if ( !bDisposing ) - { - ::SolarMutexGuard aGuard; - Window* pParent = VCLUnoHelper::GetWindow( xWindow ); - WaitObject aWaitObject( pParent ); - - String aCommand( _rURL.Path); - if(aCommand.EqualsAscii("Bib/Mapping")) - { - pDatMan->CreateMappingDialog(pParent); - } - else if(aCommand.EqualsAscii("Bib/source")) - { - ChangeDataSource(aArgs); - } - else if(aCommand.EqualsAscii("Bib/sdbsource")) - { - rtl::OUString aURL = pDatMan->CreateDBChangeDialog(pParent); - if(aURL.getLength()) - { - try - { - uno::Sequence< beans::PropertyValue > aNewDataSource(2); - beans::PropertyValue* pProps = aNewDataSource.getArray(); - pProps[0].Value <<= rtl::OUString(); - pProps[1].Value <<= aURL; - ChangeDataSource(aNewDataSource); - } - catch(const Exception&) - { - OSL_FAIL("Exception catched while changing the data source"); - } - } - } - else if(aCommand.EqualsAscii("Bib/autoFilter")) - { - sal_uInt16 nCount = aStatusListeners.Count(); - for ( sal_uInt16 n=0; n<nCount; n++ ) - { - BibStatusDispatch *pObj = aStatusListeners[n]; - if ( pObj->aURL.Path == C2U("Bib/removeFilter") ) - { - FeatureStateEvent aEvent; - aEvent.FeatureURL = pObj->aURL; - aEvent.IsEnabled = sal_True; - aEvent.Requery = sal_False; - aEvent.Source = (XDispatch *) this; - pObj->xListener->statusChanged( aEvent ); - //break; because there are more than one - } - } - - const beans::PropertyValue* pPropertyValue = aArgs.getConstArray(); - uno::Any aValue=pPropertyValue[0].Value; - rtl::OUString aQuery; - aValue >>= aQuery; - - aValue=pPropertyValue[1].Value; - rtl::OUString aQueryField; - aValue >>= aQueryField; - BibConfig* pConfig = BibModul::GetConfig(); - pConfig->setQueryField(aQueryField); - pDatMan->startQueryWith(aQuery); - } - else if(aCommand.EqualsAscii("Bib/standardFilter")) - { - try - { - uno::Reference< lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory(); - - // build the arguments for the filter dialog to be created - Sequence< Any > aDialogCreationArgs( 3 ); - Any* pDialogCreationArgs = aDialogCreationArgs.getArray(); - // the query composer - *pDialogCreationArgs++ <<= beans::PropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "QueryComposer" )), - -1, - makeAny( pDatMan->getParser() ), - beans::PropertyState_DIRECT_VALUE - ); - - // the rowset - *pDialogCreationArgs++ <<= beans::PropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowSet" )), - -1, - makeAny( pDatMan->getForm() ), - beans::PropertyState_DIRECT_VALUE - ); - // the parent window for the dialog - *pDialogCreationArgs++ <<= beans::PropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )), - -1, - makeAny( xWindow ), - beans::PropertyState_DIRECT_VALUE - ); - - // create the dialog object - const ::rtl::OUString sDialogServiceName(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.FilterDialog" )); - uno::Reference< uno::XInterface > xDialog = xORB->createInstanceWithArguments( - sDialogServiceName, - aDialogCreationArgs - ); - if ( !xDialog.is() ) - { - ShowServiceNotAvailableError( VCLUnoHelper::GetWindow( xWindow ), sDialogServiceName, sal_True ); - } - else - { - // execute it - uno::Reference< ui::dialogs::XExecutableDialog > xExec( xDialog, UNO_QUERY ); - DBG_ASSERT( xExec.is(), "BibFrameController_Impl::dispatch: missing an interface on the dialog!" ); - if ( xExec.is() ) - if ( xExec->execute( ) ) - { - // the dialog has been executed successfully, and the filter on the query composer - // has been changed - ::rtl::OUString sNewFilter = pDatMan->getParser()->getFilter(); - pDatMan->setFilter( sNewFilter ); - } - } - } - catch( const uno::Exception& ) - { - OSL_FAIL( "BibFrameController_Impl::dispatch: caught an exception!" ); - } - - sal_uInt16 nCount = aStatusListeners.Count(); - for ( sal_uInt16 n=0; n<nCount; n++ ) - { - BibStatusDispatch *pObj = aStatusListeners[n]; - if ( pObj->aURL.Path == C2U("Bib/removeFilter") && pDatMan->getParser().is()) - { - FeatureStateEvent aEvent; - aEvent.FeatureURL = pObj->aURL; - aEvent.IsEnabled = 0 != pDatMan->getParser()->getFilter().getLength(); - aEvent.Requery = sal_False; - aEvent.Source = (XDispatch *) this; - pObj->xListener->statusChanged( aEvent ); - } - } - } - else if(aCommand.EqualsAscii("Bib/removeFilter")) - { - RemoveFilter(); - } - else if(_rURL.Complete.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("slot:5503")) || - aCommand.EqualsAscii("CloseDoc")) - { - Application::PostUserEvent( STATIC_LINK( this, BibFrameController_Impl, - DisposeHdl ), 0 ); - - } - else if(aCommand.EqualsAscii("Bib/InsertRecord")) - { - Reference<form::runtime::XFormController > xFormCtrl = pDatMan->GetFormController(); - if(SaveModified(xFormCtrl)) - { - try - { - Reference< sdbc::XResultSet > xCursor( pDatMan->getForm(), UNO_QUERY ); - xCursor->last(); - - Reference< XResultSetUpdate > xUpdateCursor( pDatMan->getForm(), UNO_QUERY ); - xUpdateCursor->moveToInsertRow(); - } - catch(Exception&) - { - OSL_FAIL("Exception in last() or moveToInsertRow()"); - } - } - } - else if(aCommand.EqualsAscii("Bib/DeleteRecord")) - { - Reference< ::com::sun::star::sdbc::XResultSet > xCursor(pDatMan->getForm(), UNO_QUERY); - Reference< XResultSetUpdate > xUpdateCursor(xCursor, UNO_QUERY); - Reference< beans::XPropertySet > xSet(pDatMan->getForm(), UNO_QUERY); - sal_Bool bIsNew = ::comphelper::getBOOL(xSet->getPropertyValue(C2U("IsNew"))); - if(!bIsNew) - { - sal_uInt32 nCount = 0; - xSet->getPropertyValue(C2U("RowCount")) >>= nCount; - // naechste position festellen - sal_Bool bSuccess = sal_False; - sal_Bool bLeft = sal_False; - sal_Bool bRight = sal_False; - try - { - bLeft = xCursor->isLast() && nCount > 1; - bRight= !xCursor->isLast(); - // ask for confirmation - Reference< frame::XController > xCtrl = pImp->pController; - Reference< form::XConfirmDeleteListener > xConfirm(pDatMan->GetFormController(),UNO_QUERY); - if (xConfirm.is()) - { - sdb::RowChangeEvent aEvent; - aEvent.Source = Reference< XInterface > (xCursor, UNO_QUERY); - aEvent.Action = sdb::RowChangeAction::DELETE; - aEvent.Rows = 1; - bSuccess = xConfirm->confirmDelete(aEvent); - } - - // das Ding loeschen - if (bSuccess) - xUpdateCursor->deleteRow(); - } - catch(Exception&) - { - bSuccess = sal_False; - } - if (bSuccess) - { - if (bLeft || bRight) - xCursor->relative(bRight ? 1 : -1); - else - { - sal_Bool bCanInsert = canInsertRecords(xSet); - // kann noch ein Datensatz eingefuegt weden - try - { - if (bCanInsert) - xUpdateCursor->moveToInsertRow(); - else - // Datensatz bewegen um Stati neu zu setzen - xCursor->first(); - } - catch(Exception&) - { - OSL_FAIL("DeleteRecord : exception caught !"); - } - } - } - } - } - else if(aCommand.EqualsAscii("Cut")) - { - Window* pChild = lcl_GetFocusChild( VCLUnoHelper::GetWindow( xWindow ) ); - if(pChild) - { - KeyEvent aEvent( 0, KEYFUNC_CUT ); - pChild->KeyInput( aEvent ); - } - } - else if(aCommand.EqualsAscii("Copy")) - { - Window* pChild = lcl_GetFocusChild( VCLUnoHelper::GetWindow( xWindow ) ); - if(pChild) - { - KeyEvent aEvent( 0, KEYFUNC_COPY ); - pChild->KeyInput( aEvent ); - } - } - else if(aCommand.EqualsAscii("Paste")) - { - Window* pChild = lcl_GetFocusChild( VCLUnoHelper::GetWindow( xWindow ) ); - if(pChild) - { - KeyEvent aEvent( 0, KEYFUNC_PASTE ); - pChild->KeyInput( aEvent ); - } - } - } -} -IMPL_STATIC_LINK( BibFrameController_Impl, DisposeHdl, void*, EMPTYARG ) -{ - pThis->xFrame->dispose(); - return 0; -}; - -//----------------------------------------------------------------------------- -void BibFrameController_Impl::addStatusListener( - const uno::Reference< frame::XStatusListener > & aListener, - const util::URL& aURL) - throw (::com::sun::star::uno::RuntimeException) -{ - BibConfig* pConfig = BibModul::GetConfig(); - // create a new Reference and insert into listener array - aStatusListeners.Insert( new BibStatusDispatch( aURL, aListener ), aStatusListeners.Count() ); - - // den ersten Status synchron zusenden - FeatureStateEvent aEvent; - aEvent.FeatureURL = aURL; - aEvent.Requery = sal_False; - aEvent.Source = (XDispatch *) this; - if ( aURL.Path == C2U("StatusBarVisible") ) - { - aEvent.IsEnabled = sal_False; - aEvent.State <<= sal_Bool( sal_False ); - } - else if ( aURL.Path == C2U("Bib/hierarchical") ) - { - aEvent.IsEnabled = sal_True; - const char* pHier = bHierarchical? "" : "*" ; - aEvent.State <<= rtl::OUString::createFromAscii(pHier); - } - else if(aURL.Path == C2U("Bib/MenuFilter")) - { - aEvent.IsEnabled = sal_True; - aEvent.FeatureDescriptor=pDatMan->getQueryField(); - - uno::Sequence<rtl::OUString> aStringSeq=pDatMan->getQueryFields(); - aEvent.State.setValue(&aStringSeq,::getCppuType((uno::Sequence<rtl::OUString>*)0)); - - } - else if ( aURL.Path == C2U("Bib/source")) - { - aEvent.IsEnabled = sal_True; - aEvent.FeatureDescriptor=pDatMan->getActiveDataTable(); - - uno::Sequence<rtl::OUString> aStringSeq=pDatMan->getDataSources(); - aEvent.State.setValue(&aStringSeq,::getCppuType((uno::Sequence<rtl::OUString>*)0)); - } - else if(aURL.Path == C2U("Bib/sdbsource") || - aURL.Path == C2U("Bib/Mapping") || - aURL.Path == C2U("Bib/autoFilter") || - aURL.Path.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Bib/standardFilter"))) - { - aEvent.IsEnabled = sal_True; - } - else if(aURL.Path == C2U("Bib/query")) - { - aEvent.IsEnabled = sal_True; - aEvent.State <<= pConfig->getQueryText(); - } - else if (aURL.Path == C2U("Bib/removeFilter") ) - { - rtl::OUString aFilterStr=pDatMan->getFilter(); - aEvent.IsEnabled = (aFilterStr.getLength() > 0); - } - else if(aURL.Path == C2U("Cut")) - { - Window* pChild = lcl_GetFocusChild( VCLUnoHelper::GetWindow( xWindow ) ); - Edit* pEdit = dynamic_cast<Edit*>( pChild ); - if( pEdit ) - aEvent.IsEnabled = !pEdit->IsReadOnly() && pEdit->GetSelection().Len(); - } - if(aURL.Path == C2U("Copy")) - { - Window* pChild = lcl_GetFocusChild( VCLUnoHelper::GetWindow( xWindow ) ); - Edit* pEdit = dynamic_cast<Edit*>( pChild ); - if( pEdit ) - aEvent.IsEnabled = pEdit->GetSelection().Len() > 0; - } - else if(aURL.Path == C2U("Paste") ) - { - aEvent.IsEnabled = sal_False; - Window* pChild = lcl_GetFocusChild( VCLUnoHelper::GetWindow( xWindow ) ); - if(pChild) - { - uno::Reference< datatransfer::clipboard::XClipboard > xClip = pChild->GetClipboard(); - if(xClip.is()) - { - uno::Reference< datatransfer::XTransferable > xDataObj; - const sal_uInt32 nRef = Application::ReleaseSolarMutex(); - try - { - xDataObj = xClip->getContents(); - } - catch( const uno::Exception& ) - { - } - Application::AcquireSolarMutex( nRef ); - - if ( xDataObj.is() ) - { - datatransfer::DataFlavor aFlavor; - SotExchange::GetFormatDataFlavor( SOT_FORMAT_STRING, aFlavor ); - try - { - uno::Any aData = xDataObj->getTransferData( aFlavor ); - ::rtl::OUString aText; - aData >>= aText; - aEvent.IsEnabled = aText.getLength() > 0; - } - catch( const uno::Exception& ) - { - } - } - } - uno::Reference< datatransfer::XTransferable > xContents = xClip->getContents( ); - } - } - else if(aURL.Path == C2U("Bib/DeleteRecord")) - { - Reference< ::com::sun::star::sdbc::XResultSet > xCursor(pDatMan->getForm(), UNO_QUERY); - Reference< XResultSetUpdate > xUpdateCursor(xCursor, UNO_QUERY); - Reference< beans::XPropertySet > xSet(pDatMan->getForm(), UNO_QUERY); - sal_Bool bIsNew = ::comphelper::getBOOL(xSet->getPropertyValue(C2U("IsNew"))); - if(!bIsNew) - { - sal_uInt32 nCount = 0; - xSet->getPropertyValue(C2U("RowCount")) >>= nCount; - aEvent.IsEnabled = nCount > 0; - } - } - else if (aURL.Path == C2U("Bib/InsertRecord")) - { - Reference< beans::XPropertySet > xSet(pDatMan->getForm(), UNO_QUERY); - aEvent.IsEnabled = canInsertRecords(xSet); - } - aListener->statusChanged( aEvent ); -} -//----------------------------------------------------------------------------- -void BibFrameController_Impl::removeStatusListener( - const uno::Reference< frame::XStatusListener > & aObject, const util::URL& aURL) - throw (::com::sun::star::uno::RuntimeException) -{ - // search listener array for given listener - // for checking equality always "cast" to XInterface - if ( !bDisposing ) - { - sal_uInt16 nCount = aStatusListeners.Count(); - for ( sal_uInt16 n=0; n<nCount; n++ ) - { - BibStatusDispatch *pObj = aStatusListeners[n]; - sal_Bool bFlag=pObj->xListener.is(); - if (!bFlag || (pObj->xListener == aObject && - ( !aURL.Complete.getLength() || pObj->aURL.Path == aURL.Path ))) - { - aStatusListeners.DeleteAndDestroy( n ); - break; - } - } - } -} -//----------------------------------------------------------------------------- -void BibFrameController_Impl::RemoveFilter() -{ - rtl::OUString aQuery; - pDatMan->startQueryWith(aQuery); - - sal_uInt16 nCount = aStatusListeners.Count(); - - sal_Bool bRemoveFilter=sal_False; - sal_Bool bQueryText=sal_False; - - for ( sal_uInt16 n=0; n<nCount; n++ ) - { - BibStatusDispatch *pObj = aStatusListeners[n]; - if ( pObj->aURL.Path == C2U("Bib/removeFilter") ) - { - FeatureStateEvent aEvent; - aEvent.FeatureURL = pObj->aURL; - aEvent.IsEnabled = sal_False; - aEvent.Requery = sal_False; - aEvent.Source = (XDispatch *) this; - pObj->xListener->statusChanged( aEvent ); - bRemoveFilter=sal_True; - } - else if(pObj->aURL.Path == C2U("Bib/query")) - { - FeatureStateEvent aEvent; - aEvent.FeatureURL = pObj->aURL; - aEvent.IsEnabled = sal_True; - aEvent.Requery = sal_False; - aEvent.Source = (XDispatch *) this; - aEvent.State <<= aQuery; - pObj->xListener->statusChanged( aEvent ); - bQueryText=sal_True; - } - - if(bRemoveFilter && bQueryText) - break; - - } -} -//----------------------------------------------------------------------------- -void BibFrameController_Impl::ChangeDataSource(const uno::Sequence< beans::PropertyValue >& aArgs) -{ - const beans::PropertyValue* pPropertyValue = aArgs.getConstArray(); - uno::Any aValue=pPropertyValue[0].Value; - rtl::OUString aDBTableName; - aValue >>= aDBTableName; - - - if(aArgs.getLength() > 1) - { - uno::Any aDB = pPropertyValue[1].Value; - rtl::OUString aURL; - aDB >>= aURL; - pDatMan->setActiveDataSource(aURL); - aDBTableName = pDatMan->getActiveDataTable(); - } - else - { - m_xDatMan->unload(); - pDatMan->setActiveDataTable(aDBTableName); - pDatMan->updateGridModel(); - m_xDatMan->load(); - } - - - sal_uInt16 nCount = aStatusListeners.Count(); - - sal_Bool bMenuFilter=sal_False; - sal_Bool bQueryText=sal_False; - for ( sal_uInt16 n=0; n<nCount; n++ ) - { - BibStatusDispatch *pObj = aStatusListeners[n]; - if(COMPARE_EQUAL == pObj->aURL.Path.compareToAscii("Bib/MenuFilter")) - { - FeatureStateEvent aEvent; - aEvent.FeatureURL = pObj->aURL; - aEvent.IsEnabled = sal_True; - aEvent.Requery = sal_False; - aEvent.Source = (XDispatch *) this; - aEvent.FeatureDescriptor=pDatMan->getQueryField(); - - uno::Sequence<rtl::OUString> aStringSeq=pDatMan->getQueryFields(); - aEvent.State = makeAny( aStringSeq ); - - pObj->xListener->statusChanged( aEvent ); - bMenuFilter=sal_True; - } - else if(COMPARE_EQUAL == pObj->aURL.Path.compareToAscii("Bib/query")) - { - FeatureStateEvent aEvent; - aEvent.FeatureURL = pObj->aURL; - aEvent.IsEnabled = sal_True; - aEvent.Requery = sal_False; - aEvent.Source = (XDispatch *) this; - BibConfig* pConfig = BibModul::GetConfig(); - aEvent.State <<= pConfig->getQueryText(); - pObj->xListener->statusChanged( aEvent ); - bQueryText=sal_True; - } - - if (bMenuFilter && bQueryText) - break; - - } -} - -void BibFrameController_Impl::activate() -{ -} -void BibFrameController_Impl::deactivate() -{ -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/framectr.hxx b/extensions/source/bibliography/framectr.hxx deleted file mode 100644 index 4ef00f967..000000000 --- a/extensions/source/bibliography/framectr.hxx +++ /dev/null @@ -1,132 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BIB_FRAMECTR_HXX -#define _BIB_FRAMECTR_HXX -#include <com/sun/star/beans/XPropertyChangeListener.hpp> -#include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/frame/XController.hpp> -#include <com/sun/star/frame/XDispatch.hpp> -#include <com/sun/star/form/XLoadable.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/frame/XDispatchInformationProvider.hpp> -#include <cppuhelper/implbase5.hxx> -#include <svl/svarray.hxx> - -#include "bibmod.hxx" -class BibDataManager; -class BibFrameCtrl_Impl; -namespace com{namespace sun{namespace star{ - namespace form { namespace runtime { - class XFormController; - } } -}}} -class BibStatusDispatch -{ -public: - ::com::sun::star::util::URL aURL; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > xListener; - BibStatusDispatch( const ::com::sun::star::util::URL& rURL, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > xRef ) - : aURL( rURL ) - , xListener( xRef ) - {} -}; - -typedef BibStatusDispatch* BibStatusDispatchPtr; -SV_DECL_PTRARR_DEL( BibStatusDispatchArr, BibStatusDispatchPtr, 4, 4 ) - -class BibFrameController_Impl : public cppu::WeakImplHelper5 < - ::com::sun::star::lang::XServiceInfo, - ::com::sun::star::frame::XController, - ::com::sun::star::frame::XDispatch, - ::com::sun::star::frame::XDispatchProvider, - ::com::sun::star::frame::XDispatchInformationProvider -> -{ -friend class BibFrameCtrl_Impl; - BibFrameCtrl_Impl* pImp; - BibStatusDispatchArr aStatusListeners; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xWindow; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame; - sal_Bool bDisposing; - sal_Bool bHierarchical; - ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable > m_xDatMan; - BibDataManager* pDatMan; - HdlBibModul pBibMod; - - DECL_STATIC_LINK( BibFrameController_Impl, DisposeHdl, void* ); - - sal_Bool SaveModified(const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController>& xController); -public: - BibFrameController_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > & xComponent, - BibDataManager* pDatMan); - ~BibFrameController_Impl(); - - - void activate(); - void deactivate(); - - void ChangeDataSource(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs); - void RemoveFilter(); - - // ::com::sun::star::lang::XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& sServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::frame::XController - virtual void SAL_CALL attachFrame( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > & xFrame ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL attachModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xModel ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL suspend( sal_Bool bSuspend ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getViewData() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL restoreViewData( const ::com::sun::star::uno::Any& Value ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL getFrame() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SAL_CALL getModel() throw (::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::lang::XComponent - virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener ) throw (::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::frame::XDispatchProvider - virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& aDescripts) throw (::com::sun::star::uno::RuntimeException); - - //class ::com::sun::star::frame::XDispatch - virtual void SAL_CALL dispatch(const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xControl, const ::com::sun::star::util::URL& aURL) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xControl, const ::com::sun::star::util::URL& aURL) throw (::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::frame::XDispatchInformationProvider - virtual ::com::sun::star::uno::Sequence< ::sal_Int16 > SAL_CALL getSupportedCommandGroups( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation( ::sal_Int16 CommandGroup ) throw (::com::sun::star::uno::RuntimeException); - }; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx deleted file mode 100644 index 9c5910613..000000000 --- a/extensions/source/bibliography/general.cxx +++ /dev/null @@ -1,878 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - - -#include <comphelper/processfactory.hxx> -#include <com/sun/star/awt/PosSize.hpp> -#include <com/sun/star/sdbc/XRowSet.hpp> -#include <com/sun/star/sdb/XColumn.hpp> -#include <com/sun/star/sdb/CommandType.hpp> -#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> -#include <com/sun/star/form/ListSourceType.hpp> -#include <com/sun/star/awt/XWindow.hpp> -#include <toolkit/helper/vclunohelper.hxx> -#include <cppuhelper/implbase1.hxx> // helper for implementations -#include "general.hxx" -#include "sections.hrc" -#include "bibresid.hxx" -#include "datman.hxx" -#include "bibconfig.hxx" -#include "bibprop.hrc" -#include "bib.hrc" -#include "bibmod.hxx" -#include "bibtools.hxx" -#include "bibliography.hrc" -#include <tools/debug.hxx> -#include <vcl/svapp.hxx> -#include <vcl/i18nhelp.hxx> -#include <vcl/mnemonic.hxx> -#include <algorithm> -#include <functional> -#include <vector> -#include <tools/urlobj.hxx> - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::sdb; -using namespace ::rtl; - -#define C2U(cChar) OUString::createFromAscii(cChar) -#define C2S(cChar) String::CreateFromAscii(cChar) -#define DISTANCE_CONTROL_TO_FIXEDTEXT 5 - -::Point lcl_MovePoint(const FixedText& rFixedText) -{ - ::Point aRet(rFixedText.GetPosPixel()); - aRet.X() += rFixedText.GetSizePixel().Width(); - aRet.X() += DISTANCE_CONTROL_TO_FIXEDTEXT; - return aRet; -} - -//----------------------------------------------------------------------------- -OUString lcl_GetColumnName( const Mapping* pMapping, sal_uInt16 nIndexPos ) -{ - BibConfig* pBibConfig = BibModul::GetConfig(); - OUString sRet = pBibConfig->GetDefColumnName(nIndexPos); - if(pMapping) - for(sal_uInt16 i = 0; i < COLUMN_COUNT; i++) - { - if(pMapping->aColumnPairs[i].sLogicalColumnName == sRet) - { - sRet = pMapping->aColumnPairs[i].sRealColumnName; - break; - } - } - return sRet; -} - -class BibPosListener :public cppu::WeakImplHelper1 <sdbc::XRowSetListener> -{ - BibGeneralPage* pParentPage; -public: - BibPosListener(BibGeneralPage* pParent); - - //XPositioningListener - virtual void SAL_CALL cursorMoved(const lang::EventObject& event) throw( uno::RuntimeException ); - virtual void SAL_CALL rowChanged(const lang::EventObject& /*event*/) throw( uno::RuntimeException ){ /* not interested in */ } - virtual void SAL_CALL rowSetChanged(const lang::EventObject& /*event*/) throw( uno::RuntimeException ){ /* not interested in */ } - - //XEventListener - virtual void SAL_CALL disposing(const lang::EventObject& Source) throw( uno::RuntimeException ); - -}; - -BibPosListener::BibPosListener(BibGeneralPage* pParent) : - pParentPage(pParent) -{ -} - -void BibPosListener::cursorMoved(const lang::EventObject& /*aEvent*/) throw( uno::RuntimeException ) -{ - try - { - uno::Reference< form::XBoundComponent > xLstBox = pParentPage->GetTypeListBoxModel(); - uno::Reference< beans::XPropertySet > xPropSet(xLstBox, UNO_QUERY); - if(xPropSet.is()) - { - BibConfig* pBibConfig = BibModul::GetConfig(); - BibDataManager* pDatMan = pParentPage->GetDataManager(); - BibDBDescriptor aDesc; - aDesc.sDataSource = pDatMan->getActiveDataSource(); - aDesc.sTableOrQuery = pDatMan->getActiveDataTable(); - aDesc.nCommandType = CommandType::TABLE; - - const Mapping* pMapping = pBibConfig->GetMapping(aDesc); - OUString sTypeMapping = pBibConfig->GetDefColumnName(AUTHORITYTYPE_POS); - if(pMapping) - { - for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++) - { - if(pMapping->aColumnPairs[nEntry].sLogicalColumnName == sTypeMapping) - { - sTypeMapping = pMapping->aColumnPairs[nEntry].sRealColumnName; - break; - } - } - } - rtl::OUString uTypeMapping = sTypeMapping; - - uno::Reference< form::XForm > xForm = pDatMan->getForm(); - uno::Reference< sdbcx::XColumnsSupplier > xSupplyCols(xForm, UNO_QUERY); - uno::Reference< container::XNameAccess > xValueAcc; - if (xSupplyCols.is()) - xValueAcc = xSupplyCols->getColumns(); - - sal_Int16 nTempVal = -1; - if(xValueAcc.is() && xValueAcc->hasByName(uTypeMapping)) - { - uno::Any aVal = xValueAcc->getByName(uTypeMapping); - uno::Reference< uno::XInterface > xInt = *(uno::Reference< uno::XInterface > *)aVal.getValue(); - uno::Reference< sdb::XColumn > xCol(xInt, UNO_QUERY); - DBG_ASSERT(xCol.is(), "BibPosListener::positioned : invalid column (no sdb::XColumn) !"); - if (xCol.is()) - { - nTempVal = xCol->getShort(); - // getShort returns zero if the value is not a number - if (!nTempVal || xCol->wasNull()) - { - rtl::OUString sTempVal = xCol->getString(); - if(sTempVal != rtl::OUString('0')) - nTempVal = -1; - } - } - } - if(nTempVal < 0 || nTempVal >= TYPE_COUNT) - { - uno::Any aSel; - uno::Sequence<sal_Int16> aSelSeq(1); - sal_Int16* pArr = aSelSeq.getArray(); - pArr[0] = TYPE_COUNT; - aSel.setValue(&aSelSeq, ::getCppuType((Sequence<sal_Int16>*)0)); - xPropSet->setPropertyValue(C2U("SelectedItems"), aSel); - } - } - } - catch(Exception& rEx) - { - (void) rEx; // make compiler happy - OSL_FAIL("BibPosListener::positioned: something went wrong !"); - } -} - -void BibPosListener::disposing(const lang::EventObject& /*Source*/) throw( uno::RuntimeException ) -{ -} - -BibGeneralPage::BibGeneralPage(Window* pParent, BibDataManager* pMan): - BibTabPage(pParent,BibResId(RID_TP_GENERAL)), - aControlParentWin(this, WB_DIALOGCONTROL), - aIdentifierFT(&aControlParentWin, BibResId(FT_IDENTIFIER )), - aAuthTypeFT(&aControlParentWin, BibResId(FT_AUTHTYPE )), - aYearFT(&aControlParentWin, BibResId(FT_YEAR )), - aAuthorFT(&aControlParentWin, BibResId(FT_AUTHOR )), - aTitleFT(&aControlParentWin, BibResId(FT_TITLE )), - aPublisherFT(&aControlParentWin, BibResId(FT_PUBLISHER )), - aAddressFT(&aControlParentWin, BibResId(FT_ADDRESS )), - aISBNFT(&aControlParentWin, BibResId(FT_ISBN )), - aChapterFT(&aControlParentWin, BibResId(FT_CHAPTER )), - aPagesFT(&aControlParentWin, BibResId(FT_PAGE )), - aFirstFL(&aControlParentWin, BibResId(FL_1 )), - aEditorFT(&aControlParentWin, BibResId(FT_EDITOR )), - aEditionFT(&aControlParentWin, BibResId(FT_EDITION )), - aBooktitleFT(&aControlParentWin, BibResId(FT_BOOKTITLE )), - aVolumeFT(&aControlParentWin, BibResId(FT_VOLUME )), - aHowpublishedFT(&aControlParentWin, BibResId(FT_HOWPUBLISHED )), - aOrganizationsFT(&aControlParentWin,BibResId(FT_ORGANIZATION )), - aInstitutionFT(&aControlParentWin, BibResId(FT_INSTITUTION )), - aSchoolFT(&aControlParentWin, BibResId(FT_SCHOOL )), - aReportTypeFT(&aControlParentWin, BibResId(FT_REPORT )), - aMonthFT(&aControlParentWin, BibResId(FT_MONTH )), - aSecondFL(&aControlParentWin, BibResId(FL_2 )), - aJournalFT(&aControlParentWin, BibResId(FT_JOURNAL )), - aNumberFT(&aControlParentWin, BibResId(FT_NUMBER )), - aSeriesFT(&aControlParentWin, BibResId(FT_SERIES )), - aAnnoteFT(&aControlParentWin, BibResId(FT_ANNOTE )), - aNoteFT(&aControlParentWin, BibResId(FT_NOTE )), - aURLFT(&aControlParentWin, BibResId(FT_URL )), - aThirdFL(&aControlParentWin, BibResId(FL_3 )), - aCustom1FT(&aControlParentWin, BibResId(FT_CUSTOM1 )), - aCustom2FT(&aControlParentWin, BibResId(FT_CUSTOM2 )), - aCustom3FT(&aControlParentWin, BibResId(FT_CUSTOM3 )), - aCustom4FT(&aControlParentWin, BibResId(FT_CUSTOM4 )), - aCustom5FT(&aControlParentWin, BibResId(FT_CUSTOM5 )), - aHoriScroll(this, WB_HORZ), - aVertScroll(this, WB_VERT), - sErrorPrefix(BibResId(ST_ERROR_PREFIX)), - pDatMan(pMan) -{ - aControlParentWin.Show(); - aControlParentWin.SetHelpId(HID_BIB_CONTROL_PARENT); - aStdSize = GetOutputSizePixel(); - - aBibTypeArr[0] = String(BibResId(ST_TYPE_ARTICLE)); - aBibTypeArr[1] = String(BibResId(ST_TYPE_BOOK)); - aBibTypeArr[2] = String(BibResId(ST_TYPE_BOOKLET)); - aBibTypeArr[3] = String(BibResId(ST_TYPE_CONFERENCE)); - aBibTypeArr[4] = String(BibResId(ST_TYPE_INBOOK )); - aBibTypeArr[5] = String(BibResId(ST_TYPE_INCOLLECTION)); - aBibTypeArr[6] = String(BibResId(ST_TYPE_INPROCEEDINGS)); - aBibTypeArr[7] = String(BibResId(ST_TYPE_JOURNAL )); - aBibTypeArr[8] = String(BibResId(ST_TYPE_MANUAL )); - aBibTypeArr[9] = String(BibResId(ST_TYPE_MASTERSTHESIS)); - aBibTypeArr[10] = String(BibResId(ST_TYPE_MISC )); - aBibTypeArr[11] = String(BibResId(ST_TYPE_PHDTHESIS )); - aBibTypeArr[12] = String(BibResId(ST_TYPE_PROCEEDINGS )); - aBibTypeArr[13] = String(BibResId(ST_TYPE_TECHREPORT )); - aBibTypeArr[14] = String(BibResId(ST_TYPE_UNPUBLISHED )); - aBibTypeArr[15] = String(BibResId(ST_TYPE_EMAIL )); - aBibTypeArr[16] = String(BibResId(ST_TYPE_WWW )); - aBibTypeArr[17] = String(BibResId(ST_TYPE_CUSTOM1 )); - aBibTypeArr[18] = String(BibResId(ST_TYPE_CUSTOM2 )); - aBibTypeArr[19] = String(BibResId(ST_TYPE_CUSTOM3 )); - aBibTypeArr[20] = String(BibResId(ST_TYPE_CUSTOM4 )); - aBibTypeArr[21] = String(BibResId(ST_TYPE_CUSTOM5 )); - - FreeResource(); - - InitFixedTexts(); - - aBasePos = aIdentifierFT.GetPosPixel(); - - sal_Int16* pMap = nFT2CtrlMap; - for( sal_uInt16 i = 0 ; i < FIELD_COUNT ; ++i, ++pMap ) - { - aControls[ i ] = 0; - *pMap = -1; - } - - AdjustScrollbars(); - Link aScrollLnk(LINK(this, BibGeneralPage, ScrollHdl)); - aHoriScroll.SetScrollHdl( aScrollLnk ); - aVertScroll.SetScrollHdl( aScrollLnk ); - aHoriScroll.SetLineSize(10); - aVertScroll.SetLineSize(10); - aHoriScroll.SetPageSize( aIdentifierFT.GetSizePixel().Width()); - aVertScroll.SetPageSize( - aPublisherFT.GetPosPixel().Y() - aIdentifierFT.GetPosPixel().Y()); - aHoriScroll.Show(); - aVertScroll.Show(); - - BibConfig* pBibConfig = BibModul::GetConfig(); - BibDBDescriptor aDesc; - aDesc.sDataSource = pDatMan->getActiveDataSource(); - aDesc.sTableOrQuery = pDatMan->getActiveDataTable(); - aDesc.nCommandType = CommandType::TABLE; - const Mapping* pMapping = pBibConfig->GetMapping(aDesc); - - xCtrlContnr = VCLUnoHelper::CreateControlContainer(&aControlParentWin); - - xMgr = comphelper::getProcessServiceFactory(); - // the control should be a bit smaller than the fixed text - Size aControlSize(aIdentifierFT.GetSizePixel()); - aControlSize.Width() = aControlSize.Width() * 8 / 10; - - AddControlWithError( lcl_GetColumnName( pMapping, IDENTIFIER_POS ), lcl_MovePoint( aIdentifierFT ), - aControlSize, sTableErrorString, aIdentifierFT.GetText(), - HID_BIB_IDENTIFIER_POS, 0 ); - - sTypeColumnName = lcl_GetColumnName(pMapping, AUTHORITYTYPE_POS); - - AddControlWithError( sTypeColumnName, lcl_MovePoint(aAuthTypeFT ), aControlSize, sTableErrorString, - aAuthTypeFT.GetText(), HID_BIB_AUTHORITYTYPE_POS, 1 ); - - ::Point aYearPos = lcl_MovePoint(aYearFT); - AddControlWithError( lcl_GetColumnName( pMapping, YEAR_POS ), aYearPos, - aControlSize, sTableErrorString, aYearFT.GetText(), HID_BIB_YEAR_POS, 4 ); - - AddControlWithError( lcl_GetColumnName(pMapping, AUTHOR_POS), lcl_MovePoint(aAuthorFT), - aControlSize, sTableErrorString, aAuthorFT.GetText(), HID_BIB_AUTHOR_POS, 2 ); - - ::Point aTitlePos( lcl_MovePoint( aTitleFT ) ); - ::Size aTitleSize = aTitleFT.GetSizePixel(); - aTitleSize.Width() = aYearPos.X() + aControlSize.Width() - aTitlePos.X(); - AddControlWithError( lcl_GetColumnName(pMapping, TITLE_POS), aTitlePos, aTitleSize, sTableErrorString, - aTitleFT.GetText(), HID_BIB_TITLE_POS, 22 ); - - AddControlWithError( lcl_GetColumnName( pMapping, PUBLISHER_POS ), lcl_MovePoint( aPublisherFT), - aControlSize, sTableErrorString, aPublisherFT.GetText(), HID_BIB_PUBLISHER_POS, 5 ); - - AddControlWithError( lcl_GetColumnName( pMapping, ADDRESS_POS ), lcl_MovePoint( aAddressFT ), - aControlSize, sTableErrorString, aAddressFT.GetText(), HID_BIB_ADDRESS_POS, 7 ); - - AddControlWithError( lcl_GetColumnName( pMapping, ISBN_POS ), lcl_MovePoint( aISBNFT ), - aControlSize, sTableErrorString, aISBNFT.GetText(), HID_BIB_ISBN_POS, 6 ); - - AddControlWithError( lcl_GetColumnName( pMapping, CHAPTER_POS ), lcl_MovePoint(aChapterFT), - aControlSize, sTableErrorString, aChapterFT.GetText(), HID_BIB_CHAPTER_POS, 10 ); - - AddControlWithError( lcl_GetColumnName( pMapping, PAGES_POS ), lcl_MovePoint( aPagesFT ), - aControlSize, sTableErrorString, aPagesFT.GetText(), HID_BIB_PAGES_POS, 19 ); - - AddControlWithError( lcl_GetColumnName( pMapping, EDITOR_POS ), lcl_MovePoint( aEditorFT ), - aControlSize, sTableErrorString, aEditorFT.GetText(), HID_BIB_EDITOR_POS, 12 ); - - AddControlWithError( lcl_GetColumnName( pMapping, EDITION_POS ), lcl_MovePoint(aEditionFT), - aControlSize, sTableErrorString, aEditionFT.GetText(), HID_BIB_EDITION_POS, 11 ); - - AddControlWithError( lcl_GetColumnName(pMapping, BOOKTITLE_POS), lcl_MovePoint(aBooktitleFT), - aControlSize, sTableErrorString, aBooktitleFT.GetText(), HID_BIB_BOOKTITLE_POS, 9 ); - - AddControlWithError( lcl_GetColumnName( pMapping, VOLUME_POS ), lcl_MovePoint( aVolumeFT ), - aControlSize, sTableErrorString, aVolumeFT.GetText(), HID_BIB_VOLUME_POS, 24 ); - - AddControlWithError( lcl_GetColumnName( pMapping, HOWPUBLISHED_POS ), lcl_MovePoint( aHowpublishedFT ), - aControlSize, sTableErrorString, aHowpublishedFT.GetText(), HID_BIB_HOWPUBLISHED_POS, 13 ); - - AddControlWithError( lcl_GetColumnName( pMapping, ORGANIZATIONS_POS ), lcl_MovePoint( aOrganizationsFT ), - aControlSize, sTableErrorString, aOrganizationsFT.GetText(), HID_BIB_ORGANIZATIONS_POS, 18 ); - - AddControlWithError( lcl_GetColumnName( pMapping, INSTITUTION_POS ), lcl_MovePoint( aInstitutionFT ), - aControlSize, sTableErrorString, aInstitutionFT.GetText(), HID_BIB_INSTITUTION_POS, 14 ); - - AddControlWithError( lcl_GetColumnName( pMapping, SCHOOL_POS ), lcl_MovePoint( aSchoolFT ), - aControlSize, sTableErrorString, aSchoolFT.GetText(), HID_BIB_SCHOOL_POS, 20 ); - - AddControlWithError( lcl_GetColumnName( pMapping, REPORTTYPE_POS ), lcl_MovePoint( aReportTypeFT ), - aControlSize, sTableErrorString, aReportTypeFT.GetText(), HID_BIB_REPORTTYPE_POS, 23 ); - - AddControlWithError( lcl_GetColumnName( pMapping, MONTH_POS ), lcl_MovePoint( aMonthFT ), - aControlSize, sTableErrorString, aMonthFT.GetText(), HID_BIB_MONTH_POS, 3 ); - - AddControlWithError( lcl_GetColumnName( pMapping, JOURNAL_POS ), lcl_MovePoint( aJournalFT ), - aControlSize, sTableErrorString, aJournalFT.GetText(), HID_BIB_JOURNAL_POS, 15 ); - - AddControlWithError( lcl_GetColumnName( pMapping, NUMBER_POS ), lcl_MovePoint( aNumberFT ), - aControlSize, sTableErrorString, aNumberFT.GetText(), HID_BIB_NUMBER_POS, 17 ); - - AddControlWithError( lcl_GetColumnName( pMapping, SERIES_POS ), lcl_MovePoint( aSeriesFT ), - aControlSize, sTableErrorString, aSeriesFT.GetText(), HID_BIB_SERIES_POS, 21 ); - - AddControlWithError( lcl_GetColumnName( pMapping, ANNOTE_POS ), lcl_MovePoint( aAnnoteFT ), - aControlSize, sTableErrorString, aAnnoteFT.GetText(), HID_BIB_ANNOTE_POS, 8 ); - - AddControlWithError( lcl_GetColumnName( pMapping, NOTE_POS ), lcl_MovePoint( aNoteFT ), - aControlSize, sTableErrorString, aNoteFT.GetText(), HID_BIB_NOTE_POS, 16 ); - - AddControlWithError( lcl_GetColumnName( pMapping, URL_POS ), lcl_MovePoint( aURLFT ), - aControlSize, sTableErrorString, aURLFT.GetText(), HID_BIB_URL_POS, 25 ); - - AddControlWithError( lcl_GetColumnName( pMapping, CUSTOM1_POS ), lcl_MovePoint( aCustom1FT ), - aControlSize, sTableErrorString, aCustom1FT.GetText(), HID_BIB_CUSTOM1_POS, 26 ); - - AddControlWithError( lcl_GetColumnName( pMapping, CUSTOM2_POS ), lcl_MovePoint( aCustom2FT ), - aControlSize, sTableErrorString, aCustom2FT.GetText(), HID_BIB_CUSTOM2_POS, 27 ); - - AddControlWithError( lcl_GetColumnName( pMapping, CUSTOM3_POS ), lcl_MovePoint( aCustom3FT ), - aControlSize, sTableErrorString, aCustom3FT.GetText(), HID_BIB_CUSTOM3_POS, 28 ); - - AddControlWithError( lcl_GetColumnName( pMapping, CUSTOM4_POS ), lcl_MovePoint( aCustom4FT ), - aControlSize, sTableErrorString, aCustom4FT.GetText(), HID_BIB_CUSTOM4_POS, 29 ); - - AddControlWithError( lcl_GetColumnName( pMapping, CUSTOM5_POS ), lcl_MovePoint( aCustom5FT ), - aControlSize, sTableErrorString, aCustom5FT.GetText(), HID_BIB_CUSTOM5_POS, 30 ); - - xPosListener = new BibPosListener(this); - uno::Reference< sdbc::XRowSet > xRowSet(pDatMan->getForm(), UNO_QUERY); - if(xRowSet.is()) - xRowSet->addRowSetListener(xPosListener); - uno::Reference< form::runtime::XFormController > xFormCtrl = pDatMan->GetFormController(); - xFormCtrl->setContainer(xCtrlContnr); - xFormCtrl->activateTabOrder(); - - if(sTableErrorString.Len()) - sTableErrorString.Insert(sErrorPrefix, 0); -} -//----------------------------------------------------------------------------- -BibGeneralPage::~BibGeneralPage() -{ - if (pDatMan && xPosListener.is()) - { - uno::Reference< sdbc::XRowSet > xRowSet(pDatMan->getForm(), UNO_QUERY); - if(xRowSet.is()) - xRowSet->removeRowSetListener(xPosListener); - } -} - -void BibGeneralPage::RemoveListeners() -{ - for(sal_uInt16 i = 0; i < FIELD_COUNT; i++) - { - if(aControls[i].is()) - { - uno::Reference< awt::XWindow > xCtrWin(aControls[i], uno::UNO_QUERY ); - xCtrWin->removeFocusListener( this ); - aControls[i] = 0; - } - } -} - -void BibGeneralPage::CommitActiveControl() -{ - uno::Reference< form::runtime::XFormController > xFormCtrl = pDatMan->GetFormController(); - uno::Reference< awt::XControl > xCurr = xFormCtrl->getCurrentControl(); - if(xCurr.is()) - { - uno::Reference< awt::XControlModel > xModel = xCurr->getModel(); - uno::Reference< form::XBoundComponent > xBound(xModel, UNO_QUERY); - if(xBound.is()) - xBound->commit(); - } -} -//----------------------------------------------------------------------------- -void BibGeneralPage::AddControlWithError( const OUString& rColumnName, const ::Point& rPos, const ::Size& rSize, - String& rErrorString, String aColumnUIName, const rtl::OString& sHelpId, sal_uInt16 nIndexInFTArray ) -{ - // adds also the XControl and creates a map entry in nFT2CtrlMap[] for mapping between control and FT - - sal_Int16 nIndex = -1; - uno::Reference< awt::XControlModel > xTmp = AddXControl(rColumnName, rPos, rSize, sHelpId, nIndex ); - if( xTmp.is() ) - { - DBG_ASSERT( nIndexInFTArray < FIELD_COUNT, "*BibGeneralPage::AddControlWithError(): wrong array index!" ); - DBG_ASSERT( nFT2CtrlMap[ nIndexInFTArray ] < 0, "+BibGeneralPage::AddControlWithError(): index already in use!" ); - - nFT2CtrlMap[ nIndexInFTArray ] = nIndex; - } - else - { - if( rErrorString.Len() ) - rErrorString += '\n'; - - rErrorString += MnemonicGenerator::EraseAllMnemonicChars( aColumnUIName ); - } -} -//----------------------------------------------------------------------------- -uno::Reference< awt::XControlModel > BibGeneralPage::AddXControl( - const String& rName, - ::Point rPos, ::Size rSize, const rtl::OString& sHelpId, sal_Int16& rIndex ) -{ - uno::Reference< awt::XControlModel > xCtrModel; - try - { - sal_Bool bTypeListBox = sTypeColumnName == rName; - xCtrModel = pDatMan->loadControlModel(rName, bTypeListBox); - if ( xCtrModel.is() && xMgr.is()) - { - uno::Reference< beans::XPropertySet > xPropSet( xCtrModel, UNO_QUERY ); - - if( xPropSet.is()) - { - uno::Reference< beans::XPropertySetInfo > xPropInfo = xPropSet->getPropertySetInfo(); - - uno::Any aAny = xPropSet->getPropertyValue( C2U("DefaultControl") ); - rtl::OUString aControlName; - aAny >>= aControlName; - - rtl::OUString uProp(C2U("HelpURL")); - if(xPropInfo->hasPropertyByName(uProp)) - { - ::rtl::OUString sId = ::rtl::OUString::createFromAscii( INET_HID_SCHEME ); - DBG_ASSERT( INetURLObject( rtl::OStringToOUString( sHelpId, RTL_TEXTENCODING_UTF8 ) ).GetProtocol() == INET_PROT_NOT_VALID, "Wrong HelpId!" ); - sId += ::rtl::OUString( sHelpId, sHelpId.getLength(), RTL_TEXTENCODING_UTF8 ); - xPropSet->setPropertyValue( uProp, makeAny( sId ) ); - } - - if(bTypeListBox) - { - //uno::Reference< beans::XPropertySet > xPropSet(xControl, UNO_QUERY); - aAny <<= (sal_Int16)1; - xPropSet->setPropertyValue(C2U("BoundColumn"), aAny); - ListSourceType eSet = ListSourceType_VALUELIST; - aAny.setValue( &eSet, ::getCppuType((const ListSourceType*)0) ); - xPropSet->setPropertyValue(C2U("ListSourceType"), aAny); - - uno::Sequence<rtl::OUString> aListSource(TYPE_COUNT); - rtl::OUString* pListSourceArr = aListSource.getArray(); - //pListSourceArr[0] = C2U("select TypeName, TypeIndex from TypeNms"); - for(sal_uInt16 i = 0; i < TYPE_COUNT; i++) - pListSourceArr[i] = String::CreateFromInt32(i); - aAny.setValue(&aListSource, ::getCppuType((uno::Sequence<rtl::OUString>*)0)); - - xPropSet->setPropertyValue(C2U("ListSource"), aAny); - - uno::Sequence<rtl::OUString> aValues(TYPE_COUNT + 1); - rtl::OUString* pValuesArr = aValues.getArray(); - for(sal_uInt16 j = 0; j < TYPE_COUNT; j++) - pValuesArr[j] = aBibTypeArr[j]; - // empty string if an invalid value no values is set - pValuesArr[TYPE_COUNT] = rtl::OUString(); - - aAny.setValue(&aValues, ::getCppuType((uno::Sequence<rtl::OUString>*)0)); - - xPropSet->setPropertyValue(C2U("StringItemList"), aAny); - - sal_Bool bTrue = sal_True; - aAny.setValue( &bTrue, ::getBooleanCppuType() ); - xPropSet->setPropertyValue( C2U("Dropdown"), aAny ); - - aControlName = C2U("com.sun.star.form.control.ListBox"); - xLBModel = Reference< form::XBoundComponent >(xCtrModel, UNO_QUERY); - - } - - uno::Reference< awt::XControl > xControl(xMgr->createInstance( aControlName ), UNO_QUERY ); - if ( xControl.is() ) - { - xControl->setModel( xCtrModel); - - // Peer als Child zu dem FrameWindow - xCtrlContnr->addControl(rName, xControl); - uno::Reference< awt::XWindow > xCtrWin(xControl, UNO_QUERY ); - xCtrWin->addFocusListener( this ); - rIndex = -1; // -> implies, that not found - for(sal_uInt16 i = 0; i < FIELD_COUNT; i++) - if(!aControls[i].is()) - { - aControls[i] = xCtrWin; - rIndex = sal_Int16( i ); - break; - } - xCtrWin->setVisible( sal_True ); - xControl->setDesignMode( sal_True ); - // initially switch on the desing mode - switch it off _after_ loading the form - - xCtrWin->setPosSize(rPos.X(), rPos.Y(), rSize.Width(), - rSize.Height(), awt::PosSize::POSSIZE); - } - } - } - } - catch(Exception& rEx) - { - (void) rEx; // make compiler happy - OSL_FAIL("BibGeneralPage::AddXControl: something went wrong !"); - } - return xCtrModel; -} - -void BibGeneralPage::AdjustScrollbars() -{ - long nVertScrollWidth = aVertScroll.GetSizePixel().Width(); - long nHoriScrollHeight = aHoriScroll.GetSizePixel().Height(); - ::Size aOutSize(GetOutputSizePixel()); - sal_Bool bHoriVisible = aOutSize.Width() <= aStdSize.Width(); - sal_Bool bVertVisible = (aOutSize.Height()-(bHoriVisible ? nHoriScrollHeight : 0)) <= (aStdSize.Height()); - aHoriScroll.Show(bHoriVisible); - aVertScroll.Show(bVertVisible); - - if(bHoriVisible) - { - ::Size aHoriSize(aOutSize.Width() - (bVertVisible ? nVertScrollWidth : 0), - nHoriScrollHeight); - aHoriScroll.SetSizePixel(aHoriSize); - aHoriScroll.SetRange( Range(0, aStdSize.Width())); - aHoriScroll.SetVisibleSize( aHoriSize.Width() - (bVertVisible ? nVertScrollWidth : 0)); - } - if(bVertVisible) - { - ::Size aVertSize(nHoriScrollHeight, aOutSize.Height() - - (bHoriVisible ? nHoriScrollHeight : 0)); - aVertScroll.SetSizePixel(aVertSize); - aVertScroll.SetRange( Range(0, aStdSize.Height())); - aVertScroll.SetVisibleSize( aVertSize.Height() ); - } - - ::Size aSize(8, 8); - aSize = LogicToPixel(aSize, MapMode(MAP_APPFONT)); - ::Size aScrollSize(aOutSize.Width() - aSize.Height(), aSize.Height()); - ::Point aScrollPos(0, aOutSize.Height() - aSize.Height()); - aHoriScroll.SetPosSizePixel(aScrollPos, aScrollSize); - - aScrollPos.X() = aOutSize.Width() - aSize.Width(); - aScrollPos.Y() = 0; - aScrollSize.Width() = aSize.Width(); - aScrollSize.Height() = aOutSize.Height() - aSize.Height(); - aVertScroll.SetPosSizePixel(aScrollPos, aScrollSize); - - ::Size aControlParentWinSz(aOutSize); - if(bHoriVisible) - aControlParentWinSz.Height() -= aSize.Height(); - if(bVertVisible) - aControlParentWinSz.Width() -= aSize.Width(); - aControlParentWin.SetSizePixel(aControlParentWinSz); -} - -void BibGeneralPage::Resize() -{ - AdjustScrollbars(); - ScrollHdl(&aVertScroll); - ScrollHdl(&aHoriScroll); - Window::Resize(); -} - -void BibGeneralPage::InitFixedTexts( void ) -{ - String aFixedStrings[ FIELD_COUNT ] = - { - String( BibResId( ST_IDENTIFIER ) ), - String( BibResId( ST_AUTHTYPE ) ), - String( BibResId( ST_AUTHOR ) ), - String( BibResId( ST_TITLE ) ), - String( BibResId( ST_MONTH ) ), - String( BibResId( ST_YEAR ) ), - String( BibResId( ST_ISBN ) ), - String( BibResId( ST_BOOKTITLE ) ), - String( BibResId( ST_CHAPTER ) ), - String( BibResId( ST_EDITION ) ), - String( BibResId( ST_EDITOR ) ), - String( BibResId( ST_HOWPUBLISHED ) ), - String( BibResId( ST_INSTITUTION ) ), - String( BibResId( ST_JOURNAL ) ), - String( BibResId( ST_NOTE ) ), - String( BibResId( ST_ANNOTE ) ), - String( BibResId( ST_NUMBER ) ), - String( BibResId( ST_ORGANIZATION ) ), - String( BibResId( ST_PAGE ) ), - String( BibResId( ST_PUBLISHER ) ), - String( BibResId( ST_ADDRESS ) ), - String( BibResId( ST_SCHOOL ) ), - String( BibResId( ST_SERIES ) ), - String( BibResId( ST_REPORT ) ), - String( BibResId( ST_VOLUME ) ), - String( BibResId( ST_URL ) ), - String( BibResId( ST_CUSTOM1 ) ), - String( BibResId( ST_CUSTOM2 ) ), - String( BibResId( ST_CUSTOM3 ) ), - String( BibResId( ST_CUSTOM4 ) ), - String( BibResId( ST_CUSTOM5 ) ) - }; - - aFixedTexts[0] = &aIdentifierFT; - aFixedTexts[1] = &aAuthTypeFT; - aFixedTexts[2] = &aAuthorFT; - aFixedTexts[3] = &aTitleFT; - aFixedTexts[4] = &aMonthFT; - aFixedTexts[5] = &aYearFT; - aFixedTexts[6] = &aISBNFT; - aFixedTexts[7] = &aBooktitleFT; - aFixedTexts[8] = &aChapterFT; - aFixedTexts[9] = &aEditionFT; - aFixedTexts[10] = &aEditorFT; - aFixedTexts[11] = &aHowpublishedFT; - aFixedTexts[12] = &aInstitutionFT; - aFixedTexts[13] = &aJournalFT; - aFixedTexts[14] = &aNoteFT; - aFixedTexts[15] = &aAnnoteFT; - aFixedTexts[16] = &aNumberFT; - aFixedTexts[17] = &aOrganizationsFT; - aFixedTexts[18] = &aPagesFT; - aFixedTexts[19] = &aPublisherFT; - aFixedTexts[20] = &aAddressFT; - aFixedTexts[21] = &aSchoolFT; - aFixedTexts[22] = &aSeriesFT; - aFixedTexts[23] = &aReportTypeFT; - aFixedTexts[24] = &aVolumeFT; - aFixedTexts[25] = &aURLFT; - aFixedTexts[26] = &aCustom1FT; - aFixedTexts[27] = &aCustom2FT; - aFixedTexts[28] = &aCustom3FT; - aFixedTexts[29] = &aCustom4FT; - aFixedTexts[30] = &aCustom5FT; - - int i; - - MnemonicGenerator aMnemonicGenerator; - // init mnemonics, first register all strings - for( i = 0 ; i < FIELD_COUNT ; ++i ) - aMnemonicGenerator.RegisterMnemonic( aFixedStrings[ i ] ); - - // ... then get all strings - for( i = 0 ; i < FIELD_COUNT ; ++i ) - aMnemonicGenerator.CreateMnemonic( aFixedStrings[ i ] ); - - // set texts - for( i = 0 ; i < FIELD_COUNT ; ++i ) - aFixedTexts[ i ]->SetText( aFixedStrings[ i ] ); -} - -IMPL_LINK(BibGeneralPage, ScrollHdl, ScrollBar*, pScroll) -{ - sal_Bool bVertical = &aVertScroll == pScroll; - long nOffset = 0; - long nCurrentOffset = 0; - if(bVertical) - nCurrentOffset = aFixedTexts[0]->GetPosPixel().Y() - aBasePos.Y(); - else - nCurrentOffset = aFixedTexts[0]->GetPosPixel().X() - aBasePos.X(); - nOffset = pScroll->IsVisible() ? pScroll->GetThumbPos() + nCurrentOffset : nCurrentOffset;; - - for(sal_uInt16 i = 0; i < FIELD_COUNT; i++) - { - ::Point aPos = aFixedTexts[i]->GetPosPixel(); - if(bVertical) - aPos.Y() -= nOffset; - else - aPos.X() -= nOffset; - aFixedTexts[i]->SetPosPixel(aPos); - if(aControls[i].is()) - { - awt::Rectangle aRect = aControls[i]->getPosSize(); - long nX = aRect.X; - long nY = aRect.Y; - if(bVertical) - nY -= nOffset; - else - nX -= nOffset; - aControls[i]->setPosSize(nX, nY, 0, 0, awt::PosSize::POS); - } - } - return 0; -} - -void BibGeneralPage::focusGained(const awt::FocusEvent& rEvent) throw( uno::RuntimeException ) -{ - Reference<awt::XWindow> xCtrWin(rEvent.Source, UNO_QUERY ); - if(xCtrWin.is()) - { - ::Size aOutSize = aControlParentWin.GetOutputSizePixel(); - awt::Rectangle aRect = xCtrWin->getPosSize(); - long nX = aRect.X; - if(nX < 0) - { - // left of the visible area - aHoriScroll.SetThumbPos(aHoriScroll.GetThumbPos() + nX); - ScrollHdl(&aHoriScroll); - } - else if(nX > aOutSize.Width()) - { - // right of the visible area - aHoriScroll.SetThumbPos(aHoriScroll.GetThumbPos() + nX - aOutSize.Width() + aFixedTexts[0]->GetSizePixel().Width()); - ScrollHdl(&aHoriScroll); - } - long nY = aRect.Y; - if(nY < 0) - { - // below the visible area - aVertScroll.SetThumbPos(aVertScroll.GetThumbPos() + nY); - ScrollHdl(&aVertScroll); - } - else if(nY > aOutSize.Height()) - { - // over the visible area - aVertScroll.SetThumbPos(aVertScroll.GetThumbPos() + nY - aOutSize.Height()+ aFixedTexts[0]->GetSizePixel().Height()); - ScrollHdl(&aVertScroll); - } - } -} - -void BibGeneralPage::focusLost(const awt::FocusEvent& ) throw( uno::RuntimeException ) -{ - CommitActiveControl(); -} - -void BibGeneralPage::disposing(const lang::EventObject& /*Source*/) throw( uno::RuntimeException ) -{ -} - -void BibGeneralPage::GetFocus() -{ - Reference< awt::XWindow >* pxControl = aControls; - - for( int i = FIELD_COUNT ; i ; --i, ++pxControl ) - { - if( pxControl->is() ) - { - ( *pxControl )->setFocus(); - return; - } - } - - // fallback - aControlParentWin.GrabFocus(); -} - -sal_Bool BibGeneralPage::HandleShortCutKey( const KeyEvent& rKeyEvent ) -{ - DBG_ASSERT( KEY_MOD2 == rKeyEvent.GetKeyCode().GetModifier(), "+BibGeneralPage::HandleShortCutKey(): this is not for me!" ); - - const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper(); - const xub_Unicode c = rKeyEvent.GetCharCode(); - sal_Bool bHandled = sal_False; - - sal_Int16 i; - - typedef std::vector< sal_Int16 > sal_Int16_vector; - - sal_Int16_vector::size_type nFocused = 0xFFFF; // index of focused in vector, no one focused initial - DBG_ASSERT( nFocused > 0, "*BibGeneralPage::HandleShortCutKey(): size_type works not as expected!" ); - - sal_Int16_vector aMatchList; - - for( i = 0 ; i < FIELD_COUNT ; ++i ) - { - if( rI18nHelper.MatchMnemonic( aFixedTexts[ i ]->GetText(), c ) ) - { - bHandled = sal_True; - sal_Int16 nCtrlIndex = nFT2CtrlMap[ i ]; - - if( nCtrlIndex >= 0 ) - { // store index of control - DBG_ASSERT( aControls[ nCtrlIndex ].is(), "-BibGeneralPage::HandleShortCutKey(): valid index and no control?" ); - - uno::Reference< awt::XControl > xControl( aControls[ nCtrlIndex ], UNO_QUERY ); - DBG_ASSERT( xControl.is(), "-BibGeneralPage::HandleShortCutKey(): a control wich is not a control!" ); - - Window* pWindow = VCLUnoHelper::GetWindow( xControl->getPeer() ); - - if( pWindow ) - { - aMatchList.push_back( nCtrlIndex ); - if( pWindow->HasChildPathFocus() ) - { // save focused control - DBG_ASSERT( nFocused == 0xFFFF, "+BibGeneralPage::HandleShortCutKey(): more than one with focus?!" ); - DBG_ASSERT( !aMatchList.empty(), "+BibGeneralPage::HandleShortCutKey(): push_back and no content?!" ); - nFocused = aMatchList.size() - 1; - } - } - } - } - } - - if( bHandled ) - { - DBG_ASSERT( !aMatchList.empty(), "*BibGeneralPage::HandleShortCutKey(): be prepared to crash..." ); - - if( nFocused >= ( aMatchList.size() - 1 ) ) - // >=... includes 0xFFFF - // no one or last focused, take first - nFocused = 0; - else - // take next one - nFocused++; - - aControls[ aMatchList[ nFocused ] ]->setFocus(); - } - - return bHandled; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/general.hxx b/extensions/source/bibliography/general.hxx deleted file mode 100644 index 86ff5a0cb..000000000 --- a/extensions/source/bibliography/general.hxx +++ /dev/null @@ -1,207 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BIB_GENERAL_HXX -#define _BIB_GENERAL_HXX - -#include <com/sun/star/awt/XFocusListener.hpp> -#include <com/sun/star/awt/XControlContainer.hpp> -#include <com/sun/star/form/XBoundComponent.hpp> -#include <com/sun/star/sdbc/XRowSetListener.hpp> -#include <svtools/stdctrl.hxx> - -#include <vcl/lstbox.hxx> -#include <vcl/group.hxx> -#include <svtools/svmedit.hxx> -#include <vcl/tabpage.hxx> -#include <vcl/combobox.hxx> -#include <vcl/scrbar.hxx> -#include <cppuhelper/implbase1.hxx> // helper for implementations -#include "bibshortcuthandler.hxx" - - -class BibDataManager; -#define TYPE_COUNT 22 -#define FIELD_COUNT 31 - -typedef cppu::WeakAggImplHelper1 < ::com::sun::star::awt::XFocusListener > BibGeneralPageBaseClass; - -class BibGeneralPage: public BibGeneralPageBaseClass, public BibTabPage -{ - Window aControlParentWin; - FixedText aIdentifierFT; - FixedText aAuthTypeFT; - FixedText aYearFT; - - FixedText aAuthorFT; - FixedText aTitleFT; - - FixedText aPublisherFT; - FixedText aAddressFT; - FixedText aISBNFT; - - FixedText aChapterFT; - FixedText aPagesFT; - FixedLine aFirstFL; - - FixedText aEditorFT; - FixedText aEditionFT; - - FixedText aBooktitleFT; - FixedText aVolumeFT; - FixedText aHowpublishedFT; - - FixedText aOrganizationsFT; - FixedText aInstitutionFT; - FixedText aSchoolFT; - - FixedText aReportTypeFT; - FixedText aMonthFT; - FixedLine aSecondFL; - - FixedText aJournalFT; - FixedText aNumberFT; - FixedText aSeriesFT; - - FixedText aAnnoteFT; - FixedText aNoteFT; - FixedText aURLFT; - FixedLine aThirdFL; - - FixedText aCustom1FT; - FixedText aCustom2FT; - FixedText aCustom3FT; - FixedText aCustom4FT; - FixedText aCustom5FT; - - ScrollBar aHoriScroll; - ScrollBar aVertScroll; - - FixedText* aFixedTexts[ FIELD_COUNT ]; - sal_Int16 nFT2CtrlMap[ FIELD_COUNT ]; - - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > - aControls[ FIELD_COUNT ]; - - Size aStdSize; - Point aBasePos; - - String aBibTypeArr[ TYPE_COUNT ]; - String sErrorPrefix; - String sTableErrorString; - - String sTypeColumnName; - - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > - xCtrlContnr; - - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - xMgr; - - ::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundComponent > - xCurrentBoundComponent; - - ::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundComponent > - xLBModel; - - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSetListener > - xPosListener; - - - BibDataManager* pDatMan; - - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > - AddXControl( const String& rName, Point aPos, Size aSize, const rtl::OString& sHelpId, - sal_Int16& rIndex ); - - void AddControlWithError( const rtl::OUString& rColumnName, const Point& rPos, - const Size& rSize, String& rErrorString, String aColumnUIName, - const rtl::OString& sHelpId, sal_uInt16 nIndexInFTArray ); - - void AdjustScrollbars(); - - DECL_LINK( ScrollHdl, ScrollBar* ); - -protected: - virtual void Resize(); - void InitFixedTexts( void ); // create mnemonics and set text an all fixed texts - -public: - BibGeneralPage(Window* pParent, BibDataManager* pDatMan); - virtual ~BibGeneralPage(); - - inline const String& GetErrorString() const; - - inline const ::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundComponent >& - GetTypeListBoxModel() const; - inline const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& - GetControlContainer() const; - - inline BibDataManager* GetDataManager(); - - void CommitActiveControl(); - - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw( com::sun::star::uno::RuntimeException ); - - void SAL_CALL focusGained( const ::com::sun::star::awt::FocusEvent& e ) throw( com::sun::star::uno::RuntimeException ); - void SAL_CALL focusLost( const ::com::sun::star::awt::FocusEvent& e ) throw( com::sun::star::uno::RuntimeException ); - - void RemoveListeners(); - - virtual void GetFocus(); - - virtual sal_Bool HandleShortCutKey( const KeyEvent& rKeyEvent ); // returns true, if key was handled -}; - - -inline const String& BibGeneralPage::GetErrorString() const -{ - return sTableErrorString; -} - -inline const ::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundComponent >& - BibGeneralPage::GetTypeListBoxModel() const -{ - return xLBModel; -} - -inline const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& - BibGeneralPage::GetControlContainer() const -{ - return xCtrlContnr; -} - -inline BibDataManager* BibGeneralPage::GetDataManager() -{ - return pDatMan; -} - -#endif - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/hidother.src b/extensions/source/bibliography/hidother.src deleted file mode 100644 index 57028fb42..000000000 --- a/extensions/source/bibliography/hidother.src +++ /dev/null @@ -1,61 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "bibliography.hrc" - -hidspecial HID_BIB_IDENTIFIER_POS { HelpID = HID_BIB_IDENTIFIER_POS ; }; -hidspecial HID_BIB_AUTHORITYTYPE_POS { HelpID = HID_BIB_AUTHORITYTYPE_POS ; }; -hidspecial HID_BIB_AUTHOR_POS { HelpID = HID_BIB_AUTHOR_POS ; }; -hidspecial HID_BIB_TITLE_POS { HelpID = HID_BIB_TITLE_POS ; }; -hidspecial HID_BIB_YEAR_POS { HelpID = HID_BIB_YEAR_POS ; }; -hidspecial HID_BIB_ISBN_POS { HelpID = HID_BIB_ISBN_POS ; }; -hidspecial HID_BIB_BOOKTITLE_POS { HelpID = HID_BIB_BOOKTITLE_POS ; }; -hidspecial HID_BIB_CHAPTER_POS { HelpID = HID_BIB_CHAPTER_POS ; }; -hidspecial HID_BIB_EDITION_POS { HelpID = HID_BIB_EDITION_POS ; }; -hidspecial HID_BIB_EDITOR_POS { HelpID = HID_BIB_EDITOR_POS ; }; -hidspecial HID_BIB_HOWPUBLISHED_POS { HelpID = HID_BIB_HOWPUBLISHED_POS ; }; -hidspecial HID_BIB_INSTITUTION_POS { HelpID = HID_BIB_INSTITUTION_POS ; }; -hidspecial HID_BIB_JOURNAL_POS { HelpID = HID_BIB_JOURNAL_POS ; }; -hidspecial HID_BIB_MONTH_POS { HelpID = HID_BIB_MONTH_POS ; }; -hidspecial HID_BIB_NOTE_POS { HelpID = HID_BIB_NOTE_POS ; }; -hidspecial HID_BIB_ANNOTE_POS { HelpID = HID_BIB_ANNOTE_POS ; }; -hidspecial HID_BIB_NUMBER_POS { HelpID = HID_BIB_NUMBER_POS ; }; -hidspecial HID_BIB_ORGANIZATIONS_POS { HelpID = HID_BIB_ORGANIZATIONS_POS ; }; -hidspecial HID_BIB_PAGES_POS { HelpID = HID_BIB_PAGES_POS ; }; -hidspecial HID_BIB_PUBLISHER_POS { HelpID = HID_BIB_PUBLISHER_POS ; }; -hidspecial HID_BIB_ADDRESS_POS { HelpID = HID_BIB_ADDRESS_POS ; }; -hidspecial HID_BIB_SCHOOL_POS { HelpID = HID_BIB_SCHOOL_POS ; }; -hidspecial HID_BIB_SERIES_POS { HelpID = HID_BIB_SERIES_POS ; }; -hidspecial HID_BIB_REPORTTYPE_POS { HelpID = HID_BIB_REPORTTYPE_POS ; }; -hidspecial HID_BIB_VOLUME_POS { HelpID = HID_BIB_VOLUME_POS ; }; -hidspecial HID_BIB_URL_POS { HelpID = HID_BIB_URL_POS ; }; -hidspecial HID_BIB_CUSTOM1_POS { HelpID = HID_BIB_CUSTOM1_POS ; }; -hidspecial HID_BIB_CUSTOM2_POS { HelpID = HID_BIB_CUSTOM2_POS ; }; -hidspecial HID_BIB_CUSTOM3_POS { HelpID = HID_BIB_CUSTOM3_POS ; }; -hidspecial HID_BIB_CUSTOM4_POS { HelpID = HID_BIB_CUSTOM4_POS ; }; -hidspecial HID_BIB_CUSTOM5_POS { HelpID = HID_BIB_CUSTOM5_POS ; }; -hidspecial HID_BIB_DB_GRIDCTRL { HelpID = HID_BIB_DB_GRIDCTRL ; }; diff --git a/extensions/source/bibliography/loadlisteneradapter.cxx b/extensions/source/bibliography/loadlisteneradapter.cxx deleted file mode 100644 index 928fb020a..000000000 --- a/extensions/source/bibliography/loadlisteneradapter.cxx +++ /dev/null @@ -1,241 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "loadlisteneradapter.hxx" -#include <osl/diagnose.h> -#include <rtl/ref.hxx> - -//......................................................................... -namespace bib -{ -//......................................................................... - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::form; - - //===================================================================== - //= OComponentListener - //===================================================================== - //--------------------------------------------------------------------- - OComponentListener::~OComponentListener() - { - { - ::osl::MutexGuard aGuard( m_rMutex ); - if ( m_pAdapter ) - m_pAdapter->dispose(); - } - } - - //--------------------------------------------------------------------- - void OComponentListener::_disposing( const EventObject& /*_rSource*/ ) throw( RuntimeException) - { - // nothing to do here, overrride if you're interested in - } - - //--------------------------------------------------------------------- - void OComponentListener::setAdapter( OComponentAdapterBase* pAdapter ) - { - { - ::osl::MutexGuard aGuard( m_rMutex ); - if ( m_pAdapter ) - { - m_pAdapter->release(); - m_pAdapter = NULL; - } - } - - if ( pAdapter ) - { - ::osl::MutexGuard aGuard( m_rMutex ); - m_pAdapter = pAdapter; - m_pAdapter->acquire(); - } - } - - //===================================================================== - //= OComponentAdapterBase - //===================================================================== - //--------------------------------------------------------------------- - OComponentAdapterBase::OComponentAdapterBase( const Reference< XComponent >& _rxComp, sal_Bool _bAutoRelease ) - :m_xComponent( _rxComp ) - ,m_pListener( NULL ) - ,m_nLockCount( 0 ) - ,m_bListening( sal_False ) - ,m_bAutoRelease( _bAutoRelease ) - { - OSL_ENSURE( m_xComponent.is(), "OComponentAdapterBase::OComponentAdapterBase: invalid component!" ); - } - - //--------------------------------------------------------------------- - void OComponentAdapterBase::Init( OComponentListener* _pListener ) - { - OSL_ENSURE( !m_pListener, "OComponentAdapterBase::Init: already initialized!" ); - OSL_ENSURE( _pListener, "OComponentAdapterBase::Init: invalid listener!" ); - - m_pListener = _pListener; - if ( m_pListener ) - m_pListener->setAdapter( this ); - - startComponentListening( ); - m_bListening = sal_True; - } - - //--------------------------------------------------------------------- - OComponentAdapterBase::~OComponentAdapterBase() - { - } - - //--------------------------------------------------------------------- - void OComponentAdapterBase::dispose() - { - if ( m_bListening ) - { - ::rtl::Reference< OComponentAdapterBase > xPreventDelete(this); - - disposing(); - - m_pListener->setAdapter(NULL); - - m_pListener = NULL; - m_bListening = sal_False; - - if (m_bAutoRelease) - m_xComponent = NULL; - } - } - - // XEventListener - - //--------------------------------------------------------------------- - void SAL_CALL OComponentAdapterBase::disposing( const EventObject& _rSource ) throw( RuntimeException ) - { - if ( m_pListener ) - { - // tell the listener - if ( !locked() ) - m_pListener->_disposing( _rSource ); - - // disconnect the listener - if ( m_pListener ) // may have been reset whilest calling into _disposing - m_pListener->setAdapter( NULL ); - } - - m_pListener = NULL; - m_bListening = sal_False; - - if ( m_bAutoRelease ) - m_xComponent = NULL; - } - - //===================================================================== - //= OLoadListenerAdapter - //===================================================================== - //--------------------------------------------------------------------- - OLoadListenerAdapter::OLoadListenerAdapter( const Reference< XLoadable >& _rxLoadable, sal_Bool _bAutoRelease ) - :OComponentAdapterBase( Reference< XComponent >( _rxLoadable, UNO_QUERY ), _bAutoRelease ) - { - } - - //--------------------------------------------------------------------- - void OLoadListenerAdapter::startComponentListening() - { - Reference< XLoadable > xLoadable( getComponent(), UNO_QUERY ); - OSL_ENSURE( xLoadable.is(), "OLoadListenerAdapter::OLoadListenerAdapter: invalid object!" ); - if ( xLoadable.is() ) - xLoadable->addLoadListener( this ); - } - - //--------------------------------------------------------------------- - void SAL_CALL OLoadListenerAdapter::acquire( ) throw () - { - OLoadListenerAdapter_Base::acquire(); - } - - //--------------------------------------------------------------------- - void SAL_CALL OLoadListenerAdapter::release( ) throw () - { - OLoadListenerAdapter_Base::release(); - } - - //--------------------------------------------------------------------- - void SAL_CALL OLoadListenerAdapter::disposing( const EventObject& _rSource ) throw( RuntimeException) - { - OComponentAdapterBase::disposing( _rSource ); - } - - //--------------------------------------------------------------------- - void OLoadListenerAdapter::disposing() - { - Reference< XLoadable > xLoadable( getComponent(), UNO_QUERY ); - if ( xLoadable.is() ) - xLoadable->removeLoadListener( this ); - } - - //--------------------------------------------------------------------- - void SAL_CALL OLoadListenerAdapter::loaded( const EventObject& _rEvent ) throw (RuntimeException) - { - if ( !locked() && getLoadListener( ) ) - getLoadListener( )->_loaded( _rEvent ); - } - - //--------------------------------------------------------------------- - void SAL_CALL OLoadListenerAdapter::unloading( const EventObject& _rEvent ) throw (RuntimeException) - { - if ( !locked() && getLoadListener( ) ) - getLoadListener( )->_unloading( _rEvent ); - } - - //--------------------------------------------------------------------- - void SAL_CALL OLoadListenerAdapter::unloaded( const EventObject& _rEvent ) throw (RuntimeException) - { - if ( !locked() && getLoadListener( ) ) - getLoadListener( )->_unloaded( _rEvent ); - } - - //--------------------------------------------------------------------- - void SAL_CALL OLoadListenerAdapter::reloading( const EventObject& _rEvent ) throw (RuntimeException) - { - if ( !locked() && getLoadListener( ) ) - getLoadListener( )->_reloading( _rEvent ); - } - - //--------------------------------------------------------------------- - void SAL_CALL OLoadListenerAdapter::reloaded( const EventObject& _rEvent ) throw (RuntimeException) - { - if ( !locked() && getLoadListener( ) ) - getLoadListener( )->_reloaded( _rEvent ); - } - -//......................................................................... -} // namespace bib -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/loadlisteneradapter.hxx b/extensions/source/bibliography/loadlisteneradapter.hxx deleted file mode 100644 index c35cb939b..000000000 --- a/extensions/source/bibliography/loadlisteneradapter.hxx +++ /dev/null @@ -1,187 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_BIB_LOADLISTENERADAPTER_HXX -#define EXTENSIONS_BIB_LOADLISTENERADAPTER_HXX - -#include <osl/mutex.hxx> -#include <com/sun/star/lang/XComponent.hpp> -#include <cppuhelper/implbase1.hxx> -#include <com/sun/star/form/XLoadable.hpp> - -//......................................................................... -namespace bib -{ -//......................................................................... - - class OComponentAdapterBase; - - //===================================================================== - //= OComponentListener - //===================================================================== - class OComponentListener - { - friend class OComponentAdapterBase; - - private: - OComponentAdapterBase* m_pAdapter; - ::osl::Mutex& m_rMutex; - protected: - OComponentListener( ::osl::Mutex& _rMutex ) - :m_pAdapter( NULL ) - ,m_rMutex( _rMutex ) - { - } - - virtual ~OComponentListener(); - - // XEventListener equivalents - virtual void _disposing( const ::com::sun::star::lang::EventObject& _rSource ) throw( ::com::sun::star::uno::RuntimeException ); - - protected: - void setAdapter( OComponentAdapterBase* _pAdapter ); - }; - - //===================================================================== - //= OComponentAdapterBase - //===================================================================== - class OComponentAdapterBase - { - friend class OComponentListener; - - private: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > - m_xComponent; - OComponentListener* m_pListener; - sal_Int32 m_nLockCount; - sal_Bool m_bListening : 1; - sal_Bool m_bAutoRelease : 1; - - // impl method for dispose - virtual, 'cause you at least need to remove the listener from the broadcaster - virtual void disposing() = 0; - - protected: - // attribute access for derivees - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& - getComponent() const { return m_xComponent; } - OComponentListener* getListener() { return m_pListener; } - - // to be called by derivees which started listening at the component - virtual void startComponentListening() = 0; - - virtual ~OComponentAdapterBase(); - - public: - OComponentAdapterBase( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _rxComp, - sal_Bool _bAutoRelease = sal_True - ); - - // late construction - // can be called from within you ctor, to have you're object fully initialized at the moment of - // the call (which would not be the case when calling this ctor) - void Init( OComponentListener* _pListener ); - - // base for ref-counting, implemented by OComponentAdapter - virtual void SAL_CALL acquire( ) throw () = 0; - virtual void SAL_CALL release( ) throw () = 0; - - // helper - /// get the lock count - sal_Int32 locked() const { return m_nLockCount; } - - /// dispose the object - stop listening and such - void dispose(); - - protected: - // XEventListener - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw( ::com::sun::star::uno::RuntimeException); - }; - - //===================================================================== - //= OLoadListener - //===================================================================== - class OLoadListener : public OComponentListener - { - friend class OLoadListenerAdapter; - - protected: - OLoadListener( ::osl::Mutex& _rMutex ) : OComponentListener( _rMutex ) { } - - // XLoadListener equivalents - virtual void _loaded( const ::com::sun::star::lang::EventObject& aEvent ) = 0; - virtual void _unloading( const ::com::sun::star::lang::EventObject& aEvent ) = 0; - virtual void _unloaded( const ::com::sun::star::lang::EventObject& aEvent ) = 0; - virtual void _reloading( const ::com::sun::star::lang::EventObject& aEvent ) = 0; - virtual void _reloaded( const ::com::sun::star::lang::EventObject& aEvent ) = 0; - }; - - //===================================================================== - //= OLoadListenerAdapter - //===================================================================== - typedef ::cppu::WeakImplHelper1< ::com::sun::star::form::XLoadListener > OLoadListenerAdapter_Base; - class OLoadListenerAdapter - :public OLoadListenerAdapter_Base - ,public OComponentAdapterBase - { - protected: - OLoadListener* getLoadListener( ) { return static_cast< OLoadListener* >( getListener() ); } - - protected: - virtual void disposing(); - virtual void startComponentListening(); - - public: - OLoadListenerAdapter( - const ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable >& _rxLoadable, - sal_Bool _bAutoRelease = sal_True - ); - - - virtual void SAL_CALL acquire( ) throw (); - virtual void SAL_CALL release( ) throw (); - - protected: - // XEventListener - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& _rSource ) throw( ::com::sun::star::uno::RuntimeException); - - // XLoadListener - virtual void SAL_CALL loaded( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL unloading( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL unloaded( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL reloading( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL reloaded( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); - }; - -//......................................................................... -} // namespace bib -//......................................................................... - -#endif // EXTENSIONS_BIB_LOADLISTENERADAPTER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/makefile.mk b/extensions/source/bibliography/makefile.mk deleted file mode 100644 index b681c6c90..000000000 --- a/extensions/source/bibliography/makefile.mk +++ /dev/null @@ -1,98 +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 -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/.. - -PRJNAME=extensions -TARGET=bib -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES= $(SLO)$/formcontrolcontainer.obj \ - $(SLO)$/loadlisteneradapter.obj \ - $(SLO)$/bibconfig.obj \ - $(SLO)$/bibcont.obj \ - $(SLO)$/bibload.obj \ - $(SLO)$/bibmod.obj \ - $(SLO)$/general.obj \ - $(SLO)$/framectr.obj \ - $(SLO)$/bibview.obj \ - $(SLO)$/bibbeam.obj \ - $(SLO)$/toolbar.obj \ - $(SLO)$/datman.obj \ - - -SRS1NAME=$(TARGET) -SRC1FILES= bib.src \ - datman.src \ - sections.src \ - toolbar.src - -RESLIB1NAME=bib -RESLIB1SRSFILES= $(SRS)$/bib.srs -RESLIB1DEPN= bib.src bib.hrc - - -SHL1STDLIBS= \ - $(SOTLIB) \ - $(SVTOOLLIB) \ - $(TKLIB) \ - $(VCLLIB) \ - $(SVLLIB) \ - $(UNOTOOLSLIB) \ - $(TOOLSLIB) \ - $(DBTOOLSLIB) \ - $(COMPHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) - - -SHL1TARGET= $(TARGET)$(DLLPOSTFIX) -SHL1LIBS= $(SLB)$/$(TARGET).lib -SHL1IMPLIB= i$(TARGET) -SHL1DEPN= $(SHL1LIBS) -SHL1DEF= $(MISC)$/$(SHL1TARGET).def -SHL1VERSIONMAP=$(SOLARENV)/src/component.map -DEF1NAME= $(SHL1TARGET) - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - - -ALLTAR : $(MISC)/bib.component - -$(MISC)/bib.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ - bib.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt bib.component diff --git a/extensions/source/bibliography/sections.hrc b/extensions/source/bibliography/sections.hrc deleted file mode 100644 index 2488f4ed6..000000000 --- a/extensions/source/bibliography/sections.hrc +++ /dev/null @@ -1,128 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "bib.hrc" - -//General -/*#define FT_FIRST_MIDDLE 1 -#define ED_FIRST 2 -#define ED_MIDDLE 3 -#define FT_NAME_SUFFIX 4 -#define ED_NAME 5 -#define CB_SUFFIX 6 -#define ED_INITIALS 8 -#define FT_COMPANY 9 -#define ED_COMPANY 10 -#define FT_DEPARTMENT 11 -#define ED_DEPARTMENT 12 -#define FT_SALUTATION 13 -#define CB_SALUTATION 14 -#define FT_SHOWNNAME 15 -#define ED_SHOWNNAME 16*/ -#define FT_IDENTIFIER 1 -#define FT_AUTHTYPE 2 -#define FT_AUTHOR 3 -#define FT_YEAR 4 -#define FT_ISBN 5 - -#define FT_MONTH 6 - -#define FT_PUBLISHER 8 - -#define FT_ADDRESS 9 -#define FT_ANNOTE 10 -#define FT_BOOKTITLE 11 -#define FT_CHAPTER 12 -#define FT_EDITION 13 -#define FT_EDITOR 14 -#define FT_HOWPUBLISHED 15 -#define FT_INSTITUTION 16 -#define FT_JOURNAL 17 -#define FT_NOTE 18 -#define FT_NUMBER 19 -#define FT_ORGANIZATION 20 -#define FT_PAGE 21 -#define FT_SCHOOL 22 -#define FT_SERIES 23 -#define FT_TITLE 24 -#define FT_REPORT 25 -#define FT_VOLUME 26 -#define FT_URL 27 -#define FT_CUSTOM1 28 -#define FT_CUSTOM2 29 -#define FT_CUSTOM3 30 -#define FT_CUSTOM4 31 -#define FT_CUSTOM5 32 -#define ST_ERROR_PREFIX 33 -#define FL_1 34 -#define FL_2 35 -#define FL_3 36 - -//Business Address -#define FT_OFFICE 1 -#define FT_STREET 2 -#define FT_CITY 3 -#define FT_STATE 4 -#define FT_COUNTRY 5 -#define FT_ZIP 6 -#define ED_OFFICE 7 -#define ED_STREET 8 -#define ED_CITY 9 -#define ED_STATE 10 -#define ED_COUNTRY 11 -#define ED_ZIP 12 -#define ED_POBOX 13 - - -//Popup SectionControl -#define PU_INSERT 1 -#define PU_REMOVE 2 -#define PU_CHG_NAME 3 - -#define ST_TYPE_ARTICLE 40 -#define ST_TYPE_BOOK 41 -#define ST_TYPE_BOOKLET 42 -#define ST_TYPE_CONFERENCE 43 -#define ST_TYPE_INBOOK 44 -#define ST_TYPE_INCOLLECTION 45 -#define ST_TYPE_INPROCEEDINGS 46 -#define ST_TYPE_JOURNAL 47 -#define ST_TYPE_MANUAL 48 -#define ST_TYPE_MASTERSTHESIS 49 -#define ST_TYPE_MISC 50 -#define ST_TYPE_PHDTHESIS 51 -#define ST_TYPE_PROCEEDINGS 52 -#define ST_TYPE_TECHREPORT 53 -#define ST_TYPE_UNPUBLISHED 54 -#define ST_TYPE_EMAIL 55 -#define ST_TYPE_WWW 56 -#define ST_TYPE_CUSTOM1 57 -#define ST_TYPE_CUSTOM2 58 -#define ST_TYPE_CUSTOM3 59 -#define ST_TYPE_CUSTOM4 60 -#define ST_TYPE_CUSTOM5 61 - diff --git a/extensions/source/bibliography/sections.src b/extensions/source/bibliography/sections.src deleted file mode 100644 index 3f7fe83d5..000000000 --- a/extensions/source/bibliography/sections.src +++ /dev/null @@ -1,584 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -//#pragma CHARSET_ANSI - -#include "sections.hrc" -#include "bibliography.hrc" - -#define FT_POS 12 -#define FTSIZE_LEFT 88 -#define ED_POS_LEFT FT_POS+FTSIZE_LEFT+1 -#define ED_SIZE 70 -#define ED_POS_LEFT2 ED_POS_LEFT + ED_SIZE +1 -#define FT_POS_MIDDLE ED_POS_LEFT2 + 5 -#define FT_POS_RIGHT FT_POS_MIDDLE + FT_POS_MIDDLE - FT_POS - -#define FL_POS 6 -#define PAGE_WIDTH FT_POS_RIGHT + FTSIZE_LEFT + (FTSIZE_LEFT * 8 / 10) + FL_POS + 5 -#define FL_WIDTH PAGE_WIDTH - 2 * FL_POS - -TabPage RID_TP_GENERAL -{ - SVLook = TRUE ; - Size = MAP_APPFONT( PAGE_WIDTH, 209 ); - HelpId = HID_BIB_CONTROL_PAGE; - - FixedText FT_IDENTIFIER - { - Pos = MAP_APPFONT( FT_POS, 6 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_AUTHTYPE - { - Pos = MAP_APPFONT( FT_POS_MIDDLE, 6 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_YEAR - { - Pos = MAP_APPFONT( FT_POS_RIGHT, 6 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_AUTHOR - { - Pos = MAP_APPFONT( FT_POS, 20 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_TITLE - { - Pos = MAP_APPFONT( FT_POS_MIDDLE, 20 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_PUBLISHER - { - Pos = MAP_APPFONT( FT_POS, 34 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_ADDRESS - { - Pos = MAP_APPFONT( FT_POS_MIDDLE, 34 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_ISBN - { - Pos = MAP_APPFONT( FT_POS_RIGHT, 34 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_CHAPTER - { - Pos = MAP_APPFONT( FT_POS, 48 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_PAGE - { - Pos = MAP_APPFONT( FT_POS_MIDDLE, 48 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedLine FL_1 - { - Pos = MAP_APPFONT( FL_POS, 62 ); - Size = MAP_APPFONT( FL_WIDTH, 8 ); - }; - FixedText FT_EDITOR - { - Pos = MAP_APPFONT( FT_POS, 73 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_EDITION - { - Pos = MAP_APPFONT( FT_POS_MIDDLE, 73 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_BOOKTITLE - { - Pos = MAP_APPFONT( FT_POS, 87 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_VOLUME - { - Pos = MAP_APPFONT( FT_POS_MIDDLE, 87 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_HOWPUBLISHED - { - Pos = MAP_APPFONT( FT_POS_RIGHT, 87 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_ORGANIZATION - { - Pos = MAP_APPFONT( FT_POS, 101 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_INSTITUTION - { - Pos = MAP_APPFONT( FT_POS_MIDDLE, 101 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_SCHOOL - { - Pos = MAP_APPFONT( FT_POS_RIGHT, 101 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_REPORT - { - Pos = MAP_APPFONT( FT_POS, 115); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_MONTH - { - Pos = MAP_APPFONT( FT_POS_MIDDLE, 115 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedLine FL_2 - { - Pos = MAP_APPFONT( FL_POS, 129 ); - Size = MAP_APPFONT( FL_WIDTH, 8 ); - }; - FixedText FT_JOURNAL - { - Pos = MAP_APPFONT( FT_POS, 140 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - - FixedText FT_NUMBER - { - Pos = MAP_APPFONT( FT_POS_MIDDLE, 140 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_SERIES - { - Pos = MAP_APPFONT( FT_POS_RIGHT, 140 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_ANNOTE - { - Pos = MAP_APPFONT( FT_POS, 154 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_NOTE - { - Pos = MAP_APPFONT( FT_POS_MIDDLE, 154 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_URL - { - Pos = MAP_APPFONT( FT_POS_RIGHT, 154 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedLine FL_3 - { - Pos = MAP_APPFONT( FL_POS, 168 ); - Size = MAP_APPFONT( FL_WIDTH, 8 ); - }; - FixedText FT_CUSTOM1 - { - Pos = MAP_APPFONT( FT_POS, 179 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_CUSTOM2 - { - Pos = MAP_APPFONT( FT_POS_MIDDLE, 179 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_CUSTOM3 - { - Pos = MAP_APPFONT( FT_POS_RIGHT, 179 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_CUSTOM4 - { - Pos = MAP_APPFONT( FT_POS, 193 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_CUSTOM5 - { - Pos = MAP_APPFONT( FT_POS_MIDDLE, 193 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - String ST_ERROR_PREFIX - { - Text [ en-US ] = "The following column names could not be assigned:\n"; - }; - String ST_TYPE_ARTICLE - { - Text [ en-US ] = "Article"; - }; - String ST_TYPE_BOOK - { - Text [ en-US ] = "Book"; - }; - String ST_TYPE_BOOKLET - { - Text [ en-US ] = "Brochures"; - }; - String ST_TYPE_CONFERENCE - { - Text [ en-US ] = "Conference proceedings"; - }; - String ST_TYPE_INBOOK - { - Text [ en-US ] = "Book excerpt"; - }; - String ST_TYPE_INCOLLECTION - { - Text [ en-US ] = "Book excerpt with title"; - }; - String ST_TYPE_INPROCEEDINGS - { - Text [ en-US ] = "Conference proceedings"; - }; - String ST_TYPE_JOURNAL - { - Text [ en-US ] = "Journal"; - }; - String ST_TYPE_MANUAL - { - Text [ en-US ] = "Techn. documentation"; - }; - String ST_TYPE_MASTERSTHESIS - { - Text [ en-US ] = "Thesis"; - }; - String ST_TYPE_MISC - { - Text [ en-US ] = "Miscellaneous"; - }; - String ST_TYPE_PHDTHESIS - { - Text [ en-US ] = "Dissertation"; - }; - String ST_TYPE_PROCEEDINGS - { - Text [ en-US ] = "Conference proceedings"; - }; - String ST_TYPE_TECHREPORT - { - Text [ en-US ] = "Research report"; - }; - String ST_TYPE_UNPUBLISHED - { - Text [ en-US ] = "Unpublished"; - }; - String ST_TYPE_EMAIL - { - Text [ en-US ] = "e-mail"; - }; - String ST_TYPE_WWW - { - Text [ en-US ] = "WWW document"; - }; - String ST_TYPE_CUSTOM1 - { - Text [ en-US ] = "User-defined1"; - }; - String ST_TYPE_CUSTOM2 - { - Text [ en-US ] = "User-defined2"; - }; - String ST_TYPE_CUSTOM3 - { - Text [ en-US ] = "User-defined3"; - }; - String ST_TYPE_CUSTOM4 - { - Text [ en-US ] = "User-defined4"; - }; - String ST_TYPE_CUSTOM5 - { - Text [ en-US ] = "User-defined5"; - }; - Text [ en-US ] = "General"; -}; -Menu RID_POPUP_ME_VIEW -{ - ItemList = - { - MenuItem - { - Identifier = PU_INSERT; - Text [ en-US ] = "Insert Section..."; - }; - MenuItem - { - Identifier = PU_REMOVE; - Text [ en-US ] = "Delete Section..."; - }; - MenuItem - { - Identifier = PU_CHG_NAME; - Text [ en-US ] = "Modify Name..."; - }; - }; -}; - -String ST_IDENTIFIER -{ - Text [ en-US ] = "~Short name"; -}; -String ST_AUTHTYPE -{ - Text [ en-US ] = "~Type"; -}; -String ST_YEAR -{ - Text [ en-US ] = "~Year"; -}; -String ST_AUTHOR -{ - Text [ en-US ] = "Author(s)"; -}; -String ST_TITLE -{ - Text [ en-US ] = "Tit~le"; -}; -String ST_PUBLISHER -{ - Text [ en-US ] = "~Publisher"; -}; -String ST_ADDRESS -{ - Text [ en-US ] = "A~ddress"; -}; -String ST_ISBN -{ - Text [ en-US ] = "~ISBN"; -}; -String ST_CHAPTER -{ - Text [ en-US ] = "~Chapter"; -}; -String ST_PAGE -{ - Text [ en-US ] = "Pa~ge(s)"; -}; -String ST_EDITOR -{ - Text [ en-US ] = "Editor"; -}; -String ST_EDITION -{ - Text [ en-US ] = "Ed~ition"; -}; -String ST_BOOKTITLE -{ - Text [ en-US ] = "~Book title"; -}; -String ST_VOLUME -{ - Text [ en-US ] = "Volume"; -}; -String ST_HOWPUBLISHED -{ - Text [ en-US ] = "Publication t~ype"; -}; -String ST_ORGANIZATION -{ - Text [ en-US ] = "Organi~zation"; -}; -String ST_INSTITUTION -{ - Text [ en-US ] = "Instit~ution"; -}; -String ST_SCHOOL -{ - Text [ en-US ] = "University"; -}; -String ST_REPORT -{ - Text [ en-US ] = "Type of re~port"; -}; -String ST_MONTH -{ - Text [ en-US ] = "~Month"; -}; -String ST_JOURNAL -{ - Text [ en-US ] = "~Journal"; -}; - -String ST_NUMBER -{ - Text [ en-US ] = "Numb~er"; -}; -String ST_SERIES -{ - Text [ en-US ] = "Se~ries"; -}; -String ST_ANNOTE -{ - Text [ en-US ] = "Ann~otation"; -}; -String ST_NOTE -{ - Text [ en-US ] = "~Note"; -}; -String ST_URL -{ - Text [ en-US ] = "URL"; -}; -String ST_CUSTOM1 -{ - Text [ en-US ] = "User-defined field ~1"; -}; -String ST_CUSTOM2 -{ - Text [ en-US ] = "User-defined field ~2"; -}; -String ST_CUSTOM3 -{ - Text [ en-US ] = "User-defined field ~3"; -}; -String ST_CUSTOM4 -{ - Text [ en-US ] = "User-defined field ~4"; -}; -String ST_CUSTOM5 -{ - Text [ en-US ] = "User-defined field ~5"; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/extensions/source/bibliography/toolbar.cxx b/extensions/source/bibliography/toolbar.cxx deleted file mode 100644 index 47dd6c5ae..000000000 --- a/extensions/source/bibliography/toolbar.cxx +++ /dev/null @@ -1,633 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include <comphelper/processfactory.hxx> -#include <tools/urlobj.hxx> -#include <com/sun/star/frame/XDispatch.hpp> -#include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/util/XURLTransformer.hpp> -#include <com/sun/star/frame/FrameSearchFlag.hpp> -#include <datman.hxx> -#include <tools/debug.hxx> -#include <svx/svxids.hrc> -#include <svtools/miscopt.hxx> -#include <svtools/imgdef.hxx> -#include <vcl/svapp.hxx> -#include <vcl/mnemonic.hxx> -#include "bibbeam.hxx" -#include "toolbar.hrc" -#include "bibresid.hxx" - -#include "bibtools.hxx" -#include <osl/mutex.hxx> - -using namespace ::rtl; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -#define C2U(cChar) OUString::createFromAscii(cChar) - - -// Konstanten ------------------------------------------------------------- - - -BibToolBarListener::BibToolBarListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId): - nIndex(nId), - aCommand(aStr), - pToolBar(pTB) -{ -} - -BibToolBarListener::~BibToolBarListener() -{ -} - -void BibToolBarListener::statusChanged(const ::com::sun::star::frame::FeatureStateEvent& rEvt)throw( ::com::sun::star::uno::RuntimeException ) -{ - if(rEvt.FeatureURL.Complete == aCommand) - { - SolarMutexGuard aGuard; - pToolBar->EnableItem(nIndex,rEvt.IsEnabled); - - ::com::sun::star::uno::Any aState=rEvt.State; - if(aState.getValueType()==::getBooleanCppuType()) - { - sal_Bool bChecked= *(sal_Bool*)aState.getValue(); - pToolBar->CheckItem(nIndex, bChecked); - } - - } -}; - -rtl::OUString BibToolBarListener::GetCommand() const -{ - return aCommand; -} - -BibTBListBoxListener::BibTBListBoxListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId): - BibToolBarListener(pTB,aStr,nId) -{ -} - -BibTBListBoxListener::~BibTBListBoxListener() -{ -} - -void BibTBListBoxListener::statusChanged(const ::com::sun::star::frame::FeatureStateEvent& rEvt)throw( ::com::sun::star::uno::RuntimeException ) -{ - if(rEvt.FeatureURL.Complete == GetCommand()) - { - SolarMutexGuard aGuard; - pToolBar->EnableSourceList(rEvt.IsEnabled); - - Any aState = rEvt.State; - if(aState.getValueType() == ::getCppuType((Sequence<rtl::OUString>*)0)) - { - pToolBar->UpdateSourceList(sal_False); - pToolBar->ClearSourceList(); - - Sequence<rtl::OUString>* pStringSeq = (Sequence<rtl::OUString>*)aState.getValue(); - const rtl::OUString* pStringArray = (const rtl::OUString*)pStringSeq->getConstArray(); - - sal_uInt32 nCount = pStringSeq->getLength(); - XubString aEntry; - for( sal_uInt32 i=0; i<nCount; i++ ) - { - aEntry = String(pStringArray[i]); - pToolBar->InsertSourceEntry(aEntry); - } - pToolBar->UpdateSourceList(sal_True); - } - - XubString aStr = String(rEvt.FeatureDescriptor); - pToolBar->SelectSourceEntry(aStr); - } -}; - -BibTBQueryMenuListener::BibTBQueryMenuListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId): - BibToolBarListener(pTB,aStr,nId) -{ -} - -BibTBQueryMenuListener::~BibTBQueryMenuListener() -{ -} - -void BibTBQueryMenuListener::statusChanged(const frame::FeatureStateEvent& rEvt)throw( uno::RuntimeException ) -{ - if(rEvt.FeatureURL.Complete == GetCommand()) - { - SolarMutexGuard aGuard; - pToolBar->EnableSourceList(rEvt.IsEnabled); - - uno::Any aState=rEvt.State; - if(aState.getValueType()==::getCppuType((Sequence<rtl::OUString>*)0)) - { - pToolBar->ClearFilterMenu(); - - Sequence<rtl::OUString>* pStringSeq = (Sequence<rtl::OUString>*) aState.getValue(); - const rtl::OUString* pStringArray = (const rtl::OUString*)pStringSeq->getConstArray(); - - sal_uInt32 nCount = pStringSeq->getLength(); - for( sal_uInt32 i=0; i<nCount; i++ ) - { - sal_uInt16 nID=pToolBar->InsertFilterItem(String(pStringArray[i])); - if(pStringArray[i]==rEvt.FeatureDescriptor) - { - pToolBar->SelectFilterItem(nID); - } - } - } - } -}; - -BibTBEditListener::BibTBEditListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId): - BibToolBarListener(pTB,aStr,nId) -{ -} - -BibTBEditListener::~BibTBEditListener() -{ -} - -void BibTBEditListener::statusChanged(const frame::FeatureStateEvent& rEvt)throw( uno::RuntimeException ) -{ - if(rEvt.FeatureURL.Complete == GetCommand()) - { - SolarMutexGuard aGuard; - pToolBar->EnableQuery(rEvt.IsEnabled); - - uno::Any aState=rEvt.State; - if(aState.getValueType()==::getCppuType((const OUString*)0)) - { - String aStr = String(*(OUString*) aState.getValue()); - pToolBar->SetQueryString(aStr); - } - } -} - -SV_IMPL_PTRARR( BibToolBarListenerArr, BibToolBarListenerPtr); - -BibToolBar::BibToolBar(Window* pParent, Link aLink, WinBits nStyle): - ToolBox(pParent,BibResId(RID_BIB_TOOLBAR)), - aImgLst(BibResId( RID_TOOLBAR_IMGLIST )), - aBigImgLst(BibResId( RID_TOOLBAR_BIGIMGLIST )), - aFtSource(this,WB_VCENTER), - aLBSource(this,WB_DROPDOWN), - aFtQuery(this,WB_VCENTER), - aEdQuery(this), - nMenuId(0), - nSelMenuItem(0), - aLayoutManager( aLink ), - nSymbolsSize( SFX_SYMBOLS_SIZE_SMALL ), - nOutStyle( 0 ) -{ - SvtMiscOptions aSvtMiscOptions; - nSymbolsSize = aSvtMiscOptions.GetCurrentSymbolsSize(); - nOutStyle = aSvtMiscOptions.GetToolboxStyle(); - - ApplyImageList(); - SetStyle(GetStyle()|nStyle); - SetOutStyle(TOOLBOX_STYLE_FLAT); - Size a2Size(GetOutputSizePixel()); - a2Size.Width()=100; - aLBSource.SetSizePixel(a2Size); - aLBSource.SetDropDownLineCount(9); - aLBSource.Show(); - aLBSource.SetSelectHdl(LINK( this, BibToolBar, SelHdl)); - - SvtMiscOptions().AddListenerLink( LINK( this, BibToolBar, OptionsChanged_Impl ) ); - Application::AddEventListener( LINK( this, BibToolBar, SettingsChanged_Impl ) ); - - aTimer.SetTimeoutHdl(LINK( this, BibToolBar, SendSelHdl)); - aTimer.SetTimeout(400); - - SetDropdownClickHdl( LINK( this, BibToolBar, MenuHdl)); - - aEdQuery.SetSizePixel(aLBSource.GetSizePixel()); - aEdQuery.Show(); - - XubString aStr=GetItemText(TBC_FT_SOURCE); - Rectangle aRect=GetItemRect(TBC_FT_SOURCE); - aFtSource.SetText(aStr); - aFtSource.SetSizePixel(aRect.GetSize()); - aFtSource.SetBackground(Wallpaper( COL_TRANSPARENT )); - - aStr=GetItemText(TBC_FT_QUERY); - aRect=GetItemRect(TBC_FT_QUERY); - aFtQuery.SetText(aStr); - aFtQuery.SetSizePixel(aRect.GetSize()); - aFtQuery.SetBackground(Wallpaper( COL_TRANSPARENT )); - - SetItemWindow(TBC_FT_SOURCE,&aFtSource); - SetItemWindow(TBC_LB_SOURCE,&aLBSource); - SetItemWindow(TBC_FT_QUERY ,&aFtQuery); - SetItemWindow(TBC_ED_QUERY ,&aEdQuery); - - ::bib::AddToTaskPaneList( this ); -} - -BibToolBar::~BibToolBar() -{ - SvtMiscOptions().RemoveListenerLink( LINK( this, BibToolBar, OptionsChanged_Impl ) ); - Application::RemoveEventListener( LINK( this, BibToolBar, SettingsChanged_Impl ) ); - ::bib::RemoveFromTaskPaneList( this ); -} - -void BibToolBar::InitListener() -{ - sal_uInt16 nCount=GetItemCount(); - - uno::Reference< lang::XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); - uno::Reference< frame::XDispatch > xDisp(xController,UNO_QUERY); - - uno::Reference< util::XURLTransformer > xTrans ( xMgr->createInstance( C2U("com.sun.star.util.URLTransformer") ), UNO_QUERY ); - if( xTrans.is() ) - { - util::URL aQueryURL; - aQueryURL.Complete = C2U(".uno:Bib/MenuFilter"); - xTrans->parseStrict( aQueryURL); - BibToolBarListener* pQuery=new BibTBQueryMenuListener(this,aQueryURL.Complete,TBC_BT_AUTOFILTER); - xDisp->addStatusListener(uno::Reference< frame::XStatusListener > (pQuery),aQueryURL); - - for(sal_uInt16 nPos=0;nPos<nCount;nPos++) - { - sal_uInt16 nId=GetItemId(nPos); - if(!nId || nId==TBC_FT_SOURCE || nId==TBC_FT_QUERY) - continue; - - util::URL aURL; - aURL.Complete = GetItemCommand(nId); - if(!aURL.Complete.getLength()) - continue; - - xTrans->parseStrict( aURL ); - - BibToolBarListener* pListener=NULL; - if(nId==TBC_LB_SOURCE) - { - pListener=new BibTBListBoxListener(this,aURL.Complete,nId); - } - else if(nId==TBC_ED_QUERY) - { - pListener=new BibTBEditListener(this,aURL.Complete,nId); - } - else - { - pListener=new BibToolBarListener(this,aURL.Complete,nId); - } - - BibToolBarListenerPtr pxInsert = new Reference<frame::XStatusListener>; - (*pxInsert) = pListener; - aListenerArr.Insert( pxInsert, aListenerArr.Count() ); - xDisp->addStatusListener(uno::Reference< frame::XStatusListener > (pListener),aURL); - } - } -} - -void BibToolBar::SetXController(const uno::Reference< frame::XController > & xCtr) -{ - xController=xCtr; - InitListener(); - -} - -void BibToolBar::Select() -{ - sal_uInt16 nId=GetCurItemId(); - - if(nId!=TBC_BT_AUTOFILTER) - { - SendDispatch(nId,Sequence<PropertyValue>() ); - } - else - { - Sequence<PropertyValue> aPropVal(2); - PropertyValue* pPropertyVal = (PropertyValue*)aPropVal.getConstArray(); - pPropertyVal[0].Name=C2U("QueryText"); - rtl::OUString aSelection = aEdQuery.GetText(); - pPropertyVal[0].Value <<= aSelection; - - pPropertyVal[1].Name=C2U("QueryField"); - pPropertyVal[1].Value <<= aQueryField; - SendDispatch(nId,aPropVal); - } -} - -void BibToolBar::SendDispatch(sal_uInt16 nId, const Sequence< PropertyValue >& rArgs) -{ - rtl::OUString aCommand = GetItemCommand(nId); - - uno::Reference< frame::XDispatchProvider > xDSP( xController, UNO_QUERY ); - - if( xDSP.is() && aCommand.getLength()) - { - uno::Reference< lang::XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); - - uno::Reference< util::XURLTransformer > xTrans ( xMgr->createInstance( C2U("com.sun.star.util.URLTransformer") ), UNO_QUERY ); - if( xTrans.is() ) - { - // Datei laden - util::URL aURL; - aURL.Complete = aCommand; - - xTrans->parseStrict( aURL ); - - uno::Reference< frame::XDispatch > xDisp = xDSP->queryDispatch( aURL, rtl::OUString(), frame::FrameSearchFlag::SELF ); - - if ( xDisp.is() ) - xDisp->dispatch( aURL, rArgs); - } - } - -} - -void BibToolBar::Click() -{ - sal_uInt16 nId=GetCurItemId(); - - if(nId == TBC_BT_COL_ASSIGN ) - { - if(pDatMan) - pDatMan->CreateMappingDialog(GetParent()); - CheckItem( nId, sal_False ); - } - else if(nId == TBC_BT_CHANGESOURCE) - { - if(pDatMan) - { - OUString sNew = pDatMan->CreateDBChangeDialog(GetParent()); - if(sNew.getLength()) - pDatMan->setActiveDataSource(sNew); - } - CheckItem( nId, sal_False ); - } -} - -void BibToolBar::ClearFilterMenu() -{ - aPopupMenu.Clear(); - nMenuId=0; -} -sal_uInt16 BibToolBar::InsertFilterItem(const XubString& aMenuEntry) -{ - nMenuId++; - aPopupMenu.InsertItem(nMenuId,aMenuEntry); - - return nMenuId; -} -void BibToolBar::SelectFilterItem(sal_uInt16 nId) -{ - aPopupMenu.CheckItem(nId); - nSelMenuItem=nId; - aQueryField = MnemonicGenerator::EraseAllMnemonicChars( aPopupMenu.GetItemText(nId) ); -} - -void BibToolBar::EnableSourceList(sal_Bool bFlag) -{ - aFtSource.Enable(bFlag); - aLBSource.Enable(bFlag); -} - -void BibToolBar::ClearSourceList() -{ - aLBSource.Clear(); -} - -void BibToolBar::UpdateSourceList(sal_Bool bFlag) -{ - aLBSource.SetUpdateMode(bFlag); -} - -void BibToolBar::InsertSourceEntry(const XubString& aEntry, sal_uInt16 nPos) -{ - aLBSource.InsertEntry(aEntry, nPos); -} - -void BibToolBar::SelectSourceEntry(const XubString& aStr) -{ - aLBSource.SelectEntry(aStr); -} - -void BibToolBar::EnableQuery(sal_Bool bFlag) -{ - aFtQuery.Enable(bFlag); - aEdQuery.Enable(bFlag); -} - -void BibToolBar::SetQueryString(const XubString& aStr) -{ - aEdQuery.SetText(aStr); -} - - -long BibToolBar::PreNotify( NotifyEvent& rNEvt ) -{ - long nResult=sal_True; - - sal_uInt16 nSwitch=rNEvt.GetType(); - if(aEdQuery.HasFocus() && nSwitch==EVENT_KEYINPUT) - { - const KeyCode& aKeyCode=rNEvt.GetKeyEvent()->GetKeyCode(); - sal_uInt16 nKey = aKeyCode.GetCode(); - if(nKey == KEY_RETURN) - { - Sequence<PropertyValue> aPropVal(2); - PropertyValue* pPropertyVal = (PropertyValue*)aPropVal.getConstArray(); - pPropertyVal[0].Name = C2U("QueryText"); - rtl::OUString aSelection = aEdQuery.GetText(); - pPropertyVal[0].Value <<= aSelection; - pPropertyVal[1].Name=C2U("QueryField"); - pPropertyVal[1].Value <<= aQueryField; - SendDispatch(TBC_BT_AUTOFILTER,aPropVal); - return nResult; - } - - } - - nResult=ToolBox::PreNotify(rNEvt); - - return nResult; -} - -IMPL_LINK( BibToolBar, SelHdl, ListBox*, /*pLb*/ ) -{ - aTimer.Start(); - return 0; -} - -IMPL_LINK( BibToolBar, SendSelHdl, Timer*,/*pT*/) -{ - Sequence<PropertyValue> aPropVal(1); - PropertyValue* pPropertyVal = (PropertyValue*)aPropVal.getConstArray(); - pPropertyVal[0].Name = C2U("DataSourceName"); - String aEntry( MnemonicGenerator::EraseAllMnemonicChars( aLBSource.GetSelectEntry() ) ); - rtl::OUString aSelection = aEntry; - pPropertyVal[0].Value <<= aSelection; - SendDispatch(TBC_LB_SOURCE,aPropVal); - - return 0; -} -//----------------------------------------------------------------------------- -IMPL_LINK( BibToolBar, MenuHdl, ToolBox*, /*pToolbox*/) -{ - sal_uInt16 nId=GetCurItemId(); - if(nId==TBC_BT_AUTOFILTER) - { - EndSelection(); // vor SetDropMode (SetDropMode ruft SetItemImage) - - SetItemDown(TBC_BT_AUTOFILTER,sal_True); - nId = aPopupMenu.Execute(this, GetItemRect(TBC_BT_AUTOFILTER)); - - - if(nId>0) - { - aPopupMenu.CheckItem(nSelMenuItem,sal_False); - aPopupMenu.CheckItem(nId); - nSelMenuItem=nId; - aQueryField = MnemonicGenerator::EraseAllMnemonicChars( aPopupMenu.GetItemText(nId) ); - Sequence<PropertyValue> aPropVal(2); - PropertyValue* pPropertyVal = (PropertyValue*)aPropVal.getConstArray(); - pPropertyVal[0].Name = C2U("QueryText"); - rtl::OUString aSelection = aEdQuery.GetText(); - pPropertyVal[0].Value <<= aSelection; - pPropertyVal[1].Name=C2U("QueryField"); - pPropertyVal[1].Value <<= aQueryField; - SendDispatch(TBC_BT_AUTOFILTER,aPropVal); - } - - Point aPoint; - MouseEvent aLeave( aPoint, 0, MOUSE_LEAVEWINDOW | MOUSE_SYNTHETIC ); - MouseMove( aLeave ); - SetItemDown(TBC_BT_AUTOFILTER,sal_False); - - - } - return 0; -} -//----------------------------------------------------------------------------- -void BibToolBar::statusChanged(const frame::FeatureStateEvent& rEvent) - throw( uno::RuntimeException ) -{ - for(sal_uInt16 i = 0; i < aListenerArr.Count(); i++) - { - BibToolBarListenerPtr pListener = aListenerArr.GetObject(i); - (*pListener)->statusChanged(rEvent); - } -} - -void BibToolBar::DataChanged( const DataChangedEvent& rDCEvt ) -{ - if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && - (rDCEvt.GetFlags() & SETTINGS_STYLE) ) - ApplyImageList(); - ToolBox::DataChanged( rDCEvt ); -} - -IMPL_LINK( BibToolBar, OptionsChanged_Impl, void*, /*pVoid*/ ) -{ - sal_Bool bRebuildToolBar = sal_False; - sal_Int16 eSymbolsSize = SvtMiscOptions().GetCurrentSymbolsSize(); - if ( nSymbolsSize != eSymbolsSize ) - { - nSymbolsSize = eSymbolsSize; - bRebuildToolBar = sal_True; - } - else if ( nOutStyle != SvtMiscOptions().GetToolboxStyle() ) - { - nOutStyle = SvtMiscOptions().GetToolboxStyle(); - SetOutStyle( nOutStyle ); - bRebuildToolBar = sal_True; - } - - if ( bRebuildToolBar ) - RebuildToolbar(); - - return 0L; -} - -//----------------------------------------------------------------------------- - -IMPL_LINK( BibToolBar, SettingsChanged_Impl, void*, /*pVoid*/ ) -{ - // Check if toolbar button size have changed and we have to use system settings - sal_Int16 eSymbolsSize = SvtMiscOptions().GetCurrentSymbolsSize(); - if ( eSymbolsSize != nSymbolsSize ) - { - nSymbolsSize = eSymbolsSize; - RebuildToolbar(); - } - - return 0L; -} - -//----------------------------------------------------------------------------- -void BibToolBar::RebuildToolbar() -{ - ApplyImageList(); - // We have to call parent asynchronously as SetSize works also asynchronously! - Application::PostUserEvent( aLayoutManager, 0 ); -} - -//----------------------------------------------------------------------------- - -void BibToolBar::ApplyImageList() -{ - ImageList& rList = ( nSymbolsSize == SFX_SYMBOLS_SIZE_SMALL ) ? - ( aImgLst ) : - ( aBigImgLst ); - - SetItemImage(TBC_BT_AUTOFILTER , rList.GetImage(SID_FM_AUTOFILTER)); - SetItemImage(TBC_BT_FILTERCRIT , rList.GetImage(SID_FM_FILTERCRIT)); - SetItemImage(TBC_BT_REMOVEFILTER, rList.GetImage(SID_FM_REMOVE_FILTER_SORT )); - AdjustToolBox(); -} - -void BibToolBar::AdjustToolBox() -{ - Size aOldSize = GetSizePixel(); - Size aSize = CalcWindowSizePixel(); - if ( !aSize.Width() ) - aSize.Width() = aOldSize.Width(); - else if ( !aSize.Height() ) - aSize.Height() = aOldSize.Height(); - - Size aTbSize = GetSizePixel(); - if ( - (aSize.Width() && aSize.Width() != aTbSize.Width()) || - (aSize.Height() && aSize.Height() != aTbSize.Height()) - ) - { - SetPosSizePixel( GetPosPixel(), aSize ); - Invalidate(); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/toolbar.hrc b/extensions/source/bibliography/toolbar.hrc deleted file mode 100644 index 7349bd2c2..000000000 --- a/extensions/source/bibliography/toolbar.hrc +++ /dev/null @@ -1,46 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "bib.hrc" - -#define TBC_FT_SOURCE 1 -#define TBC_LB_SOURCE 2 -#define TBC_FT_QUERY 3 -#define TBC_ED_QUERY 4 -#define TBC_BT_AUTOFILTER 5 -#define TBC_BT_FILTERCRIT 6 -#define TBC_BT_REMOVEFILTER 7 -#define TBC_BT_NEWCARD 8 -#define TBC_BT_EDITCARD 9 -#define TBC_BT_REMOVECARD 10 -#define TBC_BT_INSERT 11 -#define TBC_BT_UPDATE 12 -#define TBC_BT_MAIL 13 -#define TBC_BT_URL 14 -#define TBC_BT_COL_ASSIGN 15 -#define TBC_BT_CHANGESOURCE 16 -#define IL_TOOLBOX 17 -#define ILH_TOOLBOX 18 diff --git a/extensions/source/bibliography/toolbar.hxx b/extensions/source/bibliography/toolbar.hxx deleted file mode 100644 index 4601fca0d..000000000 --- a/extensions/source/bibliography/toolbar.hxx +++ /dev/null @@ -1,191 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BIB_TOOLBAR_HXX -#define _BIB_TOOLBAR_HXX - -#include <com/sun/star/frame/XController.hpp> -#include <com/sun/star/frame/XStatusListener.hpp> - - -#include <vcl/toolbox.hxx> -#include <vcl/lstbox.hxx> -#include <vcl/edit.hxx> -#include <vcl/fixed.hxx> -#include <svl/svarray.hxx> -#include <vcl/timer.hxx> -#include <cppuhelper/implbase1.hxx> // helper for implementations - -class BibDataManager; -class BibToolBar; - -class BibToolBarListener: public cppu::WeakImplHelper1 < ::com::sun::star::frame::XStatusListener> -{ -private: - - sal_uInt16 nIndex; - rtl::OUString aCommand; - -protected: - - BibToolBar *pToolBar; - -public: - - BibToolBarListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId); - ~BibToolBarListener(); - - rtl::OUString GetCommand() const; - - // ::com::sun::star::lang::XEventListener - // we do not hold References to dispatches, so there is nothing to do on disposal - virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& /*Source*/) - throw( ::com::sun::star::uno::RuntimeException ){}; - - // ::com::sun::star::frame::XStatusListener - virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event) - throw( ::com::sun::star::uno::RuntimeException ); - -}; - -class BibTBListBoxListener: public BibToolBarListener -{ -public: - - BibTBListBoxListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId); - ~BibTBListBoxListener(); - - virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event) - throw( ::com::sun::star::uno::RuntimeException ); - -}; - -class BibTBEditListener: public BibToolBarListener -{ -public: - - BibTBEditListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId); - ~BibTBEditListener(); - - virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event) - throw( ::com::sun::star::uno::RuntimeException ); - -}; - -class BibTBQueryMenuListener: public BibToolBarListener -{ -public: - - BibTBQueryMenuListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId); - ~BibTBQueryMenuListener(); - - virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event) - throw( ::com::sun::star::uno::RuntimeException ); - -}; - - -typedef ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener>* BibToolBarListenerPtr; -SV_DECL_PTRARR_DEL( BibToolBarListenerArr, BibToolBarListenerPtr, 4, 4 ) - -class BibToolBar: public ToolBox -{ - private: - - BibToolBarListenerArr aListenerArr; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > xController; - Timer aTimer; - ImageList aImgLst; - ImageList aImgLstHC; - ImageList aBigImgLst; - ImageList aBigImgLstHC; - FixedText aFtSource; - ListBox aLBSource; - FixedText aFtQuery; - Edit aEdQuery; - PopupMenu aPopupMenu; - sal_uInt16 nMenuId; - sal_uInt16 nSelMenuItem; - rtl::OUString aQueryField; - Link aLayoutManager; - sal_Int16 nSymbolsSize; - sal_Int16 nOutStyle; - - BibDataManager* pDatMan; - DECL_LINK( SelHdl, ListBox* ); - DECL_LINK( SendSelHdl, Timer* ); - DECL_LINK( MenuHdl, ToolBox* ); - DECL_LINK( OptionsChanged_Impl, void* ); - DECL_LINK( SettingsChanged_Impl, void* ); - - void ApplyImageList(); - void RebuildToolbar(); - - protected: - - void DataChanged( const DataChangedEvent& rDCEvt ); - void InitListener(); - virtual void Select(); - virtual void Click(); - long PreNotify( NotifyEvent& rNEvt ); - - - public: - - BibToolBar(Window* pParent, Link aLink, WinBits nStyle = WB_3DLOOK ); - ~BibToolBar(); - - void SetXController(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > &); - - void ClearSourceList(); - void UpdateSourceList(sal_Bool bFlag=sal_True); - void EnableSourceList(sal_Bool bFlag=sal_True); - void InsertSourceEntry(const XubString&,sal_uInt16 nPos=LISTBOX_APPEND ); - void SelectSourceEntry(const XubString& ); - - void EnableQuery(sal_Bool bFlag=sal_True); - void SetQueryString(const XubString& ); - void AdjustToolBox(); - - void ClearFilterMenu(); - sal_uInt16 InsertFilterItem(const XubString& ); - void SelectFilterItem(sal_uInt16 nId); - - void statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event) - throw( ::com::sun::star::uno::RuntimeException ); - - void SetDatMan(BibDataManager& rDatMan) {pDatMan = &rDatMan;} - void SendDispatch(sal_uInt16 nId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs); -}; - - - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/toolbar.src b/extensions/source/bibliography/toolbar.src deleted file mode 100644 index c712bc1c3..000000000 --- a/extensions/source/bibliography/toolbar.src +++ /dev/null @@ -1,153 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include <svx/svxids.hrc> -#include "bibliography.hrc" -#include "toolbar.hrc" -#include "svx/svxcommands.h" - -#define MASKCOLOR MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; }; - -ToolBox RID_BIB_TOOLBAR -{ - HelpId = HID_BIB_DB_TBX; - Sizeable = TRUE ; - HideWhenDeactivate = TRUE ; - LineSpacing = TRUE ; - Border = TRUE ; - SVLook = TRUE ; - Pos = MAP_APPFONT ( 0 , 0 ) ; - Size = MAP_APPFONT ( 200 , 16 ) ; - ButtonType = BUTTON_SYMBOL ; - ItemList = - { - ToolBoxItem - { - Identifier = TBC_FT_SOURCE; - Text [ en-US ] = "Table"; - }; - ToolBoxItem - { - Identifier = TBC_LB_SOURCE; - HelpID = HID_BIB_TBX_TABLE; - Command = ".uno:Bib/source" ; - }; - ToolBoxItem - { - Type = TOOLBOXITEM_SEPARATOR ; - }; - - ToolBoxItem - { - Identifier = TBC_FT_QUERY; - Text [ en-US ] = "Search Key"; - }; - ToolBoxItem - { - Identifier = TBC_ED_QUERY; - HelpID = HID_BIB_TBX_SEARCH; - Command = ".uno:Bib/query" ; - }; - ToolBoxItem - { - Type = TOOLBOXITEM_SEPARATOR ; - }; - - ToolBoxItem - { - Identifier = TBC_BT_AUTOFILTER ; - HelpID = HID_BIB_TBX_AUTOFILTER; -// ItemBitmap = Bitmap { File = "sc10716.bmp" ; }; - DropDown = TRUE ; - Command = ".uno:Bib/autoFilter" ; - Text [ en-US ] = "AutoFilter"; - }; - - ToolBoxItem - { - Identifier = TBC_BT_FILTERCRIT ; -// ItemBitmap = Bitmap { File = "sc10715.bmp" ; }; -// Text [ de ] = "Standard Filter" ; - Command = ".uno:Bib/standardFilter" ; - Text [ en-US ] = "Standard Filter"; - }; - - ToolBoxItem - { - Identifier = TBC_BT_REMOVEFILTER ; -// ItemBitmap = Bitmap { File = "sc10711.bmp" ; }; - Command = ".uno:Bib/removeFilter" ; - Text [ en-US ] = "Remove Filter"; - }; - ToolBoxItem - { - Identifier = TBC_BT_COL_ASSIGN ; - HelpId = HID_BIB_MAPPINGDLG; -// Command = ".uno:Bib/Mapping" ; -// ItemBitmap = Bitmap { File = "sc10711.bmp" ; }; - Text [ en-US ] = "Column Arrangement"; - }; - ToolBoxItem - { - Identifier = TBC_BT_CHANGESOURCE ; - HelpId = HID_BIB_CHANGESOURCE; - Command = ".uno:Bib/sdbsource" ; -// ItemBitmap = Bitmap { File = "sc10711.bmp" ; }; - Checkable=TRUE; - Text [ en-US ] = "Data Source"; - }; - }; - Scroll = TRUE ; -}; -#define BIB_IMAGES \ - IdList = \ - { \ - SID_FM_AUTOFILTER; /*10716*/ \ - SID_FM_FILTERCRIT; /*10715*/ \ - SID_FM_REMOVE_FILTER_SORT ; /*10711*/ \ - }; \ - IdCount = { 3; }; - -ImageList RID_TOOLBAR_IMGLIST -{ - Prefix = "sc"; - MASKCOLOR - BIB_IMAGES -}; - -ImageList RID_TOOLBAR_BIGIMGLIST -{ - Prefix = "lc"; - MASKCOLOR - BIB_IMAGES -}; - - - - - - - diff --git a/extensions/source/bibliography/uiconfig/sbibliography/menubar/menubar.xml b/extensions/source/bibliography/uiconfig/sbibliography/menubar/menubar.xml deleted file mode 100644 index 817473af0..000000000 --- a/extensions/source/bibliography/uiconfig/sbibliography/menubar/menubar.xml +++ /dev/null @@ -1,92 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<menu:menubar xmlns:menu="http://openoffice.org/2001/menu" menu:id="menubar"> - <menu:menu menu:id=".uno:PickList"> - <menu:menupopup> - <menu:menuitem menu:id=".uno:AddDirect"/> - <menu:menuitem menu:id=".uno:Open"/> - <menu:menuitem menu:id=".uno:AutoPilotMenu"/> - <menu:menuseparator/> - <menu:menuitem menu:id=".uno:CloseWin"/> - <menu:menuitem menu:id=".uno:Save"/> - <menu:menuitem menu:id=".uno:SaveAs"/> - <menu:menuitem menu:id=".uno:SaveAll"/> - <menu:menuitem menu:id=".uno:Reload"/> - <menu:menuitem menu:id=".uno:VersionDialog"/> - <menu:menuseparator/> - <menu:menuitem menu:id=".uno:SendToMenu"/> - <menu:menuseparator/> - <menu:menuitem menu:id=".uno:SetDocumentProperties"/> - <menu:menu menu:id=".uno:TemplateMenu"> - <menu:menupopup> - <menu:menuitem menu:id=".uno:Organizer"/> - <menu:menuitem menu:id=".uno:AddressBookSource"/> - <menu:menuitem menu:id=".uno:SaveAsTemplate"/> - <menu:menuitem menu:id=".uno:OpenTemplate"/> - </menu:menupopup> - </menu:menu> - <menu:menuseparator/> - <menu:menuitem menu:id=".uno:PrintPreview"/> - <menu:menuitem menu:id=".uno:Print"/> - <menu:menuitem menu:id=".uno:PrinterSetup"/> - <menu:menuseparator/> - <menu:menuitem menu:id=".uno:Quit"/> - </menu:menupopup> - </menu:menu> - <menu:menu menu:id=".uno:EditMenu"> - <menu:menupopup> - <menu:menuitem menu:id=".uno:Cut"/> - <menu:menuitem menu:id=".uno:Copy"/> - <menu:menuitem menu:id=".uno:Paste"/> - <menu:menuseparator/> - <menu:menuitem menu:id=".uno:Bib/Mapping"/> - <menu:menuitem menu:id=".uno:Bib/sdbsource"/> - <menu:menuitem menu:id=".uno:Bib/DeleteRecord"/> - </menu:menupopup> - </menu:menu> - <menu:menu menu:id=".uno:ViewMenu"> - <menu:menupopup> - <menu:menuitem menu:id=".uno:AvailableToolbars"/> - <menu:menuitem menu:id=".uno:StatusBarVisible"/> - </menu:menupopup> - </menu:menu> - <menu:menu menu:id=".uno:InsertMenu"> - <menu:menupopup> - <menu:menuitem menu:id=".uno:Bib/InsertRecord"/> - </menu:menupopup> - </menu:menu> - <menu:menu menu:id=".uno:ToolsMenu"> - <menu:menupopup> - <menu:menuitem menu:id=".uno:Bib/standardFilter"/> - <menu:menuseparator/> - <menu:menu menu:id=".uno:MacrosMenu"> - <menu:menupopup> - <menu:menuitem menu:id=".uno:MacroRecorder"/> - <menu:menuitem menu:id=".uno:RunMacro"/> - <menu:menu menu:id=".uno:ScriptOrganizer"/> - <menu:menuseparator/> - <menu:menuitem menu:id=".uno:MacroOrganizer?TabId:short=1"/> - </menu:menupopup> - </menu:menu> - <menu:menuitem menu:id="service:com.sun.star.deployment.ui.PackageManagerDialog"/> - <menu:menuitem menu:id=".uno:ConfigureDialog"/> - <menu:menuitem menu:id=".uno:OptionsTreeDialog"/> - </menu:menupopup> - </menu:menu> - <menu:menu menu:id=".uno:WindowList"> - <menu:menupopup> - <menu:menuitem menu:id=".uno:NewWindow"/> - <menu:menuitem menu:id=".uno:CloseWin"/> - <menu:menuseparator/> - </menu:menupopup> - </menu:menu> - <menu:menu menu:id=".uno:HelpMenu"> - <menu:menupopup> - <menu:menuitem menu:id=".uno:HelpIndex"/> - <menu:menuitem menu:id=".uno:ExtendedHelp"/> - <menu:menuseparator/> - <menu:menuitem menu:id=".uno:ShowLicense"/> - <menu:menuseparator/> - <menu:menuitem menu:id=".uno:About"/> - </menu:menupopup> - </menu:menu> -</menu:menubar> |