Files
libreoffice/basctl/source/dlged/dlgedobj.cxx

1893 lines
65 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2001-02-26 09:47:06 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2001-02-26 09:47:06 +00:00
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
2001-02-26 09:47:06 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2001-02-26 09:47:06 +00:00
*
* This file is part of OpenOffice.org.
2001-02-26 09:47:06 +00:00
*
* 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.
2001-02-26 09:47:06 +00:00
*
* 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).
2001-02-26 09:47:06 +00:00
*
* 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.
2001-02-26 09:47:06 +00:00
*
************************************************************************/
2001-02-26 09:47:06 +00:00
#include "dlged.hxx"
2011-11-21 20:28:01 -05:00
#include "dlgeddef.hxx"
#include "dlgedlist.hxx"
#include "dlgedobj.hxx"
2001-02-26 09:47:06 +00:00
#include "dlgedpage.hxx"
#include "dlgedview.hxx"
2011-11-21 20:28:01 -05:00
#include "iderid.hxx"
#include "localizationmgr.hxx"
#include "dlgresid.hrc"
#include <com/sun/star/form/binding/XBindableValue.hpp>
#include <com/sun/star/form/binding/XValueBinding.hpp>
#include <com/sun/star/form/binding/XListEntrySink.hpp>
#include <com/sun/star/awt/XUnoControlContainer.hpp>
#include <com/sun/star/awt/XVclContainerPeer.hpp>
2001-03-12 10:31:43 +00:00
#include <com/sun/star/container/XContainer.hpp>
2001-03-16 12:43:42 +00:00
#include <com/sun/star/lang/XServiceInfo.hpp>
2011-11-21 20:28:01 -05:00
#include <com/sun/star/script/XScriptEventsSupplier.hpp>
2011-02-08 19:33:25 +01:00
#include <o3tl/compat_functional.hxx>
2011-11-21 20:28:01 -05:00
#include <unotools/sharedunocomponent.hxx>
#include <vcl/svapp.hxx>
2001-02-26 09:47:06 +00:00
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
2001-03-12 10:31:43 +00:00
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::script;
using ::rtl::OUString;
2001-02-26 09:47:06 +00:00
TYPEINIT1(DlgEdObj, SdrUnoObj);
DBG_NAME(DlgEdObj);
//----------------------------------------------------------------------------
DlgEdObj::DlgEdObj()
:SdrUnoObj(String(), sal_False)
,bIsListening(sal_False)
,pDlgEdForm( NULL )
2001-02-26 09:47:06 +00:00
{
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)
,pDlgEdForm( NULL )
2001-02-26 09:47:06 +00:00
{
DBG_CTOR(DlgEdObj, NULL);
}
//----------------------------------------------------------------------------
DlgEdObj::~DlgEdObj()
{
DBG_DTOR(DlgEdObj, NULL);
if ( isListening() )
EndListening();
2001-02-26 09:47:06 +00:00
}
//----------------------------------------------------------------------------
void DlgEdObj::SetPage(SdrPage* _pNewPage)
{
// now set the page
SdrUnoObj::SetPage(_pNewPage);
}
//----------------------------------------------------------------------------
namespace
{
/** returns the DlgEdForm which the given DlgEdObj belongs to
(which might in fact be the object itself)
Failure to obtain the form will be reported with an assertion in the non-product
version.
*/
bool lcl_getDlgEdForm( DlgEdObj* _pObject, DlgEdForm*& _out_pDlgEdForm )
{
_out_pDlgEdForm = dynamic_cast< DlgEdForm* >( _pObject );
if ( !_out_pDlgEdForm )
_out_pDlgEdForm = _pObject->GetDlgEdForm();
DBG_ASSERT( _out_pDlgEdForm, "lcl_getDlgEdForm: no form!" );
return ( _out_pDlgEdForm != NULL );
}
}
//----------------------------------------------------------------------------
uno::Reference< awt::XControl > DlgEdObj::GetControl() const
{
const DlgEdForm* pForm = GetDlgEdForm();
const DlgEditor* pEditor = pForm ? pForm->GetDlgEditor() : NULL;
SdrView* pView = pEditor ? pEditor->GetView() : NULL;
Window* pWindow = pEditor ? pEditor->GetWindow() : NULL;
OSL_ENSURE( ( pView && pWindow ) || !pForm, "DlgEdObj::GetControl: no view or no window!" );
uno::Reference< awt::XControl > xControl;
if ( pView && pWindow )
xControl = GetUnoControl( *pView, *pWindow );
return xControl;
}
//----------------------------------------------------------------------------
bool DlgEdObj::TransformSdrToControlCoordinates(
sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn,
sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut )
2001-02-26 09:47:06 +00:00
{
// input position and size
Size aPos( nXIn, nYIn );
Size aSize( nWidthIn, nHeightIn );
// form position
DlgEdForm* pForm = NULL;
if ( !lcl_getDlgEdForm( this, pForm ) )
return false;
Rectangle aFormRect = pForm->GetSnapRect();
Size aFormPos( aFormRect.Left(), aFormRect.Top() );
// convert 100th_mm to pixel
OutputDevice* pDevice = Application::GetDefaultDevice();
DBG_ASSERT( pDevice, "DlgEdObj::TransformSdrToControlCoordinates: missing default device!" );
if ( !pDevice )
return false;
aPos = pDevice->LogicToPixel( aPos, MapMode( MAP_100TH_MM ) );
aSize = pDevice->LogicToPixel( aSize, MapMode( MAP_100TH_MM ) );
aFormPos = pDevice->LogicToPixel( aFormPos, MapMode( MAP_100TH_MM ) );
// subtract form position
aPos.Width() -= aFormPos.Width();
aPos.Height() -= aFormPos.Height();
// take window borders into account
Reference< beans::XPropertySet > xPSetForm( pForm->GetUnoControlModel(), UNO_QUERY );
DBG_ASSERT( xPSetForm.is(), "DlgEdObj::TransformFormToSdrCoordinates: no form property set!" );
if ( !xPSetForm.is() )
return false;
bool bDecoration = true;
xPSetForm->getPropertyValue( DLGED_PROP_DECORATION ) >>= bDecoration;
if( bDecoration )
{
awt::DeviceInfo aDeviceInfo = pForm->getDeviceInfo();
aPos.Width() -= aDeviceInfo.LeftInset;
aPos.Height() -= aDeviceInfo.TopInset;
}
// convert pixel to logic units
aPos = pDevice->PixelToLogic( aPos, MAP_APPFONT );
aSize = pDevice->PixelToLogic( aSize, MAP_APPFONT );
// set out parameters
nXOut = aPos.Width();
nYOut = aPos.Height();
nWidthOut = aSize.Width();
nHeightOut = aSize.Height();
return true;
}
//----------------------------------------------------------------------------
bool DlgEdObj::TransformSdrToFormCoordinates(
sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn,
sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut )
{
// input position and size
Size aPos( nXIn, nYIn );
Size aSize( nWidthIn, nHeightIn );
// convert 100th_mm to pixel
OutputDevice* pDevice = Application::GetDefaultDevice();
DBG_ASSERT( pDevice, "DlgEdObj::TransformSdrToFormCoordinates: missing default device!" );
if ( !pDevice )
return false;
aPos = pDevice->LogicToPixel( aPos, MapMode( MAP_100TH_MM ) );
aSize = pDevice->LogicToPixel( aSize, MapMode( MAP_100TH_MM ) );
// take window borders into account
DlgEdForm* pForm = NULL;
if ( !lcl_getDlgEdForm( this, pForm ) )
return false;
// take window borders into account
Reference< beans::XPropertySet > xPSetForm( pForm->GetUnoControlModel(), UNO_QUERY );
DBG_ASSERT( xPSetForm.is(), "DlgEdObj::TransformFormToSdrCoordinates: no form property set!" );
if ( !xPSetForm.is() )
return false;
bool bDecoration = true;
xPSetForm->getPropertyValue( DLGED_PROP_DECORATION ) >>= bDecoration;
if( bDecoration )
{
awt::DeviceInfo aDeviceInfo = pForm->getDeviceInfo();
aSize.Width() -= aDeviceInfo.LeftInset + aDeviceInfo.RightInset;
aSize.Height() -= aDeviceInfo.TopInset + aDeviceInfo.BottomInset;
}
// convert pixel to logic units
aPos = pDevice->PixelToLogic( aPos, MAP_APPFONT );
aSize = pDevice->PixelToLogic( aSize, MAP_APPFONT );
// set out parameters
nXOut = aPos.Width();
nYOut = aPos.Height();
nWidthOut = aSize.Width();
nHeightOut = aSize.Height();
return true;
}
//----------------------------------------------------------------------------
bool DlgEdObj::TransformControlToSdrCoordinates(
sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn,
sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut )
{
// input position and size
Size aPos( nXIn, nYIn );
Size aSize( nWidthIn, nHeightIn );
// form position
DlgEdForm* pForm = NULL;
if ( !lcl_getDlgEdForm( this, pForm ) )
return false;
Reference< beans::XPropertySet > xPSetForm( pForm->GetUnoControlModel(), UNO_QUERY );
DBG_ASSERT( xPSetForm.is(), "DlgEdObj::TransformControlToSdrCoordinates: no form property set!" );
if ( !xPSetForm.is() )
return false;
sal_Int32 nFormX = 0, nFormY = 0, nFormWidth, nFormHeight;
xPSetForm->getPropertyValue( DLGED_PROP_POSITIONX ) >>= nFormX;
xPSetForm->getPropertyValue( DLGED_PROP_POSITIONY ) >>= nFormY;
xPSetForm->getPropertyValue( DLGED_PROP_WIDTH ) >>= nFormWidth;
xPSetForm->getPropertyValue( DLGED_PROP_HEIGHT ) >>= nFormHeight;
Size aFormPos( nFormX, nFormY );
// convert logic units to pixel
OutputDevice* pDevice = Application::GetDefaultDevice();
DBG_ASSERT( pDevice, "DlgEdObj::TransformControlToSdrCoordinates: missing default device!" );
if ( !pDevice )
return false;
aPos = pDevice->LogicToPixel( aPos, MAP_APPFONT );
aSize = pDevice->LogicToPixel( aSize, MAP_APPFONT );
aFormPos = pDevice->LogicToPixel( aFormPos, MAP_APPFONT );
// add form position
aPos.Width() += aFormPos.Width();
aPos.Height() += aFormPos.Height();
// take window borders into account
bool bDecoration = true;
xPSetForm->getPropertyValue( DLGED_PROP_DECORATION ) >>= bDecoration;
if( bDecoration )
{
awt::DeviceInfo aDeviceInfo = pForm->getDeviceInfo();
aPos.Width() += aDeviceInfo.LeftInset;
aPos.Height() += aDeviceInfo.TopInset;
}
// convert pixel to 100th_mm
aPos = pDevice->PixelToLogic( aPos, MapMode( MAP_100TH_MM ) );
aSize = pDevice->PixelToLogic( aSize, MapMode( MAP_100TH_MM ) );
2001-02-26 09:47:06 +00:00
// set out parameters
nXOut = aPos.Width();
nYOut = aPos.Height();
nWidthOut = aSize.Width();
nHeightOut = aSize.Height();
return true;
}
2001-02-26 09:47:06 +00:00
//----------------------------------------------------------------------------
bool DlgEdObj::TransformFormToSdrCoordinates(
sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn,
sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut )
{
// input position and size
Size aPos( nXIn, nYIn );
Size aSize( nWidthIn, nHeightIn );
// convert logic units to pixel
OutputDevice* pDevice = Application::GetDefaultDevice();
DBG_ASSERT( pDevice, "DlgEdObj::TransformFormToSdrCoordinates: missing default device!" );
if ( !pDevice )
return false;
// take window borders into account
DlgEdForm* pForm = NULL;
if ( !lcl_getDlgEdForm( this, pForm ) )
return false;
aPos = pDevice->LogicToPixel( aPos, MAP_APPFONT );
aSize = pDevice->LogicToPixel( aSize, MAP_APPFONT );
// take window borders into account
Reference< beans::XPropertySet > xPSetForm( pForm->GetUnoControlModel(), UNO_QUERY );
DBG_ASSERT( xPSetForm.is(), "DlgEdObj::TransformFormToSdrCoordinates: no form property set!" );
if ( !xPSetForm.is() )
return false;
bool bDecoration = true;
xPSetForm->getPropertyValue( DLGED_PROP_DECORATION ) >>= bDecoration;
if( bDecoration )
{
awt::DeviceInfo aDeviceInfo = pForm->getDeviceInfo();
aSize.Width() += aDeviceInfo.LeftInset + aDeviceInfo.RightInset;
aSize.Height() += aDeviceInfo.TopInset + aDeviceInfo.BottomInset;
}
// convert pixel to 100th_mm
aPos = pDevice->PixelToLogic( aPos, MapMode( MAP_100TH_MM ) );
aSize = pDevice->PixelToLogic( aSize, MapMode( MAP_100TH_MM ) );
// set out parameters
nXOut = aPos.Width();
nYOut = aPos.Height();
nWidthOut = aSize.Width();
nHeightOut = aSize.Height();
return true;
2001-02-26 09:47:06 +00:00
}
//----------------------------------------------------------------------------
void DlgEdObj::SetRectFromProps()
2001-02-26 09:47:06 +00:00
{
// get control position and size from properties
Reference< beans::XPropertySet > xPSet( GetUnoControlModel(), UNO_QUERY );
if ( xPSet.is() )
2001-02-26 09:47:06 +00:00
{
sal_Int32 nXIn = 0, nYIn = 0, nWidthIn = 0, nHeightIn = 0;
xPSet->getPropertyValue( DLGED_PROP_POSITIONX ) >>= nXIn;
xPSet->getPropertyValue( DLGED_PROP_POSITIONY ) >>= nYIn;
xPSet->getPropertyValue( DLGED_PROP_WIDTH ) >>= nWidthIn;
xPSet->getPropertyValue( DLGED_PROP_HEIGHT ) >>= nHeightIn;
// transform coordinates
sal_Int32 nXOut, nYOut, nWidthOut, nHeightOut;
if ( TransformControlToSdrCoordinates( nXIn, nYIn, nWidthIn, nHeightIn, nXOut, nYOut, nWidthOut, nHeightOut ) )
2001-02-26 09:47:06 +00:00
{
// set rectangle position and size
Point aPoint( nXOut, nYOut );
Size aSize( nWidthOut, nHeightOut );
SetSnapRect( Rectangle( aPoint, aSize ) );
}
}
}
//----------------------------------------------------------------------------
void DlgEdObj::SetPropsFromRect()
{
// get control position and size from rectangle
Rectangle aRect_ = GetSnapRect();
sal_Int32 nXIn = aRect_.Left();
sal_Int32 nYIn = aRect_.Top();
sal_Int32 nWidthIn = aRect_.GetWidth();
sal_Int32 nHeightIn = aRect_.GetHeight();
// transform coordinates
sal_Int32 nXOut, nYOut, nWidthOut, nHeightOut;
if ( TransformSdrToControlCoordinates( nXIn, nYIn, nWidthIn, nHeightIn, nXOut, nYOut, nWidthOut, nHeightOut ) )
{
// set properties
Reference< beans::XPropertySet > xPSet( GetUnoControlModel(), UNO_QUERY );
if ( xPSet.is() )
{
Any aValue;
aValue <<= nXOut;
xPSet->setPropertyValue( DLGED_PROP_POSITIONX, aValue );
aValue <<= nYOut;
xPSet->setPropertyValue( DLGED_PROP_POSITIONY, aValue );
aValue <<= nWidthOut;
xPSet->setPropertyValue( DLGED_PROP_WIDTH, aValue );
aValue <<= nHeightOut;
xPSet->setPropertyValue( DLGED_PROP_HEIGHT, aValue );
}
}
}
//----------------------------------------------------------------------------
void DlgEdObj::PositionAndSizeChange( const beans::PropertyChangeEvent& evt )
{
DlgEdPage* pPage_ = 0;
if ( pDlgEdForm )
{
DlgEditor* pEditor = pDlgEdForm->GetDlgEditor();
if ( pEditor )
pPage_ = pEditor->GetPage();
}
DBG_ASSERT( pPage_, "DlgEdObj::PositionAndSizeChange: no page!" );
if ( pPage_ )
{
sal_Int32 nPageXIn = 0;
sal_Int32 nPageYIn = 0;
Size aPageSize = pPage_->GetSize();
sal_Int32 nPageWidthIn = aPageSize.Width();
sal_Int32 nPageHeightIn = aPageSize.Height();
sal_Int32 nPageX, nPageY, nPageWidth, nPageHeight;
if ( TransformSdrToControlCoordinates( nPageXIn, nPageYIn, nPageWidthIn, nPageHeightIn, nPageX, nPageY, nPageWidth, nPageHeight ) )
{
Reference< beans::XPropertySet > xPSet( GetUnoControlModel(), UNO_QUERY );
if ( xPSet.is() )
{
sal_Int32 nX = 0, nY = 0, nWidth = 0, nHeight = 0;
xPSet->getPropertyValue( DLGED_PROP_POSITIONX ) >>= nX;
xPSet->getPropertyValue( DLGED_PROP_POSITIONY ) >>= nY;
xPSet->getPropertyValue( DLGED_PROP_WIDTH ) >>= nWidth;
xPSet->getPropertyValue( DLGED_PROP_HEIGHT ) >>= nHeight;
2001-02-26 09:47:06 +00:00
sal_Int32 nValue = 0;
evt.NewValue >>= nValue;
sal_Int32 nNewValue = nValue;
if ( evt.PropertyName == DLGED_PROP_POSITIONX )
{
if ( nNewValue + nWidth > nPageX + nPageWidth )
nNewValue = nPageX + nPageWidth - nWidth;
if ( nNewValue < nPageX )
nNewValue = nPageX;
}
else if ( evt.PropertyName == DLGED_PROP_POSITIONY )
{
if ( nNewValue + nHeight > nPageY + nPageHeight )
nNewValue = nPageY + nPageHeight - nHeight;
if ( nNewValue < nPageY )
nNewValue = nPageY;
}
else if ( evt.PropertyName == DLGED_PROP_WIDTH )
{
if ( nX + nNewValue > nPageX + nPageWidth )
nNewValue = nPageX + nPageWidth - nX;
if ( nNewValue < 1 )
nNewValue = 1;
}
else if ( evt.PropertyName == DLGED_PROP_HEIGHT )
{
if ( nY + nNewValue > nPageY + nPageHeight )
nNewValue = nPageY + nPageHeight - nY;
if ( nNewValue < 1 )
nNewValue = 1;
}
if ( nNewValue != nValue )
{
Any aNewValue;
aNewValue <<= nNewValue;
EndListening( sal_False );
xPSet->setPropertyValue( evt.PropertyName, aNewValue );
StartListening();
}
}
}
2001-02-26 09:47:06 +00:00
}
SetRectFromProps();
2001-02-26 09:47:06 +00:00
}
//----------------------------------------------------------------------------
2001-03-20 13:37:42 +00:00
void SAL_CALL DlgEdObj::NameChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw( ::com::sun::star::uno::RuntimeException)
{
2001-03-20 13:37:42 +00:00
// get old name
::rtl::OUString aOldName;
evt.OldValue >>= aOldName;
2001-03-20 13:37:42 +00:00
// get new name
::rtl::OUString aNewName;
evt.NewValue >>= aNewName;
2001-04-10 14:18:14 +00:00
if ( !aNewName.equals(aOldName) )
2001-03-20 13:37:42 +00:00
{
2001-04-10 14:18:14 +00:00
Reference< container::XNameAccess > xNameAcc((GetDlgEdForm()->GetUnoControlModel()), UNO_QUERY);
if ( xNameAcc.is() && xNameAcc->hasByName(aOldName) )
{
if ( !xNameAcc->hasByName(aNewName) && !aNewName.isEmpty())
2001-04-10 14:18:14 +00:00
{
// 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 );
DlgEditor* pEditor;
if ( ISA(DlgEdForm) )
pEditor = ((DlgEdForm*)this)->GetDlgEditor();
else
pEditor = GetDlgEdForm()->GetDlgEditor();
LocalizationMgr::renameControlResourceIDsForEditorObject( pEditor, aAny, aNewName );
2001-04-10 14:18:14 +00:00
}
}
else
{
// set old name property
EndListening(sal_False);
Reference< beans::XPropertySet > xPSet(GetUnoControlModel(), UNO_QUERY);
Any aName;
aName <<= aOldName;
xPSet->setPropertyValue( DLGED_PROP_NAME, aName );
2001-04-10 14:18:14 +00:00
StartListening();
}
}
}
}
//----------------------------------------------------------------------------
2001-03-07 17:10:25 +00:00
sal_Int32 DlgEdObj::GetStep() const
{
// get step property
sal_Int32 nStep = 0;
2001-03-07 17:10:25 +00:00
uno::Reference< beans::XPropertySet > xPSet( GetUnoControlModel(), uno::UNO_QUERY );
if (xPSet.is())
{
xPSet->getPropertyValue( DLGED_PROP_STEP ) >>= nStep;
2001-03-07 17:10:25 +00:00
}
return nStep;
}
//----------------------------------------------------------------------------
void DlgEdObj::UpdateStep()
{
sal_Int32 nCurStep = GetDlgEdForm()->GetStep();
sal_Int32 nStep = GetStep();
SdrLayerAdmin& rLayerAdmin = GetModel()->GetLayerAdmin();
2011-11-21 23:54:04 -05:00
SdrLayerID nHiddenLayerId = rLayerAdmin.GetLayerID( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HiddenLayer" ) ), sal_False );
SdrLayerID nControlLayerId = rLayerAdmin.GetLayerID( rLayerAdmin.GetControlLayerName(), sal_False );
2001-03-07 17:10:25 +00:00
if( nCurStep )
{
if ( nStep && (nStep != nCurStep) )
{
SetLayer( nHiddenLayerId );
2001-03-07 17:10:25 +00:00
}
else
{
SetLayer( nControlLayerId );
2001-03-07 17:10:25 +00:00
}
}
else
{
SetLayer( nControlLayerId );
2001-03-07 17:10:25 +00:00
}
}
//----------------------------------------------------------------------------
void DlgEdObj::TabIndexChange( const beans::PropertyChangeEvent& evt ) throw (RuntimeException)
2001-03-20 13:37:42 +00:00
{
DlgEdForm* pForm = GetDlgEdForm();
if ( pForm )
2001-03-20 13:37:42 +00:00
{
// stop listening with all children
2011-12-07 02:33:51 -08:00
::std::vector<DlgEdObj*> aChildList = pForm->GetChildren();
::std::vector<DlgEdObj*>::iterator aIter;
for ( aIter = aChildList.begin() ; aIter != aChildList.end() ; ++aIter )
2001-03-20 13:37:42 +00:00
{
(*aIter)->EndListening( sal_False );
2001-03-20 13:37:42 +00:00
}
Reference< container::XNameAccess > xNameAcc( pForm->GetUnoControlModel() , UNO_QUERY );
if ( xNameAcc.is() )
2001-03-20 13:37:42 +00:00
{
// get sequence of control names
Sequence< ::rtl::OUString > aNames = xNameAcc->getElementNames();
const ::rtl::OUString* pNames = aNames.getConstArray();
sal_Int32 nCtrls = aNames.getLength();
sal_Int16 i;
// create a map of tab indices and control names, sorted by tab index
IndexToNameMap aIndexToNameMap;
for ( i = 0; i < nCtrls; ++i )
2001-03-20 13:37:42 +00: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( DLGED_PROP_TABINDEX ) >>= nTabIndex;
// insert into map
aIndexToNameMap.insert( IndexToNameMap::value_type( nTabIndex, aName ) );
2001-03-20 13:37:42 +00: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(),
2011-02-08 19:33:25 +01:00
::o3tl::select2nd< IndexToNameMap::value_type >( )
);
// check tab index
sal_Int16 nOldTabIndex = 0;
evt.OldValue >>= nOldTabIndex;
sal_Int16 nNewTabIndex = 0;
evt.NewValue >>= nNewTabIndex;
if ( nNewTabIndex < 0 )
nNewTabIndex = 0;
else if ( nNewTabIndex > nCtrls - 1 )
nNewTabIndex = sal::static_int_cast<sal_Int16>( 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( DLGED_PROP_TABINDEX, aTabIndex );
}
}
2001-03-20 13:37:42 +00: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 13:37:42 +00:00
}
}
//----------------------------------------------------------------------------
sal_Bool DlgEdObj::supportsService( const sal_Char* _pServiceName ) const
{
sal_Bool bSupports = sal_False;
2001-03-16 12:43:42 +00: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 12:43:42 +00:00
return bSupports;
2001-03-16 12:43:42 +00:00
}
//----------------------------------------------------------------------------
2001-03-23 15:16:45 +00:00
::rtl::OUString DlgEdObj::GetDefaultName() const
2001-03-16 12:43:42 +00:00
{
sal_uInt16 nResId = 0;
::rtl::OUString aDefaultName;
if ( supportsService( "com.sun.star.awt.UnoControlDialogModel" ) )
2001-03-16 12:43:42 +00:00
{
nResId = RID_STR_CLASS_DIALOG;
}
else if ( supportsService( "com.sun.star.awt.UnoControlButtonModel" ) )
2001-03-16 12:43:42 +00:00
{
nResId = RID_STR_CLASS_BUTTON;
}
else if ( supportsService( "com.sun.star.awt.UnoControlRadioButtonModel" ) )
2001-03-16 12:43:42 +00:00
{
nResId = RID_STR_CLASS_RADIOBUTTON;
}
else if ( supportsService( "com.sun.star.awt.UnoControlCheckBoxModel" ) )
2001-03-16 12:43:42 +00:00
{
nResId = RID_STR_CLASS_CHECKBOX;
}
else if ( supportsService( "com.sun.star.awt.UnoControlListBoxModel" ) )
2001-03-16 12:43:42 +00:00
{
nResId = RID_STR_CLASS_LISTBOX;
}
else if ( supportsService( "com.sun.star.awt.UnoControlComboBoxModel" ) )
2001-03-16 12:43:42 +00:00
{
nResId = RID_STR_CLASS_COMBOBOX;
}
else if ( supportsService( "com.sun.star.awt.UnoControlGroupBoxModel" ) )
2001-03-16 12:43:42 +00:00
{
nResId = RID_STR_CLASS_GROUPBOX;
}
else if ( supportsService( "com.sun.star.awt.UnoControlEditModel" ) )
2001-03-16 12:43:42 +00:00
{
nResId = RID_STR_CLASS_EDIT;
}
else if ( supportsService( "com.sun.star.awt.UnoControlFixedTextModel" ) )
2001-03-16 12:43:42 +00:00
{
nResId = RID_STR_CLASS_FIXEDTEXT;
}
else if ( supportsService( "com.sun.star.awt.UnoControlImageControlModel" ) )
2001-03-16 12:43:42 +00:00
{
nResId = RID_STR_CLASS_IMAGECONTROL;
}
else if ( supportsService( "com.sun.star.awt.UnoControlProgressBarModel" ) )
2001-04-26 11:40:09 +00:00
{
nResId = RID_STR_CLASS_PROGRESSBAR;
}
else if ( supportsService( "com.sun.star.awt.UnoControlScrollBarModel" ) )
2001-05-02 11:39:47 +00:00
{
nResId = RID_STR_CLASS_SCROLLBAR;
}
else if ( supportsService( "com.sun.star.awt.UnoControlFixedLineModel" ) )
2001-05-04 10:10:36 +00:00
{
nResId = RID_STR_CLASS_FIXEDLINE;
}
else if ( supportsService( "com.sun.star.awt.UnoControlDateFieldModel" ) )
{
nResId = RID_STR_CLASS_DATEFIELD;
}
else if ( supportsService( "com.sun.star.awt.UnoControlTimeFieldModel" ) )
{
nResId = RID_STR_CLASS_TIMEFIELD;
}
else if ( supportsService( "com.sun.star.awt.UnoControlNumericFieldModel" ) )
{
nResId = RID_STR_CLASS_NUMERICFIELD;
}
else if ( supportsService( "com.sun.star.awt.UnoControlCurrencyFieldModel" ) )
{
nResId = RID_STR_CLASS_CURRENCYFIELD;
}
else if ( supportsService( "com.sun.star.awt.UnoControlFormattedFieldModel" ) )
{
nResId = RID_STR_CLASS_FORMATTEDFIELD;
}
else if ( supportsService( "com.sun.star.awt.UnoControlPatternFieldModel" ) )
{
nResId = RID_STR_CLASS_PATTERNFIELD;
}
else if ( supportsService( "com.sun.star.awt.UnoControlFileControlModel" ) )
{
nResId = RID_STR_CLASS_FILECONTROL;
}
else if ( supportsService( "com.sun.star.awt.tree.TreeControlModel" ) )
{
nResId = RID_STR_CLASS_TREECONTROL;
}
else if ( supportsService( "com.sun.star.awt.UnoControlSpinButtonModel" ) )
{
nResId = RID_STR_CLASS_SPINCONTROL;
}
else
{
nResId = RID_STR_CLASS_CONTROL;
}
2001-03-16 12:43:42 +00:00
if (nResId)
{
2011-11-21 23:54:04 -05:00
aDefaultName = ResId::toString(IDEResId(nResId));
2001-03-16 12:43:42 +00:00
}
return aDefaultName;
}
//----------------------------------------------------------------------------
2001-03-23 15:16:45 +00:00
::rtl::OUString DlgEdObj::GetUniqueName() const
{
2001-03-16 12:43:42 +00:00
::rtl::OUString aUniqueName;
uno::Reference< container::XNameAccess > xNameAcc((GetDlgEdForm()->GetUnoControlModel()), uno::UNO_QUERY);
if ( xNameAcc.is() )
{
sal_Int32 n = 0;
2001-03-16 12:43:42 +00:00
::rtl::OUString aDefaultName = GetDefaultName();
do
{
2001-03-16 12:43:42 +00:00
aUniqueName = aDefaultName + ::rtl::OUString::valueOf(++n);
} while (xNameAcc->hasByName(aUniqueName));
}
2001-03-16 12:43:42 +00:00
return aUniqueName;
}
//----------------------------------------------------------------------------
2001-02-26 09:47:06 +00:00
sal_uInt32 DlgEdObj::GetObjInventor() const
{
2001-07-27 17:06:15 +00:00
return DlgInventor;
2001-02-26 09:47:06 +00:00
}
//----------------------------------------------------------------------------
sal_uInt16 DlgEdObj::GetObjIdentifier() const
{
if ( supportsService( "com.sun.star.awt.UnoControlDialogModel" ))
2001-03-23 15:16:45 +00:00
{
2001-07-27 17:06:15 +00:00
return OBJ_DLG_DIALOG;
2001-03-23 15:16:45 +00:00
}
else if ( supportsService( "com.sun.star.awt.UnoControlButtonModel" ))
2001-03-23 15:16:45 +00:00
{
return OBJ_DLG_PUSHBUTTON;
}
else if ( supportsService( "com.sun.star.awt.UnoControlRadioButtonModel" ))
2001-03-23 15:16:45 +00:00
{
return OBJ_DLG_RADIOBUTTON;
}
else if ( supportsService( "com.sun.star.awt.UnoControlCheckBoxModel" ))
2001-03-23 15:16:45 +00:00
{
return OBJ_DLG_CHECKBOX;
}
else if ( supportsService( "com.sun.star.awt.UnoControlListBoxModel" ))
2001-03-23 15:16:45 +00:00
{
return OBJ_DLG_LISTBOX;
}
else if ( supportsService( "com.sun.star.awt.UnoControlComboBoxModel" ))
2001-03-23 15:16:45 +00:00
{
return OBJ_DLG_COMBOBOX;
}
else if ( supportsService( "com.sun.star.awt.UnoControlGroupBoxModel" ))
2001-03-23 15:16:45 +00:00
{
return OBJ_DLG_GROUPBOX;
}
else if ( supportsService( "com.sun.star.awt.UnoControlEditModel" ))
2001-03-23 15:16:45 +00:00
{
return OBJ_DLG_EDIT;
}
else if ( supportsService( "com.sun.star.awt.UnoControlFixedTextModel" ))
2001-03-23 15:16:45 +00:00
{
return OBJ_DLG_FIXEDTEXT;
}
else if ( supportsService( "com.sun.star.awt.UnoControlImageControlModel" ))
2001-03-23 15:16:45 +00:00
{
2001-05-14 10:23:57 +00:00
return OBJ_DLG_IMAGECONTROL;
2001-03-23 15:16:45 +00:00
}
else if ( supportsService( "com.sun.star.awt.UnoControlProgressBarModel" ))
2001-04-26 11:40:09 +00:00
{
2001-05-14 10:23:57 +00:00
return OBJ_DLG_PROGRESSBAR;
2001-04-26 11:40:09 +00:00
}
else if ( supportsService( "com.sun.star.awt.UnoControlScrollBarModel" ))
2001-05-02 11:39:47 +00:00
{
2001-05-14 10:23:57 +00:00
return OBJ_DLG_HSCROLLBAR;
2001-05-04 10:10:36 +00:00
}
else if ( supportsService( "com.sun.star.awt.UnoControlFixedLineModel" ))
2001-05-04 10:10:36 +00:00
{
2001-05-14 10:23:57 +00:00
return OBJ_DLG_HFIXEDLINE;
2001-05-02 11:39:47 +00:00
}
else if ( supportsService( "com.sun.star.awt.UnoControlDateFieldModel" ))
{
return OBJ_DLG_DATEFIELD;
}
else if ( supportsService( "com.sun.star.awt.UnoControlTimeFieldModel" ))
{
return OBJ_DLG_TIMEFIELD;
}
else if ( supportsService( "com.sun.star.awt.UnoControlNumericFieldModel" ))
{
return OBJ_DLG_NUMERICFIELD;
}
else if ( supportsService( "com.sun.star.awt.UnoControlCurrencyFieldModel" ))
{
return OBJ_DLG_CURRENCYFIELD;
}
else if ( supportsService( "com.sun.star.awt.UnoControlFormattedFieldModel" ))
{
return OBJ_DLG_FORMATTEDFIELD;
}
else if ( supportsService( "com.sun.star.awt.UnoControlPatternFieldModel" ))
{
return OBJ_DLG_PATTERNFIELD;
}
else if ( supportsService( "com.sun.star.awt.UnoControlFileControlModel" ))
{
return OBJ_DLG_FILECONTROL;
}
else if ( supportsService( "com.sun.star.awt.tree.TreeControlModel" ))
{
return OBJ_DLG_TREECONTROL;
}
2001-05-14 10:23:57 +00:00
else
2001-03-23 15:16:45 +00:00
{
return OBJ_DLG_CONTROL;
2001-03-23 15:16:45 +00:00
}
2001-02-26 09:47:06 +00:00
}
//----------------------------------------------------------------------------
void DlgEdObj::clonedFrom(const DlgEdObj* _pSource)
2001-02-26 09:47:06 +00: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( DLGED_PROP_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( DLGED_PROP_TABINDEX, aTabIndex );
// insert control model in dialog model
Reference< awt::XControlModel > xCtrl( xPSet , UNO_QUERY );
Any aCtrl;
aCtrl <<= xCtrl;
xCont->insertByName( aOUniqueName , aCtrl );
// #110559#
pDlgEdForm->UpdateTabOrderAndGroups();
}
}
// start listening
StartListening();
2001-02-26 09:47:06 +00:00
}
//----------------------------------------------------------------------------
DlgEdObj* DlgEdObj::Clone() const
2001-02-26 09:47:06 +00:00
{
DlgEdObj* pDlgEdObj = CloneHelper< DlgEdObj >();
DBG_ASSERT( pDlgEdObj != NULL, "DlgEdObj::Clone: invalid clone!" );
if ( pDlgEdObj )
pDlgEdObj->clonedFrom( this );
2001-02-26 09:47:06 +00:00
return pDlgEdObj;
2001-02-26 09:47:06 +00:00
}
//----------------------------------------------------------------------------
CWS-TOOLING: integrate CWS aw059 2008-12-16 16:15:40 +0100 aw r265557 : #i95645# avoid expensive tries to stream in graphic data when stream is at end anyways 2008-12-15 16:49:58 +0100 wg r265512 : i97278 2008-12-12 16:02:15 +0100 aw r265427 : #i95645# new formulation was wrong in two places; thanks go to THB. Thanks! 2008-12-12 15:49:06 +0100 aw r265425 : #i95645# refined formulation of AA on/off constraints for VCLCanvas 2008-12-12 14:51:26 +0100 aw r265420 : #i95645# workaround for DrawTransparent of button hilighting when remote displayed; somehow GDI+ does bad dithering in that case 2008-12-12 13:23:00 +0100 aw r265414 : removed temporary build hack; it made it's way in using the rebase; with SVN the rebase is not based on pure checkouts, but uses local changes. 2008-12-11 19:35:59 +0100 aw r265352 : #i95645# need to switch off AA for WNT and UNX, the VCLCanvas is currently not able to handle AA correctly 2008-12-11 16:05:17 +0100 thb r265327 : #i95645# Changed defaults to on; as for the while svx dialog is not changed 2008-12-10 13:40:38 +0100 aw r265180 : #i95645# changed pixel snap to basegfx::fround 2008-12-10 13:25:45 +0100 aw r265177 : corrected linux warning 2008-12-10 12:28:02 +0100 aw r265167 : #i95645# added support for pixel snap/linux resp. no AA for mac (also pixel snap) when AA is switched off to the basegfx::B2DPolyPolygon painting VCL methods; needed for e.g. selection in SC and SW 2008-12-09 18:44:39 +0100 aw r265136 : #i95645# corrected filled path construction 2008-12-09 18:12:40 +0100 aw r265133 : #i95645# added support for non-AAd transparent paints 2008-12-09 18:11:58 +0100 aw r265132 : #i95645# forced selection without AA 2008-12-09 18:11:29 +0100 aw r265131 : #i88893# smoothed/corrected SW selection rects for transparent selection, forced selection without AA 2008-12-09 15:21:39 +0100 aw r265094 : #i95645# corrected FormControl full drag 2008-12-09 15:11:26 +0100 aw r265093 : #i95645# make gdiplus usages more safe when no line or fill color is selected 2008-12-09 14:30:09 +0100 aw r265085 : #i95645# added GDIPlus support 2008-12-09 13:41:06 +0100 aw r265081 : #i95645# added simple AA using GDIPlis to VCL 2008-12-09 13:40:46 +0100 aw r265080 : #i95645# added simple AA using GDIPlis to VCL 2008-12-09 13:40:29 +0100 aw r265079 : #i95645# added simple AA using GDIPlis to VCL 2008-12-09 13:33:16 +0100 aw r265078 : #i95645# changes to requirements, discussed with FPE 2008-12-08 14:11:39 +0100 aw r264995 : #i95646# added missing extra-wireframe for SdrDragObjOwn implementations when object has no border 2008-12-08 14:11:00 +0100 aw r264994 : #i95646# corrected RenderMarkerArrayPrimitive2D OutDev usage in VclProcessor2D 2008-12-08 12:15:10 +0100 ufi r264987 : aw059 2008-12-08 12:14:40 +0100 ufi r264986 : aw059 2008-12-05 13:16:18 +0100 aw r264905 : CWS-TOOLING: rebase CWS aw059 to trunk@264807 (milestone: DEV300:m37) 2008-12-04 11:29:48 +0100 aw r264827 : #i95645# corrected warning 2008-12-03 14:43:39 +0100 aw r264783 : #i95645# simplified overlay manager and objects to stl vector; added stuff to render some more overlay to primitive renderer to get AA support for WIN32 2008-12-03 14:42:43 +0100 aw r264782 : #i95645# added test for WIN32 for AA if cairo canvas is available 2008-12-03 14:42:13 +0100 aw r264781 : #i95645# removed unused options for writer selection overlay 2008-12-03 14:41:51 +0100 aw r264780 : #i95645# removed unused options for calc overlay 2008-12-03 14:41:21 +0100 aw r264779 : #i95645# small corrections in canvas renderer 2008-12-02 18:32:31 +0100 aw r264730 : #i95646# merged cairo version from THB's CWS cairosource01 2008-12-02 15:25:45 +0100 aw r264705 : #i95645# added helpers for the MarkerArrayPrimitive2D change which support buffered creation of the most used markers 2008-12-02 12:50:01 +0100 aw r264690 : #i95645# added a non-saved method IsAAPossibleOnThisSystem to SvtOptionsDrawinglayer to quickly test if AA can be offered on the system, added buffering of that check. 2008-12-02 12:48:51 +0100 aw r264689 : #i95645# unified MarkerArrayPrimitive2D to work bitmap-orientated, adapted usages. Added buffered preparation for needed markers. Minor adaptions for AA 2008-12-02 12:47:53 +0100 aw r264688 : #i95645# unified MarkerArrayPrimitive2D to no longer work on a enum and types of markers, but to use a BitmapEx (or any other Bitmap object) which will be displayed centerd and in discrete coordinates at positions. Adapted decomposition and all usages. Corrected minor stuff with grid primitive 2008-11-28 17:11:12 +0100 thb r264565 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities 2008-11-28 17:03:27 +0100 thb r264563 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities 2008-11-28 17:00:07 +0100 thb r264562 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities 2008-11-28 16:59:51 +0100 thb r264561 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities 2008-11-27 19:13:42 +0100 aw r264519 : #i95646# optimized getLength() a little bit 2008-11-27 19:12:50 +0100 aw r264518 : #i95646# corrected AA expansion of invalidate frame; buffered discrete distance at OM 2008-11-27 18:50:05 +0100 aw r264516 : #i95646# corrected fit to frame texts for WIN32 2008-11-27 15:32:15 +0100 aw r264496 : #i95646# helplines corrected 2008-11-27 15:32:05 +0100 aw r264495 : #i95646# helplines corrected 2008-11-27 15:01:30 +0100 aw r264492 : #i95646# enable AA support for old polygons, especially to get support for MetaFile output 2008-11-27 14:33:28 +0100 aw r264489 : #i95646# AA support for wireframe overlays 2008-11-27 13:40:54 +0100 aw r264485 : #i95646# added full repaint when AA option changes 2008-11-27 13:29:19 +0100 aw r264482 : #i95646# corrected handling of bSolidDragging config entries 2008-11-27 13:29:08 +0100 aw r264481 : #i95646# corrected handling of bSolidDragging config entries 2008-11-27 11:30:12 +0100 aw r264469 : #i95646# corrected IsAAPossibleOnThisSystem implementation 2008-11-26 16:33:04 +0100 aw r264420 : #i95646# adapted OfaViewTabPage to use disable mechanism for AA and HWAccel 2008-11-26 15:49:19 +0100 aw r264406 : #i95646# added DlgEdObj::getFullDragClone() to create specialized simple SdrUnoObj clones for solid dragging 2008-11-26 15:48:11 +0100 aw r264405 : #i95646# changed derivation of ViewObjectContactOfUnoControl to get a valid isPrimitiveVisible() implementation 2008-11-26 14:11:37 +0100 aw r264385 : #i88893# added new look for selection in sw 2008-11-26 11:32:33 +0100 aw r264360 : corrected compiler warning 2008-11-25 18:46:29 +0100 aw r264328 : #i95646# snapshot with FullDrag clones 2008-11-25 18:46:07 +0100 aw r264327 : #i95646# snapshot with FullDrag clones 2008-11-25 18:45:43 +0100 aw r264326 : #i95646# snapshot with FullDrag clones 2008-11-25 18:19:04 +0100 thb r264324 : #i96585# Added missing inline specifier 2008-11-25 13:16:25 +0100 aw r264285 : #i95646# next snapshot 2008-11-25 13:15:33 +0100 aw r264284 : #i95646# next snapshot 2008-11-25 13:15:12 +0100 aw r264283 : #i95646# next snapshot 2008-11-25 13:14:51 +0100 aw r264282 : #i95646# next snapshot 2008-11-20 13:40:49 +0100 aw r264045 : #i95646# stable snapshot 2008-11-20 13:40:29 +0100 aw r264044 : #i95646# stable snapshot 2008-11-20 13:40:06 +0100 aw r264043 : #i95646# stable snapshot 2008-11-20 13:39:45 +0100 aw r264042 : #i95646# stable snapshot 2008-11-18 11:53:39 +0100 aw r263758 : #i95646# snapshot for linux test build 2008-11-18 11:52:54 +0100 aw r263757 : #i95646# snapshot for linux test build 2008-11-18 11:52:02 +0100 aw r263756 : #i95646# snapshot for linux test build 2008-11-14 18:17:49 +0100 aw r263692 : #i95646# snapshot with most stuff working 2008-11-14 18:14:26 +0100 aw r263691 : #i95646# snapshot with most stuff working 2008-11-14 18:12:50 +0100 aw r263690 : #i95646# snapshot with most stuff working 2008-11-14 18:12:16 +0100 aw r263689 : #i95646# snapshot with most stuff working 2008-11-14 18:11:41 +0100 aw r263688 : #i95646# snapshot with most stuff working 2008-11-07 18:44:22 +0100 aw r263479 : #i95968# better support PrefMapMode; special for MAP_PIXEL was missing 2008-11-05 17:39:15 +0100 aw r263356 : #i95644# #i95645# #i95646# bigger change done, saving for another experiment 2008-11-05 17:39:02 +0100 aw r263355 : #i95644# #i95645# #i95646# bigger change done, saving for another experiment 2008-11-05 12:28:32 +0100 aw r263350 : #i95644# #i95645# #i95646# in-between state before bigger change 2008-11-05 12:27:51 +0100 aw r263349 : #i95644# #i95645# #i95646# in-between state before bigger change 2008-11-05 12:26:58 +0100 aw r263348 : #i95644# #i95645# #i95646# in-between state before bigger change 2008-11-05 12:26:17 +0100 aw r263347 : #i95644# #i95645# #i95646# in-between state before bigger change 2008-11-05 12:25:55 +0100 aw r263346 : #i95644# #i95645# #i95646# in-between state before bigger change
2009-01-05 13:44:12 +00:00
SdrObject* DlgEdObj::getFullDragClone() const
2001-02-26 09:47:06 +00:00
{
CWS-TOOLING: integrate CWS aw059 2008-12-16 16:15:40 +0100 aw r265557 : #i95645# avoid expensive tries to stream in graphic data when stream is at end anyways 2008-12-15 16:49:58 +0100 wg r265512 : i97278 2008-12-12 16:02:15 +0100 aw r265427 : #i95645# new formulation was wrong in two places; thanks go to THB. Thanks! 2008-12-12 15:49:06 +0100 aw r265425 : #i95645# refined formulation of AA on/off constraints for VCLCanvas 2008-12-12 14:51:26 +0100 aw r265420 : #i95645# workaround for DrawTransparent of button hilighting when remote displayed; somehow GDI+ does bad dithering in that case 2008-12-12 13:23:00 +0100 aw r265414 : removed temporary build hack; it made it's way in using the rebase; with SVN the rebase is not based on pure checkouts, but uses local changes. 2008-12-11 19:35:59 +0100 aw r265352 : #i95645# need to switch off AA for WNT and UNX, the VCLCanvas is currently not able to handle AA correctly 2008-12-11 16:05:17 +0100 thb r265327 : #i95645# Changed defaults to on; as for the while svx dialog is not changed 2008-12-10 13:40:38 +0100 aw r265180 : #i95645# changed pixel snap to basegfx::fround 2008-12-10 13:25:45 +0100 aw r265177 : corrected linux warning 2008-12-10 12:28:02 +0100 aw r265167 : #i95645# added support for pixel snap/linux resp. no AA for mac (also pixel snap) when AA is switched off to the basegfx::B2DPolyPolygon painting VCL methods; needed for e.g. selection in SC and SW 2008-12-09 18:44:39 +0100 aw r265136 : #i95645# corrected filled path construction 2008-12-09 18:12:40 +0100 aw r265133 : #i95645# added support for non-AAd transparent paints 2008-12-09 18:11:58 +0100 aw r265132 : #i95645# forced selection without AA 2008-12-09 18:11:29 +0100 aw r265131 : #i88893# smoothed/corrected SW selection rects for transparent selection, forced selection without AA 2008-12-09 15:21:39 +0100 aw r265094 : #i95645# corrected FormControl full drag 2008-12-09 15:11:26 +0100 aw r265093 : #i95645# make gdiplus usages more safe when no line or fill color is selected 2008-12-09 14:30:09 +0100 aw r265085 : #i95645# added GDIPlus support 2008-12-09 13:41:06 +0100 aw r265081 : #i95645# added simple AA using GDIPlis to VCL 2008-12-09 13:40:46 +0100 aw r265080 : #i95645# added simple AA using GDIPlis to VCL 2008-12-09 13:40:29 +0100 aw r265079 : #i95645# added simple AA using GDIPlis to VCL 2008-12-09 13:33:16 +0100 aw r265078 : #i95645# changes to requirements, discussed with FPE 2008-12-08 14:11:39 +0100 aw r264995 : #i95646# added missing extra-wireframe for SdrDragObjOwn implementations when object has no border 2008-12-08 14:11:00 +0100 aw r264994 : #i95646# corrected RenderMarkerArrayPrimitive2D OutDev usage in VclProcessor2D 2008-12-08 12:15:10 +0100 ufi r264987 : aw059 2008-12-08 12:14:40 +0100 ufi r264986 : aw059 2008-12-05 13:16:18 +0100 aw r264905 : CWS-TOOLING: rebase CWS aw059 to trunk@264807 (milestone: DEV300:m37) 2008-12-04 11:29:48 +0100 aw r264827 : #i95645# corrected warning 2008-12-03 14:43:39 +0100 aw r264783 : #i95645# simplified overlay manager and objects to stl vector; added stuff to render some more overlay to primitive renderer to get AA support for WIN32 2008-12-03 14:42:43 +0100 aw r264782 : #i95645# added test for WIN32 for AA if cairo canvas is available 2008-12-03 14:42:13 +0100 aw r264781 : #i95645# removed unused options for writer selection overlay 2008-12-03 14:41:51 +0100 aw r264780 : #i95645# removed unused options for calc overlay 2008-12-03 14:41:21 +0100 aw r264779 : #i95645# small corrections in canvas renderer 2008-12-02 18:32:31 +0100 aw r264730 : #i95646# merged cairo version from THB's CWS cairosource01 2008-12-02 15:25:45 +0100 aw r264705 : #i95645# added helpers for the MarkerArrayPrimitive2D change which support buffered creation of the most used markers 2008-12-02 12:50:01 +0100 aw r264690 : #i95645# added a non-saved method IsAAPossibleOnThisSystem to SvtOptionsDrawinglayer to quickly test if AA can be offered on the system, added buffering of that check. 2008-12-02 12:48:51 +0100 aw r264689 : #i95645# unified MarkerArrayPrimitive2D to work bitmap-orientated, adapted usages. Added buffered preparation for needed markers. Minor adaptions for AA 2008-12-02 12:47:53 +0100 aw r264688 : #i95645# unified MarkerArrayPrimitive2D to no longer work on a enum and types of markers, but to use a BitmapEx (or any other Bitmap object) which will be displayed centerd and in discrete coordinates at positions. Adapted decomposition and all usages. Corrected minor stuff with grid primitive 2008-11-28 17:11:12 +0100 thb r264565 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities 2008-11-28 17:03:27 +0100 thb r264563 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities 2008-11-28 17:00:07 +0100 thb r264562 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities 2008-11-28 16:59:51 +0100 thb r264561 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities 2008-11-27 19:13:42 +0100 aw r264519 : #i95646# optimized getLength() a little bit 2008-11-27 19:12:50 +0100 aw r264518 : #i95646# corrected AA expansion of invalidate frame; buffered discrete distance at OM 2008-11-27 18:50:05 +0100 aw r264516 : #i95646# corrected fit to frame texts for WIN32 2008-11-27 15:32:15 +0100 aw r264496 : #i95646# helplines corrected 2008-11-27 15:32:05 +0100 aw r264495 : #i95646# helplines corrected 2008-11-27 15:01:30 +0100 aw r264492 : #i95646# enable AA support for old polygons, especially to get support for MetaFile output 2008-11-27 14:33:28 +0100 aw r264489 : #i95646# AA support for wireframe overlays 2008-11-27 13:40:54 +0100 aw r264485 : #i95646# added full repaint when AA option changes 2008-11-27 13:29:19 +0100 aw r264482 : #i95646# corrected handling of bSolidDragging config entries 2008-11-27 13:29:08 +0100 aw r264481 : #i95646# corrected handling of bSolidDragging config entries 2008-11-27 11:30:12 +0100 aw r264469 : #i95646# corrected IsAAPossibleOnThisSystem implementation 2008-11-26 16:33:04 +0100 aw r264420 : #i95646# adapted OfaViewTabPage to use disable mechanism for AA and HWAccel 2008-11-26 15:49:19 +0100 aw r264406 : #i95646# added DlgEdObj::getFullDragClone() to create specialized simple SdrUnoObj clones for solid dragging 2008-11-26 15:48:11 +0100 aw r264405 : #i95646# changed derivation of ViewObjectContactOfUnoControl to get a valid isPrimitiveVisible() implementation 2008-11-26 14:11:37 +0100 aw r264385 : #i88893# added new look for selection in sw 2008-11-26 11:32:33 +0100 aw r264360 : corrected compiler warning 2008-11-25 18:46:29 +0100 aw r264328 : #i95646# snapshot with FullDrag clones 2008-11-25 18:46:07 +0100 aw r264327 : #i95646# snapshot with FullDrag clones 2008-11-25 18:45:43 +0100 aw r264326 : #i95646# snapshot with FullDrag clones 2008-11-25 18:19:04 +0100 thb r264324 : #i96585# Added missing inline specifier 2008-11-25 13:16:25 +0100 aw r264285 : #i95646# next snapshot 2008-11-25 13:15:33 +0100 aw r264284 : #i95646# next snapshot 2008-11-25 13:15:12 +0100 aw r264283 : #i95646# next snapshot 2008-11-25 13:14:51 +0100 aw r264282 : #i95646# next snapshot 2008-11-20 13:40:49 +0100 aw r264045 : #i95646# stable snapshot 2008-11-20 13:40:29 +0100 aw r264044 : #i95646# stable snapshot 2008-11-20 13:40:06 +0100 aw r264043 : #i95646# stable snapshot 2008-11-20 13:39:45 +0100 aw r264042 : #i95646# stable snapshot 2008-11-18 11:53:39 +0100 aw r263758 : #i95646# snapshot for linux test build 2008-11-18 11:52:54 +0100 aw r263757 : #i95646# snapshot for linux test build 2008-11-18 11:52:02 +0100 aw r263756 : #i95646# snapshot for linux test build 2008-11-14 18:17:49 +0100 aw r263692 : #i95646# snapshot with most stuff working 2008-11-14 18:14:26 +0100 aw r263691 : #i95646# snapshot with most stuff working 2008-11-14 18:12:50 +0100 aw r263690 : #i95646# snapshot with most stuff working 2008-11-14 18:12:16 +0100 aw r263689 : #i95646# snapshot with most stuff working 2008-11-14 18:11:41 +0100 aw r263688 : #i95646# snapshot with most stuff working 2008-11-07 18:44:22 +0100 aw r263479 : #i95968# better support PrefMapMode; special for MAP_PIXEL was missing 2008-11-05 17:39:15 +0100 aw r263356 : #i95644# #i95645# #i95646# bigger change done, saving for another experiment 2008-11-05 17:39:02 +0100 aw r263355 : #i95644# #i95645# #i95646# bigger change done, saving for another experiment 2008-11-05 12:28:32 +0100 aw r263350 : #i95644# #i95645# #i95646# in-between state before bigger change 2008-11-05 12:27:51 +0100 aw r263349 : #i95644# #i95645# #i95646# in-between state before bigger change 2008-11-05 12:26:58 +0100 aw r263348 : #i95644# #i95645# #i95646# in-between state before bigger change 2008-11-05 12:26:17 +0100 aw r263347 : #i95644# #i95645# #i95646# in-between state before bigger change 2008-11-05 12:25:55 +0100 aw r263346 : #i95644# #i95645# #i95646# in-between state before bigger change
2009-01-05 13:44:12 +00:00
// no need to really add the clone for dragging, it's a temporary
// object
SdrObject* pObj = new SdrUnoObj(String());
*pObj = *((const SdrUnoObj*)this);
CWS-TOOLING: integrate CWS aw059 2008-12-16 16:15:40 +0100 aw r265557 : #i95645# avoid expensive tries to stream in graphic data when stream is at end anyways 2008-12-15 16:49:58 +0100 wg r265512 : i97278 2008-12-12 16:02:15 +0100 aw r265427 : #i95645# new formulation was wrong in two places; thanks go to THB. Thanks! 2008-12-12 15:49:06 +0100 aw r265425 : #i95645# refined formulation of AA on/off constraints for VCLCanvas 2008-12-12 14:51:26 +0100 aw r265420 : #i95645# workaround for DrawTransparent of button hilighting when remote displayed; somehow GDI+ does bad dithering in that case 2008-12-12 13:23:00 +0100 aw r265414 : removed temporary build hack; it made it's way in using the rebase; with SVN the rebase is not based on pure checkouts, but uses local changes. 2008-12-11 19:35:59 +0100 aw r265352 : #i95645# need to switch off AA for WNT and UNX, the VCLCanvas is currently not able to handle AA correctly 2008-12-11 16:05:17 +0100 thb r265327 : #i95645# Changed defaults to on; as for the while svx dialog is not changed 2008-12-10 13:40:38 +0100 aw r265180 : #i95645# changed pixel snap to basegfx::fround 2008-12-10 13:25:45 +0100 aw r265177 : corrected linux warning 2008-12-10 12:28:02 +0100 aw r265167 : #i95645# added support for pixel snap/linux resp. no AA for mac (also pixel snap) when AA is switched off to the basegfx::B2DPolyPolygon painting VCL methods; needed for e.g. selection in SC and SW 2008-12-09 18:44:39 +0100 aw r265136 : #i95645# corrected filled path construction 2008-12-09 18:12:40 +0100 aw r265133 : #i95645# added support for non-AAd transparent paints 2008-12-09 18:11:58 +0100 aw r265132 : #i95645# forced selection without AA 2008-12-09 18:11:29 +0100 aw r265131 : #i88893# smoothed/corrected SW selection rects for transparent selection, forced selection without AA 2008-12-09 15:21:39 +0100 aw r265094 : #i95645# corrected FormControl full drag 2008-12-09 15:11:26 +0100 aw r265093 : #i95645# make gdiplus usages more safe when no line or fill color is selected 2008-12-09 14:30:09 +0100 aw r265085 : #i95645# added GDIPlus support 2008-12-09 13:41:06 +0100 aw r265081 : #i95645# added simple AA using GDIPlis to VCL 2008-12-09 13:40:46 +0100 aw r265080 : #i95645# added simple AA using GDIPlis to VCL 2008-12-09 13:40:29 +0100 aw r265079 : #i95645# added simple AA using GDIPlis to VCL 2008-12-09 13:33:16 +0100 aw r265078 : #i95645# changes to requirements, discussed with FPE 2008-12-08 14:11:39 +0100 aw r264995 : #i95646# added missing extra-wireframe for SdrDragObjOwn implementations when object has no border 2008-12-08 14:11:00 +0100 aw r264994 : #i95646# corrected RenderMarkerArrayPrimitive2D OutDev usage in VclProcessor2D 2008-12-08 12:15:10 +0100 ufi r264987 : aw059 2008-12-08 12:14:40 +0100 ufi r264986 : aw059 2008-12-05 13:16:18 +0100 aw r264905 : CWS-TOOLING: rebase CWS aw059 to trunk@264807 (milestone: DEV300:m37) 2008-12-04 11:29:48 +0100 aw r264827 : #i95645# corrected warning 2008-12-03 14:43:39 +0100 aw r264783 : #i95645# simplified overlay manager and objects to stl vector; added stuff to render some more overlay to primitive renderer to get AA support for WIN32 2008-12-03 14:42:43 +0100 aw r264782 : #i95645# added test for WIN32 for AA if cairo canvas is available 2008-12-03 14:42:13 +0100 aw r264781 : #i95645# removed unused options for writer selection overlay 2008-12-03 14:41:51 +0100 aw r264780 : #i95645# removed unused options for calc overlay 2008-12-03 14:41:21 +0100 aw r264779 : #i95645# small corrections in canvas renderer 2008-12-02 18:32:31 +0100 aw r264730 : #i95646# merged cairo version from THB's CWS cairosource01 2008-12-02 15:25:45 +0100 aw r264705 : #i95645# added helpers for the MarkerArrayPrimitive2D change which support buffered creation of the most used markers 2008-12-02 12:50:01 +0100 aw r264690 : #i95645# added a non-saved method IsAAPossibleOnThisSystem to SvtOptionsDrawinglayer to quickly test if AA can be offered on the system, added buffering of that check. 2008-12-02 12:48:51 +0100 aw r264689 : #i95645# unified MarkerArrayPrimitive2D to work bitmap-orientated, adapted usages. Added buffered preparation for needed markers. Minor adaptions for AA 2008-12-02 12:47:53 +0100 aw r264688 : #i95645# unified MarkerArrayPrimitive2D to no longer work on a enum and types of markers, but to use a BitmapEx (or any other Bitmap object) which will be displayed centerd and in discrete coordinates at positions. Adapted decomposition and all usages. Corrected minor stuff with grid primitive 2008-11-28 17:11:12 +0100 thb r264565 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities 2008-11-28 17:03:27 +0100 thb r264563 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities 2008-11-28 17:00:07 +0100 thb r264562 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities 2008-11-28 16:59:51 +0100 thb r264561 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities 2008-11-27 19:13:42 +0100 aw r264519 : #i95646# optimized getLength() a little bit 2008-11-27 19:12:50 +0100 aw r264518 : #i95646# corrected AA expansion of invalidate frame; buffered discrete distance at OM 2008-11-27 18:50:05 +0100 aw r264516 : #i95646# corrected fit to frame texts for WIN32 2008-11-27 15:32:15 +0100 aw r264496 : #i95646# helplines corrected 2008-11-27 15:32:05 +0100 aw r264495 : #i95646# helplines corrected 2008-11-27 15:01:30 +0100 aw r264492 : #i95646# enable AA support for old polygons, especially to get support for MetaFile output 2008-11-27 14:33:28 +0100 aw r264489 : #i95646# AA support for wireframe overlays 2008-11-27 13:40:54 +0100 aw r264485 : #i95646# added full repaint when AA option changes 2008-11-27 13:29:19 +0100 aw r264482 : #i95646# corrected handling of bSolidDragging config entries 2008-11-27 13:29:08 +0100 aw r264481 : #i95646# corrected handling of bSolidDragging config entries 2008-11-27 11:30:12 +0100 aw r264469 : #i95646# corrected IsAAPossibleOnThisSystem implementation 2008-11-26 16:33:04 +0100 aw r264420 : #i95646# adapted OfaViewTabPage to use disable mechanism for AA and HWAccel 2008-11-26 15:49:19 +0100 aw r264406 : #i95646# added DlgEdObj::getFullDragClone() to create specialized simple SdrUnoObj clones for solid dragging 2008-11-26 15:48:11 +0100 aw r264405 : #i95646# changed derivation of ViewObjectContactOfUnoControl to get a valid isPrimitiveVisible() implementation 2008-11-26 14:11:37 +0100 aw r264385 : #i88893# added new look for selection in sw 2008-11-26 11:32:33 +0100 aw r264360 : corrected compiler warning 2008-11-25 18:46:29 +0100 aw r264328 : #i95646# snapshot with FullDrag clones 2008-11-25 18:46:07 +0100 aw r264327 : #i95646# snapshot with FullDrag clones 2008-11-25 18:45:43 +0100 aw r264326 : #i95646# snapshot with FullDrag clones 2008-11-25 18:19:04 +0100 thb r264324 : #i96585# Added missing inline specifier 2008-11-25 13:16:25 +0100 aw r264285 : #i95646# next snapshot 2008-11-25 13:15:33 +0100 aw r264284 : #i95646# next snapshot 2008-11-25 13:15:12 +0100 aw r264283 : #i95646# next snapshot 2008-11-25 13:14:51 +0100 aw r264282 : #i95646# next snapshot 2008-11-20 13:40:49 +0100 aw r264045 : #i95646# stable snapshot 2008-11-20 13:40:29 +0100 aw r264044 : #i95646# stable snapshot 2008-11-20 13:40:06 +0100 aw r264043 : #i95646# stable snapshot 2008-11-20 13:39:45 +0100 aw r264042 : #i95646# stable snapshot 2008-11-18 11:53:39 +0100 aw r263758 : #i95646# snapshot for linux test build 2008-11-18 11:52:54 +0100 aw r263757 : #i95646# snapshot for linux test build 2008-11-18 11:52:02 +0100 aw r263756 : #i95646# snapshot for linux test build 2008-11-14 18:17:49 +0100 aw r263692 : #i95646# snapshot with most stuff working 2008-11-14 18:14:26 +0100 aw r263691 : #i95646# snapshot with most stuff working 2008-11-14 18:12:50 +0100 aw r263690 : #i95646# snapshot with most stuff working 2008-11-14 18:12:16 +0100 aw r263689 : #i95646# snapshot with most stuff working 2008-11-14 18:11:41 +0100 aw r263688 : #i95646# snapshot with most stuff working 2008-11-07 18:44:22 +0100 aw r263479 : #i95968# better support PrefMapMode; special for MAP_PIXEL was missing 2008-11-05 17:39:15 +0100 aw r263356 : #i95644# #i95645# #i95646# bigger change done, saving for another experiment 2008-11-05 17:39:02 +0100 aw r263355 : #i95644# #i95645# #i95646# bigger change done, saving for another experiment 2008-11-05 12:28:32 +0100 aw r263350 : #i95644# #i95645# #i95646# in-between state before bigger change 2008-11-05 12:27:51 +0100 aw r263349 : #i95644# #i95645# #i95646# in-between state before bigger change 2008-11-05 12:26:58 +0100 aw r263348 : #i95644# #i95645# #i95646# in-between state before bigger change 2008-11-05 12:26:17 +0100 aw r263347 : #i95644# #i95645# #i95646# in-between state before bigger change 2008-11-05 12:25:55 +0100 aw r263346 : #i95644# #i95645# #i95646# in-between state before bigger change
2009-01-05 13:44:12 +00:00
return pObj;
2001-02-26 09:47:06 +00:00
}
//----------------------------------------------------------------------------
void DlgEdObj::NbcMove( const Size& rSize )
{
SdrUnoObj::NbcMove( rSize );
2001-04-10 14:18:14 +00:00
// stop listening
EndListening(sal_False);
// set geometry properties
2001-02-26 09:47:06 +00:00
SetPropsFromRect();
2001-04-10 14:18:14 +00:00
// start listening
StartListening();
2001-05-15 12:16:52 +00:00
// dialog model changed
GetDlgEdForm()->GetDlgEditor()->SetDialogModelChanged(sal_True);
2001-02-26 09:47:06 +00:00
}
//----------------------------------------------------------------------------
void DlgEdObj::NbcResize(const Point& rRef, const Fraction& xFract, const Fraction& yFract)
{
SdrUnoObj::NbcResize( rRef, xFract, yFract );
2001-04-10 14:18:14 +00:00
// stop listening
EndListening(sal_False);
// set geometry properties
2001-02-26 09:47:06 +00:00
SetPropsFromRect();
2001-04-10 14:18:14 +00:00
// start listening
StartListening();
2001-05-15 12:16:52 +00:00
// dialog model changed
GetDlgEdForm()->GetDlgEditor()->SetDialogModelChanged(sal_True);
2001-02-26 09:47:06 +00:00
}
//----------------------------------------------------------------------------
2010-10-05 07:57:51 -05:00
bool DlgEdObj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
2001-02-26 09:47:06 +00:00
{
2010-10-05 07:57:51 -05:00
bool bResult = SdrUnoObj::EndCreate(rStat, eCmd);
2001-02-26 09:47:06 +00:00
SetDefaults();
StartListening();
return bResult;
}
//----------------------------------------------------------------------------
void DlgEdObj::SetDefaults()
{
// set parent form
2001-03-23 15:16:45 +00:00
pDlgEdForm = ((DlgEdPage*)GetPage())->GetDlgEdForm();
if ( pDlgEdForm )
{
// add child to parent form
pDlgEdForm->AddChild( this );
Reference< beans::XPropertySet > xPSet( GetUnoControlModel(), UNO_QUERY );
if ( xPSet.is() )
{
// get unique name
::rtl::OUString aOUniqueName( GetUniqueName() );
// set name property
Any aUniqueName;
aUniqueName <<= aOUniqueName;
xPSet->setPropertyValue( DLGED_PROP_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" ) )
{
xPSet->setPropertyValue( DLGED_PROP_LABEL, aUniqueName );
}
// 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( DLGED_PROP_FORMATSSUPPLIER, aSupplier );
}
}
// set geometry properties
SetPropsFromRect();
Reference< container::XNameContainer > xCont( GetDlgEdForm()->GetUnoControlModel() , UNO_QUERY );
if ( xCont.is() )
{
// set tabindex
Sequence< OUString > aNames = xCont->getElementNames();
uno::Any aTabIndex;
aTabIndex <<= (sal_Int16) aNames.getLength();
xPSet->setPropertyValue( DLGED_PROP_TABINDEX, aTabIndex );
// set step
Reference< beans::XPropertySet > xPSetForm( xCont, UNO_QUERY );
if ( xPSetForm.is() )
{
Any aStep = xPSetForm->getPropertyValue( DLGED_PROP_STEP );
xPSet->setPropertyValue( DLGED_PROP_STEP, aStep );
}
// insert control model in dialog model
Reference< awt::XControlModel > xCtrl( xPSet , UNO_QUERY );
Any aAny;
aAny <<= xCtrl;
xCont->insertByName( aOUniqueName , aAny );
DlgEditor* pEditor;
if ( ISA(DlgEdForm) )
pEditor = ((DlgEdForm*)this)->GetDlgEditor();
else
pEditor = GetDlgEdForm()->GetDlgEditor();
LocalizationMgr::setControlResourceIDsForNewEditorObject( pEditor, aAny, aOUniqueName );
// #110559#
pDlgEdForm->UpdateTabOrderAndGroups();
}
}
// dialog model changed
pDlgEdForm->GetDlgEditor()->SetDialogModelChanged( sal_True );
}
2001-02-26 09:47:06 +00:00
}
//----------------------------------------------------------------------------
2001-03-12 10:31:43 +00: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 16:24:59 +00:00
xControlModel->addPropertyChangeListener( ::rtl::OUString() , m_xPropertyChangeListener );
2001-03-12 10:31:43 +00: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 16:24:59 +00:00
xControlModel->removePropertyChangeListener( ::rtl::OUString() , m_xPropertyChangeListener );
2001-03-12 10:31:43 +00: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 09:47:06 +00:00
void SAL_CALL DlgEdObj::_propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw( ::com::sun::star::uno::RuntimeException)
{
if (isListening())
{
DlgEdForm* pRealDlgEdForm = dynamic_cast< DlgEdForm* >(this);
if( pRealDlgEdForm == 0 )
pRealDlgEdForm = GetDlgEdForm();
DlgEditor* pDlgEditor = pRealDlgEdForm ? pRealDlgEdForm->GetDlgEditor() : 0;
if( !pDlgEditor || pDlgEditor->isInPaint() )
return;
2001-03-06 13:50:13 +00:00
// dialog model changed
pDlgEditor->SetDialogModelChanged(sal_True);
2001-03-06 13:50:13 +00:00
// update position and size
if ( evt.PropertyName == DLGED_PROP_POSITIONX || evt.PropertyName == DLGED_PROP_POSITIONY ||
evt.PropertyName == DLGED_PROP_WIDTH || evt.PropertyName == DLGED_PROP_HEIGHT ||
evt.PropertyName == DLGED_PROP_DECORATION )
2001-02-26 09:47:06 +00:00
{
PositionAndSizeChange( evt );
if ( evt.PropertyName == DLGED_PROP_DECORATION )
{
if ( ISA(DlgEdForm) )
((DlgEdForm*)this)->GetDlgEditor()->ResetDialog();
else
GetDlgEdForm()->GetDlgEditor()->ResetDialog();
}
2001-02-26 09:47:06 +00:00
}
2001-03-06 13:50:13 +00:00
// change name of control in dialog model
else if ( evt.PropertyName == DLGED_PROP_NAME )
{
2001-03-20 13:37:42 +00:00
if ( !ISA(DlgEdForm) )
{
NameChange(evt);
}
}
2001-03-07 17:10:25 +00:00
// update step
else if ( evt.PropertyName == DLGED_PROP_STEP )
2001-03-07 17:10:25 +00:00
{
UpdateStep();
}
2001-03-20 13:37:42 +00:00
// change tabindex
else if ( evt.PropertyName == DLGED_PROP_TABINDEX )
2001-03-20 13:37:42 +00:00
{
if ( !ISA(DlgEdForm) )
{
TabIndexChange(evt);
}
}
2001-02-26 09:47:06 +00:00
}
}
//----------------------------------------------------------------------------
void SAL_CALL DlgEdObj::_elementInserted(const ::com::sun::star::container::ContainerEvent& ) throw(::com::sun::star::uno::RuntimeException)
2001-02-26 09:47:06 +00:00
{
2001-03-12 10:31:43 +00:00
if (isListening())
2001-02-26 09:47:06 +00:00
{
2001-03-12 10:31:43 +00:00
// dialog model changed
if ( ISA(DlgEdForm) )
2001-02-26 09:47:06 +00:00
{
((DlgEdForm*)this)->GetDlgEditor()->SetDialogModelChanged(sal_True);
2001-03-12 10:31:43 +00:00
}
else
{
GetDlgEdForm()->GetDlgEditor()->SetDialogModelChanged(sal_True);
2001-02-26 09:47:06 +00:00
}
}
}
//----------------------------------------------------------------------------
void SAL_CALL DlgEdObj::_elementReplaced(const ::com::sun::star::container::ContainerEvent& ) throw(::com::sun::star::uno::RuntimeException)
2001-02-26 09:47:06 +00:00
{
if (isListening())
{
2001-03-12 10:31:43 +00:00
// dialog model changed
if ( ISA(DlgEdForm) )
2001-02-26 09:47:06 +00:00
{
((DlgEdForm*)this)->GetDlgEditor()->SetDialogModelChanged(sal_True);
2001-03-12 10:31:43 +00:00
}
else
{
GetDlgEdForm()->GetDlgEditor()->SetDialogModelChanged(sal_True);
2001-03-12 10:31:43 +00:00
}
}
}
//----------------------------------------------------------------------------
2001-02-26 09:47:06 +00:00
void SAL_CALL DlgEdObj::_elementRemoved(const ::com::sun::star::container::ContainerEvent& ) throw(::com::sun::star::uno::RuntimeException)
2001-03-12 10:31:43 +00:00
{
if (isListening())
{
// dialog model changed
if ( ISA(DlgEdForm) )
{
((DlgEdForm*)this)->GetDlgEditor()->SetDialogModelChanged(sal_True);
2001-03-12 10:31:43 +00:00
}
else
{
GetDlgEdForm()->GetDlgEditor()->SetDialogModelChanged(sal_True);
2001-02-26 09:47:06 +00: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-02-26 09:47:06 +00:00
//----------------------------------------------------------------------------
TYPEINIT1(DlgEdForm, DlgEdObj);
DBG_NAME(DlgEdForm);
//----------------------------------------------------------------------------
DlgEdForm::DlgEdForm()
:DlgEdObj()
{
DBG_CTOR(DlgEdForm, NULL);
}
//----------------------------------------------------------------------------
DlgEdForm::~DlgEdForm()
{
DBG_DTOR(DlgEdForm, NULL);
}
//----------------------------------------------------------------------------
2001-03-07 17:10:25 +00:00
void DlgEdForm::SetDlgEditor( DlgEditor* pEditor )
{
pDlgEditor = pEditor;
ImplInvalidateDeviceInfo();
}
//----------------------------------------------------------------------------
void DlgEdForm::ImplInvalidateDeviceInfo()
{
mpDeviceInfo.reset();
}
//----------------------------------------------------------------------------
void DlgEdForm::SetRectFromProps()
{
// get form position and size from properties
Reference< beans::XPropertySet > xPSet( GetUnoControlModel(), UNO_QUERY );
if ( xPSet.is() )
{
sal_Int32 nXIn = 0, nYIn = 0, nWidthIn = 0, nHeightIn = 0;
xPSet->getPropertyValue( DLGED_PROP_POSITIONX ) >>= nXIn;
xPSet->getPropertyValue( DLGED_PROP_POSITIONY ) >>= nYIn;
xPSet->getPropertyValue( DLGED_PROP_WIDTH ) >>= nWidthIn;
xPSet->getPropertyValue( DLGED_PROP_HEIGHT ) >>= nHeightIn;
// transform coordinates
sal_Int32 nXOut, nYOut, nWidthOut, nHeightOut;
if ( TransformFormToSdrCoordinates( nXIn, nYIn, nWidthIn, nHeightIn, nXOut, nYOut, nWidthOut, nHeightOut ) )
{
// set rectangle position and size
Point aPoint( nXOut, nYOut );
Size aSize( nWidthOut, nHeightOut );
SetSnapRect( Rectangle( aPoint, aSize ) );
}
}
}
//----------------------------------------------------------------------------
void DlgEdForm::SetPropsFromRect()
{
// get form position and size from rectangle
Rectangle aRect_ = GetSnapRect();
sal_Int32 nXIn = aRect_.Left();
sal_Int32 nYIn = aRect_.Top();
sal_Int32 nWidthIn = aRect_.GetWidth();
sal_Int32 nHeightIn = aRect_.GetHeight();
// transform coordinates
sal_Int32 nXOut, nYOut, nWidthOut, nHeightOut;
if ( TransformSdrToFormCoordinates( nXIn, nYIn, nWidthIn, nHeightIn, nXOut, nYOut, nWidthOut, nHeightOut ) )
{
// set properties
Reference< beans::XPropertySet > xPSet( GetUnoControlModel(), UNO_QUERY );
if ( xPSet.is() )
{
Any aValue;
aValue <<= nXOut;
xPSet->setPropertyValue( DLGED_PROP_POSITIONX, aValue );
aValue <<= nYOut;
xPSet->setPropertyValue( DLGED_PROP_POSITIONY, aValue );
aValue <<= nWidthOut;
xPSet->setPropertyValue( DLGED_PROP_WIDTH, aValue );
aValue <<= nHeightOut;
xPSet->setPropertyValue( DLGED_PROP_HEIGHT, aValue );
}
}
}
//----------------------------------------------------------------------------
2001-03-20 13:37:42 +00:00
void DlgEdForm::AddChild( DlgEdObj* pDlgEdObj )
{
2011-12-07 02:33:51 -08:00
pChildren.push_back( pDlgEdObj );
2001-03-20 13:37:42 +00:00
}
//----------------------------------------------------------------------------
void DlgEdForm::RemoveChild( DlgEdObj* pDlgEdObj )
{
2011-12-07 02:33:51 -08:00
pChildren.erase( ::std::find( pChildren.begin() , pChildren.end() , pDlgEdObj ) );
2001-03-20 13:37:42 +00:00
}
//----------------------------------------------------------------------------
void DlgEdForm::PositionAndSizeChange( const beans::PropertyChangeEvent& evt )
{
DlgEditor* pEditor = GetDlgEditor();
DBG_ASSERT( pEditor, "DlgEdForm::PositionAndSizeChange: no dialog editor!" );
if ( pEditor )
{
DlgEdPage* pPage_ = pEditor->GetPage();
DBG_ASSERT( pPage_, "DlgEdForm::PositionAndSizeChange: no page!" );
if ( pPage_ )
{
sal_Int32 nPageXIn = 0;
sal_Int32 nPageYIn = 0;
Size aPageSize = pPage_->GetSize();
sal_Int32 nPageWidthIn = aPageSize.Width();
sal_Int32 nPageHeightIn = aPageSize.Height();
sal_Int32 nPageX, nPageY, nPageWidth, nPageHeight;
if ( TransformSdrToFormCoordinates( nPageXIn, nPageYIn, nPageWidthIn, nPageHeightIn, nPageX, nPageY, nPageWidth, nPageHeight ) )
{
Reference< beans::XPropertySet > xPSetForm( GetUnoControlModel(), UNO_QUERY );
if ( xPSetForm.is() )
{
sal_Int32 nValue = 0;
evt.NewValue >>= nValue;
sal_Int32 nNewValue = nValue;
if ( evt.PropertyName == DLGED_PROP_POSITIONX )
{
if ( nNewValue < nPageX )
nNewValue = nPageX;
}
else if ( evt.PropertyName == DLGED_PROP_POSITIONY )
{
if ( nNewValue < nPageY )
nNewValue = nPageY;
}
else if ( evt.PropertyName == DLGED_PROP_WIDTH )
{
if ( nNewValue < 1 )
nNewValue = 1;
}
else if ( evt.PropertyName == DLGED_PROP_HEIGHT )
{
if ( nNewValue < 1 )
nNewValue = 1;
}
if ( nNewValue != nValue )
{
Any aNewValue;
aNewValue <<= nNewValue;
EndListening( sal_False );
xPSetForm->setPropertyValue( evt.PropertyName, aNewValue );
StartListening();
}
}
}
bool bAdjustedPageSize = pEditor->AdjustPageSize();
SetRectFromProps();
::std::vector< DlgEdObj* >::iterator aIter;
2011-12-07 02:33:51 -08:00
::std::vector< DlgEdObj* > aChildList = ((DlgEdForm*)this)->GetChildren();
if ( bAdjustedPageSize )
{
pEditor->InitScrollBars();
aPageSize = pPage_->GetSize();
nPageWidthIn = aPageSize.Width();
nPageHeightIn = aPageSize.Height();
if ( TransformSdrToControlCoordinates( nPageXIn, nPageYIn, nPageWidthIn, nPageHeightIn, nPageX, nPageY, nPageWidth, nPageHeight ) )
{
2011-08-09 00:17:54 +02:00
for ( aIter = aChildList.begin(); aIter != aChildList.end(); ++aIter )
{
Reference< beans::XPropertySet > xPSet( (*aIter)->GetUnoControlModel(), UNO_QUERY );
if ( xPSet.is() )
{
sal_Int32 nX = 0, nY = 0, nWidth = 0, nHeight = 0;
xPSet->getPropertyValue( DLGED_PROP_POSITIONX ) >>= nX;
xPSet->getPropertyValue( DLGED_PROP_POSITIONY ) >>= nY;
xPSet->getPropertyValue( DLGED_PROP_WIDTH ) >>= nWidth;
xPSet->getPropertyValue( DLGED_PROP_HEIGHT ) >>= nHeight;
sal_Int32 nNewX = nX;
if ( nX + nWidth > nPageX + nPageWidth )
{
nNewX = nPageX + nPageWidth - nWidth;
if ( nNewX < nPageX )
nNewX = nPageX;
}
if ( nNewX != nX )
{
Any aValue;
aValue <<= nNewX;
EndListening( sal_False );
xPSet->setPropertyValue( DLGED_PROP_POSITIONX, aValue );
StartListening();
}
sal_Int32 nNewY = nY;
if ( nY + nHeight > nPageY + nPageHeight )
{
nNewY = nPageY + nPageHeight - nHeight;
if ( nNewY < nPageY )
nNewY = nPageY;
}
if ( nNewY != nY )
{
Any aValue;
aValue <<= nNewY;
EndListening( sal_False );
xPSet->setPropertyValue( DLGED_PROP_POSITIONY, aValue );
StartListening();
}
}
}
}
}
2011-08-09 00:17:54 +02:00
for ( aIter = aChildList.begin(); aIter != aChildList.end(); ++aIter )
{
(*aIter)->SetRectFromProps();
}
}
}
}
//----------------------------------------------------------------------------
2001-03-07 17:10:25 +00:00
void DlgEdForm::UpdateStep()
{
sal_uLong nObjCount;
2001-03-07 17:10:25 +00:00
SdrPage* pSdrPage = GetPage();
if ( pSdrPage && ( ( nObjCount = pSdrPage->GetObjCount() ) > 0 ) )
{
for ( sal_uLong i = 0 ; i < nObjCount ; i++ )
2001-03-07 17:10:25 +00:00
{
SdrObject* pObj = pSdrPage->GetObj(i);
DlgEdObj* pDlgEdObj = PTR_CAST(DlgEdObj, pObj);
if ( pDlgEdObj && !pDlgEdObj->ISA(DlgEdForm) )
pDlgEdObj->UpdateStep();
}
}
}
//----------------------------------------------------------------------------
2001-02-26 09:47:06 +00:00
void DlgEdForm::UpdateTabIndices()
2001-03-20 13:37:42 +00:00
{
// stop listening with all children
2001-03-20 13:37:42 +00:00
::std::vector<DlgEdObj*>::iterator aIter;
2011-12-07 02:33:51 -08:00
for ( aIter = pChildren.begin() ; aIter != pChildren.end() ; ++aIter )
2001-03-20 13:37:42 +00:00
{
(*aIter)->EndListening( sal_False );
2001-03-20 13:37:42 +00: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();
// 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 13:37:42 +00:00
{
// get name
::rtl::OUString aName( pNames[i] );
2001-03-20 13:37:42 +00:00
// get tab index
sal_Int16 nTabIndex = -1;
Any aCtrl = xNameAcc->getByName( aName );
2001-03-20 13:37:42 +00:00
Reference< ::com::sun::star::beans::XPropertySet > xPSet;
aCtrl >>= xPSet;
if ( xPSet.is() )
xPSet->getPropertyValue( DLGED_PROP_TABINDEX ) >>= nTabIndex;
2001-03-20 13:37:42 +00:00
// insert into map
aIndexToNameMap.insert( IndexToNameMap::value_type( nTabIndex, aName ) );
2001-03-20 13:37:42 +00:00
}
// set new tab indices
sal_Int16 nNewTabIndex = 0;
for ( IndexToNameMap::iterator aIt = aIndexToNameMap.begin(); aIt != aIndexToNameMap.end(); ++aIt )
2001-03-20 13:37:42 +00:00
{
Any aCtrl = xNameAcc->getByName( aIt->second );
Reference< beans::XPropertySet > xPSet;
2001-03-20 13:37:42 +00:00
aCtrl >>= xPSet;
if ( xPSet.is() )
2001-03-20 13:37:42 +00:00
{
Any aTabIndex;
aTabIndex <<= (sal_Int16) nNewTabIndex++;
xPSet->setPropertyValue( DLGED_PROP_TABINDEX, aTabIndex );
2001-03-20 13:37:42 +00:00
}
}
// #110559#
UpdateTabOrderAndGroups();
2001-03-20 13:37:42 +00:00
}
// start listening with all children
2011-12-07 02:33:51 -08:00
for ( aIter = pChildren.begin() ; aIter != pChildren.end() ; ++aIter )
2001-03-20 13:37:42 +00:00
{
(*aIter)->StartListening();
}
}
//----------------------------------------------------------------------------
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.
Reference< awt::XUnoControlContainer > xCont( GetControl(), 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() )
{
// create a global list of controls that belong to the dialog
2011-12-07 02:33:51 -08:00
::std::vector<DlgEdObj*> aChildList = GetChildren();
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]->GetControl(), 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( GetControl(), 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-05-15 12:16:52 +00:00
void DlgEdForm::NbcMove( const Size& rSize )
{
SdrUnoObj::NbcMove( rSize );
// set geometry properties of form
EndListening(sal_False);
SetPropsFromRect();
StartListening();
2011-12-07 02:33:51 -08:00
// set geometry properties of all children
2001-05-15 12:16:52 +00:00
::std::vector<DlgEdObj*>::iterator aIter;
2011-12-07 02:33:51 -08:00
for ( aIter = pChildren.begin() ; aIter != pChildren.end() ; ++aIter )
2001-05-15 12:16:52 +00:00
{
(*aIter)->EndListening(sal_False);
(*aIter)->SetPropsFromRect();
(*aIter)->StartListening();
}
// dialog model changed
GetDlgEditor()->SetDialogModelChanged(sal_True);
2001-05-15 12:16:52 +00:00
}
//----------------------------------------------------------------------------
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();
2011-12-07 02:33:51 -08:00
// set geometry properties of all children
2001-05-15 12:16:52 +00:00
::std::vector<DlgEdObj*>::iterator aIter;
2011-12-07 02:33:51 -08:00
for ( aIter = pChildren.begin() ; aIter != pChildren.end() ; ++aIter )
2001-05-15 12:16:52 +00:00
{
(*aIter)->EndListening(sal_False);
(*aIter)->SetPropsFromRect();
(*aIter)->StartListening();
}
// dialog model changed
GetDlgEditor()->SetDialogModelChanged(sal_True);
2001-05-15 12:16:52 +00:00
}
//----------------------------------------------------------------------------
2010-10-05 07:57:51 -05:00
bool DlgEdForm::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
2001-02-26 09:47:06 +00:00
{
2010-10-05 07:57:51 -05:00
bool bResult = SdrUnoObj::EndCreate(rStat, eCmd);
2001-02-26 09:47:06 +00:00
2001-03-23 15:16:45 +00:00
// stop listening
EndListening(sal_False);
2001-03-13 16:24:59 +00:00
// set geometry properties
2001-02-26 09:47:06 +00:00
SetPropsFromRect();
2001-03-23 15:16:45 +00:00
// dialog model changed
GetDlgEditor()->SetDialogModelChanged(sal_True);
2001-03-23 15:16:45 +00:00
// start listening
StartListening();
2001-02-26 09:47:06 +00:00
return bResult;
}
//----------------------------------------------------------------------------
awt::DeviceInfo DlgEdForm::getDeviceInfo() const
{
awt::DeviceInfo aDeviceInfo;
DlgEditor* pEditor = GetDlgEditor();
DBG_ASSERT( pEditor, "DlgEdForm::getDeviceInfo: no editor associated with the form object!" );
if ( !pEditor )
return aDeviceInfo;
Window* pWindow = pEditor->GetWindow();
DBG_ASSERT( pWindow, "DlgEdForm::getDeviceInfo: no window associated with the editor!" );
if ( !pWindow )
return aDeviceInfo;
// obtain an XControl
::utl::SharedUNOComponent< awt::XControl > xDialogControl; // ensures auto-disposal, if needed
xDialogControl.reset( GetControl(), ::utl::SharedUNOComponent< awt::XControl >::NoTakeOwnership );
if ( !xDialogControl.is() )
{
// don't create a temporary control all the time, this method here is called
// way too often. Instead, use a cached DeviceInfo.
2011-02-13 17:35:58 +01:00
// #i74065#
if ( !!mpDeviceInfo )
return *mpDeviceInfo;
Reference< awt::XControlContainer > xEditorControlContainer( pEditor->GetWindowControlContainer() );
xDialogControl.reset(
GetTemporaryControlForWindow( *pWindow, xEditorControlContainer ),
::utl::SharedUNOComponent< awt::XControl >::TakeOwnership );
}
Reference< awt::XDevice > xDialogDevice;
if ( xDialogControl.is() )
xDialogDevice.set( xDialogControl->getPeer(), UNO_QUERY );
DBG_ASSERT( xDialogDevice.is(), "DlgEdForm::getDeviceInfo: no device!" );
if ( xDialogDevice.is() )
aDeviceInfo = xDialogDevice->getInfo();
mpDeviceInfo.reset( aDeviceInfo );
return aDeviceInfo;
}
bool DlgEdObj::MakeDataAware( const Reference< frame::XModel >& xModel )
{
bool bRes = false;
// Need to flesh this out, currently we will only support data-aware controls for calc
// and only handle a subset of functionality e.g. linked-cell and cell range data source. Of course later
// we need to disambiguate for writer ( and others ? ) and also support the generic form (db) bindings
// we need some more work in xmlscript to be able to handle that
Reference< lang::XMultiServiceFactory > xFac( xModel, UNO_QUERY );
Reference< form::binding::XBindableValue > xBindable( GetUnoControlModel(), UNO_QUERY );
Reference< form::binding::XListEntrySink > xListEntrySink( GetUnoControlModel(), UNO_QUERY );
if ( xFac.is() )
{
if ( xBindable.is() )
{
Reference< form::binding::XValueBinding > xBinding( xFac->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.table.CellValueBinding" ) ) ), UNO_QUERY );
xBindable->setValueBinding( xBinding );
}
if ( xListEntrySink.is() )
{
Reference< form::binding::XListEntrySource > xSource( xFac->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.table.CellRangeListSource" ) ) ), UNO_QUERY );
xListEntrySink->setListEntrySource( xSource );
}
if ( xListEntrySink.is() || xBindable.is() )
bRes = true;
}
return bRes;
}
//----------------------------------------------------------------------------
2001-02-26 09:47:06 +00:00
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */