2001-02-26 03:47:06 -06:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* $RCSfile: dlgedobj.cxx,v $
|
|
|
|
*
|
2004-11-03 04:17:12 -06:00
|
|
|
* $Revision: 1.36 $
|
2001-02-26 03:47:06 -06:00
|
|
|
*
|
2004-11-03 04:17:12 -06:00
|
|
|
* last change: $Author: pjunck $ $Date: 2004-11-03 11:17:12 $
|
2001-02-26 03:47:06 -06:00
|
|
|
*
|
|
|
|
* 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): _______________________________________
|
|
|
|
*
|
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2001-03-20 07:37:42 -06:00
|
|
|
#include <vector>
|
|
|
|
#include <algorithm>
|
|
|
|
|
2001-07-27 12:06:15 -05:00
|
|
|
#ifndef _BASCTL_DLGEDDEF_HXX
|
|
|
|
#include <dlgeddef.hxx>
|
|
|
|
#endif
|
|
|
|
|
2001-02-26 03:47:06 -06:00
|
|
|
#ifndef _BASCTL_DLGEDOBJ_HXX
|
|
|
|
#include "dlgedobj.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _BASCTL_DLGED_HXX
|
|
|
|
#include "dlged.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _BASCTL_DLGEDMOD_HXX
|
|
|
|
#include "dlgedmod.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _BASCTL_DLGEDPAGE_HXX
|
|
|
|
#include "dlgedpage.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _BASCTL_DLGEDVIEW_HXX
|
|
|
|
#include "dlgedview.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _BASCTL_DLGEDLIST_HXX
|
|
|
|
#include "dlgedlist.hxx"
|
|
|
|
#endif
|
|
|
|
|
2001-03-23 09:16:45 -06:00
|
|
|
#ifndef _IDERID_HXX
|
|
|
|
#include <iderid.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _BASCTL_DLGRESID_HRC
|
|
|
|
#include <dlgresid.hrc>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _TOOLS_RESMGR_HXX
|
|
|
|
#include <tools/resmgr.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _SVDIO_HXX //autogen
|
|
|
|
#include <svx/svdio.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _SHL_HXX
|
|
|
|
#include <tools/shl.hxx>
|
|
|
|
#endif
|
|
|
|
|
2003-11-05 05:40:17 -06:00
|
|
|
#ifndef _COM_SUN_STAR_AWT_XTABCONTROLLERMODEL_HPP_
|
|
|
|
#include <com/sun/star/awt/XTabControllerModel.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_AWT_XUNOCONTROLCONTAINER_HPP_
|
|
|
|
#include <com/sun/star/awt/XUnoControlContainer.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINERPEER_HPP_
|
|
|
|
#include <com/sun/star/awt/XVclContainerPeer.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
|
|
|
|
#include <com/sun/star/awt/XWindow.hpp>
|
2001-07-18 10:28:17 -05:00
|
|
|
#endif
|
2001-02-26 03:47:06 -06:00
|
|
|
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
|
|
|
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
|
|
|
#endif
|
2001-03-06 07:50:13 -06:00
|
|
|
#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
|
|
|
|
#include <com/sun/star/beans/PropertyAttribute.hpp>
|
|
|
|
#endif
|
2001-03-12 04:31:43 -06:00
|
|
|
#ifndef _COM_SUN_STAR_SCRIPT_XSCRIPTEVENTSSUPPLIER_HPP_
|
|
|
|
#include <com/sun/star/script/XScriptEventsSupplier.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_CONTAINER_XCONTAINER_HPP_
|
|
|
|
#include <com/sun/star/container/XContainer.hpp>
|
|
|
|
#endif
|
2001-03-16 06:43:42 -06:00
|
|
|
#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
|
|
|
|
#include <com/sun/star/lang/XServiceInfo.hpp>
|
|
|
|
#endif
|
2003-11-05 05:40:17 -06:00
|
|
|
#ifndef _COMPHELPER_PROCESSFACTORY_HXX_
|
|
|
|
#include <comphelper/processfactory.hxx>
|
|
|
|
#endif
|
2001-03-16 06:43:42 -06:00
|
|
|
|
2003-04-11 11:39:00 -05:00
|
|
|
#include <algorithm>
|
|
|
|
#include <functional>
|
|
|
|
|
2001-02-26 03:47:06 -06:00
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::beans;
|
2001-03-12 04:31:43 -06:00
|
|
|
using namespace ::com::sun::star::container;
|
|
|
|
using namespace ::com::sun::star::script;
|
2001-02-26 03:47:06 -06:00
|
|
|
using namespace ::rtl;
|
|
|
|
|
|
|
|
|
|
|
|
TYPEINIT1(DlgEdObj, SdrUnoObj);
|
|
|
|
DBG_NAME(DlgEdObj);
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
DlgEdObj::DlgEdObj()
|
|
|
|
:SdrUnoObj(String(), sal_False)
|
|
|
|
,bIsListening(sal_False)
|
|
|
|
{
|
|
|
|
DBG_CTOR(DlgEdObj, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
DlgEdObj::DlgEdObj(const ::rtl::OUString& rModelName)
|
|
|
|
:SdrUnoObj(rModelName, sal_False)
|
|
|
|
,bIsListening(sal_False)
|
|
|
|
{
|
|
|
|
DBG_CTOR(DlgEdObj, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
DlgEdObj::DlgEdObj(const ::rtl::OUString& rModelName,
|
|
|
|
const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxSFac)
|
|
|
|
:SdrUnoObj(rModelName, rxSFac, sal_False)
|
|
|
|
,bIsListening(sal_False)
|
|
|
|
{
|
|
|
|
DBG_CTOR(DlgEdObj, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
DlgEdObj::~DlgEdObj()
|
|
|
|
{
|
|
|
|
DBG_DTOR(DlgEdObj, NULL);
|
|
|
|
|
2002-08-01 09:06:29 -05:00
|
|
|
if ( isListening() )
|
|
|
|
EndListening();
|
2001-02-26 03:47:06 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void DlgEdObj::SetPage(SdrPage* _pNewPage)
|
|
|
|
{
|
|
|
|
// now set the page
|
|
|
|
SdrUnoObj::SetPage(_pNewPage);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void DlgEdObj::SetRectFromProps()
|
|
|
|
{
|
2001-07-18 10:28:17 -05:00
|
|
|
// get property sets
|
|
|
|
Reference< beans::XPropertySet > xPSet( GetUnoControlModel(), UNO_QUERY );
|
|
|
|
Reference< beans::XPropertySet > xPSetForm( GetDlgEdForm()->GetUnoControlModel(), UNO_QUERY );
|
2001-03-03 09:20:36 -06:00
|
|
|
|
2001-07-18 10:28:17 -05:00
|
|
|
if (xPSet.is() && xPSetForm.is())
|
2001-03-03 09:20:36 -06:00
|
|
|
{
|
2001-07-18 10:28:17 -05:00
|
|
|
// get control position and size from properties
|
2001-02-26 03:47:06 -06:00
|
|
|
sal_Int32 nX, nY, nWidth, nHeight;
|
|
|
|
xPSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) ) ) >>= nX;
|
|
|
|
xPSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) ) ) >>= nY;
|
|
|
|
xPSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) >>= nWidth;
|
|
|
|
xPSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) >>= nHeight;
|
|
|
|
|
2001-07-18 10:28:17 -05:00
|
|
|
// get form position and size from properties
|
|
|
|
sal_Int32 nFormX, nFormY, nFormWidth, nFormHeight;
|
|
|
|
xPSetForm->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) ) ) >>= nFormX;
|
|
|
|
xPSetForm->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) ) ) >>= nFormY;
|
|
|
|
xPSetForm->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) >>= nFormWidth;
|
|
|
|
xPSetForm->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) >>= nFormHeight;
|
|
|
|
|
2001-02-26 03:47:06 -06:00
|
|
|
Size aPos( nX, nY );
|
|
|
|
Size aSize( nWidth, nHeight );
|
2001-07-18 10:28:17 -05:00
|
|
|
Size aFormPos( nFormX, nFormY );
|
|
|
|
Size aFormSize( nFormWidth, nFormHeight );
|
2001-02-26 03:47:06 -06:00
|
|
|
|
2001-07-18 10:28:17 -05:00
|
|
|
// convert logic units to pixel
|
2001-02-26 03:47:06 -06:00
|
|
|
OutputDevice* pDevice = Application::GetDefaultDevice();
|
|
|
|
DBG_ASSERT( pDevice, "Missing Default Device!" );
|
|
|
|
if( pDevice )
|
|
|
|
{
|
|
|
|
aPos = pDevice->LogicToPixel( aPos, MapMode(MAP_APPFONT) );
|
|
|
|
aSize = pDevice->LogicToPixel( aSize, MapMode(MAP_APPFONT) );
|
2001-07-18 10:28:17 -05:00
|
|
|
aFormPos = pDevice->LogicToPixel( aFormPos, MapMode(MAP_APPFONT) );
|
|
|
|
aFormSize = pDevice->LogicToPixel( aFormSize, MapMode(MAP_APPFONT) );
|
|
|
|
}
|
|
|
|
|
|
|
|
// take window borders into account
|
|
|
|
awt::DeviceInfo aDeviceInfo;
|
|
|
|
Window* pWindow = GetDlgEdForm()->GetDlgEditor()->GetWindow();
|
|
|
|
Reference< awt::XControl > xDlg( GetDlgEdForm()->GetUnoControl( pWindow ), UNO_QUERY );
|
|
|
|
if ( xDlg.is() )
|
|
|
|
{
|
|
|
|
Reference< awt::XDevice > xDev( xDlg->getPeer(), UNO_QUERY );
|
|
|
|
if ( xDev.is() )
|
|
|
|
aDeviceInfo = xDev->getInfo();
|
|
|
|
}
|
|
|
|
aPos.Width() += aFormPos.Width() + aDeviceInfo.LeftInset;
|
|
|
|
aPos.Height() += aFormPos.Height() + aDeviceInfo.TopInset;
|
|
|
|
|
|
|
|
// convert pixel to 100th_mm
|
|
|
|
if( pDevice )
|
|
|
|
{
|
|
|
|
aPos = pDevice->PixelToLogic( aPos, MapMode(MAP_100TH_MM) );
|
2001-02-26 03:47:06 -06:00
|
|
|
aSize = pDevice->PixelToLogic( aSize, MapMode(MAP_100TH_MM) );
|
|
|
|
}
|
|
|
|
|
|
|
|
Point aPoint;
|
|
|
|
aPoint.X() = aPos.Width();
|
|
|
|
aPoint.Y() = aPos.Height();
|
|
|
|
|
|
|
|
// set rectangle position and size
|
|
|
|
SetSnapRect( Rectangle( aPoint, aSize ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void DlgEdObj::SetPropsFromRect()
|
|
|
|
{
|
2001-07-18 10:28:17 -05:00
|
|
|
// get control property set
|
|
|
|
Reference< beans::XPropertySet > xPSet( GetUnoControlModel(), UNO_QUERY );
|
2001-02-26 03:47:06 -06:00
|
|
|
if (xPSet.is())
|
|
|
|
{
|
2001-07-18 10:28:17 -05:00
|
|
|
// get control position and size from rectangle
|
2001-02-26 03:47:06 -06:00
|
|
|
Rectangle aRect = GetSnapRect();
|
|
|
|
Point aPoint = aRect.TopLeft();
|
|
|
|
Size aSize = aRect.GetSize();
|
|
|
|
Size aPos;
|
|
|
|
aPos.Width() = aPoint.X();
|
|
|
|
aPos.Height() = aPoint.Y();
|
|
|
|
|
2001-07-18 10:28:17 -05:00
|
|
|
// get form position and size from rectangle
|
|
|
|
Rectangle aFormRect = GetDlgEdForm()->GetSnapRect();
|
|
|
|
Point aFormPoint = aFormRect.TopLeft();
|
|
|
|
Size aFormSize = aFormRect.GetSize();
|
|
|
|
Size aFormPos;
|
|
|
|
aFormPos.Width() = aFormPoint.X();
|
|
|
|
aFormPos.Height() = aFormPoint.Y();
|
|
|
|
|
|
|
|
// convert 100th_mm to pixel
|
2001-02-26 03:47:06 -06:00
|
|
|
OutputDevice* pDevice = Application::GetDefaultDevice();
|
|
|
|
DBG_ASSERT( pDevice, "Missing Default Device!" );
|
|
|
|
if( pDevice )
|
|
|
|
{
|
|
|
|
aPos = pDevice->LogicToPixel( aPos, MapMode(MAP_100TH_MM) );
|
|
|
|
aSize = pDevice->LogicToPixel( aSize, MapMode(MAP_100TH_MM) );
|
2001-07-18 10:28:17 -05:00
|
|
|
aFormPos = pDevice->LogicToPixel( aFormPos, MapMode(MAP_100TH_MM) );
|
|
|
|
aFormSize = pDevice->LogicToPixel( aFormSize, MapMode(MAP_100TH_MM) );
|
|
|
|
}
|
|
|
|
|
|
|
|
// take window borders into account
|
|
|
|
awt::DeviceInfo aDeviceInfo;
|
|
|
|
Window* pWindow = GetDlgEdForm()->GetDlgEditor()->GetWindow();
|
|
|
|
Reference< awt::XControl > xDlg( GetDlgEdForm()->GetUnoControl( pWindow ), UNO_QUERY );
|
|
|
|
if ( xDlg.is() )
|
|
|
|
{
|
|
|
|
Reference< awt::XDevice > xDev( xDlg->getPeer(), UNO_QUERY );
|
|
|
|
if ( xDev.is() )
|
|
|
|
aDeviceInfo = xDev->getInfo();
|
|
|
|
}
|
|
|
|
aPos.Width() -= aFormPos.Width() + aDeviceInfo.LeftInset;
|
|
|
|
aPos.Height() -= aFormPos.Height() + aDeviceInfo.TopInset;
|
|
|
|
|
|
|
|
// convert pixel to logic units
|
|
|
|
if( pDevice )
|
|
|
|
{
|
|
|
|
aPos = pDevice->PixelToLogic( aPos, MapMode(MAP_APPFONT) );
|
2001-02-26 03:47:06 -06:00
|
|
|
aSize = pDevice->PixelToLogic( aSize, MapMode(MAP_APPFONT) );
|
|
|
|
}
|
|
|
|
|
|
|
|
// set properties
|
|
|
|
Any aValue;
|
|
|
|
aValue <<= aPos.Width();
|
|
|
|
xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) ), aValue );
|
|
|
|
aValue <<= aPos.Height();
|
|
|
|
xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) ), aValue );
|
|
|
|
aValue <<= aSize.Width();
|
|
|
|
xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Width" ) ), aValue );
|
|
|
|
aValue <<= aSize.Height();
|
|
|
|
xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Height" ) ), aValue );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2001-03-20 07:37:42 -06:00
|
|
|
void SAL_CALL DlgEdObj::NameChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw( ::com::sun::star::uno::RuntimeException)
|
2001-03-01 02:50:51 -06:00
|
|
|
{
|
2001-03-20 07:37:42 -06:00
|
|
|
// get old name
|
|
|
|
::rtl::OUString aOldName;
|
|
|
|
evt.OldValue >>= aOldName;
|
2001-03-01 02:50:51 -06:00
|
|
|
|
2001-03-20 07:37:42 -06:00
|
|
|
// get new name
|
|
|
|
::rtl::OUString aNewName;
|
|
|
|
evt.NewValue >>= aNewName;
|
2001-03-01 02:50:51 -06:00
|
|
|
|
2001-04-10 09:18:14 -05:00
|
|
|
if ( !aNewName.equals(aOldName) )
|
2001-03-20 07:37:42 -06:00
|
|
|
{
|
2001-04-10 09:18:14 -05:00
|
|
|
Reference< container::XNameAccess > xNameAcc((GetDlgEdForm()->GetUnoControlModel()), UNO_QUERY);
|
|
|
|
if ( xNameAcc.is() && xNameAcc->hasByName(aOldName) )
|
2001-03-01 02:50:51 -06:00
|
|
|
{
|
2001-04-10 09:18:14 -05:00
|
|
|
if ( !xNameAcc->hasByName(aNewName) && aNewName.getLength() != 0 )
|
|
|
|
{
|
|
|
|
// remove the control by the old name and insert the control by the new name in the container
|
|
|
|
Reference< container::XNameContainer > xCont(xNameAcc, UNO_QUERY );
|
|
|
|
if ( xCont.is() )
|
|
|
|
{
|
|
|
|
Reference< awt::XControlModel > xCtrl(GetUnoControlModel(), UNO_QUERY);
|
|
|
|
Any aAny;
|
|
|
|
aAny <<= xCtrl;
|
|
|
|
xCont->removeByName( aOldName );
|
|
|
|
xCont->insertByName( aNewName , aAny );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// set old name property
|
|
|
|
EndListening(sal_False);
|
|
|
|
Reference< beans::XPropertySet > xPSet(GetUnoControlModel(), UNO_QUERY);
|
|
|
|
Any aName;
|
|
|
|
aName <<= aOldName;
|
|
|
|
xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Name" ) ), aName );
|
|
|
|
StartListening();
|
|
|
|
}
|
2001-03-01 02:50:51 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2001-03-07 11:10:25 -06:00
|
|
|
sal_Int32 DlgEdObj::GetStep() const
|
|
|
|
{
|
|
|
|
// get step property
|
|
|
|
sal_Int32 nStep;
|
|
|
|
uno::Reference< beans::XPropertySet > xPSet( GetUnoControlModel(), uno::UNO_QUERY );
|
|
|
|
if (xPSet.is())
|
|
|
|
{
|
|
|
|
xPSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Step" ) ) ) >>= nStep;
|
|
|
|
}
|
|
|
|
return nStep;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void DlgEdObj::UpdateStep()
|
|
|
|
{
|
|
|
|
sal_Int32 nCurStep = GetDlgEdForm()->GetStep();
|
|
|
|
sal_Int32 nStep = GetStep();
|
|
|
|
|
|
|
|
if( nCurStep )
|
|
|
|
{
|
|
|
|
SdrLayerAdmin& rLayerAdmin = GetModel()->GetLayerAdmin();
|
|
|
|
SdrLayerID nLayerId = rLayerAdmin.GetLayerID( String( RTL_CONSTASCII_USTRINGPARAM( "HiddenLayer" ) ), FALSE );
|
|
|
|
if ( nStep && (nStep != nCurStep) )
|
|
|
|
{
|
|
|
|
SetLayer( nLayerId );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SetLayer( 0 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SetLayer( 0 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2003-04-11 11:39:00 -05:00
|
|
|
void DlgEdObj::TabIndexChange( const beans::PropertyChangeEvent& evt ) throw (RuntimeException)
|
2001-03-20 07:37:42 -06:00
|
|
|
{
|
2003-11-05 05:40:17 -06:00
|
|
|
DlgEdForm* pForm = GetDlgEdForm();
|
|
|
|
if ( pForm )
|
2001-03-20 07:37:42 -06:00
|
|
|
{
|
2003-11-05 05:40:17 -06:00
|
|
|
// stop listening with all children
|
|
|
|
::std::vector<DlgEdObj*> aChildList = pForm->GetChilds();
|
|
|
|
::std::vector<DlgEdObj*>::iterator aIter;
|
|
|
|
for ( aIter = aChildList.begin() ; aIter != aChildList.end() ; ++aIter )
|
2001-03-20 07:37:42 -06:00
|
|
|
{
|
2003-11-05 05:40:17 -06:00
|
|
|
(*aIter)->EndListening( sal_False );
|
2001-03-20 07:37:42 -06:00
|
|
|
}
|
|
|
|
|
2003-11-05 05:40:17 -06:00
|
|
|
Reference< container::XNameAccess > xNameAcc( pForm->GetUnoControlModel() , UNO_QUERY );
|
|
|
|
if ( xNameAcc.is() )
|
2001-03-20 07:37:42 -06:00
|
|
|
{
|
2003-11-05 05:40:17 -06:00
|
|
|
// get sequence of control names
|
|
|
|
Sequence< ::rtl::OUString > aNames = xNameAcc->getElementNames();
|
|
|
|
const ::rtl::OUString* pNames = aNames.getConstArray();
|
|
|
|
sal_Int32 nCtrls = aNames.getLength();
|
2004-02-04 06:22:27 -06:00
|
|
|
sal_Int16 i;
|
2003-11-05 05:40:17 -06:00
|
|
|
|
|
|
|
// create a map of tab indices and control names, sorted by tab index
|
|
|
|
IndexToNameMap aIndexToNameMap;
|
2004-02-04 06:22:27 -06:00
|
|
|
for ( i = 0; i < nCtrls; ++i )
|
2001-03-20 07:37:42 -06:00
|
|
|
{
|
2003-11-05 05:40:17 -06:00
|
|
|
// get control name
|
|
|
|
::rtl::OUString aName( pNames[i] );
|
|
|
|
|
|
|
|
// get tab index
|
|
|
|
sal_Int16 nTabIndex = -1;
|
|
|
|
Any aCtrl = xNameAcc->getByName( aName );
|
|
|
|
Reference< beans::XPropertySet > xPSet;
|
|
|
|
aCtrl >>= xPSet;
|
|
|
|
if ( xPSet.is() && xPSet == Reference< beans::XPropertySet >( evt.Source, UNO_QUERY ) )
|
|
|
|
evt.OldValue >>= nTabIndex;
|
|
|
|
else if ( xPSet.is() )
|
|
|
|
xPSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TabIndex" ) ) ) >>= nTabIndex;
|
|
|
|
|
|
|
|
// insert into map
|
|
|
|
aIndexToNameMap.insert( IndexToNameMap::value_type( nTabIndex, aName ) );
|
2001-03-20 07:37:42 -06:00
|
|
|
}
|
2002-04-24 08:52:16 -05:00
|
|
|
|
2003-11-05 05:40:17 -06:00
|
|
|
// create a helper list of control names, sorted by tab index
|
|
|
|
::std::vector< ::rtl::OUString > aNameList( aIndexToNameMap.size() );
|
|
|
|
::std::transform(
|
|
|
|
aIndexToNameMap.begin(), aIndexToNameMap.end(),
|
|
|
|
aNameList.begin(),
|
|
|
|
::std::select2nd< IndexToNameMap::value_type >( )
|
|
|
|
);
|
|
|
|
|
|
|
|
// check tab index
|
|
|
|
sal_Int16 nOldTabIndex;
|
|
|
|
evt.OldValue >>= nOldTabIndex;
|
|
|
|
sal_Int16 nNewTabIndex;
|
|
|
|
evt.NewValue >>= nNewTabIndex;
|
|
|
|
if ( nNewTabIndex < 0 )
|
|
|
|
nNewTabIndex = 0;
|
|
|
|
else if ( nNewTabIndex > nCtrls - 1 )
|
|
|
|
nNewTabIndex = nCtrls - 1;
|
|
|
|
|
|
|
|
// reorder helper list
|
|
|
|
::rtl::OUString aCtrlName = aNameList[nOldTabIndex];
|
|
|
|
aNameList.erase( aNameList.begin() + nOldTabIndex );
|
|
|
|
aNameList.insert( aNameList.begin() + nNewTabIndex , aCtrlName );
|
|
|
|
|
|
|
|
// set new tab indices
|
|
|
|
for ( i = 0; i < nCtrls; ++i )
|
|
|
|
{
|
|
|
|
Any aCtrl = xNameAcc->getByName( aNameList[i] );
|
|
|
|
Reference< beans::XPropertySet > xPSet;
|
|
|
|
aCtrl >>= xPSet;
|
|
|
|
if ( xPSet.is() )
|
|
|
|
{
|
|
|
|
Any aTabIndex;
|
|
|
|
aTabIndex <<= (sal_Int16) i;
|
|
|
|
xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "TabIndex" ) ), aTabIndex );
|
|
|
|
}
|
|
|
|
}
|
2001-03-20 07:37:42 -06:00
|
|
|
|
2003-11-05 05:40:17 -06:00
|
|
|
// reorder objects in drawing page
|
|
|
|
GetModel()->GetPage(0)->SetObjectOrdNum( nOldTabIndex + 1, nNewTabIndex + 1 );
|
|
|
|
|
|
|
|
// #110559#
|
|
|
|
pForm->UpdateTabOrderAndGroups();
|
|
|
|
}
|
|
|
|
|
|
|
|
// start listening with all children
|
|
|
|
for ( aIter = aChildList.begin() ; aIter != aChildList.end() ; ++aIter )
|
|
|
|
{
|
|
|
|
(*aIter)->StartListening();
|
|
|
|
}
|
2001-03-20 07:37:42 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2003-03-18 09:17:10 -06:00
|
|
|
sal_Bool DlgEdObj::supportsService( const sal_Char* _pServiceName ) const
|
2001-03-01 02:50:51 -06:00
|
|
|
{
|
2003-03-18 09:17:10 -06:00
|
|
|
sal_Bool bSupports = sal_False;
|
2001-03-16 06:43:42 -06:00
|
|
|
|
2003-03-18 09:17:10 -06:00
|
|
|
Reference< lang::XServiceInfo > xServiceInfo( GetUnoControlModel() , UNO_QUERY );
|
|
|
|
// TODO: cache xServiceInfo as member?
|
|
|
|
if ( xServiceInfo.is() )
|
|
|
|
bSupports = xServiceInfo->supportsService( ::rtl::OUString::createFromAscii( _pServiceName ) );
|
2001-03-16 06:43:42 -06:00
|
|
|
|
2003-03-18 09:17:10 -06:00
|
|
|
return bSupports;
|
2001-03-16 06:43:42 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2001-03-23 09:16:45 -06:00
|
|
|
::rtl::OUString DlgEdObj::GetDefaultName() const
|
2001-03-16 06:43:42 -06:00
|
|
|
{
|
|
|
|
sal_uInt16 nResId = 0;
|
|
|
|
::rtl::OUString aDefaultName;
|
2003-03-18 09:17:10 -06:00
|
|
|
if ( supportsService( "com.sun.star.awt.UnoControlDialogModel" ) )
|
2001-03-16 06:43:42 -06:00
|
|
|
{
|
|
|
|
nResId = RID_STR_CLASS_DIALOG;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlButtonModel" ) )
|
2001-03-16 06:43:42 -06:00
|
|
|
{
|
|
|
|
nResId = RID_STR_CLASS_BUTTON;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlRadioButtonModel" ) )
|
2001-03-16 06:43:42 -06:00
|
|
|
{
|
|
|
|
nResId = RID_STR_CLASS_RADIOBUTTON;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlCheckBoxModel" ) )
|
2001-03-16 06:43:42 -06:00
|
|
|
{
|
|
|
|
nResId = RID_STR_CLASS_CHECKBOX;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlListBoxModel" ) )
|
2001-03-16 06:43:42 -06:00
|
|
|
{
|
|
|
|
nResId = RID_STR_CLASS_LISTBOX;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlComboBoxModel" ) )
|
2001-03-16 06:43:42 -06:00
|
|
|
{
|
|
|
|
nResId = RID_STR_CLASS_COMBOBOX;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlGroupBoxModel" ) )
|
2001-03-16 06:43:42 -06:00
|
|
|
{
|
|
|
|
nResId = RID_STR_CLASS_GROUPBOX;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlEditModel" ) )
|
2001-03-16 06:43:42 -06:00
|
|
|
{
|
|
|
|
nResId = RID_STR_CLASS_EDIT;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlFixedTextModel" ) )
|
2001-03-16 06:43:42 -06:00
|
|
|
{
|
|
|
|
nResId = RID_STR_CLASS_FIXEDTEXT;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlImageControlModel" ) )
|
2001-03-16 06:43:42 -06:00
|
|
|
{
|
|
|
|
nResId = RID_STR_CLASS_IMAGECONTROL;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlProgressBarModel" ) )
|
2001-04-26 06:40:09 -05:00
|
|
|
{
|
|
|
|
nResId = RID_STR_CLASS_PROGRESSBAR;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlScrollBarModel" ) )
|
2001-05-02 06:39:47 -05:00
|
|
|
{
|
|
|
|
nResId = RID_STR_CLASS_SCROLLBAR;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlFixedLineModel" ) )
|
2001-05-04 05:10:36 -05:00
|
|
|
{
|
|
|
|
nResId = RID_STR_CLASS_FIXEDLINE;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlDateFieldModel" ) )
|
2001-09-17 05:24:18 -05:00
|
|
|
{
|
|
|
|
nResId = RID_STR_CLASS_DATEFIELD;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlTimeFieldModel" ) )
|
2001-09-17 05:24:18 -05:00
|
|
|
{
|
|
|
|
nResId = RID_STR_CLASS_TIMEFIELD;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlNumericFieldModel" ) )
|
2001-09-17 05:24:18 -05:00
|
|
|
{
|
|
|
|
nResId = RID_STR_CLASS_NUMERICFIELD;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlCurrencyFieldModel" ) )
|
2001-09-17 05:24:18 -05:00
|
|
|
{
|
|
|
|
nResId = RID_STR_CLASS_CURRENCYFIELD;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlFormattedFieldModel" ) )
|
2001-09-17 05:24:18 -05:00
|
|
|
{
|
|
|
|
nResId = RID_STR_CLASS_FORMATTEDFIELD;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlPatternFieldModel" ) )
|
2001-09-17 05:24:18 -05:00
|
|
|
{
|
|
|
|
nResId = RID_STR_CLASS_PATTERNFIELD;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlFileControlModel" ) )
|
2001-09-17 05:24:18 -05:00
|
|
|
{
|
|
|
|
nResId = RID_STR_CLASS_FILECONTROL;
|
|
|
|
}
|
2001-08-17 07:57:40 -05:00
|
|
|
else
|
|
|
|
{
|
|
|
|
nResId = RID_STR_CLASS_CONTROL;
|
|
|
|
}
|
2001-03-16 06:43:42 -06:00
|
|
|
|
|
|
|
if (nResId)
|
|
|
|
{
|
|
|
|
aDefaultName = ::rtl::OUString( IDEResId(nResId) );
|
|
|
|
}
|
|
|
|
|
|
|
|
return aDefaultName;
|
2001-03-01 02:50:51 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2001-03-23 09:16:45 -06:00
|
|
|
::rtl::OUString DlgEdObj::GetUniqueName() const
|
2001-03-01 02:50:51 -06:00
|
|
|
{
|
2001-03-16 06:43:42 -06:00
|
|
|
::rtl::OUString aUniqueName;
|
2001-03-01 02:50:51 -06:00
|
|
|
uno::Reference< container::XNameAccess > xNameAcc((GetDlgEdForm()->GetUnoControlModel()), uno::UNO_QUERY);
|
|
|
|
|
|
|
|
if ( xNameAcc.is() )
|
|
|
|
{
|
|
|
|
sal_Int32 n = 0;
|
2001-03-16 06:43:42 -06:00
|
|
|
::rtl::OUString aDefaultName = GetDefaultName();
|
2001-03-01 02:50:51 -06:00
|
|
|
|
|
|
|
do
|
|
|
|
{
|
2001-03-16 06:43:42 -06:00
|
|
|
aUniqueName = aDefaultName + ::rtl::OUString::valueOf(++n);
|
|
|
|
} while (xNameAcc->hasByName(aUniqueName));
|
2001-03-01 02:50:51 -06:00
|
|
|
}
|
|
|
|
|
2001-03-16 06:43:42 -06:00
|
|
|
return aUniqueName;
|
2001-03-01 02:50:51 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2001-02-26 03:47:06 -06:00
|
|
|
sal_uInt32 DlgEdObj::GetObjInventor() const
|
|
|
|
{
|
2001-07-27 12:06:15 -05:00
|
|
|
return DlgInventor;
|
2001-02-26 03:47:06 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_uInt16 DlgEdObj::GetObjIdentifier() const
|
|
|
|
{
|
2003-03-18 09:17:10 -06:00
|
|
|
if ( supportsService( "com.sun.star.awt.UnoControlDialogModel" ))
|
2001-03-23 09:16:45 -06:00
|
|
|
{
|
2001-07-27 12:06:15 -05:00
|
|
|
return OBJ_DLG_DIALOG;
|
2001-03-23 09:16:45 -06:00
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlButtonModel" ))
|
2001-03-23 09:16:45 -06:00
|
|
|
{
|
|
|
|
return OBJ_DLG_PUSHBUTTON;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlRadioButtonModel" ))
|
2001-03-23 09:16:45 -06:00
|
|
|
{
|
|
|
|
return OBJ_DLG_RADIOBUTTON;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlCheckBoxModel" ))
|
2001-03-23 09:16:45 -06:00
|
|
|
{
|
|
|
|
return OBJ_DLG_CHECKBOX;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlListBoxModel" ))
|
2001-03-23 09:16:45 -06:00
|
|
|
{
|
|
|
|
return OBJ_DLG_LISTBOX;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlComboBoxModel" ))
|
2001-03-23 09:16:45 -06:00
|
|
|
{
|
|
|
|
return OBJ_DLG_COMBOBOX;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlGroupBoxModel" ))
|
2001-03-23 09:16:45 -06:00
|
|
|
{
|
|
|
|
return OBJ_DLG_GROUPBOX;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlEditModel" ))
|
2001-03-23 09:16:45 -06:00
|
|
|
{
|
|
|
|
return OBJ_DLG_EDIT;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlFixedTextModel" ))
|
2001-03-23 09:16:45 -06:00
|
|
|
{
|
|
|
|
return OBJ_DLG_FIXEDTEXT;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlImageControlModel" ))
|
2001-03-23 09:16:45 -06:00
|
|
|
{
|
2001-05-14 05:23:57 -05:00
|
|
|
return OBJ_DLG_IMAGECONTROL;
|
2001-03-23 09:16:45 -06:00
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlProgressBarModel" ))
|
2001-04-26 06:40:09 -05:00
|
|
|
{
|
2001-05-14 05:23:57 -05:00
|
|
|
return OBJ_DLG_PROGRESSBAR;
|
2001-04-26 06:40:09 -05:00
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlScrollBarModel" ))
|
2001-05-02 06:39:47 -05:00
|
|
|
{
|
2001-05-14 05:23:57 -05:00
|
|
|
return OBJ_DLG_HSCROLLBAR;
|
2001-05-04 05:10:36 -05:00
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlFixedLineModel" ))
|
2001-05-04 05:10:36 -05:00
|
|
|
{
|
2001-05-14 05:23:57 -05:00
|
|
|
return OBJ_DLG_HFIXEDLINE;
|
2001-05-02 06:39:47 -05:00
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlDateFieldModel" ))
|
2001-09-17 05:24:18 -05:00
|
|
|
{
|
|
|
|
return OBJ_DLG_DATEFIELD;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlTimeFieldModel" ))
|
2001-09-17 05:24:18 -05:00
|
|
|
{
|
|
|
|
return OBJ_DLG_TIMEFIELD;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlNumericFieldModel" ))
|
2001-09-17 05:24:18 -05:00
|
|
|
{
|
|
|
|
return OBJ_DLG_NUMERICFIELD;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlCurrencyFieldModel" ))
|
2001-09-17 05:24:18 -05:00
|
|
|
{
|
|
|
|
return OBJ_DLG_CURRENCYFIELD;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlFormattedFieldModel" ))
|
2001-09-17 05:24:18 -05:00
|
|
|
{
|
|
|
|
return OBJ_DLG_FORMATTEDFIELD;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlPatternFieldModel" ))
|
2001-09-17 05:24:18 -05:00
|
|
|
{
|
|
|
|
return OBJ_DLG_PATTERNFIELD;
|
|
|
|
}
|
2003-03-18 09:17:10 -06:00
|
|
|
else if ( supportsService( "com.sun.star.awt.UnoControlFileControlModel" ))
|
2001-09-17 05:24:18 -05:00
|
|
|
{
|
|
|
|
return OBJ_DLG_FILECONTROL;
|
|
|
|
}
|
2001-05-14 05:23:57 -05:00
|
|
|
else
|
2001-03-23 09:16:45 -06:00
|
|
|
{
|
2001-08-17 07:57:40 -05:00
|
|
|
return OBJ_DLG_CONTROL;
|
2001-03-23 09:16:45 -06:00
|
|
|
}
|
2001-02-26 03:47:06 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2002-08-01 09:06:29 -05:00
|
|
|
void DlgEdObj::clonedFrom(const DlgEdObj* _pSource)
|
2001-02-26 03:47:06 -06:00
|
|
|
{
|
2002-08-01 09:06:29 -05:00
|
|
|
// set parent form
|
|
|
|
pDlgEdForm = _pSource->pDlgEdForm;
|
|
|
|
|
|
|
|
// add child to parent form
|
|
|
|
pDlgEdForm->AddChild( this );
|
|
|
|
|
|
|
|
Reference< beans::XPropertySet > xPSet( GetUnoControlModel(), UNO_QUERY );
|
|
|
|
if ( xPSet.is() )
|
|
|
|
{
|
|
|
|
// set new name
|
|
|
|
::rtl::OUString aOUniqueName( GetUniqueName() );
|
|
|
|
Any aUniqueName;
|
|
|
|
aUniqueName <<= aOUniqueName;
|
|
|
|
xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Name" ) ), aUniqueName );
|
|
|
|
|
|
|
|
Reference< container::XNameContainer > xCont( GetDlgEdForm()->GetUnoControlModel() , UNO_QUERY );
|
|
|
|
if ( xCont.is() )
|
|
|
|
{
|
|
|
|
// set tabindex
|
|
|
|
Sequence< OUString > aNames = xCont->getElementNames();
|
|
|
|
Any aTabIndex;
|
|
|
|
aTabIndex <<= (sal_Int16) aNames.getLength();
|
|
|
|
xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "TabIndex" ) ), aTabIndex );
|
|
|
|
|
|
|
|
// insert control model in dialog model
|
|
|
|
Reference< awt::XControlModel > xCtrl( xPSet , UNO_QUERY );
|
|
|
|
Any aCtrl;
|
|
|
|
aCtrl <<= xCtrl;
|
|
|
|
xCont->insertByName( aOUniqueName , aCtrl );
|
2003-11-05 05:40:17 -06:00
|
|
|
|
|
|
|
// #110559#
|
|
|
|
pDlgEdForm->UpdateTabOrderAndGroups();
|
2002-08-01 09:06:29 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// start listening
|
|
|
|
StartListening();
|
2001-02-26 03:47:06 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2002-08-01 09:06:29 -05:00
|
|
|
SdrObject* DlgEdObj::Clone() const
|
2001-02-26 03:47:06 -06:00
|
|
|
{
|
|
|
|
SdrObject* pReturn = SdrUnoObj::Clone();
|
|
|
|
|
2002-08-01 09:06:29 -05:00
|
|
|
DlgEdObj* pDlgEdObj = PTR_CAST(DlgEdObj, pReturn);
|
|
|
|
DBG_ASSERT( pDlgEdObj != NULL, "DlgEdObj::Clone: invalid clone!" );
|
|
|
|
if ( pDlgEdObj )
|
|
|
|
pDlgEdObj->clonedFrom( this );
|
2001-02-26 03:47:06 -06:00
|
|
|
|
|
|
|
return pReturn;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2001-03-23 09:16:45 -06:00
|
|
|
SdrObject* DlgEdObj::Clone(SdrPage* _pPage, SdrModel* _pModel) const // not working yet
|
2001-02-26 03:47:06 -06:00
|
|
|
{
|
2004-05-10 08:22:40 -05:00
|
|
|
// #116235#
|
|
|
|
//SdrObject* pReturn = SdrUnoObj::Clone(_pPage, _pModel);
|
|
|
|
SdrObject* pReturn = SdrUnoObj::Clone();
|
|
|
|
|
|
|
|
if(pReturn)
|
|
|
|
{
|
|
|
|
pReturn->SetModel(_pModel);
|
|
|
|
pReturn->SetPage(_pPage);
|
|
|
|
}
|
2001-02-26 03:47:06 -06:00
|
|
|
|
|
|
|
return pReturn;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2002-08-01 09:06:29 -05:00
|
|
|
void DlgEdObj::operator= (const SdrObject& rObj)
|
2001-02-26 03:47:06 -06:00
|
|
|
{
|
|
|
|
SdrUnoObj::operator= (rObj);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2004-11-03 04:17:12 -06:00
|
|
|
//BFS01void DlgEdObj::WriteData(SvStream& rOut) const // not working yet
|
|
|
|
//BFS01{
|
|
|
|
//BFS01 SdrUnoObj::WriteData(rOut);
|
|
|
|
//BFS01}
|
2001-02-26 03:47:06 -06:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2004-11-03 04:17:12 -06:00
|
|
|
//BFS01void DlgEdObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) // not working yet
|
|
|
|
//BFS01{
|
|
|
|
//BFS01 SdrUnoObj::ReadData(rHead,rIn);
|
|
|
|
//BFS01}
|
2001-02-26 03:47:06 -06:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void DlgEdObj::NbcMove( const Size& rSize )
|
|
|
|
{
|
|
|
|
SdrUnoObj::NbcMove( rSize );
|
2001-04-10 09:18:14 -05:00
|
|
|
|
|
|
|
// stop listening
|
|
|
|
EndListening(sal_False);
|
|
|
|
|
|
|
|
// set geometry properties
|
2001-02-26 03:47:06 -06:00
|
|
|
SetPropsFromRect();
|
2001-04-10 09:18:14 -05:00
|
|
|
|
|
|
|
// start listening
|
|
|
|
StartListening();
|
2001-05-15 07:16:52 -05:00
|
|
|
|
|
|
|
// dialog model changed
|
|
|
|
GetDlgEdForm()->GetDlgEditor()->SetDialogModelChanged(TRUE);
|
2001-02-26 03:47:06 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void DlgEdObj::NbcResize(const Point& rRef, const Fraction& xFract, const Fraction& yFract)
|
|
|
|
{
|
|
|
|
SdrUnoObj::NbcResize( rRef, xFract, yFract );
|
2001-04-10 09:18:14 -05:00
|
|
|
|
|
|
|
// stop listening
|
|
|
|
EndListening(sal_False);
|
|
|
|
|
|
|
|
// set geometry properties
|
2001-02-26 03:47:06 -06:00
|
|
|
SetPropsFromRect();
|
2001-04-10 09:18:14 -05:00
|
|
|
|
|
|
|
// start listening
|
|
|
|
StartListening();
|
2001-05-15 07:16:52 -05:00
|
|
|
|
|
|
|
// dialog model changed
|
|
|
|
GetDlgEdForm()->GetDlgEditor()->SetDialogModelChanged(TRUE);
|
2001-02-26 03:47:06 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
FASTBOOL DlgEdObj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
|
|
|
|
{
|
|
|
|
sal_Bool bResult = SdrUnoObj::EndCreate(rStat, eCmd);
|
|
|
|
|
2002-04-24 08:52:16 -05:00
|
|
|
SetDefaults();
|
2002-08-01 09:06:29 -05:00
|
|
|
StartListening();
|
2002-04-24 08:52:16 -05:00
|
|
|
|
|
|
|
return bResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void DlgEdObj::SetDefaults()
|
|
|
|
{
|
2001-03-02 07:02:06 -06:00
|
|
|
// set parent form
|
2001-03-23 09:16:45 -06:00
|
|
|
pDlgEdForm = ((DlgEdPage*)GetPage())->GetDlgEdForm();
|
2001-03-02 07:02:06 -06:00
|
|
|
|
2003-11-05 05:40:17 -06:00
|
|
|
if ( pDlgEdForm )
|
2002-04-24 08:52:16 -05:00
|
|
|
{
|
2003-11-05 05:40:17 -06:00
|
|
|
// add child to parent form
|
|
|
|
pDlgEdForm->AddChild( this );
|
2002-04-24 08:52:16 -05:00
|
|
|
|
2003-11-05 05:40:17 -06:00
|
|
|
Reference< beans::XPropertySet > xPSet( GetUnoControlModel(), UNO_QUERY );
|
|
|
|
if ( xPSet.is() )
|
2002-04-24 08:52:16 -05:00
|
|
|
{
|
2003-11-05 05:40:17 -06:00
|
|
|
// get unique name
|
|
|
|
::rtl::OUString aOUniqueName( GetUniqueName() );
|
|
|
|
|
|
|
|
// set name property
|
|
|
|
Any aUniqueName;
|
|
|
|
aUniqueName <<= aOUniqueName;
|
|
|
|
xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Name" ) ), aUniqueName );
|
|
|
|
|
|
|
|
// set labels
|
|
|
|
if ( supportsService( "com.sun.star.awt.UnoControlButtonModel" ) ||
|
|
|
|
supportsService( "com.sun.star.awt.UnoControlRadioButtonModel" ) ||
|
|
|
|
supportsService( "com.sun.star.awt.UnoControlCheckBoxModel" ) ||
|
|
|
|
supportsService( "com.sun.star.awt.UnoControlGroupBoxModel" ) ||
|
|
|
|
supportsService( "com.sun.star.awt.UnoControlFixedTextModel" ) )
|
2002-04-24 08:52:16 -05:00
|
|
|
{
|
2003-11-05 05:40:17 -06:00
|
|
|
xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Label" ) ), aUniqueName );
|
2002-04-24 08:52:16 -05:00
|
|
|
}
|
2001-03-01 02:50:51 -06:00
|
|
|
|
2003-11-05 05:40:17 -06:00
|
|
|
// set number formats supplier for formatted field
|
|
|
|
if ( supportsService( "com.sun.star.awt.UnoControlFormattedFieldModel" ) )
|
|
|
|
{
|
|
|
|
Reference< util::XNumberFormatsSupplier > xSupplier = GetDlgEdForm()->GetDlgEditor()->GetNumberFormatsSupplier();
|
|
|
|
if ( xSupplier.is() )
|
|
|
|
{
|
|
|
|
Any aSupplier;
|
|
|
|
aSupplier <<= xSupplier;
|
|
|
|
xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "FormatsSupplier" ) ), aSupplier );
|
|
|
|
}
|
|
|
|
}
|
2001-03-01 02:50:51 -06:00
|
|
|
|
2003-11-05 05:40:17 -06:00
|
|
|
// set geometry properties
|
|
|
|
SetPropsFromRect();
|
2002-04-24 08:52:16 -05:00
|
|
|
|
2003-11-05 05:40:17 -06:00
|
|
|
Reference< container::XNameContainer > xCont( GetDlgEdForm()->GetUnoControlModel() , UNO_QUERY );
|
|
|
|
if ( xCont.is() )
|
2002-04-24 08:52:16 -05:00
|
|
|
{
|
2003-11-05 05:40:17 -06:00
|
|
|
// set tabindex
|
|
|
|
Sequence< OUString > aNames = xCont->getElementNames();
|
|
|
|
uno::Any aTabIndex;
|
|
|
|
aTabIndex <<= (sal_Int16) aNames.getLength();
|
|
|
|
xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "TabIndex" ) ), aTabIndex );
|
2001-03-01 02:50:51 -06:00
|
|
|
|
2003-11-05 05:40:17 -06:00
|
|
|
// set step
|
|
|
|
Reference< beans::XPropertySet > xPSetForm( xCont, UNO_QUERY );
|
|
|
|
if ( xPSetForm.is() )
|
|
|
|
{
|
|
|
|
Any aStep = xPSetForm->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Step" ) ) );
|
|
|
|
xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Step" ) ), aStep );
|
|
|
|
}
|
|
|
|
|
|
|
|
// insert control model in dialog model
|
|
|
|
Reference< awt::XControlModel > xCtrl( xPSet , UNO_QUERY );
|
|
|
|
Any aAny;
|
|
|
|
aAny <<= xCtrl;
|
|
|
|
xCont->insertByName( aOUniqueName , aAny );
|
|
|
|
|
|
|
|
// #110559#
|
|
|
|
pDlgEdForm->UpdateTabOrderAndGroups();
|
|
|
|
}
|
2002-04-24 08:52:16 -05:00
|
|
|
}
|
2001-09-20 03:07:32 -05:00
|
|
|
|
2003-11-05 05:40:17 -06:00
|
|
|
// dialog model changed
|
|
|
|
pDlgEdForm->GetDlgEditor()->SetDialogModelChanged( TRUE );
|
|
|
|
}
|
2001-02-26 03:47:06 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
IMPL_LINK(DlgEdObj, OnCreate, void*, EMPTYTAG)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
if (pTempView)
|
|
|
|
pTempView->ObjectCreated(this);
|
|
|
|
*/
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2001-03-12 04:31:43 -06:00
|
|
|
void DlgEdObj::StartListening()
|
|
|
|
{
|
|
|
|
DBG_ASSERT(!isListening(), "DlgEdObj::StartListening: already listening!");
|
|
|
|
|
|
|
|
if (!isListening())
|
|
|
|
{
|
|
|
|
bIsListening = sal_True;
|
|
|
|
|
|
|
|
// XPropertyChangeListener
|
|
|
|
Reference< XPropertySet > xControlModel( GetUnoControlModel() , UNO_QUERY );
|
|
|
|
if (!m_xPropertyChangeListener.is() && xControlModel.is())
|
|
|
|
{
|
|
|
|
// create listener
|
|
|
|
m_xPropertyChangeListener = static_cast< ::com::sun::star::beans::XPropertyChangeListener*>( new DlgEdPropListenerImpl( (DlgEdObj*)this ) );
|
|
|
|
|
|
|
|
// register listener to properties
|
2001-03-13 10:24:59 -06:00
|
|
|
xControlModel->addPropertyChangeListener( ::rtl::OUString() , m_xPropertyChangeListener );
|
2001-03-12 04:31:43 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// XContainerListener
|
|
|
|
Reference< XScriptEventsSupplier > xEventsSupplier( GetUnoControlModel() , UNO_QUERY );
|
|
|
|
if( !m_xContainerListener.is() && xEventsSupplier.is() )
|
|
|
|
{
|
|
|
|
// create listener
|
|
|
|
m_xContainerListener = static_cast< ::com::sun::star::container::XContainerListener*>( new DlgEdEvtContListenerImpl( (DlgEdObj*)this ) );
|
|
|
|
|
|
|
|
// register listener to script event container
|
|
|
|
Reference< XNameContainer > xEventCont = xEventsSupplier->getEvents();
|
|
|
|
DBG_ASSERT(xEventCont.is(), "DlgEdObj::StartListening: control model has no script event container!");
|
|
|
|
Reference< XContainer > xCont( xEventCont , UNO_QUERY );
|
|
|
|
if (xCont.is())
|
|
|
|
xCont->addContainerListener( m_xContainerListener );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void DlgEdObj::EndListening(sal_Bool bRemoveListener)
|
|
|
|
{
|
|
|
|
DBG_ASSERT(isListening(), "DlgEdObj::EndListening: not listening currently!");
|
|
|
|
|
|
|
|
if (isListening())
|
|
|
|
{
|
|
|
|
bIsListening = sal_False;
|
|
|
|
|
|
|
|
if (bRemoveListener)
|
|
|
|
{
|
|
|
|
// XPropertyChangeListener
|
|
|
|
Reference< XPropertySet > xControlModel(GetUnoControlModel(), UNO_QUERY);
|
|
|
|
if ( m_xPropertyChangeListener.is() && xControlModel.is() )
|
|
|
|
{
|
|
|
|
// remove listener
|
2001-03-13 10:24:59 -06:00
|
|
|
xControlModel->removePropertyChangeListener( ::rtl::OUString() , m_xPropertyChangeListener );
|
2001-03-12 04:31:43 -06:00
|
|
|
}
|
|
|
|
m_xPropertyChangeListener.clear();
|
|
|
|
|
|
|
|
// XContainerListener
|
|
|
|
Reference< XScriptEventsSupplier > xEventsSupplier( GetUnoControlModel() , UNO_QUERY );
|
|
|
|
if( m_xContainerListener.is() && xEventsSupplier.is() )
|
|
|
|
{
|
|
|
|
// remove listener
|
|
|
|
Reference< XNameContainer > xEventCont = xEventsSupplier->getEvents();
|
|
|
|
DBG_ASSERT(xEventCont.is(), "DlgEdObj::EndListening: control model has no script event container!");
|
|
|
|
Reference< XContainer > xCont( xEventCont , UNO_QUERY );
|
|
|
|
if (xCont.is())
|
|
|
|
xCont->removeContainerListener( m_xContainerListener );
|
|
|
|
}
|
|
|
|
m_xContainerListener.clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2001-02-26 03:47:06 -06:00
|
|
|
void SAL_CALL DlgEdObj::_propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw( ::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
if (isListening())
|
|
|
|
{
|
2001-03-06 07:50:13 -06:00
|
|
|
// dialog model changed
|
|
|
|
if ( ISA(DlgEdForm) )
|
|
|
|
{
|
|
|
|
((DlgEdForm*)this)->GetDlgEditor()->SetDialogModelChanged(TRUE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GetDlgEdForm()->GetDlgEditor()->SetDialogModelChanged(TRUE);
|
|
|
|
}
|
|
|
|
|
2001-02-26 03:47:06 -06:00
|
|
|
// set rectangle, if geometry information in the model changed
|
|
|
|
if ( evt.PropertyName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Width")) ||
|
|
|
|
evt.PropertyName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Height")) ||
|
|
|
|
evt.PropertyName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PositionX")) ||
|
|
|
|
evt.PropertyName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PositionY")) )
|
|
|
|
{
|
2001-07-18 10:28:17 -05:00
|
|
|
if ( !ISA(DlgEdForm) )
|
|
|
|
{
|
|
|
|
SetRectFromProps();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// set rectangle of form
|
|
|
|
SetRectFromProps();
|
|
|
|
|
|
|
|
// set rectangles of all childs
|
|
|
|
::std::vector<DlgEdObj*>::iterator aIter;
|
|
|
|
::std::vector<DlgEdObj*> aChildList = ((DlgEdForm*)this)->GetChilds();
|
|
|
|
for ( aIter = aChildList.begin() ; aIter != aChildList.end() ; aIter++ )
|
|
|
|
{
|
|
|
|
(*aIter)->SetRectFromProps();
|
|
|
|
}
|
|
|
|
}
|
2001-02-26 03:47:06 -06:00
|
|
|
}
|
2001-03-06 07:50:13 -06:00
|
|
|
// change name of control in dialog model
|
2001-03-01 02:50:51 -06:00
|
|
|
else if ( evt.PropertyName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name")) )
|
|
|
|
{
|
2001-03-20 07:37:42 -06:00
|
|
|
if ( !ISA(DlgEdForm) )
|
|
|
|
{
|
|
|
|
NameChange(evt);
|
|
|
|
}
|
2001-03-01 02:50:51 -06:00
|
|
|
}
|
2001-03-07 11:10:25 -06:00
|
|
|
// update step
|
|
|
|
else if ( evt.PropertyName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Step")) )
|
|
|
|
{
|
|
|
|
UpdateStep();
|
|
|
|
}
|
2001-03-20 07:37:42 -06:00
|
|
|
// change tabindex
|
|
|
|
else if ( evt.PropertyName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TabIndex")) )
|
|
|
|
{
|
|
|
|
if ( !ISA(DlgEdForm) )
|
|
|
|
{
|
|
|
|
TabIndexChange(evt);
|
|
|
|
}
|
|
|
|
}
|
2001-02-26 03:47:06 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2001-03-12 04:31:43 -06:00
|
|
|
void SAL_CALL DlgEdObj::_elementInserted(const ::com::sun::star::container::ContainerEvent& Event) throw(::com::sun::star::uno::RuntimeException)
|
2001-02-26 03:47:06 -06:00
|
|
|
{
|
2001-03-12 04:31:43 -06:00
|
|
|
if (isListening())
|
2001-02-26 03:47:06 -06:00
|
|
|
{
|
2001-03-12 04:31:43 -06:00
|
|
|
// dialog model changed
|
|
|
|
if ( ISA(DlgEdForm) )
|
2001-02-26 03:47:06 -06:00
|
|
|
{
|
2001-03-12 04:31:43 -06:00
|
|
|
((DlgEdForm*)this)->GetDlgEditor()->SetDialogModelChanged(TRUE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GetDlgEdForm()->GetDlgEditor()->SetDialogModelChanged(TRUE);
|
2001-02-26 03:47:06 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2001-03-12 04:31:43 -06:00
|
|
|
void SAL_CALL DlgEdObj::_elementReplaced(const ::com::sun::star::container::ContainerEvent& Event) throw(::com::sun::star::uno::RuntimeException)
|
2001-02-26 03:47:06 -06:00
|
|
|
{
|
|
|
|
if (isListening())
|
|
|
|
{
|
2001-03-12 04:31:43 -06:00
|
|
|
// dialog model changed
|
|
|
|
if ( ISA(DlgEdForm) )
|
2001-02-26 03:47:06 -06:00
|
|
|
{
|
2001-03-12 04:31:43 -06:00
|
|
|
((DlgEdForm*)this)->GetDlgEditor()->SetDialogModelChanged(TRUE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GetDlgEdForm()->GetDlgEditor()->SetDialogModelChanged(TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2001-02-26 03:47:06 -06:00
|
|
|
|
2001-03-12 04:31:43 -06:00
|
|
|
void SAL_CALL DlgEdObj::_elementRemoved(const ::com::sun::star::container::ContainerEvent& Event) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
if (isListening())
|
|
|
|
{
|
|
|
|
// dialog model changed
|
|
|
|
if ( ISA(DlgEdForm) )
|
|
|
|
{
|
|
|
|
((DlgEdForm*)this)->GetDlgEditor()->SetDialogModelChanged(TRUE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GetDlgEdForm()->GetDlgEditor()->SetDialogModelChanged(TRUE);
|
2001-02-26 03:47:06 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-05-04 09:20:34 -05:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2003-03-26 05:49:33 -06:00
|
|
|
void DlgEdObj::SetLayer(SdrLayerID nLayer)
|
|
|
|
{
|
|
|
|
SdrLayerID nOldLayer = GetLayer();
|
|
|
|
|
|
|
|
if ( nLayer != nOldLayer )
|
|
|
|
{
|
|
|
|
SdrUnoObj::SetLayer( nLayer );
|
|
|
|
|
|
|
|
DlgEdHint aHint( DLGED_HINT_LAYERCHANGED, this );
|
|
|
|
GetDlgEdForm()->GetDlgEditor()->Broadcast( aHint );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2001-05-04 09:20:34 -05:00
|
|
|
SdrObject* DlgEdObj::CheckHit( const Point& rPnt, USHORT nTol,const SetOfByte* pSet ) const
|
|
|
|
{
|
2003-11-05 05:40:17 -06:00
|
|
|
// #109994# fixed here, because the drawing layer doesn't handle objects
|
|
|
|
// with a width or height of 0 in a proper way
|
|
|
|
Rectangle aRect( aOutRect );
|
|
|
|
if ( aRect.IsEmpty() )
|
|
|
|
{
|
|
|
|
aRect.Left() -= nTol;
|
|
|
|
aRect.Top() -= nTol;
|
|
|
|
aRect.Right() = ( aRect.Right() == RECT_EMPTY ? aOutRect.Left() + nTol : aRect.Right() + nTol );
|
|
|
|
aRect.Bottom() = ( aRect.Bottom() == RECT_EMPTY ? aOutRect.Top() + nTol : aRect.Bottom() + nTol );
|
|
|
|
|
|
|
|
if ( aRect.IsInside( rPnt ) )
|
|
|
|
return (SdrObject*)this;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2003-03-18 09:17:10 -06:00
|
|
|
if ( supportsService( "com.sun.star.awt.UnoControlGroupBoxModel" ))
|
2001-05-04 09:20:34 -05:00
|
|
|
{
|
|
|
|
Rectangle aROuter = aOutRect;
|
|
|
|
aROuter.Left() -= nTol;
|
|
|
|
aROuter.Right() += nTol;
|
|
|
|
aROuter.Top() -= nTol;
|
|
|
|
aROuter.Bottom() += nTol;
|
|
|
|
|
|
|
|
Rectangle aRInner = aOutRect;
|
|
|
|
if( (aRInner.GetSize().Height() > (long)nTol*2) &&
|
|
|
|
(aRInner.GetSize().Width() > (long)nTol*2) )
|
|
|
|
{
|
|
|
|
aRInner.Left() += nTol;
|
|
|
|
aRInner.Right() -= nTol;
|
|
|
|
aRInner.Top() += nTol;
|
|
|
|
aRInner.Bottom() -= nTol;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( aROuter.IsInside( rPnt ) && !aRInner.IsInside( rPnt ) )
|
|
|
|
return (SdrObject*)this;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
2003-11-05 05:40:17 -06:00
|
|
|
return SdrUnoObj::CheckHit( rPnt, nTol, pSet );
|
2001-05-04 09:20:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-02-26 03:47:06 -06:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
TYPEINIT1(DlgEdForm, DlgEdObj);
|
|
|
|
DBG_NAME(DlgEdForm);
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
DlgEdForm::DlgEdForm(const ::rtl::OUString& rModelName)
|
|
|
|
:DlgEdObj(rModelName)
|
|
|
|
{
|
|
|
|
DBG_CTOR(DlgEdForm, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
DlgEdForm::DlgEdForm(const ::rtl::OUString& rModelName,
|
|
|
|
const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxSFac)
|
|
|
|
:DlgEdObj(rModelName, rxSFac)
|
|
|
|
{
|
|
|
|
DBG_CTOR(DlgEdForm, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
DlgEdForm::DlgEdForm()
|
|
|
|
:DlgEdObj()
|
|
|
|
{
|
|
|
|
DBG_CTOR(DlgEdForm, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
DlgEdForm::~DlgEdForm()
|
|
|
|
{
|
|
|
|
DBG_DTOR(DlgEdForm, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2001-03-07 11:10:25 -06:00
|
|
|
|
2001-07-18 10:28:17 -05:00
|
|
|
void DlgEdForm::SetRectFromProps()
|
|
|
|
{
|
|
|
|
// get property set
|
|
|
|
Reference< beans::XPropertySet > xPSetForm( GetUnoControlModel(), UNO_QUERY );
|
|
|
|
|
|
|
|
if (xPSetForm.is())
|
|
|
|
{
|
|
|
|
// get form position and size from properties
|
|
|
|
sal_Int32 nFormX, nFormY, nFormWidth, nFormHeight;
|
|
|
|
xPSetForm->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) ) ) >>= nFormX;
|
|
|
|
xPSetForm->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) ) ) >>= nFormY;
|
|
|
|
xPSetForm->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) >>= nFormWidth;
|
|
|
|
xPSetForm->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) >>= nFormHeight;
|
|
|
|
|
|
|
|
Size aFormPos( nFormX, nFormY );
|
|
|
|
Size aFormSize( nFormWidth, nFormHeight );
|
|
|
|
|
|
|
|
// convert logic units to pixel
|
|
|
|
OutputDevice* pDevice = Application::GetDefaultDevice();
|
|
|
|
DBG_ASSERT( pDevice, "Missing Default Device!" );
|
|
|
|
if( pDevice )
|
|
|
|
{
|
|
|
|
aFormPos = pDevice->LogicToPixel( aFormPos, MapMode(MAP_APPFONT) );
|
|
|
|
aFormSize = pDevice->LogicToPixel( aFormSize, MapMode(MAP_APPFONT) );
|
|
|
|
}
|
|
|
|
|
|
|
|
// take window borders into account
|
|
|
|
awt::DeviceInfo aDeviceInfo;
|
|
|
|
Window* pWindow = GetDlgEditor()->GetWindow();
|
|
|
|
Reference< awt::XControl > xDlg( GetUnoControl( pWindow ), UNO_QUERY );
|
|
|
|
if ( xDlg.is() )
|
|
|
|
{
|
|
|
|
Reference< awt::XDevice > xDev( xDlg->getPeer(), UNO_QUERY );
|
|
|
|
if ( xDev.is() )
|
|
|
|
aDeviceInfo = xDev->getInfo();
|
|
|
|
}
|
|
|
|
aFormSize.Width() += aDeviceInfo.LeftInset + aDeviceInfo.RightInset;
|
|
|
|
aFormSize.Height() += aDeviceInfo.TopInset + aDeviceInfo.BottomInset;
|
|
|
|
|
|
|
|
// convert pixel to 100th_mm
|
|
|
|
if( pDevice )
|
|
|
|
{
|
|
|
|
aFormPos = pDevice->PixelToLogic( aFormPos, MapMode(MAP_100TH_MM) );
|
|
|
|
aFormSize = pDevice->PixelToLogic( aFormSize, MapMode(MAP_100TH_MM) );
|
|
|
|
}
|
|
|
|
|
|
|
|
Point aFormPoint;
|
|
|
|
aFormPoint.X() = aFormPos.Width();
|
|
|
|
aFormPoint.Y() = aFormPos.Height();
|
|
|
|
|
|
|
|
// set rectangle position and size
|
|
|
|
SetSnapRect( Rectangle( aFormPoint, aFormSize ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void DlgEdForm::SetPropsFromRect()
|
|
|
|
{
|
|
|
|
//EndListening(sal_False);
|
|
|
|
|
|
|
|
// get control property set
|
|
|
|
Reference< beans::XPropertySet > xPSetForm( GetUnoControlModel(), UNO_QUERY );
|
|
|
|
if (xPSetForm.is())
|
|
|
|
{
|
|
|
|
// get form position and size from rectangle
|
|
|
|
Rectangle aFormRect = GetSnapRect();
|
|
|
|
Point aFormPoint = aFormRect.TopLeft();
|
|
|
|
Size aFormSize = aFormRect.GetSize();
|
|
|
|
Size aFormPos;
|
|
|
|
aFormPos.Width() = aFormPoint.X();
|
|
|
|
aFormPos.Height() = aFormPoint.Y();
|
|
|
|
|
|
|
|
// convert 100th_mm to pixel
|
|
|
|
OutputDevice* pDevice = Application::GetDefaultDevice();
|
|
|
|
DBG_ASSERT( pDevice, "Missing Default Device!" );
|
|
|
|
if( pDevice )
|
|
|
|
{
|
|
|
|
aFormPos = pDevice->LogicToPixel( aFormPos, MapMode(MAP_100TH_MM) );
|
|
|
|
aFormSize = pDevice->LogicToPixel( aFormSize, MapMode(MAP_100TH_MM) );
|
|
|
|
}
|
|
|
|
|
|
|
|
// take window borders into account
|
|
|
|
awt::DeviceInfo aDeviceInfo;
|
|
|
|
Window* pWindow = GetDlgEditor()->GetWindow();
|
|
|
|
Reference< awt::XControl > xDlg( GetUnoControl( pWindow ), UNO_QUERY );
|
|
|
|
if ( xDlg.is() )
|
|
|
|
{
|
|
|
|
Reference< awt::XDevice > xDev( xDlg->getPeer(), UNO_QUERY );
|
|
|
|
if ( xDev.is() )
|
|
|
|
aDeviceInfo = xDev->getInfo();
|
|
|
|
}
|
|
|
|
aFormSize.Width() -= aDeviceInfo.LeftInset + aDeviceInfo.RightInset;
|
|
|
|
aFormSize.Height() -= aDeviceInfo.TopInset + aDeviceInfo.BottomInset;
|
|
|
|
|
|
|
|
// convert pixel to logic units
|
|
|
|
if( pDevice )
|
|
|
|
{
|
|
|
|
aFormPos = pDevice->PixelToLogic( aFormPos, MapMode(MAP_APPFONT) );
|
|
|
|
aFormSize = pDevice->PixelToLogic( aFormSize, MapMode(MAP_APPFONT) );
|
|
|
|
}
|
|
|
|
|
|
|
|
// set properties
|
|
|
|
Any aValue;
|
|
|
|
aValue <<= aFormPos.Width();
|
|
|
|
xPSetForm->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) ), aValue );
|
|
|
|
aValue <<= aFormPos.Height();
|
|
|
|
xPSetForm->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) ), aValue );
|
|
|
|
aValue <<= aFormSize.Width();
|
|
|
|
xPSetForm->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Width" ) ), aValue );
|
|
|
|
aValue <<= aFormSize.Height();
|
|
|
|
xPSetForm->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Height" ) ), aValue );
|
|
|
|
}
|
|
|
|
|
|
|
|
//StartListening();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2001-03-20 07:37:42 -06:00
|
|
|
void DlgEdForm::AddChild( DlgEdObj* pDlgEdObj )
|
|
|
|
{
|
|
|
|
pChilds.push_back( pDlgEdObj );
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void DlgEdForm::RemoveChild( DlgEdObj* pDlgEdObj )
|
|
|
|
{
|
|
|
|
pChilds.erase( ::std::find( pChilds.begin() , pChilds.end() , pDlgEdObj ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2001-03-07 11:10:25 -06:00
|
|
|
void DlgEdForm::UpdateStep()
|
|
|
|
{
|
|
|
|
ULONG nObjCount;
|
|
|
|
SdrPage* pSdrPage = GetPage();
|
|
|
|
|
|
|
|
if ( pSdrPage && ( ( nObjCount = pSdrPage->GetObjCount() ) > 0 ) )
|
|
|
|
{
|
|
|
|
for ( ULONG i = 0 ; i < nObjCount ; i++ )
|
|
|
|
{
|
|
|
|
SdrObject* pObj = pSdrPage->GetObj(i);
|
|
|
|
DlgEdObj* pDlgEdObj = PTR_CAST(DlgEdObj, pObj);
|
|
|
|
if ( pDlgEdObj && !pDlgEdObj->ISA(DlgEdForm) )
|
|
|
|
pDlgEdObj->UpdateStep();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2001-02-26 03:47:06 -06:00
|
|
|
|
2003-04-11 11:39:00 -05:00
|
|
|
void DlgEdForm::UpdateTabIndices()
|
2001-03-20 07:37:42 -06:00
|
|
|
{
|
2003-04-11 11:39:00 -05:00
|
|
|
// stop listening with all children
|
2001-03-20 07:37:42 -06:00
|
|
|
::std::vector<DlgEdObj*>::iterator aIter;
|
2003-04-11 11:39:00 -05:00
|
|
|
for ( aIter = pChilds.begin() ; aIter != pChilds.end() ; ++aIter )
|
2001-03-20 07:37:42 -06:00
|
|
|
{
|
2003-04-11 11:39:00 -05:00
|
|
|
(*aIter)->EndListening( sal_False );
|
2001-03-20 07:37:42 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
Reference< ::com::sun::star::container::XNameAccess > xNameAcc( GetUnoControlModel() , UNO_QUERY );
|
|
|
|
if ( xNameAcc.is() )
|
|
|
|
{
|
|
|
|
// get sequence of control names
|
|
|
|
Sequence< ::rtl::OUString > aNames = xNameAcc->getElementNames();
|
|
|
|
const ::rtl::OUString* pNames = aNames.getConstArray();
|
|
|
|
sal_Int32 nCtrls = aNames.getLength();
|
|
|
|
|
2003-04-11 11:39:00 -05:00
|
|
|
// create a map of tab indices and control names, sorted by tab index
|
|
|
|
IndexToNameMap aIndexToNameMap;
|
|
|
|
for ( sal_Int16 i = 0; i < nCtrls; ++i )
|
2001-03-20 07:37:42 -06:00
|
|
|
{
|
2003-04-11 11:39:00 -05:00
|
|
|
// get name
|
|
|
|
::rtl::OUString aName( pNames[i] );
|
2001-03-20 07:37:42 -06:00
|
|
|
|
2003-04-11 11:39:00 -05:00
|
|
|
// get tab index
|
|
|
|
sal_Int16 nTabIndex = -1;
|
|
|
|
Any aCtrl = xNameAcc->getByName( aName );
|
2001-03-20 07:37:42 -06:00
|
|
|
Reference< ::com::sun::star::beans::XPropertySet > xPSet;
|
|
|
|
aCtrl >>= xPSet;
|
2003-04-11 11:39:00 -05:00
|
|
|
if ( xPSet.is() )
|
|
|
|
xPSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TabIndex" ) ) ) >>= nTabIndex;
|
2001-03-20 07:37:42 -06:00
|
|
|
|
2003-04-11 11:39:00 -05:00
|
|
|
// insert into map
|
|
|
|
aIndexToNameMap.insert( IndexToNameMap::value_type( nTabIndex, aName ) );
|
2001-03-20 07:37:42 -06:00
|
|
|
}
|
|
|
|
|
2003-04-11 11:39:00 -05:00
|
|
|
// set new tab indices
|
|
|
|
sal_Int16 nNewTabIndex = 0;
|
|
|
|
for ( IndexToNameMap::iterator aIt = aIndexToNameMap.begin(); aIt != aIndexToNameMap.end(); ++aIt )
|
2001-03-20 07:37:42 -06:00
|
|
|
{
|
2003-04-11 11:39:00 -05:00
|
|
|
Any aCtrl = xNameAcc->getByName( aIt->second );
|
|
|
|
Reference< beans::XPropertySet > xPSet;
|
2001-03-20 07:37:42 -06:00
|
|
|
aCtrl >>= xPSet;
|
2003-04-11 11:39:00 -05:00
|
|
|
if ( xPSet.is() )
|
2001-03-20 07:37:42 -06:00
|
|
|
{
|
|
|
|
Any aTabIndex;
|
2003-04-11 11:39:00 -05:00
|
|
|
aTabIndex <<= (sal_Int16) nNewTabIndex++;
|
2001-03-20 07:37:42 -06:00
|
|
|
xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "TabIndex" ) ), aTabIndex );
|
|
|
|
}
|
|
|
|
}
|
2003-11-05 05:40:17 -06:00
|
|
|
|
|
|
|
// #110559#
|
|
|
|
UpdateTabOrderAndGroups();
|
2001-03-20 07:37:42 -06:00
|
|
|
}
|
|
|
|
|
2003-04-11 11:39:00 -05:00
|
|
|
// start listening with all children
|
|
|
|
for ( aIter = pChilds.begin() ; aIter != pChilds.end() ; ++aIter )
|
2001-03-20 07:37:42 -06:00
|
|
|
{
|
|
|
|
(*aIter)->StartListening();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2003-11-05 05:40:17 -06:00
|
|
|
void DlgEdForm::UpdateTabOrder()
|
|
|
|
{
|
|
|
|
// #110559#
|
|
|
|
// When the tabindex of a control model changes, the dialog control is
|
|
|
|
// notified about those changes. Due to #109067# (bad performance of
|
|
|
|
// dialog editor) the dialog control doesn't activate the tab order
|
|
|
|
// in design mode. When the dialog editor has reordered all
|
|
|
|
// tabindices, this method allows to activate the taborder afterwards.
|
|
|
|
|
|
|
|
Window* pWindow = GetDlgEditor() ? GetDlgEditor()->GetWindow() : NULL;
|
|
|
|
if ( pWindow )
|
|
|
|
{
|
|
|
|
Reference< awt::XUnoControlContainer > xCont( GetUnoControl( pWindow ), UNO_QUERY );
|
|
|
|
if ( xCont.is() )
|
|
|
|
{
|
|
|
|
Sequence< Reference< awt::XTabController > > aSeqTabCtrls = xCont->getTabControllers();
|
|
|
|
const Reference< awt::XTabController >* pTabCtrls = aSeqTabCtrls.getConstArray();
|
|
|
|
sal_Int32 nCount = aSeqTabCtrls.getLength();
|
|
|
|
for ( sal_Int32 i = 0; i < nCount; ++i )
|
|
|
|
pTabCtrls[i]->activateTabOrder();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void DlgEdForm::UpdateGroups()
|
|
|
|
{
|
|
|
|
// #110559#
|
|
|
|
// The grouping of radio buttons in a dialog is done by vcl.
|
|
|
|
// In the dialog editor we have two views (=controls) for one
|
|
|
|
// radio button model. One control is owned by the dialog control,
|
|
|
|
// but not visible in design mode. The other control is owned by
|
|
|
|
// the drawing layer object. Whereas the grouping of the first
|
|
|
|
// control is done by vcl, the grouping of the control in the
|
|
|
|
// drawing layer has to be done here.
|
|
|
|
|
|
|
|
Reference< awt::XTabControllerModel > xTabModel( GetUnoControlModel() , UNO_QUERY );
|
|
|
|
if ( xTabModel.is() )
|
|
|
|
{
|
|
|
|
Window* pWindow = GetDlgEditor() ? GetDlgEditor()->GetWindow() : NULL;
|
|
|
|
if ( pWindow )
|
|
|
|
{
|
|
|
|
// create a global list of controls that belong to the dialog
|
|
|
|
::std::vector<DlgEdObj*> aChildList = GetChilds();
|
|
|
|
sal_uInt32 nSize = aChildList.size();
|
|
|
|
Sequence< Reference< awt::XControl > > aSeqControls( nSize );
|
|
|
|
for ( sal_uInt32 i = 0; i < nSize; ++i )
|
|
|
|
aSeqControls.getArray()[i] = Reference< awt::XControl >( aChildList[i]->GetUnoControl( pWindow ), UNO_QUERY );
|
|
|
|
|
|
|
|
sal_Int32 nGroupCount = xTabModel->getGroupCount();
|
|
|
|
for ( sal_Int32 nGroup = 0; nGroup < nGroupCount; ++nGroup )
|
|
|
|
{
|
|
|
|
// get a list of control models that belong to this group
|
|
|
|
::rtl::OUString aName;
|
|
|
|
Sequence< Reference< awt::XControlModel > > aSeqModels;
|
|
|
|
xTabModel->getGroup( nGroup, aSeqModels, aName );
|
|
|
|
const Reference< awt::XControlModel >* pModels = aSeqModels.getConstArray();
|
|
|
|
sal_Int32 nModelCount = aSeqModels.getLength();
|
|
|
|
|
|
|
|
// create a list of peers that belong to this group
|
|
|
|
Sequence< Reference< awt::XWindow > > aSeqPeers( nModelCount );
|
|
|
|
for ( sal_Int32 nModel = 0; nModel < nModelCount; ++nModel )
|
|
|
|
{
|
|
|
|
// for each control model find the corresponding control in the global list
|
|
|
|
const Reference< awt::XControl >* pControls = aSeqControls.getConstArray();
|
|
|
|
sal_Int32 nControlCount = aSeqControls.getLength();
|
|
|
|
for ( sal_Int32 nControl = 0; nControl < nControlCount; ++nControl )
|
|
|
|
{
|
|
|
|
const Reference< awt::XControl > xCtrl( pControls[nControl] );
|
|
|
|
if ( xCtrl.is() )
|
|
|
|
{
|
|
|
|
Reference< awt::XControlModel > xCtrlModel( xCtrl->getModel() );
|
|
|
|
if ( (awt::XControlModel*)xCtrlModel.get() == (awt::XControlModel*)pModels[nModel].get() )
|
|
|
|
{
|
|
|
|
// get the control peer and insert into the list of peers
|
|
|
|
aSeqPeers.getArray()[ nModel ] = Reference< awt::XWindow >( xCtrl->getPeer(), UNO_QUERY );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// set the group at the dialog peer
|
|
|
|
Reference< awt::XControl > xDlg( GetUnoControl( pWindow ), UNO_QUERY );
|
|
|
|
if ( xDlg.is() )
|
|
|
|
{
|
|
|
|
Reference< awt::XVclContainerPeer > xDlgPeer( xDlg->getPeer(), UNO_QUERY );
|
|
|
|
if ( xDlgPeer.is() )
|
|
|
|
xDlgPeer->setGroup( aSeqPeers );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void DlgEdForm::UpdateTabOrderAndGroups()
|
|
|
|
{
|
|
|
|
UpdateTabOrder();
|
|
|
|
UpdateGroups();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2001-02-26 03:47:06 -06:00
|
|
|
SdrObject* DlgEdForm::CheckHit( const Point& rPnt, USHORT nTol,
|
|
|
|
const SetOfByte* pSet ) const
|
|
|
|
{
|
|
|
|
Rectangle aROuter = aOutRect;
|
|
|
|
aROuter.Left() -= nTol;
|
|
|
|
aROuter.Right() += nTol;
|
|
|
|
aROuter.Top() -= nTol;
|
|
|
|
aROuter.Bottom() += nTol;
|
|
|
|
|
|
|
|
Rectangle aRInner = aOutRect;
|
|
|
|
if( (aRInner.GetSize().Height() > (long)nTol*2) &&
|
|
|
|
(aRInner.GetSize().Width() > (long)nTol*2) )
|
|
|
|
{
|
|
|
|
aRInner.Left() += nTol;
|
|
|
|
aRInner.Right() -= nTol;
|
|
|
|
aRInner.Top() += nTol;
|
|
|
|
aRInner.Bottom() -= nTol;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( aROuter.IsInside( rPnt ) && !aRInner.IsInside( rPnt ) )
|
|
|
|
return (SdrObject*)this;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2001-05-15 07:16:52 -05:00
|
|
|
void DlgEdForm::NbcMove( const Size& rSize )
|
|
|
|
{
|
|
|
|
SdrUnoObj::NbcMove( rSize );
|
|
|
|
|
|
|
|
// set geometry properties of form
|
|
|
|
EndListening(sal_False);
|
|
|
|
SetPropsFromRect();
|
|
|
|
StartListening();
|
|
|
|
|
|
|
|
// set geometry properties of all childs
|
|
|
|
::std::vector<DlgEdObj*>::iterator aIter;
|
|
|
|
for ( aIter = pChilds.begin() ; aIter != pChilds.end() ; aIter++ )
|
|
|
|
{
|
|
|
|
(*aIter)->EndListening(sal_False);
|
|
|
|
(*aIter)->SetPropsFromRect();
|
|
|
|
(*aIter)->StartListening();
|
|
|
|
}
|
|
|
|
|
|
|
|
// dialog model changed
|
|
|
|
GetDlgEditor()->SetDialogModelChanged(TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void DlgEdForm::NbcResize(const Point& rRef, const Fraction& xFract, const Fraction& yFract)
|
|
|
|
{
|
|
|
|
SdrUnoObj::NbcResize( rRef, xFract, yFract );
|
|
|
|
|
|
|
|
// set geometry properties of form
|
|
|
|
EndListening(sal_False);
|
|
|
|
SetPropsFromRect();
|
|
|
|
StartListening();
|
|
|
|
|
|
|
|
// set geometry properties of all childs
|
|
|
|
::std::vector<DlgEdObj*>::iterator aIter;
|
|
|
|
for ( aIter = pChilds.begin() ; aIter != pChilds.end() ; aIter++ )
|
|
|
|
{
|
|
|
|
(*aIter)->EndListening(sal_False);
|
|
|
|
(*aIter)->SetPropsFromRect();
|
|
|
|
(*aIter)->StartListening();
|
|
|
|
}
|
|
|
|
|
|
|
|
// dialog model changed
|
|
|
|
GetDlgEditor()->SetDialogModelChanged(TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2001-02-26 03:47:06 -06:00
|
|
|
FASTBOOL DlgEdForm::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
|
|
|
|
{
|
|
|
|
sal_Bool bResult = SdrUnoObj::EndCreate(rStat, eCmd);
|
|
|
|
|
2001-03-23 09:16:45 -06:00
|
|
|
// stop listening
|
|
|
|
EndListening(sal_False);
|
|
|
|
|
2001-03-13 10:24:59 -06:00
|
|
|
// set geometry properties
|
2001-02-26 03:47:06 -06:00
|
|
|
SetPropsFromRect();
|
|
|
|
|
2001-03-23 09:16:45 -06:00
|
|
|
// dialog model changed
|
|
|
|
GetDlgEditor()->SetDialogModelChanged(TRUE);
|
|
|
|
|
|
|
|
// start listening
|
|
|
|
StartListening();
|
|
|
|
|
2001-02-26 03:47:06 -06:00
|
|
|
return bResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|