2004-08-02 14:30:14 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-08 13:22:27 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2004-08-02 14:30:14 +00:00
|
|
|
*
|
2005-09-08 13:22:27 +00:00
|
|
|
* $RCSfile: AppTitleWindow.cxx,v $
|
2004-08-02 14:30:14 +00:00
|
|
|
*
|
2007-07-06 07:00:39 +00:00
|
|
|
* $Revision: 1.10 $
|
2004-08-02 14:30:14 +00:00
|
|
|
*
|
2007-07-06 07:00:39 +00:00
|
|
|
* last change: $Author: rt $ $Date: 2007-07-06 08:00:39 $
|
2004-08-02 14:30:14 +00:00
|
|
|
*
|
2005-09-08 13:22:27 +00:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2004-08-02 14:30:14 +00:00
|
|
|
*
|
|
|
|
*
|
2005-09-08 13:22:27 +00:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2004-08-02 14:30:14 +00:00
|
|
|
*
|
2005-09-08 13:22:27 +00:00
|
|
|
* 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.
|
2004-08-02 14:30:14 +00:00
|
|
|
*
|
2005-09-08 13:22:27 +00:00
|
|
|
* 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.
|
2004-08-02 14:30:14 +00:00
|
|
|
*
|
2005-09-08 13:22:27 +00:00
|
|
|
* 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
|
2004-08-02 14:30:14 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
2006-09-17 05:55:28 +00:00
|
|
|
|
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_dbaccess.hxx"
|
2004-08-02 14:30:14 +00:00
|
|
|
#ifndef DBAUI_TITLE_WINDOW_HXX
|
|
|
|
#include "AppTitleWindow.hxx"
|
|
|
|
#endif
|
2007-07-06 07:00:39 +00:00
|
|
|
#ifndef _DBAUI_MODULE_DBU_HXX_
|
|
|
|
#include "moduledbu.hxx"
|
|
|
|
#endif
|
2004-08-02 14:30:14 +00:00
|
|
|
#include "memory"
|
|
|
|
#ifndef _SV_SVAPP_HXX //autogen
|
|
|
|
#include <vcl/svapp.hxx>
|
|
|
|
#endif
|
2005-09-23 11:17:30 +00:00
|
|
|
#ifndef _TOOLS_DEBUG_HXX
|
|
|
|
#include <tools/debug.hxx>
|
|
|
|
#endif
|
2004-08-02 14:30:14 +00:00
|
|
|
|
|
|
|
namespace dbaui
|
|
|
|
{
|
2005-09-23 11:17:30 +00:00
|
|
|
|
|
|
|
DBG_NAME(OTitleWindow)
|
2004-08-02 14:30:14 +00:00
|
|
|
OTitleWindow::OTitleWindow(Window* _pParent,USHORT _nTitleId,WinBits _nBits,BOOL _bShift)
|
|
|
|
: Window(_pParent,_nBits | WB_DIALOGCONTROL)
|
|
|
|
, m_aSpace1(this)
|
|
|
|
, m_aSpace2(this)
|
|
|
|
, m_aTitle(this)
|
|
|
|
, m_pChild(NULL)
|
|
|
|
, m_bShift(_bShift)
|
|
|
|
{
|
2005-09-23 11:17:30 +00:00
|
|
|
DBG_CTOR(OTitleWindow,NULL);
|
|
|
|
|
2004-08-02 14:30:14 +00:00
|
|
|
setTitle(_nTitleId);
|
2004-09-09 08:40:35 +00:00
|
|
|
SetBorderStyle(WINDOW_BORDER_MONO);
|
|
|
|
ImplInitSettings( sal_True, sal_True, sal_True );
|
|
|
|
|
2006-06-20 01:54:58 +00:00
|
|
|
Window* pWindows [] = { &m_aSpace1, &m_aSpace2, &m_aTitle };
|
|
|
|
for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i)
|
2004-08-02 14:30:14 +00:00
|
|
|
pWindows[i]->Show();
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
OTitleWindow::~OTitleWindow()
|
|
|
|
{
|
|
|
|
if ( m_pChild )
|
|
|
|
{
|
|
|
|
m_pChild->Hide();
|
|
|
|
::std::auto_ptr<Window> aTemp(m_pChild);
|
|
|
|
m_pChild = NULL;
|
|
|
|
}
|
2005-09-23 11:17:30 +00:00
|
|
|
|
|
|
|
DBG_DTOR(OTitleWindow,NULL);
|
2004-08-02 14:30:14 +00:00
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OTitleWindow::setChildWindow(Window* _pChild)
|
|
|
|
{
|
|
|
|
m_pChild = _pChild;
|
|
|
|
}
|
2004-09-09 08:40:35 +00:00
|
|
|
#define SPACE_BORDER 1
|
2004-08-02 14:30:14 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OTitleWindow::Resize()
|
|
|
|
{
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Abmessungen parent window
|
|
|
|
Size aOutputSize( GetOutputSize() );
|
|
|
|
long nOutputWidth = aOutputSize.Width();
|
|
|
|
long nOutputHeight = aOutputSize.Height();
|
|
|
|
|
|
|
|
Size aTextSize = LogicToPixel( Size( 6, 3 ), MAP_APPFONT );
|
|
|
|
sal_Int32 nXOffset = aTextSize.Width();
|
|
|
|
sal_Int32 nYOffset = aTextSize.Height();
|
|
|
|
sal_Int32 nHeight = GetTextHeight() + 2*nYOffset;
|
|
|
|
|
2004-09-09 08:40:35 +00:00
|
|
|
m_aSpace1.SetPosSizePixel( Point(SPACE_BORDER, SPACE_BORDER ),
|
|
|
|
Size(nXOffset , nHeight - SPACE_BORDER) );
|
|
|
|
m_aSpace2.SetPosSizePixel( Point(nXOffset + SPACE_BORDER, SPACE_BORDER ),
|
|
|
|
Size(nOutputWidth - nXOffset - 2*SPACE_BORDER, nYOffset) );
|
|
|
|
m_aTitle.SetPosSizePixel( Point(nXOffset + SPACE_BORDER, nYOffset + SPACE_BORDER),
|
|
|
|
Size(nOutputWidth - nXOffset - 2*SPACE_BORDER, nHeight - nYOffset - SPACE_BORDER) );
|
2004-08-02 14:30:14 +00:00
|
|
|
if ( m_pChild )
|
|
|
|
{
|
2004-09-09 08:40:35 +00:00
|
|
|
m_pChild->SetPosSizePixel( Point(m_bShift ? (nXOffset+SPACE_BORDER) : sal_Int32(SPACE_BORDER), nHeight + nXOffset + SPACE_BORDER),
|
|
|
|
Size(nOutputWidth - ( m_bShift ? (2*nXOffset - 2*SPACE_BORDER) : sal_Int32(SPACE_BORDER) ), nOutputHeight - nHeight - 2*nXOffset - 2*SPACE_BORDER) );
|
2004-08-02 14:30:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OTitleWindow::setTitle(USHORT _nTitleId)
|
|
|
|
{
|
|
|
|
if ( _nTitleId != 0 )
|
|
|
|
{
|
|
|
|
m_aTitle.SetText(ModuleRes(_nTitleId));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OTitleWindow::GetFocus()
|
|
|
|
{
|
|
|
|
Window::GetFocus();
|
|
|
|
if ( m_pChild )
|
|
|
|
m_pChild->GrabFocus();
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
long OTitleWindow::GetWidthPixel() const
|
|
|
|
{
|
2005-04-11 09:04:19 +00:00
|
|
|
Size aTextSize = LogicToPixel( Size( 12, 0 ), MAP_APPFONT );
|
|
|
|
sal_Int32 nWidth = GetTextWidth(m_aTitle.GetText()) + 2*aTextSize.Width();
|
2004-08-02 14:30:14 +00:00
|
|
|
|
|
|
|
return nWidth;
|
|
|
|
}
|
2004-09-09 08:40:35 +00:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
void OTitleWindow::DataChanged( const DataChangedEvent& rDCEvt )
|
|
|
|
{
|
|
|
|
Window::DataChanged( rDCEvt );
|
|
|
|
|
2007-07-06 07:00:39 +00:00
|
|
|
if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
|
|
|
|
(rDCEvt.GetType() == DATACHANGED_DISPLAY) ||
|
|
|
|
(rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
|
|
|
|
((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
|
|
|
|
(rDCEvt.GetFlags() & SETTINGS_STYLE)) )
|
2004-09-09 08:40:35 +00:00
|
|
|
{
|
|
|
|
ImplInitSettings( sal_True, sal_True, sal_True );
|
|
|
|
Invalidate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
void OTitleWindow::ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground )
|
|
|
|
{
|
|
|
|
AllSettings aAllSettings = GetSettings();
|
|
|
|
StyleSettings aStyle = aAllSettings.GetStyleSettings();
|
|
|
|
aStyle.SetMonoColor(aStyle.GetActiveBorderColor());//GetMenuBorderColor());
|
|
|
|
aAllSettings.SetStyleSettings(aStyle);
|
|
|
|
SetSettings(aAllSettings);
|
|
|
|
|
2006-01-03 15:16:44 +00:00
|
|
|
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
|
|
|
|
if( bFont )
|
|
|
|
{
|
|
|
|
Font aFont;
|
|
|
|
aFont = rStyleSettings.GetFieldFont();
|
|
|
|
aFont.SetColor( rStyleSettings.GetWindowTextColor() );
|
|
|
|
SetPointFont( aFont );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( bForeground || bFont )
|
|
|
|
{
|
|
|
|
SetTextColor( rStyleSettings.GetFieldTextColor() );
|
|
|
|
SetTextFillColor();
|
|
|
|
}
|
|
|
|
|
|
|
|
if( bBackground )
|
|
|
|
SetBackground( rStyleSettings.GetFieldColor() );
|
|
|
|
|
|
|
|
|
2004-09-09 08:40:35 +00:00
|
|
|
Window* pWindows [] = { &m_aSpace1, &m_aSpace2, &m_aTitle};
|
2006-06-20 01:54:58 +00:00
|
|
|
for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i)
|
2004-09-09 08:40:35 +00:00
|
|
|
{
|
|
|
|
Font aFont = pWindows[i]->GetFont();
|
|
|
|
aFont.SetWeight(WEIGHT_BOLD);
|
|
|
|
pWindows[i]->SetFont(aFont);
|
|
|
|
pWindows[i]->SetTextColor( aStyle.GetLightColor() );
|
|
|
|
pWindows[i]->SetBackground( Wallpaper( aStyle.GetShadowColor() ) );
|
|
|
|
}
|
|
|
|
}
|
2004-08-02 14:30:14 +00:00
|
|
|
// .............................................................
|
|
|
|
} // namespace dbaui
|
|
|
|
// .............................................................
|