summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/app/AppSwapWindow.cxx
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2004-08-02 14:29:56 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2004-08-02 14:29:56 +0000
commit936034b2bf8827780e35091e85c324ca817c7a3f (patch)
tree9fe5373fdfa3eadcef12d1077c0c8a33a38e207f /dbaccess/source/ui/app/AppSwapWindow.cxx
parent01537ea3df6e346b382fad8de7ec6608ded4ed70 (diff)
INTEGRATION: CWS insight01 (1.1.2); FILE ADDED
2004/03/19 07:45:46 oj 1.1.2.12: #111075# ongoing work 2004/03/18 10:15:50 oj 1.1.2.11: #111075# ongoing work 2004/01/09 11:12:47 oj 1.1.2.10: #111075# ongoing work 2003/12/18 13:53:17 oj 1.1.2.9: #111075# ongoing work 2003/12/17 13:54:58 oj 1.1.2.8: #111075# ongoing work 2003/11/26 12:17:52 oj 1.1.2.7: #111075# ongoing work 2003/11/07 07:24:09 oj 1.1.2.6: #111075# new helpid for the iconcontrol 2003/10/24 06:38:46 oj 1.1.2.5: #111075# further changes 2003/09/18 05:59:27 oj 1.1.2.4: #111075# ongoing work 2003/08/29 09:36:31 oj 1.1.2.3: #111090# ongoning work 2003/08/20 06:43:13 oj 1.1.2.2: #111075# ongoning work 2003/08/15 08:55:38 oj 1.1.2.1: #111075# ongoing new dbaapp work
Diffstat (limited to 'dbaccess/source/ui/app/AppSwapWindow.cxx')
-rw-r--r--dbaccess/source/ui/app/AppSwapWindow.cxx226
1 files changed, 226 insertions, 0 deletions
diff --git a/dbaccess/source/ui/app/AppSwapWindow.cxx b/dbaccess/source/ui/app/AppSwapWindow.cxx
new file mode 100644
index 000000000..e259ae473
--- /dev/null
+++ b/dbaccess/source/ui/app/AppSwapWindow.cxx
@@ -0,0 +1,226 @@
+/*************************************************************************
+ *
+ * $RCSfile: AppSwapWindow.cxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: hr $ $Date: 2004-08-02 15:29:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): Ocke Janssen
+ *
+ *
+ ************************************************************************/
+#ifndef DBAUI_APPSWAPWINDOW_HXX
+#include "AppSwapWindow.hxx"
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _DBA_DBACCESS_HELPID_HRC_
+#include "dbaccess_helpid.hrc"
+#endif
+#ifndef _DBU_APP_HRC_
+#include "dbu_app.hrc"
+#endif
+#ifndef DBAUI_APPVIEW_HXX
+#include "AppView.hxx"
+#endif
+#ifndef DBAUI_IAPPELEMENTNOTIFICATION_HXX
+#include "IAppElementNotification.hxx"
+#endif
+#ifndef _DBAUI_MODULE_DBU_HXX_
+#include "moduledbu.hxx"
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
+
+#include <memory>
+
+using namespace ::dbaui;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+
+//==================================================================
+// class OApplicationSwapWindow
+//==================================================================
+OApplicationSwapWindow::OApplicationSwapWindow(Window* _pParent,OAppBorderWindow* _pBorderWindow) : Control(_pParent,WB_DIALOGCONTROL )
+ ,m_aIconControl(this)
+ ,m_pBorderWin(_pBorderWindow)
+ ,m_eLastType(E_NONE)
+{
+ ImplInitSettings( sal_True, sal_True, sal_True );
+
+ m_aIconControl.SetClickHdl(LINK(this, OApplicationSwapWindow, OnContainerSelectHdl));
+ m_aIconControl.setControlActionListener(_pBorderWindow->getView()->getActionListener());
+ m_aIconControl.SetHelpId(HID_APP_SWAP_ICONCONTROL);
+ m_aIconControl.Show();
+ m_aIconControl.Enable(TRUE);
+}
+// -----------------------------------------------------------------------------
+OApplicationSwapWindow::~OApplicationSwapWindow()
+{
+}
+// -----------------------------------------------------------------------------
+void OApplicationSwapWindow::Resize()
+{
+ m_aIconControl.SetPosSizePixel( Point(0, 0 ),
+ GetOutputSize() );
+ m_aIconControl.ArrangeIcons();
+}
+// -----------------------------------------------------------------------------
+void OApplicationSwapWindow::ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ if ( bFont )
+ {
+ Font aFont = rStyleSettings.GetAppFont();
+ if ( IsControlFont() )
+ aFont.Merge( GetControlFont() );
+ SetPointFont( aFont );
+// Set/*Zoomed*/PointFont( aFont );
+ }
+
+ if ( bFont || bForeground )
+ {
+ Color aTextColor = rStyleSettings.GetButtonTextColor();
+ if ( IsControlForeground() )
+ aTextColor = GetControlForeground();
+ SetTextColor( aTextColor );
+ }
+
+ if ( bBackground )
+ {
+ if( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( rStyleSettings.GetFaceColor() );
+ }
+}
+// -----------------------------------------------------------------------
+void OApplicationSwapWindow::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ ImplInitSettings( sal_True, sal_True, sal_True );
+ Invalidate();
+ }
+}
+// -----------------------------------------------------------------------------
+void OApplicationSwapWindow::clearSelection()
+{
+ m_aIconControl.SetNoSelection();
+ ULONG nPos = 0;
+ SvxIconChoiceCtrlEntry* pEntry = m_aIconControl.GetSelectedEntry(nPos);
+ if ( pEntry )
+ m_aIconControl.InvalidateEntry(pEntry);
+ m_aIconControl.GetClickHdl().Call(&m_aIconControl);
+}
+// -----------------------------------------------------------------------------
+ElementType OApplicationSwapWindow::getElementType() const
+{
+ ULONG nPos = 0;
+ SvxIconChoiceCtrlEntry* pEntry = m_aIconControl.GetSelectedEntry(nPos);
+ return ( pEntry ) ? *static_cast<ElementType*>(pEntry->GetUserData()) : E_NONE;
+}
+// -----------------------------------------------------------------------------
+IMPL_LINK(OApplicationSwapWindow, OnContainerSelectHdl, SvtIconChoiceCtrl*, _pControl)
+{
+ ULONG nPos = 0;
+ SvxIconChoiceCtrlEntry* pEntry = _pControl->GetSelectedEntry( nPos );
+ ElementType eType = E_NONE;
+ if ( pEntry )
+ eType = *static_cast<ElementType*>(pEntry->GetUserData());
+
+ if ( m_eLastType != eType && eType != E_NONE )
+ {
+ if ( m_pBorderWin->getView()->getElementNotification()->onContainerSelect(eType) )
+ m_eLastType = eType;
+ else
+ {
+ PostUserEvent(LINK(this, OApplicationSwapWindow, ChangeToLastSelected));
+ }
+ }
+
+ return 1L;
+}
+//------------------------------------------------------------------------------
+IMPL_LINK(OApplicationSwapWindow, ChangeToLastSelected, void*, EMPTYARG)
+{
+ changeContainer(m_eLastType);
+ return 0L;
+}
+// -----------------------------------------------------------------------------
+void OApplicationSwapWindow::changeContainer(ElementType _eType)
+{
+ ULONG nCount = m_aIconControl.GetEntryCount();
+ SvxIconChoiceCtrlEntry* pEntry = NULL;
+ for (ULONG i=0; i < nCount; ++i)
+ {
+ pEntry = m_aIconControl.GetEntry(i);
+ if ( pEntry && *static_cast<ElementType*>(pEntry->GetUserData()) == _eType )
+ break;
+ pEntry = NULL;
+ }
+ if ( pEntry )
+ {
+ m_aIconControl.SetCursor(pEntry);
+ OnContainerSelectHdl(&m_aIconControl);
+ }
+ else
+ m_eLastType = E_NONE;
+}