Files
libreoffice/toolkit/source/controls/dialogcontrol.cxx

1331 lines
47 KiB
C++
Raw Normal View History

2011-08-04 15:39:25 +01:00
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
*/
#include <vcl/svapp.hxx>
#include <vcl/window.hxx>
#include <vcl/wall.hxx>
#include <osl/mutex.hxx>
#include <toolkit/controls/dialogcontrol.hxx>
#include <toolkit/controls/geometrycontrolmodel.hxx>
#include <toolkit/helper/property.hxx>
#include <toolkit/controls/stdtabcontroller.hxx>
#include <com/sun/star/awt/PosSize.hpp>
#include <com/sun/star/awt/WindowAttribute.hpp>
#include <com/sun/star/resource/XStringResourceResolver.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/graphic/XGraphicProvider.hpp>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
#include <comphelper/sequence.hxx>
#include <vcl/outdev.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <vcl/graph.hxx>
#include <vcl/image.hxx>
#include <cppuhelper/implbase1.hxx>
#include <algorithm>
2011-03-11 18:04:44 +00:00
#include <functional>
#include <map>
#include <unordered_map>
#include "osl/file.hxx"
#include <vcl/tabctrl.hxx>
#include <toolkit/awt/vclxwindows.hxx>
#include "toolkit/controls/unocontrols.hxx"
#include "helper/unopropertyarrayhelper.hxx"
#include "controlmodelcontainerbase_internal.hxx"
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::util;
#define PROPERTY_DIALOGSOURCEURL OUString( "DialogSourceURL" )
#define PROPERTY_IMAGEURL OUString( "ImageURL" )
#define PROPERTY_GRAPHIC OUString( "Graphic" )
// we probably will need both a hash of control models and hash of controls
// => use some template magic
typedef ::cppu::WeakImplHelper1< container::XNameContainer > SimpleNameContainer_BASE;
template< typename T >
class SimpleNamedThingContainer : public SimpleNameContainer_BASE
{
typedef std::unordered_map< OUString, Reference< T >, OUStringHash,
std::equal_to< OUString > > NamedThingsHash;
NamedThingsHash things;
::osl::Mutex m_aMutex;
public:
// ::com::sun::star::container::XNameContainer, XNameReplace, XNameAccess
virtual void SAL_CALL replaceByName( const OUString& aName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE
{
::osl::MutexGuard aGuard( m_aMutex );
if ( !hasByName( aName ) )
throw NoSuchElementException();
Reference< T > xElement;
if ( ! ( aElement >>= xElement ) )
throw IllegalArgumentException();
things[ aName ] = xElement;
}
virtual Any SAL_CALL getByName( const OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE
{
::osl::MutexGuard aGuard( m_aMutex );
if ( !hasByName( aName ) )
throw NoSuchElementException();
return uno::makeAny( things[ aName ] );
}
virtual Sequence< OUString > SAL_CALL getElementNames( ) throw(RuntimeException, std::exception) SAL_OVERRIDE
{
::osl::MutexGuard aGuard( m_aMutex );
Sequence< OUString > aResult( things.size() );
typename NamedThingsHash::iterator it = things.begin();
typename NamedThingsHash::iterator it_end = things.end();
OUString* pName = aResult.getArray();
for (; it != it_end; ++it, ++pName )
*pName = it->first;
return aResult;
}
virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw(RuntimeException, std::exception) SAL_OVERRIDE
{
::osl::MutexGuard aGuard( m_aMutex );
return ( things.find( aName ) != things.end() );
}
virtual void SAL_CALL insertByName( const OUString& aName, const Any& aElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE
{
::osl::MutexGuard aGuard( m_aMutex );
if ( hasByName( aName ) )
throw ElementExistException();
Reference< T > xElement;
if ( ! ( aElement >>= xElement ) )
throw IllegalArgumentException();
things[ aName ] = xElement;
}
virtual void SAL_CALL removeByName( const OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE
{
::osl::MutexGuard aGuard( m_aMutex );
if ( !hasByName( aName ) )
throw NoSuchElementException();
things.erase( things.find( aName ) );
}
virtual Type SAL_CALL getElementType( ) throw (RuntimeException, std::exception) SAL_OVERRIDE
{
return cppu::UnoType<T>::get();
}
virtual sal_Bool SAL_CALL hasElements( ) throw (RuntimeException, std::exception) SAL_OVERRIDE
{
::osl::MutexGuard aGuard( m_aMutex );
return ( !things.empty() );
}
};
namespace {
class UnoControlDialogModel : public ControlModelContainerBase
{
protected:
css::uno::Reference< css::graphic::XGraphicObject > mxGrfObj;
css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const SAL_OVERRIDE;
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
// ::cppu::OPropertySetHelper
void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const css::uno::Any& rValue ) throw (css::uno::Exception, std::exception) SAL_OVERRIDE;
public:
UnoControlDialogModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
UnoControlDialogModel( const UnoControlDialogModel& rModel );
virtual ~UnoControlDialogModel();
UnoControlModel* Clone() const SAL_OVERRIDE;
// css::beans::XMultiPropertySet
css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
// css::io::XPersistObject
OUString SAL_CALL getServiceName() throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
// XServiceInfo
OUString SAL_CALL getImplementationName()
throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
{ return OUString("stardiv.Toolkit.UnoControlDialogModel"); }
css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
{
auto s(ControlModelContainerBase::getSupportedServiceNames());
s.realloc(s.getLength() + 2);
s[s.getLength() - 2] = "com.sun.star.awt.UnoControlDialogModel";
s[s.getLength() - 1] = "stardiv.vcl.controlmodel.Dialog";
return s;
}
};
UnoControlDialogModel::UnoControlDialogModel( const Reference< XComponentContext >& rxContext )
Revert "fdo#46808, Convert awt::UnoControlDialogModel to new style" This reverts commit 6c61b20a8d4a6dcac28801cde82a211fb7e30654. As discussed at <http://lists.freedesktop.org/archives/libreoffice/2013-May/052449.html> "Re: fdo#46808, Convert awt::UnoControlDialogModel to new style problem" why the odd change in 2e2a4827ce6708f0e8677dba9cc92e1479a44086 "scripting: get CreateUnoDialog() work again" appears to fix things again: The problem is that the implementation of the css.awt.UnoControlDialogModel involves UNO aggregation (IMPL_CREATE_INSTANCE_WITH_GEOMETRY(UnoControlDialogModel) in toolkit/soruce/helper/registerservices.cxx creating a OGeometryControlModel<UnoControlDialogModel> instance that aggregates a UnoControlDialogModel instance). That means that queryInterface can return a reference to something that is technically a different object, and that's what's happening here, and explains why calling setPropertyValue in two different ways on what logically appears to be a single object can end up calling two different implementations (of two different physical objects). (UNO aggregation is known to be broken and should not be used. Nevertheless, there's still code that does---code that is a horrible mess and hard to clean up.) That all this worked as intended in the past is just sheer luck, but any way of substantially touching it is asking for trouble. I'm going to revert 6c61b20a8d4a6dcac28801cde82a211fb7e30654 again. I wasn't able to revert without also reverting be50ad28f5bbdaeff527f646481ce263843c2401 "fdo#46808, Convert awt::XUnoControlDialog to new style," as the two were tightly dependant. Also reverts all the follow-up fixes cb4b6dde8fda2a5848e11063028bf44d72f85431 "-Werror,-Wuninitialized" (sans the const-ness fix in UpdateHandler::insertControlModel), 697a007c61b9cabceb9767fad87cd5822b300452 "Fix exception specifications," 2ce6828bbbf6ba181bb2276adeec279e74151ef6 "fix awt::UnoControlModelDialog crash," and 2e2a4827ce6708f0e8677dba9cc92e1479a44086 "scripting: get CreateUnoDialog() work again." Conflicts: basctl/source/dlged/dlged.cxx filter/source/t602/t602filter.cxx xmlscript/test/imexp.cxx Change-Id: I5d133468062f3ca36300db52fbd699be1ac72998
2013-05-24 22:44:30 +02:00
:ControlModelContainerBase( rxContext )
{
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
// ImplRegisterProperty( BASEPROPERTY_BORDER );
ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
ImplRegisterProperty( BASEPROPERTY_ENABLED );
ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
// ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
ImplRegisterProperty( BASEPROPERTY_HELPURL );
ImplRegisterProperty( BASEPROPERTY_TITLE );
ImplRegisterProperty( BASEPROPERTY_SIZEABLE );
ImplRegisterProperty( BASEPROPERTY_DESKTOP_AS_PARENT );
ImplRegisterProperty( BASEPROPERTY_DECORATION );
ImplRegisterProperty( BASEPROPERTY_DIALOGSOURCEURL );
ImplRegisterProperty( BASEPROPERTY_GRAPHIC );
ImplRegisterProperty( BASEPROPERTY_IMAGEURL );
ImplRegisterProperty( BASEPROPERTY_HSCROLL );
ImplRegisterProperty( BASEPROPERTY_VSCROLL );
ImplRegisterProperty( BASEPROPERTY_SCROLLWIDTH );
ImplRegisterProperty( BASEPROPERTY_SCROLLHEIGHT );
ImplRegisterProperty( BASEPROPERTY_SCROLLTOP );
ImplRegisterProperty( BASEPROPERTY_SCROLLLEFT );
Any aBool;
aBool <<= true;
ImplRegisterProperty( BASEPROPERTY_MOVEABLE, aBool );
ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool );
// #TODO separate class for 'UserForm' ( instead of re-using Dialog ? )
uno::Reference< XNameContainer > xNameCont = new SimpleNamedThingContainer< XControlModel >();
ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES, uno::makeAny( xNameCont ) );
}
UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel& rModel )
Revert "fdo#46808, Convert awt::UnoControlDialogModel to new style" This reverts commit 6c61b20a8d4a6dcac28801cde82a211fb7e30654. As discussed at <http://lists.freedesktop.org/archives/libreoffice/2013-May/052449.html> "Re: fdo#46808, Convert awt::UnoControlDialogModel to new style problem" why the odd change in 2e2a4827ce6708f0e8677dba9cc92e1479a44086 "scripting: get CreateUnoDialog() work again" appears to fix things again: The problem is that the implementation of the css.awt.UnoControlDialogModel involves UNO aggregation (IMPL_CREATE_INSTANCE_WITH_GEOMETRY(UnoControlDialogModel) in toolkit/soruce/helper/registerservices.cxx creating a OGeometryControlModel<UnoControlDialogModel> instance that aggregates a UnoControlDialogModel instance). That means that queryInterface can return a reference to something that is technically a different object, and that's what's happening here, and explains why calling setPropertyValue in two different ways on what logically appears to be a single object can end up calling two different implementations (of two different physical objects). (UNO aggregation is known to be broken and should not be used. Nevertheless, there's still code that does---code that is a horrible mess and hard to clean up.) That all this worked as intended in the past is just sheer luck, but any way of substantially touching it is asking for trouble. I'm going to revert 6c61b20a8d4a6dcac28801cde82a211fb7e30654 again. I wasn't able to revert without also reverting be50ad28f5bbdaeff527f646481ce263843c2401 "fdo#46808, Convert awt::XUnoControlDialog to new style," as the two were tightly dependant. Also reverts all the follow-up fixes cb4b6dde8fda2a5848e11063028bf44d72f85431 "-Werror,-Wuninitialized" (sans the const-ness fix in UpdateHandler::insertControlModel), 697a007c61b9cabceb9767fad87cd5822b300452 "Fix exception specifications," 2ce6828bbbf6ba181bb2276adeec279e74151ef6 "fix awt::UnoControlModelDialog crash," and 2e2a4827ce6708f0e8677dba9cc92e1479a44086 "scripting: get CreateUnoDialog() work again." Conflicts: basctl/source/dlged/dlged.cxx filter/source/t602/t602filter.cxx xmlscript/test/imexp.cxx Change-Id: I5d133468062f3ca36300db52fbd699be1ac72998
2013-05-24 22:44:30 +02:00
: ControlModelContainerBase( rModel )
{
// need to clone BASEPROPERTY_USERFORMCONTAINEES too
Reference< XNameContainer > xSrcNameCont( const_cast< UnoControlDialogModel& >(rModel).getPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ) ), UNO_QUERY );
Reference<XNameContainer > xNameCont( new SimpleNamedThingContainer< XControlModel >() );
uno::Sequence< OUString > sNames = xSrcNameCont->getElementNames();
OUString* pName = sNames.getArray();
OUString* pNamesEnd = pName + sNames.getLength();
for ( ; pName != pNamesEnd; ++pName )
{
if ( xSrcNameCont->hasByName( *pName ) )
xNameCont->insertByName( *pName, xSrcNameCont->getByName( *pName ) );
}
setFastPropertyValue_NoBroadcast( BASEPROPERTY_USERFORMCONTAINEES, makeAny( xNameCont ) );
}
UnoControlDialogModel::~UnoControlDialogModel()
{
}
UnoControlModel* UnoControlDialogModel::Clone() const
{
// clone the container itself
UnoControlDialogModel* pClone = new UnoControlDialogModel( *this );
Clone_Impl(*pClone);
return pClone;
}
2011-03-11 18:04:44 +00:00
OUString UnoControlDialogModel::getServiceName( ) throw(RuntimeException, std::exception)
{
return OUString("stardiv.vcl.controlmodel.Dialog");
}
Any UnoControlDialogModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
{
Any aAny;
switch ( nPropId )
{
case BASEPROPERTY_DEFAULTCONTROL:
aAny <<= OUString::createFromAscii( szServiceName_UnoControlDialog );
break;
case BASEPROPERTY_SCROLLWIDTH:
case BASEPROPERTY_SCROLLHEIGHT:
case BASEPROPERTY_SCROLLTOP:
case BASEPROPERTY_SCROLLLEFT:
aAny <<= sal_Int32(0);
break;
default:
aAny = UnoControlModel::ImplGetDefaultValue( nPropId );
}
return aAny;
}
::cppu::IPropertyArrayHelper& UnoControlDialogModel::getInfoHelper()
{
static UnoPropertyArrayHelper* pHelper = NULL;
if ( !pHelper )
{
Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
pHelper = new UnoPropertyArrayHelper( aIDs );
}
return *pHelper;
}
// XMultiPropertySet
Reference< XPropertySetInfo > UnoControlDialogModel::getPropertySetInfo( ) throw(RuntimeException, std::exception)
{
static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
return xInfo;
}
void SAL_CALL UnoControlDialogModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception, std::exception)
{
ControlModelContainerBase::setFastPropertyValue_NoBroadcast( nHandle, rValue );
try
{
if ( nHandle == BASEPROPERTY_IMAGEURL && ImplHasProperty( BASEPROPERTY_GRAPHIC ) )
{
OUString sImageURL;
OSL_VERIFY( rValue >>= sImageURL );
setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( ImageHelper::getGraphicAndGraphicObjectFromURL_nothrow( mxGrfObj, sImageURL ) ) );
}
}
catch( const ::com::sun::star::uno::Exception& )
{
OSL_ENSURE( false, "UnoControlDialogModel::setFastPropertyValue_NoBroadcast: caught an exception while setting ImageURL properties!" );
}
}
}
2011-03-11 18:04:44 +00:00
// = class UnoDialogControl
UnoDialogControl::UnoDialogControl( const uno::Reference< uno::XComponentContext >& rxContext )
:UnoDialogControl_Base( rxContext )
2011-03-11 18:04:44 +00:00
,maTopWindowListeners( *this )
,mbWindowListener(false)
{
2011-03-11 18:04:44 +00:00
maComponentInfos.nWidth = 300;
maComponentInfos.nHeight = 450;
}
2011-03-11 18:04:44 +00:00
UnoDialogControl::~UnoDialogControl()
{
}
OUString UnoDialogControl::GetComponentServiceName()
{
bool bDecoration( true );
2011-03-11 18:04:44 +00:00
ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION )) >>= bDecoration;
if ( bDecoration )
return OUString("Dialog");
2011-03-11 18:04:44 +00:00
else
return OUString("TabPage");
}
void UnoDialogControl::dispose() throw(RuntimeException, std::exception)
{
2011-03-11 18:04:44 +00:00
SolarMutexGuard aGuard;
2011-03-11 18:04:44 +00:00
EventObject aEvt;
aEvt.Source = static_cast< ::cppu::OWeakObject* >( this );
maTopWindowListeners.disposeAndClear( aEvt );
ControlContainerBase::dispose();
}
2011-03-11 18:04:44 +00:00
void SAL_CALL UnoDialogControl::disposing(
const EventObject& Source )
throw(RuntimeException, std::exception)
{
2011-03-11 18:04:44 +00:00
ControlContainerBase::disposing( Source );
}
sal_Bool UnoDialogControl::setModel( const Reference< XControlModel >& rxModel ) throw(RuntimeException, std::exception)
{
2011-03-11 18:04:44 +00:00
// #Can we move all the Resource stuff to the ControlContainerBase ?
SolarMutexGuard aGuard;
bool bRet = ControlContainerBase::setModel( rxModel );
2011-03-11 18:04:44 +00:00
ImplStartListingForResourceEvents();
return bRet;
}
void UnoDialogControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException, std::exception)
{
2011-03-11 18:04:44 +00:00
SolarMutexGuard aGuard;
2011-03-11 18:04:44 +00:00
UnoControlContainer::createPeer( rxToolkit, rParentPeer );
2011-03-11 18:04:44 +00:00
Reference < XTopWindow > xTW( getPeer(), UNO_QUERY );
if ( xTW.is() )
{
2011-03-11 18:04:44 +00:00
xTW->setMenuBar( mxMenuBar );
if ( !mbWindowListener )
{
2011-03-11 18:04:44 +00:00
Reference< XWindowListener > xWL( static_cast< cppu::OWeakObject*>( this ), UNO_QUERY );
addWindowListener( xWL );
mbWindowListener = true;
}
2011-03-11 18:04:44 +00:00
if ( maTopWindowListeners.getLength() )
xTW->addTopWindowListener( &maTopWindowListeners );
// there must be a better way than doing this, we can't
// process the scrolltop & scrollleft in XDialog because
// the children haven't been added when those props are applied
ImplSetPeerProperty( GetPropertyName( BASEPROPERTY_SCROLLTOP ), ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_SCROLLTOP ) ) );
ImplSetPeerProperty( GetPropertyName( BASEPROPERTY_SCROLLLEFT ), ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_SCROLLLEFT ) ) );
}
}
OUString UnoDialogControl::getImplementationName()
throw (css::uno::RuntimeException, std::exception)
{
return OUString("stardiv.Toolkit.UnoDialogControl");
}
sal_Bool UnoDialogControl::supportsService(OUString const & ServiceName)
throw (css::uno::RuntimeException, std::exception)
{
return cppu::supportsService(this, ServiceName);
}
css::uno::Sequence<OUString> UnoDialogControl::getSupportedServiceNames()
throw (css::uno::RuntimeException, std::exception)
{
return css::uno::Sequence<OUString>{
OUString::createFromAscii(szServiceName2_UnoControlDialog),
"stardiv.vcl.control.Dialog"};
}
2011-03-11 18:04:44 +00:00
void UnoDialogControl::PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc )
{
UnoControlContainer::PrepareWindowDescriptor( rDesc );
bool bDecoration( true );
2011-03-11 18:04:44 +00:00
ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION )) >>= bDecoration;
if ( !bDecoration )
{
2011-03-11 18:04:44 +00:00
// Now we have to manipulate the WindowDescriptor
rDesc.WindowAttributes = rDesc.WindowAttributes | ::com::sun::star::awt::WindowAttribute::NODECORATION;
}
2011-03-11 18:04:44 +00:00
// We have to set the graphic property before the peer
// will be created. Otherwise the properties will be copied
// into the peer via propertiesChangeEvents. As the order of
// can lead to overwrites we have to set the graphic property
// before the propertiesChangeEvents are sent!
OUString aImageURL;
2011-03-11 18:04:44 +00:00
Reference< graphic::XGraphic > xGraphic;
if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) &&
( !aImageURL.isEmpty() ))
{
OUString absoluteUrl = aImageURL;
if ( !aImageURL.startsWith( UNO_NAME_GRAPHOBJ_URLPREFIX ) )
absoluteUrl = getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
uno::makeAny( aImageURL ) );
xGraphic = ImageHelper::getGraphicFromURL_nothrow( absoluteUrl );
ImplSetPropertyValue( PROPERTY_GRAPHIC, uno::makeAny( xGraphic ), true );
}
}
void UnoDialogControl::addTopWindowListener( const Reference< XTopWindowListener >& rxListener ) throw (RuntimeException, std::exception)
{
2011-03-11 18:04:44 +00:00
maTopWindowListeners.addInterface( rxListener );
if( getPeer().is() && maTopWindowListeners.getLength() == 1 )
{
2011-03-11 18:04:44 +00:00
Reference < XTopWindow > xTW( getPeer(), UNO_QUERY );
xTW->addTopWindowListener( &maTopWindowListeners );
}
}
void UnoDialogControl::removeTopWindowListener( const Reference< XTopWindowListener >& rxListener ) throw (RuntimeException, std::exception)
{
2011-03-11 18:04:44 +00:00
if( getPeer().is() && maTopWindowListeners.getLength() == 1 )
{
Reference < XTopWindow > xTW( getPeer(), UNO_QUERY );
xTW->removeTopWindowListener( &maTopWindowListeners );
}
maTopWindowListeners.removeInterface( rxListener );
}
void UnoDialogControl::toFront( ) throw (RuntimeException, std::exception)
{
2011-03-11 18:04:44 +00:00
SolarMutexGuard aGuard;
if ( getPeer().is() )
{
Reference< XTopWindow > xTW( getPeer(), UNO_QUERY );
if( xTW.is() )
xTW->toFront();
}
}
void UnoDialogControl::toBack( ) throw (RuntimeException, std::exception)
{
2011-03-11 18:04:44 +00:00
SolarMutexGuard aGuard;
if ( getPeer().is() )
{
2011-03-11 18:04:44 +00:00
Reference< XTopWindow > xTW( getPeer(), UNO_QUERY );
if( xTW.is() )
xTW->toBack();
}
}
void UnoDialogControl::setMenuBar( const Reference< XMenuBar >& rxMenuBar ) throw (RuntimeException, std::exception)
{
2011-03-11 18:04:44 +00:00
SolarMutexGuard aGuard;
mxMenuBar = rxMenuBar;
if ( getPeer().is() )
{
2011-03-11 18:04:44 +00:00
Reference< XTopWindow > xTW( getPeer(), UNO_QUERY );
if( xTW.is() )
xTW->setMenuBar( mxMenuBar );
}
}
2011-03-11 18:04:44 +00:00
static ::Size ImplMapPixelToAppFont( OutputDevice* pOutDev, const ::Size& aSize )
{
2011-03-11 18:04:44 +00:00
::Size aTmp = pOutDev->PixelToLogic( aSize, MAP_APPFONT );
return aTmp;
}
// ::com::sun::star::awt::XWindowListener
void SAL_CALL UnoDialogControl::windowResized( const ::com::sun::star::awt::WindowEvent& e )
throw (::com::sun::star::uno::RuntimeException, std::exception)
2011-03-11 18:04:44 +00:00
{
OutputDevice*pOutDev = Application::GetDefaultDevice();
DBG_ASSERT( pOutDev, "Missing Default Device!" );
if ( pOutDev && !mbSizeModified )
{
2011-03-11 18:04:44 +00:00
// Currentley we are simply using MAP_APPFONT
::Size aAppFontSize( e.Width, e.Height );
Reference< XControl > xDialogControl( *this, UNO_QUERY_THROW );
Reference< XDevice > xDialogDevice( xDialogControl->getPeer(), UNO_QUERY );
OSL_ENSURE( xDialogDevice.is(), "UnoDialogControl::windowResized: no peer, but a windowResized event?" );
// #i87592 In design mode the drawing layer works with sizes with decoration.
Many spelling fixes: directories r* - z*. Attempt to clean up most but certainly not all the spelling mistakes that found home in OpenOffice through decades. We could probably blame the international nature of the code but it is somewhat shameful that this wasn't done before. (cherry picked from commit 28206a7cb43aff5adb10f8235ad1680c3941ee3e) Conflicts: include/osl/file.hxx include/osl/pipe_decl.hxx include/osl/socket.h include/osl/socket_decl.hxx include/sal/main.h include/svx/dbaexchange.hxx include/svx/dlgctrl.hxx include/svx/msdffdef.hxx include/svx/sdr/contact/objectcontactofpageview.hxx include/svx/svdpntv.hxx include/ucbhelper/content.hxx include/ucbhelper/interceptedinteraction.hxx include/ucbhelper/resultsethelper.hxx include/unotools/sharedunocomponent.hxx include/unotools/viewoptions.hxx include/vcl/pdfwriter.hxx include/xmloff/txtparae.hxx include/xmloff/uniref.hxx rhino/rhino1_7R3.patch rsc/inc/rscrsc.hxx sal/inc/osl/conditn.h sal/inc/osl/security.h sal/inc/osl/semaphor.h sal/inc/osl/semaphor.hxx sal/inc/rtl/string.hxx sal/inc/rtl/tres.h sal/inc/systools/win32/StrConvert.h sal/osl/os2/file_path_helper.h sal/osl/os2/file_path_helper.hxx sal/osl/os2/file_url.cxx sal/osl/os2/file_url.h sal/osl/os2/makefile.mk sal/osl/os2/pipe.cxx sal/osl/os2/process.c sal/osl/os2/profile.c sal/osl/os2/socket.c sal/osl/os2/system.h sal/osl/unx/asm/interlck_sparc.s sal/osl/unx/file_url.cxx sal/osl/unx/signal.c sal/osl/unx/system.h sal/osl/w32/MAKEFILE.MK sal/osl/w32/interlck.c sal/osl/w32/module.cxx sal/osl/w32/security.c sal/qa/buildall.pl sal/qa/osl/file/osl_File.cxx sal/qa/osl/module/osl_Module_Const.h sal/qa/osl/mutex/osl_Mutex.cxx sal/qa/osl/pipe/osl_Pipe.cxx sal/qa/osl/process/osl_Thread.cxx sal/qa/osl/socket/osl_StreamSocket.cxx sal/qa/osl/socket/sockethelper.cxx sal/qa/rtl_strings/rtl_OUString.cxx sal/rtl/source/unload.cxx sal/systools/win32/kill/kill.cxx sal/systools/win32/uwinapi/MoveFileExA.cpp sal/test/bootstrap.pl sal/typesconfig/typesconfig.c sal/workben/tgetpwnam.cxx sax/inc/sax/parser/saxparser.hxx sc/addin/datefunc/dfa.cl sc/addin/datefunc/dfa.src sc/addin/rot13/rot13.cl sc/addin/rot13/rot13.src sc/inc/attarray.hxx sc/inc/chgtrack.hxx sc/inc/column.hxx sc/inc/compressedarray.hxx sc/inc/document.hxx sc/inc/table.hxx sc/source/core/data/column.cxx sc/source/core/data/dptablecache.cxx sc/source/core/data/dptabres.cxx sc/source/core/data/dptabsrc.cxx sc/source/core/data/global.cxx sc/source/core/tool/chgtrack.cxx sc/source/core/tool/compiler.cxx sc/source/filter/excel/xestyle.cxx sc/source/filter/excel/xichart.cxx sc/source/filter/inc/fapihelper.hxx sc/source/filter/inc/xistyle.hxx sc/source/filter/xml/xmlsubti.cxx sc/source/ui/Accessibility/AccessibleCell.cxx sc/source/ui/Accessibility/AccessibleContextBase.cxx sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx sc/source/ui/Accessibility/AccessibleEditObject.cxx sc/source/ui/Accessibility/AccessiblePreviewCell.cxx sc/source/ui/app/inputwin.cxx sc/source/ui/docshell/docfunc.cxx sc/source/ui/drawfunc/fupoor.cxx sc/source/ui/miscdlgs/linkarea.cxx sc/source/ui/unoobj/chart2uno.cxx sc/source/ui/unoobj/nameuno.cxx sc/source/ui/vba/vbacharacters.hxx sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbawindow.cxx scaddins/source/analysis/analysishelper.cxx scaddins/source/analysis/analysishelper.hxx scaddins/source/datefunc/datefunc.cxx scripting/examples/python/Capitalise.py scripting/source/pyprov/officehelper.py sd/source/filter/eppt/eppt.cxx sd/source/filter/eppt/epptso.cxx sd/source/ui/dlg/prltempl.cxx sd/source/ui/dlg/tpoption.cxx sd/source/ui/func/fuediglu.cxx sd/source/ui/func/fupoor.cxx sd/source/ui/func/fusel.cxx sd/source/ui/func/smarttag.cxx sd/source/ui/inc/OutlinerIteratorImpl.hxx sd/source/ui/inc/SlideViewShell.hxx sd/source/ui/inc/fuediglu.hxx sd/source/ui/inc/fusel.hxx sd/source/ui/slideshow/slideshowimpl.cxx sd/source/ui/slidesorter/cache/SlsQueueProcessorThread.hxx sd/source/ui/slidesorter/controller/SlsHideSlideFunction.cxx sd/source/ui/slidesorter/controller/SlsSelectionCommand.hxx sd/source/ui/slidesorter/inc/controller/SlsAnimationFunction.hxx sd/source/ui/slidesorter/view/SlsButtonBar.cxx sd/source/ui/view/Outliner.cxx sd/source/ui/view/drviewsh.cxx sd/source/ui/view/frmview.cxx sdext/source/presenter/PresenterFrameworkObserver.hxx sdext/source/presenter/PresenterSlideShowView.cxx setup_native/scripts/deregister_extensions setup_native/scripts/register_extensions setup_native/source/opensolaris/bundledextensions/README setup_native/source/opensolaris/bundledextensions/svc-ooo_bundled_extensions setup_native/source/win32/customactions/patch/swappatchfiles.cxx setup_native/source/win32/customactions/reg4msdoc/registrar.cxx setup_native/source/win32/customactions/reg4msdoc/userregistrar.cxx sfx2/inc/sfx2/sfxbasemodel.hxx sfx2/qa/complex/sfx2/DocumentProperties.java sfx2/source/appl/appopen.cxx sfx2/source/appl/appquit.cxx sfx2/source/appl/appserv.cxx sfx2/source/bastyp/sfxhtml.cxx sfx2/source/dialog/dockwin.cxx sfx2/source/doc/docfile.cxx sfx2/source/doc/docvor.cxx sfx2/source/doc/graphhelp.cxx sfx2/source/doc/objcont.cxx sfx2/source/doc/objserv.cxx sfx2/source/doc/objstor.cxx sfx2/source/doc/objuno.cxx sfx2/source/doc/objxtor.cxx sfx2/source/doc/printhelper.cxx sfx2/source/doc/sfxbasemodel.cxx sfx2/source/notify/eventsupplier.cxx sfx2/source/view/frmload.cxx sfx2/source/view/sfxbasecontroller.cxx shell/qa/zip/ziptest.cxx shell/source/backends/wininetbe/wininetbackend.cxx shell/source/win32/shlxthandler/util/utilities.cxx solenv/bin/build.pl solenv/bin/build_release.pl solenv/bin/cws.pl solenv/bin/download_external_dependencies.pl solenv/bin/make_download.pl solenv/bin/make_installer.pl solenv/bin/modules/Cws.pm solenv/bin/modules/ExtensionsLst.pm solenv/bin/modules/installer/control.pm solenv/bin/modules/installer/downloadsigner.pm solenv/bin/modules/installer/javainstaller.pm solenv/bin/modules/installer/packagepool.pm solenv/bin/modules/installer/patch/InstallationSet.pm solenv/bin/modules/installer/scriptitems.pm solenv/bin/modules/installer/windows/feature.pm solenv/bin/modules/installer/windows/msiglobal.pm solenv/bin/modules/installer/windows/sign.pm solenv/bin/modules/installer/worker.pm solenv/bin/modules/installer/xpdinstaller.pm solenv/bin/modules/osarch.pm solenv/bin/modules/packager/work.pm solenv/bin/modules/pre2par/parameter.pm solenv/bin/patch_tool.pl solenv/bin/transform_description.pl solenv/doc/gbuild/doxygen.cfg solenv/gbuild/LinkTarget.mk solenv/gbuild/gbuild.mk solenv/inc/os2gcci.mk solenv/inc/settings.mk solenv/inc/startup/Readme solenv/inc/target.mk solenv/inc/tg_compv.mk solenv/inc/tg_javav.mk solenv/inc/unitools.mk solenv/inc/unxbsdi.mk solenv/inc/unxbsdi2.mk solenv/inc/unxbsds.mk solenv/inc/unxfbsd.mk solenv/inc/unxlng.mk sot/source/sdstor/stg.cxx sot/source/sdstor/stgelem.cxx sot/source/sdstor/ucbstorage.cxx starmath/inc/toolbox.hxx starmath/source/mathmlexport.cxx starmath/source/node.cxx starmath/source/toolbox.cxx starmath/source/view.cxx stoc/source/bootstrap/bootstrap.xml stoc/source/corereflection/criface.cxx stoc/source/invocation/invocation.cxx stoc/source/security/access_controller.cxx stoc/source/servicemanager/servicemanager.cxx stoc/source/tdmanager/tdmgr.cxx stoc/test/javavm/testjavavm.cxx stoc/test/testconv.cxx stoc/test/testcorefl.cxx stoc/test/testintrosp.cxx svl/inc/svl/inettype.hxx svl/inc/svl/urihelper.hxx svl/qa/complex/ConfigItems/helper/HistoryOptTest.cxx svl/qa/complex/ConfigItems/helper/HistoryOptTest.hxx svl/source/config/itemholder2.hxx svl/source/items/itemset.cxx svl/source/numbers/zforlist.cxx svl/source/numbers/zformat.cxx svl/source/numbers/zforscan.cxx svtools/bmpmaker/bmp.cxx svtools/inc/svtools/helpagentwindow.hxx svtools/inc/svtools/menuoptions.hxx svtools/inc/svtools/miscopt.hxx svtools/inc/svtools/optionsdrawinglayer.hxx svtools/inc/svtools/stringtransfer.hxx svtools/inc/svtools/svlbitm.hxx svtools/inc/svtools/svtdata.hxx svtools/inc/svtools/valueset.hxx svtools/source/brwbox/editbrowsebox.cxx svtools/source/config/itemholder2.hxx svtools/source/contnr/contentenumeration.hxx svx/inc/svx/fmsrcimp.hxx svx/inc/svx/svdobj.hxx svx/inc/svx/xtable.hxx svx/source/accessibility/DGColorNameLookUp.cxx svx/source/accessibility/svxrectctaccessiblecontext.cxx svx/source/dialog/pfiledlg.cxx svx/source/fmcomp/fmgridcl.cxx svx/source/fmcomp/fmgridif.cxx svx/source/fmcomp/gridctrl.cxx svx/source/form/filtnav.cxx svx/source/form/fmPropBrw.cxx svx/source/form/fmshimp.cxx svx/source/form/fmsrcimp.cxx svx/source/gallery2/galtheme.cxx svx/source/inc/docrecovery.hxx svx/source/sdr/event/eventhandler.cxx svx/source/svdraw/svdedtv2.cxx svx/source/svdraw/svdedxv.cxx svx/source/svdraw/svdhdl.cxx svx/source/svdraw/svdobj.cxx svx/source/svdraw/svdograf.cxx svx/source/svdraw/svdoole2.cxx svx/source/svdraw/svdotxtr.cxx svx/source/svdraw/svdundo.cxx svx/source/svdraw/svdxcgv.cxx svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx sw/inc/SwNumberTree.hxx sw/inc/ndnotxt.hxx sw/source/core/access/acccell.cxx sw/source/core/access/acccell.hxx sw/source/core/access/accframebase.cxx sw/source/core/access/accframebase.hxx sw/source/core/access/accmap.cxx sw/source/core/access/accpage.cxx sw/source/core/access/accpage.hxx sw/source/core/access/accpara.cxx sw/source/core/access/accpara.hxx sw/source/core/bastyp/swrect.cxx sw/source/core/crsr/findtxt.cxx sw/source/core/doc/docdde.cxx sw/source/core/doc/notxtfrm.cxx sw/source/core/docnode/section.cxx sw/source/core/draw/dcontact.cxx sw/source/core/edit/edlingu.cxx sw/source/core/inc/anchoredobjectposition.hxx sw/source/core/layout/paintfrm.cxx sw/source/core/layout/tabfrm.cxx sw/source/core/layout/trvlfrm.cxx sw/source/core/ole/ndole.cxx sw/source/core/text/atrstck.cxx sw/source/core/text/inftxt.cxx sw/source/core/text/itratr.cxx sw/source/core/text/itrform2.cxx sw/source/core/text/itrform2.hxx sw/source/core/text/porfld.cxx sw/source/core/text/txtfly.cxx sw/source/core/txtnode/thints.cxx sw/source/core/txtnode/txtedt.cxx sw/source/core/uibase/dochdl/swdtflvr.cxx sw/source/core/uibase/docvw/PostItMgr.cxx sw/source/core/uibase/docvw/SidebarWin.cxx sw/source/core/uibase/docvw/edtwin.cxx sw/source/core/uibase/envelp/labimg.cxx sw/source/core/uibase/uiview/pview.cxx sw/source/core/uibase/uno/unomailmerge.cxx sw/source/core/undo/unattr.cxx sw/source/core/undo/untbl.cxx sw/source/core/unocore/unochart.cxx sw/source/core/view/vdraw.cxx sw/source/core/view/vnew.cxx sw/source/filter/basflt/fltini.cxx sw/source/filter/html/wrthtml.cxx sw/source/filter/inc/wwstyles.hxx sw/source/filter/rtf/rtffly.cxx sw/source/filter/rtf/swparrtf.cxx sw/source/filter/ww8/docxattributeoutput.cxx sw/source/filter/ww8/dump/msvbasic.cxx sw/source/filter/ww8/dump/ww8scan.cxx sw/source/filter/ww8/dump/ww8scan.hxx sw/source/filter/ww8/dump/ww8struc.hxx sw/source/filter/ww8/wrtww8.cxx sw/source/filter/ww8/ww8graf.cxx sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par2.cxx sw/source/filter/ww8/ww8par2.hxx sw/source/filter/ww8/ww8par3.cxx sw/source/filter/ww8/ww8par6.cxx sw/source/filter/ww8/ww8scan.cxx sw/source/filter/ww8/ww8scan.hxx sw/source/ui/dbui/dbinsdlg.cxx sw/source/ui/inc/tablemgr.hxx sw/source/ui/inc/uitool.hxx sw/source/ui/lingu/olmenu.cxx sw/source/ui/uiview/viewport.cxx sysui/desktop/productversion.mk sysui/desktop/slackware/makefile.mk testgraphical/source/CallExternals.pm testgraphical/source/fill_documents_loop.pl testgraphical/ui/java/ConvwatchGUIProject/src/IniFile.java toolkit/doc/layout/notes.txt toolkit/doc/layout/oldnotes.txt toolkit/source/awt/vclxtabcontrol.cxx toolkit/src2xml/source/srcparser.py toolkit/workben/layout/editor.cxx tools/inc/tools/simplerm.hxx tools/inc/tools/solar.h tools/source/communi/geninfo.cxx tools/source/fsys/dirent.cxx tools/source/fsys/filecopy.cxx tools/source/fsys/os2.cxx tools/source/inet/inetmime.cxx tools/source/rc/resmgr.cxx ucb/source/core/ucbcmds.cxx ucb/source/ucp/file/filglob.cxx ucb/source/ucp/odma/odma_content.cxx ucb/source/ucp/tdoc/ucptdoc.xml ucb/source/ucp/webdav/makefile.mk ucbhelper/inc/ucbhelper/simplecertificatevalidationrequest.hxx ucbhelper/source/client/content.cxx ucbhelper/source/client/interceptedinteraction.cxx udkapi/com/sun/star/beans/XPropertiesChangeListener.idl udkapi/com/sun/star/io/ObjectOutputStream.idl udkapi/com/sun/star/io/XMarkableStream.idl udkapi/com/sun/star/io/XTextOutputStream.idl udkapi/com/sun/star/reflection/CoreReflection.idl udkapi/com/sun/star/reflection/XTypeDescriptionEnumerationAccess.idl udkapi/com/sun/star/test/XSimpleTest.idl unodevtools/source/skeletonmaker/skeletoncommon.cxx unodevtools/source/skeletonmaker/skeletoncommon.hxx unotools/inc/unotools/cacheoptions.hxx unotools/inc/unotools/cmdoptions.hxx unotools/inc/unotools/dynamicmenuoptions.hxx unotools/inc/unotools/extendedsecurityoptions.hxx unotools/inc/unotools/fontoptions.hxx unotools/inc/unotools/historyoptions.hxx unotools/inc/unotools/idhelper.hxx unotools/inc/unotools/internaloptions.hxx unotools/inc/unotools/localisationoptions.hxx unotools/inc/unotools/moduleoptions.hxx unotools/inc/unotools/printwarningoptions.hxx unotools/inc/unotools/securityoptions.hxx unotools/inc/unotools/startoptions.hxx unotools/inc/unotools/workingsetoptions.hxx unotools/source/config/cmdoptions.cxx unotools/source/config/compatibility.cxx unotools/source/config/configitem.cxx unotools/source/config/configmgr.cxx unotools/source/config/dynamicmenuoptions.cxx unotools/source/config/fontcfg.cxx unotools/source/config/itemholder1.hxx unotools/source/config/moduleoptions.cxx unotools/source/config/pathoptions.cxx unotools/source/config/viewoptions.cxx unotools/source/misc/sharedunocomponent.cxx uui/source/fltdlg.cxx uui/source/iahndl-filter.cxx vbahelper/inc/vbahelper/collectionbase.hxx vbahelper/source/msforms/vbacontrol.cxx vbahelper/source/vbahelper/collectionbase.cxx vcl/aqua/source/gdi/atsfonts.cxx vcl/inc/aqua/salmathutils.hxx vcl/inc/graphite_cache.hxx vcl/inc/jobset.h vcl/inc/os2/salgdi.h vcl/inc/osx/saldata.hxx vcl/inc/salgdi.hxx vcl/inc/salwtype.hxx vcl/inc/unx/wmadaptor.hxx vcl/inc/vcl/print.hxx vcl/inc/vcl/strhelper.hxx vcl/os2/source/app/salinst.cxx vcl/os2/source/app/saltimer.cxx vcl/os2/source/gdi/salgdi2.cxx vcl/osx/salframeview.mm vcl/osx/salprn.cxx vcl/qa/cppunit/dndtest.cxx vcl/source/app/dbggui.cxx vcl/source/control/ilstbox.cxx vcl/source/gdi/cvtsvm.cxx vcl/source/gdi/gdimtf.cxx vcl/source/gdi/outdev4.cxx vcl/source/gdi/outdev6.cxx vcl/source/gdi/pdfwriter_impl.cxx vcl/source/gdi/pdfwriter_impl2.cxx vcl/source/gdi/print.cxx vcl/source/gdi/print2.cxx vcl/source/glyphs/gcach_layout.cxx vcl/source/glyphs/glyphcache.cxx vcl/source/glyphs/graphite_layout.cxx vcl/source/window/printdlg.cxx vcl/source/window/tabdlg.cxx vcl/source/window/window.cxx vcl/source/window/winproc.cxx vcl/unx/generic/app/saldisp.cxx vcl/unx/generic/dtrans/X11_selection.hxx vcl/unx/gtk/app/gtkdata.cxx vcl/win/source/gdi/salgdi2.cxx vcl/win/source/gdi/salgdi3.cxx vcl/win/source/window/salframe.cxx vos/inc/vos/pipe.hxx vos/inc/vos/process.hxx vos/inc/vos/signal.hxx vos/inc/vos/socket.hxx vos/inc/vos/thread.hxx vos/source/pipe.cxx vos/source/socket.cxx wizards/com/sun/star/wizards/agenda/AgendaTemplate.java wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java wizards/com/sun/star/wizards/agenda/TopicsControl.java wizards/com/sun/star/wizards/web/FTPDialog.java wizards/com/sun/star/wizards/web/ImageListDialog.java wizards/com/sun/star/wizards/web/Process.java wizards/com/sun/star/wizards/web/ProcessStatusRenderer.java wizards/com/sun/star/wizards/web/TOCPreview.java wizards/com/sun/star/wizards/web/WWD_Startup.java wizards/com/sun/star/wizards/web/data/TypeDetection.java wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.java writerfilter/inc/doctok/WW8Document.hxx writerfilter/source/dmapper/DomainMapper.cxx writerfilter/source/dmapper/NumberingManager.cxx writerfilter/source/dmapper/PropertyMap.cxx writerfilter/source/dmapper/StyleSheetTable.cxx writerfilter/source/doctok/WW8StructBase.hxx writerfilter/source/doctok/resources.xmi writerfilter/source/ooxml/README.efforts xmerge/source/activesync/XMergeFilter.cpp xmerge/source/minicalc/java/org/openoffice/xmerge/converter/xml/sxc/minicalc/SxcDocumentDeserializerImpl.java xmerge/source/palmtests/qa/comparator/pdbcomparison.java xmerge/source/palmtests/qa/test_spec/convertor_test_spec.html xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/DefinedName.java xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Workbook.java xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/Worksheet.java xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/formula/SymbolLookup.java xmerge/source/pocketword/java/org/openoffice/xmerge/converter/xml/sxw/pocketword/DocumentDescriptor.java xmerge/workben/jstyle.pl xmlhelp/source/cxxhelp/provider/databases.hxx xmlhelp/source/cxxhelp/provider/provider.cxx xmlhelp/source/treeview/tvread.cxx xmloff/inc/txtfldi.hxx xmloff/inc/xmloff/xmlmultiimagehelper.hxx xmloff/inc/xmloff/xmluconv.hxx xmloff/source/core/xmlexp.cxx xmloff/source/draw/shapeexport2.cxx xmloff/source/draw/shapeexport3.cxx xmloff/source/meta/xmlversion.cxx xmloff/source/style/impastp4.cxx xmloff/source/style/xmlaustp.cxx xmloff/source/text/XMLSectionExport.cxx xmloff/source/text/txtflde.cxx xmloff/source/text/txtimp.cxx xmloff/source/text/txtparae.cxx xmloff/source/text/txtparai.cxx xmloff/source/text/txtvfldi.cxx xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx Change-Id: Ie072e7c3a60c5dae16a67ac36d1f372c5065c99c
2014-04-29 19:25:03 +00:00
// Therefore we have to subtract them before writing back to the properties (model).
if ( xDialogDevice.is() && mbDesignMode )
{
2011-03-11 18:04:44 +00:00
DeviceInfo aDeviceInfo( xDialogDevice->getInfo() );
aAppFontSize.Width() -= aDeviceInfo.LeftInset + aDeviceInfo.RightInset;
aAppFontSize.Height() -= aDeviceInfo.TopInset + aDeviceInfo.BottomInset;
}
2011-03-11 18:04:44 +00:00
aAppFontSize = ImplMapPixelToAppFont( pOutDev, aAppFontSize );
2011-03-11 18:04:44 +00:00
// Remember that changes have been done by listener. No need to
// update the position because of property change event.
mbSizeModified = true;
Sequence< OUString > aProps( 2 );
2011-03-11 18:04:44 +00:00
Sequence< Any > aValues( 2 );
// Properties in a sequence must be sorted!
aProps[0] = "Height";
aProps[1] = "Width";
2011-03-11 18:04:44 +00:00
aValues[0] <<= aAppFontSize.Height();
aValues[1] <<= aAppFontSize.Width();
2011-03-11 18:04:44 +00:00
ImplSetPropertyValues( aProps, aValues, true );
mbSizeModified = false;
}
}
2011-03-11 18:04:44 +00:00
void SAL_CALL UnoDialogControl::windowMoved( const ::com::sun::star::awt::WindowEvent& e )
throw (::com::sun::star::uno::RuntimeException, std::exception)
{
2011-03-11 18:04:44 +00:00
OutputDevice*pOutDev = Application::GetDefaultDevice();
DBG_ASSERT( pOutDev, "Missing Default Device!" );
if ( pOutDev && !mbPosModified )
{
// Currentley we are simply using MAP_APPFONT
::Size aTmp( e.X, e.Y );
aTmp = ImplMapPixelToAppFont( pOutDev, aTmp );
2011-03-11 18:04:44 +00:00
// Remember that changes have been done by listener. No need to
// update the position because of property change event.
mbPosModified = true;
Sequence< OUString > aProps( 2 );
2011-03-11 18:04:44 +00:00
Sequence< Any > aValues( 2 );
aProps[0] = "PositionX";
aProps[1] = "PositionY";
2011-03-11 18:04:44 +00:00
aValues[0] <<= aTmp.Width();
aValues[1] <<= aTmp.Height();
2011-03-11 18:04:44 +00:00
ImplSetPropertyValues( aProps, aValues, true );
mbPosModified = false;
}
}
void SAL_CALL UnoDialogControl::windowShown( const EventObject& e ) throw (RuntimeException, std::exception)
{
2011-03-11 18:04:44 +00:00
(void)e;
}
void SAL_CALL UnoDialogControl::windowHidden( const EventObject& e ) throw (RuntimeException, std::exception)
{
2011-03-11 18:04:44 +00:00
(void)e;
}
void SAL_CALL UnoDialogControl::endDialog( ::sal_Int32 i_result ) throw (RuntimeException, std::exception)
{
Reference< XDialog2 > xPeerDialog( getPeer(), UNO_QUERY );
if ( xPeerDialog.is() )
xPeerDialog->endDialog( i_result );
}
void SAL_CALL UnoDialogControl::setHelpId( const OUString& i_id ) throw (RuntimeException, std::exception)
{
Reference< XDialog2 > xPeerDialog( getPeer(), UNO_QUERY );
if ( xPeerDialog.is() )
xPeerDialog->setHelpId( i_id );
}
void UnoDialogControl::setTitle( const OUString& Title ) throw(RuntimeException, std::exception)
{
2011-03-11 18:04:44 +00:00
SolarMutexGuard aGuard;
Any aAny;
aAny <<= Title;
ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TITLE ), aAny, true );
}
OUString UnoDialogControl::getTitle() throw(RuntimeException, std::exception)
{
2011-03-11 18:04:44 +00:00
SolarMutexGuard aGuard;
return ImplGetPropertyValue_UString( BASEPROPERTY_TITLE );
}
sal_Int16 UnoDialogControl::execute() throw(RuntimeException, std::exception)
{
2011-03-11 18:04:44 +00:00
SolarMutexGuard aGuard;
sal_Int16 nDone = -1;
if ( getPeer().is() )
{
2011-03-11 18:04:44 +00:00
Reference< XDialog > xDlg( getPeer(), UNO_QUERY );
if( xDlg.is() )
{
GetComponentInfos().bVisible = true;
2011-03-11 18:04:44 +00:00
nDone = xDlg->execute();
GetComponentInfos().bVisible = false;
}
}
2011-03-11 18:04:44 +00:00
return nDone;
}
void UnoDialogControl::endExecute() throw(RuntimeException, std::exception)
{
2011-03-11 18:04:44 +00:00
SolarMutexGuard aGuard;
if ( getPeer().is() )
{
2011-03-11 18:04:44 +00:00
Reference< XDialog > xDlg( getPeer(), UNO_QUERY );
if( xDlg.is() )
{
2011-03-11 18:04:44 +00:00
xDlg->endExecute();
GetComponentInfos().bVisible = false;
}
}
}
// XModifyListener
2011-03-11 18:04:44 +00:00
void SAL_CALL UnoDialogControl::modified(
const lang::EventObject& /*rEvent*/ )
throw (RuntimeException, std::exception)
{
2011-03-11 18:04:44 +00:00
ImplUpdateResourceResolver();
}
2011-03-11 18:04:44 +00:00
void UnoDialogControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent >& rEvents ) throw(RuntimeException)
{
2011-03-11 18:04:44 +00:00
sal_Int32 nLen = rEvents.getLength();
for( sal_Int32 i = 0; i < nLen; i++ )
{
2011-03-11 18:04:44 +00:00
const PropertyChangeEvent& rEvt = rEvents.getConstArray()[i];
Reference< XControlModel > xModel( rEvt.Source, UNO_QUERY );
bool bOwnModel = (XControlModel*)xModel.get() == (XControlModel*)getModel().get();
if ( bOwnModel && rEvt.PropertyName == "ImageURL" )
{
OUString aImageURL;
2011-03-11 18:04:44 +00:00
Reference< graphic::XGraphic > xGraphic;
if (( ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEURL ) ) >>= aImageURL ) &&
( !aImageURL.isEmpty() ))
{
OUString absoluteUrl = aImageURL;
if ( !aImageURL.startsWith( UNO_NAME_GRAPHOBJ_URLPREFIX ) )
absoluteUrl = getPhysicalLocation( ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DIALOGSOURCEURL )),
2011-03-11 18:04:44 +00:00
uno::makeAny(aImageURL));
xGraphic = ImageHelper::getGraphicFromURL_nothrow( absoluteUrl );
}
ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC), uno::makeAny( xGraphic ), true );
2011-03-11 18:04:44 +00:00
break;
}
}
2011-03-11 18:04:44 +00:00
ControlContainerBase::ImplModelPropertiesChanged(rEvents);
}
// class MultiPageControl
UnoMultiPageControl::UnoMultiPageControl( const uno::Reference< uno::XComponentContext >& rxContext ) : ControlContainerBase(rxContext), maTabListeners( *this )
{
maComponentInfos.nWidth = 280;
maComponentInfos.nHeight = 400;
}
UnoMultiPageControl::~UnoMultiPageControl()
{
}
// XTabListener
void SAL_CALL UnoMultiPageControl::inserted( SAL_UNUSED_PARAMETER ::sal_Int32 ) throw (RuntimeException, std::exception)
{
}
void SAL_CALL UnoMultiPageControl::removed( SAL_UNUSED_PARAMETER ::sal_Int32 ) throw (RuntimeException, std::exception)
{
}
void SAL_CALL UnoMultiPageControl::changed( SAL_UNUSED_PARAMETER ::sal_Int32,
SAL_UNUSED_PARAMETER const Sequence< NamedValue >& ) throw (RuntimeException, std::exception)
{
}
void SAL_CALL UnoMultiPageControl::activated( ::sal_Int32 ID ) throw (RuntimeException, std::exception)
{
ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE ), uno::makeAny( ID ), false );
}
void SAL_CALL UnoMultiPageControl::deactivated( SAL_UNUSED_PARAMETER ::sal_Int32 ) throw (RuntimeException, std::exception)
{
}
void SAL_CALL UnoMultiPageControl::disposing(const EventObject&) throw (RuntimeException, std::exception)
{
}
void SAL_CALL UnoMultiPageControl::dispose() throw (RuntimeException, std::exception)
{
lang::EventObject aEvt;
aEvt.Source = (::cppu::OWeakObject*)this;
maTabListeners.disposeAndClear( aEvt );
ControlContainerBase::dispose();
}
// com::sun::star::awt::XSimpleTabController
::sal_Int32 SAL_CALL UnoMultiPageControl::insertTab() throw (RuntimeException, std::exception)
{
Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
if ( !xMultiPage.is() )
throw RuntimeException();
return xMultiPage->insertTab();
}
void SAL_CALL UnoMultiPageControl::removeTab( ::sal_Int32 ID ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
{
Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
if ( !xMultiPage.is() )
throw RuntimeException();
xMultiPage->removeTab( ID );
}
void SAL_CALL UnoMultiPageControl::setTabProps( ::sal_Int32 ID, const Sequence< NamedValue >& Properties ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
{
Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
if ( !xMultiPage.is() )
throw RuntimeException();
xMultiPage->setTabProps( ID, Properties );
}
Sequence< NamedValue > SAL_CALL UnoMultiPageControl::getTabProps( ::sal_Int32 ID ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
{
Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
if ( !xMultiPage.is() )
throw RuntimeException();
return xMultiPage->getTabProps( ID );
}
void SAL_CALL UnoMultiPageControl::activateTab( ::sal_Int32 ID ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
{
Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
if ( !xMultiPage.is() )
throw RuntimeException();
xMultiPage->activateTab( ID );
ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE ), uno::makeAny( ID ), true );
}
::sal_Int32 SAL_CALL UnoMultiPageControl::getActiveTabID() throw (RuntimeException, std::exception)
{
Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
if ( !xMultiPage.is() )
throw RuntimeException();
return xMultiPage->getActiveTabID();
}
void SAL_CALL UnoMultiPageControl::addTabListener( const Reference< XTabListener >& Listener ) throw (RuntimeException, std::exception)
{
maTabListeners.addInterface( Listener );
Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
if ( xMultiPage.is() && maTabListeners.getLength() == 1 )
xMultiPage->addTabListener( &maTabListeners );
}
void SAL_CALL UnoMultiPageControl::removeTabListener( const Reference< XTabListener >& Listener ) throw (RuntimeException, std::exception)
{
Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
if ( xMultiPage.is() && maTabListeners.getLength() == 1 )
xMultiPage->removeTabListener( &maTabListeners );
maTabListeners.removeInterface( Listener );
}
// lang::XTypeProvider
IMPL_XTYPEPROVIDER_START( UnoMultiPageControl )
cppu::UnoType<awt::XSimpleTabController>::get(),
cppu::UnoType<awt::XTabListener>::get(),
ControlContainerBase::getTypes()
IMPL_XTYPEPROVIDER_END
// uno::XInterface
uno::Any UnoMultiPageControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
{
uno::Any aRet = ::cppu::queryInterface( rType,
(static_cast< awt::XTabListener* >(this)), (static_cast< awt::XSimpleTabController* >(this)) );
return (aRet.hasValue() ? aRet : ControlContainerBase::queryAggregation( rType ));
}
OUString UnoMultiPageControl::GetComponentServiceName()
{
bool bDecoration( true );
ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION )) >>= bDecoration;
if ( bDecoration )
return OUString("tabcontrol");
// Hopefully we can tweak the tabcontrol to display without tabs
return OUString("tabcontrolnotabs");
}
void UnoMultiPageControl::bindPage( const uno::Reference< awt::XControl >& _rxControl )
{
uno::Reference< awt::XWindowPeer > xPage( _rxControl->getPeer() );
uno::Reference< awt::XSimpleTabController > xTabCntrl( getPeer(), uno::UNO_QUERY );
uno::Reference< beans::XPropertySet > xProps( _rxControl->getModel(), uno::UNO_QUERY );
VCLXTabPage* pXPage = dynamic_cast< VCLXTabPage* >( xPage.get() );
TabPage* pPage = pXPage ? pXPage->getTabPage() : NULL;
if ( xTabCntrl.is() && pPage )
{
VCLXMultiPage* pXTab = dynamic_cast< VCLXMultiPage* >( xTabCntrl.get() );
if ( pXTab )
{
OUString sTitle;
xProps->getPropertyValue( GetPropertyName( BASEPROPERTY_TITLE ) ) >>= sTitle;
pXTab->insertTab( pPage, sTitle);
}
}
}
void UnoMultiPageControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException, std::exception)
{
SolarMutexGuard aSolarGuard;
UnoControlContainer::createPeer( rxToolkit, rParentPeer );
uno::Sequence< uno::Reference< awt::XControl > > aCtrls = getControls();
sal_uInt32 nCtrls = aCtrls.getLength();
for( sal_uInt32 n = 0; n < nCtrls; n++ )
bindPage( aCtrls[ n ] );
sal_Int32 nActiveTab(0);
Reference< XPropertySet > xMultiProps( getModel(), UNO_QUERY );
xMultiProps->getPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE ) ) >>= nActiveTab;
uno::Reference< awt::XSimpleTabController > xTabCntrl( getPeer(), uno::UNO_QUERY );
if ( xTabCntrl.is() )
{
xTabCntrl->addTabListener( this );
if ( nActiveTab && nCtrls ) // Ensure peer is initialise with correct activated tab
{
xTabCntrl->activateTab( nActiveTab );
ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE ), uno::makeAny( nActiveTab ), true );
}
}
}
void UnoMultiPageControl::impl_createControlPeerIfNecessary( const uno::Reference< awt::XControl >& _rxControl)
{
OSL_PRECOND( _rxControl.is(), "UnoMultiPageControl::impl_createControlPeerIfNecessary: invalid control, this will crash!" );
// if the container already has a peer, then also create a peer for the control
uno::Reference< awt::XWindowPeer > xMyPeer( getPeer() );
if( xMyPeer.is() )
{
_rxControl->createPeer( NULL, xMyPeer );
bindPage( _rxControl );
ImplActivateTabControllers();
}
}
// ------------- UnoMultiPageModel -----------------
UnoMultiPageModel::UnoMultiPageModel( const Reference< XComponentContext >& rxContext ) : ControlModelContainerBase( rxContext )
{
ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
ImplRegisterProperty( BASEPROPERTY_ENABLED );
ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
ImplRegisterProperty( BASEPROPERTY_HELPURL );
ImplRegisterProperty( BASEPROPERTY_SIZEABLE );
//ImplRegisterProperty( BASEPROPERTY_DIALOGSOURCEURL );
ImplRegisterProperty( BASEPROPERTY_MULTIPAGEVALUE );
ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES );
Any aBool;
aBool <<= true;
ImplRegisterProperty( BASEPROPERTY_MOVEABLE, aBool );
ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool );
ImplRegisterProperty( BASEPROPERTY_DECORATION, aBool );
// MultiPage Control has the tab stop property. And the default value is True.
ImplRegisterProperty( BASEPROPERTY_TABSTOP, aBool );
uno::Reference< XNameContainer > xNameCont = new SimpleNamedThingContainer< XControlModel >();
ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES, uno::makeAny( xNameCont ) );
}
UnoMultiPageModel::UnoMultiPageModel( const UnoMultiPageModel& rModel )
: ControlModelContainerBase( rModel )
{
}
UnoMultiPageModel::~UnoMultiPageModel()
{
}
UnoControlModel*
UnoMultiPageModel::Clone() const
{
// clone the container itself
UnoMultiPageModel* pClone = new UnoMultiPageModel( *this );
Clone_Impl( *pClone );
return pClone;
}
OUString UnoMultiPageModel::getServiceName() throw(::com::sun::star::uno::RuntimeException, std::exception)
{
return OUString( "com.sun.star.awt.UnoMultiPageModel" );
}
uno::Any UnoMultiPageModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
{
if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
{
uno::Any aAny;
aAny <<= OUString( "com.sun.star.awt.UnoControlMultiPage" );
return aAny;
}
return ControlModelContainerBase::ImplGetDefaultValue( nPropId );
}
::cppu::IPropertyArrayHelper& UnoMultiPageModel::getInfoHelper()
{
static UnoPropertyArrayHelper* pHelper = NULL;
if ( !pHelper )
{
uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
pHelper = new UnoPropertyArrayHelper( aIDs );
}
return *pHelper;
}
// beans::XMultiPropertySet
uno::Reference< beans::XPropertySetInfo > UnoMultiPageModel::getPropertySetInfo( ) throw(uno::RuntimeException, std::exception)
{
static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
return xInfo;
}
void UnoMultiPageModel::insertByName( const OUString& aName, const Any& aElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException, std::exception)
{
Reference< XServiceInfo > xInfo;
aElement >>= xInfo;
if ( !xInfo.is() )
throw IllegalArgumentException();
// Only a Page model can be inserted into the multipage
if ( !xInfo->supportsService( "com.sun.star.awt.UnoPageModel" ) )
throw IllegalArgumentException();
return ControlModelContainerBase::insertByName( aName, aElement );
}
sal_Bool SAL_CALL UnoMultiPageModel::getGroupControl( ) throw (RuntimeException, std::exception)
{
return sal_True;
}
// class UnoPageControl
UnoPageControl::UnoPageControl( const uno::Reference< uno::XComponentContext >& rxContext ) : ControlContainerBase(rxContext)
{
maComponentInfos.nWidth = 280;
maComponentInfos.nHeight = 400;
}
UnoPageControl::~UnoPageControl()
{
}
OUString UnoPageControl::GetComponentServiceName()
{
return OUString("tabpage");
}
// ------------- UnoPageModel -----------------
UnoPageModel::UnoPageModel( const Reference< XComponentContext >& rxContext ) : ControlModelContainerBase( rxContext )
{
ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
ImplRegisterProperty( BASEPROPERTY_ENABLED );
ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
ImplRegisterProperty( BASEPROPERTY_HELPURL );
ImplRegisterProperty( BASEPROPERTY_TITLE );
ImplRegisterProperty( BASEPROPERTY_SIZEABLE );
ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES );
// ImplRegisterProperty( BASEPROPERTY_DIALOGSOURCEURL );
Any aBool;
aBool <<= true;
ImplRegisterProperty( BASEPROPERTY_MOVEABLE, aBool );
ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool );
//ImplRegisterProperty( BASEPROPERTY_TABSTOP, aBool );
uno::Reference< XNameContainer > xNameCont = new SimpleNamedThingContainer< XControlModel >();
ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES, uno::makeAny( xNameCont ) );
}
UnoPageModel::UnoPageModel( const UnoPageModel& rModel )
: ControlModelContainerBase( rModel )
{
}
UnoPageModel::~UnoPageModel()
{
}
UnoControlModel*
UnoPageModel::Clone() const
{
// clone the container itself
UnoPageModel* pClone = new UnoPageModel( *this );
Clone_Impl( *pClone );
return pClone;
}
OUString UnoPageModel::getServiceName() throw(::com::sun::star::uno::RuntimeException, std::exception)
{
return OUString( "com.sun.star.awt.UnoPageModel" );
}
uno::Any UnoPageModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
{
if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
{
uno::Any aAny;
aAny <<= OUString( "com.sun.star.awt.UnoControlPage" );
return aAny;
}
return ControlModelContainerBase::ImplGetDefaultValue( nPropId );
}
::cppu::IPropertyArrayHelper& UnoPageModel::getInfoHelper()
{
static UnoPropertyArrayHelper* pHelper = NULL;
if ( !pHelper )
{
uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
pHelper = new UnoPropertyArrayHelper( aIDs );
}
return *pHelper;
}
// beans::XMultiPropertySet
uno::Reference< beans::XPropertySetInfo > UnoPageModel::getPropertySetInfo( ) throw(uno::RuntimeException, std::exception)
{
static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
return xInfo;
}
sal_Bool SAL_CALL UnoPageModel::getGroupControl( ) throw (RuntimeException, std::exception)
{
return sal_False;
}
// Frame control
// class UnoFrameControl
UnoFrameControl::UnoFrameControl( const uno::Reference< uno::XComponentContext >& rxContext ) : ControlContainerBase(rxContext)
{
maComponentInfos.nWidth = 280;
maComponentInfos.nHeight = 400;
}
UnoFrameControl::~UnoFrameControl()
{
}
OUString UnoFrameControl::GetComponentServiceName()
{
return OUString("frame");
}
void UnoFrameControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
{
bool bOwnCtrl = false;
OUString sTitle;
if ( rxCtrl.get() == Reference<XControl>( this ).get() )
bOwnCtrl = true;
Reference< XPropertySet > xProps( getModel(), UNO_QUERY );
//xProps->getPropertyValue( GetPropertyName( BASEPROPERTY_TITLE ) ) >>= sTitle;
xProps->getPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ) ) >>= sTitle;
ControlContainerBase::ImplSetPosSize( rxCtrl );
Reference < XWindow > xW( rxCtrl, UNO_QUERY );
if ( !bOwnCtrl && xW.is() && !sTitle.isEmpty() )
{
awt::Rectangle aSizePos = xW->getPosSize();
sal_Int32 nX = aSizePos.X, nY = aSizePos.Y, nWidth = aSizePos.Width, nHeight = aSizePos.Height;
// Retrieve the values set by the base class
OutputDevice*pOutDev = Application::GetDefaultDevice();
if ( pOutDev )
{
if ( !bOwnCtrl && !sTitle.isEmpty() )
{
// Adjust Y based on height of Title
::Rectangle aRect;
aRect = pOutDev->GetTextRect( aRect, sTitle );
nY = nY + ( aRect.GetHeight() / 2 );
}
}
else
{
Reference< XWindowPeer > xPeer = ImplGetCompatiblePeer( true );
Reference< XDevice > xD( xPeer, UNO_QUERY );
SimpleFontMetric aFM;
FontDescriptor aFD;
Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_FONTDESCRIPTOR ) );
aVal >>= aFD;
if ( !aFD.StyleName.isEmpty() )
{
Reference< XFont > xFont = xD->getFont( aFD );
aFM = xFont->getFontMetric();
}
else
{
Reference< XGraphics > xG = xD->createGraphics();
aFM = xG->getFontMetric();
}
sal_Int16 nH = aFM.Ascent + aFM.Descent;
if ( !bOwnCtrl && !sTitle.isEmpty() )
// offset y based on height of font ( not sure if my guess at the correct calculation is correct here )
nY = nY + ( nH / 8); // how do I test this
}
xW->setPosSize( nX, nY, nWidth, nHeight, PosSize::POSSIZE );
}
}
// ------------- UnoFrameModel -----------------
UnoFrameModel::UnoFrameModel( const Reference< XComponentContext >& rxContext ) : ControlModelContainerBase( rxContext )
{
ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
ImplRegisterProperty( BASEPROPERTY_ENABLED );
ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
ImplRegisterProperty( BASEPROPERTY_HELPURL );
ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
ImplRegisterProperty( BASEPROPERTY_LABEL );
ImplRegisterProperty( BASEPROPERTY_WRITING_MODE );
ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE );
ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES );
ImplRegisterProperty( BASEPROPERTY_HSCROLL );
ImplRegisterProperty( BASEPROPERTY_VSCROLL );
ImplRegisterProperty( BASEPROPERTY_SCROLLWIDTH );
ImplRegisterProperty( BASEPROPERTY_SCROLLHEIGHT );
ImplRegisterProperty( BASEPROPERTY_SCROLLTOP );
ImplRegisterProperty( BASEPROPERTY_SCROLLLEFT );
uno::Reference< XNameContainer > xNameCont = new SimpleNamedThingContainer< XControlModel >();
ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES, uno::makeAny( xNameCont ) );
}
UnoFrameModel::UnoFrameModel( const UnoFrameModel& rModel )
: ControlModelContainerBase( rModel )
{
}
UnoFrameModel::~UnoFrameModel()
{
}
UnoControlModel*
UnoFrameModel::Clone() const
{
// clone the container itself
UnoFrameModel* pClone = new UnoFrameModel( *this );
Clone_Impl( *pClone );
return pClone;
}
OUString UnoFrameModel::getServiceName() throw(::com::sun::star::uno::RuntimeException, std::exception)
{
return OUString( "com.sun.star.awt.UnoFrameModel" );
}
uno::Any UnoFrameModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
{
uno::Any aAny;
switch ( nPropId )
{
case BASEPROPERTY_DEFAULTCONTROL:
{
aAny <<= OUString( "com.sun.star.awt.UnoControlFrame" );
return aAny;
}
case BASEPROPERTY_SCROLLWIDTH:
case BASEPROPERTY_SCROLLHEIGHT:
case BASEPROPERTY_SCROLLTOP:
case BASEPROPERTY_SCROLLLEFT:
aAny <<= sal_Int32(0);
return aAny;
case BASEPROPERTY_USERFORMCONTAINEES:
{
uno::Reference< XNameContainer > xNameCont = new SimpleNamedThingContainer< XControlModel >();
return makeAny( xNameCont );
}
}
return ControlModelContainerBase::ImplGetDefaultValue( nPropId );
}
::cppu::IPropertyArrayHelper& UnoFrameModel::getInfoHelper()
{
static UnoPropertyArrayHelper* pHelper = NULL;
if ( !pHelper )
{
uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
pHelper = new UnoPropertyArrayHelper( aIDs );
}
return *pHelper;
}
// beans::XMultiPropertySet
uno::Reference< beans::XPropertySetInfo > UnoFrameModel::getPropertySetInfo( ) throw(uno::RuntimeException, std::exception)
{
static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
return xInfo;
}
2011-08-04 15:39:25 +01:00
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
stardiv_Toolkit_UnoControlDialogModel_get_implementation(
css::uno::XComponentContext *context,
css::uno::Sequence<css::uno::Any> const &)
{
return cppu::acquire(new OGeometryControlModel<UnoControlDialogModel>(context));
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
stardiv_Toolkit_UnoDialogControl_get_implementation(
css::uno::XComponentContext *context,
css::uno::Sequence<css::uno::Any> const &)
{
return cppu::acquire(new UnoDialogControl(context));
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
stardiv_Toolkit_UnoMultiPageControl_get_implementation(
css::uno::XComponentContext *context,
css::uno::Sequence<css::uno::Any> const &)
{
return cppu::acquire(new UnoMultiPageControl(context));
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
stardiv_Toolkit_UnoMultiPageModel_get_implementation(
css::uno::XComponentContext *context,
css::uno::Sequence<css::uno::Any> const &)
{
return cppu::acquire(new UnoMultiPageModel(context));
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
stardiv_Toolkit_UnoPageControl_get_implementation(
css::uno::XComponentContext *context,
css::uno::Sequence<css::uno::Any> const &)
{
return cppu::acquire(new UnoPageControl(context));
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
stardiv_Toolkit_UnoPageModel_get_implementation(
css::uno::XComponentContext *context,
css::uno::Sequence<css::uno::Any> const &)
{
return cppu::acquire(new UnoPageModel(context));
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
stardiv_Toolkit_UnoFrameControl_get_implementation(
css::uno::XComponentContext *context,
css::uno::Sequence<css::uno::Any> const &)
{
return cppu::acquire(new UnoFrameControl(context));
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
stardiv_Toolkit_UnoFrameModel_get_implementation(
css::uno::XComponentContext *context,
css::uno::Sequence<css::uno::Any> const &)
{
return cppu::acquire(new UnoFrameModel(context));
}
2011-08-04 15:39:25 +01:00
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */