ooo-build r13650 - in trunk: . patches/dev300 patches/vba
- From: noelpwer svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r13650 - in trunk: . patches/dev300 patches/vba
- Date: Thu, 21 Aug 2008 11:41:31 +0000 (UTC)
Author: noelpwer
Date: Thu Aug 21 11:41:31 2008
New Revision: 13650
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13650&view=rev
Log:
2008-08-21 Noel Power <noel power novell com>
* patches/dev300/controls-with-images-in-document.diff: updated with
changes from review.
* patches/dev300/controls-with-images-import.diff: ripple changes
from above
* patches/vba/enhanced-form-userform-controls.diff: userform dialog
owner ( or not ) identification
Modified:
trunk/ChangeLog
trunk/patches/dev300/controls-with-images-import.diff
trunk/patches/dev300/controls-with-images-in-document.diff
trunk/patches/vba/enhanced-form-userform-controls.diff
Modified: trunk/patches/dev300/controls-with-images-import.diff
==============================================================================
--- trunk/patches/dev300/controls-with-images-import.diff (original)
+++ trunk/patches/dev300/controls-with-images-import.diff Thu Aug 21 11:41:31 2008
@@ -24,7 +24,7 @@
#include <algorithm>
#include <memory>
-+#include <com/sun/star/graphic/GraphicObjectFactory.hpp>
++#include <com/sun/star/graphic/GraphicObject.hpp>
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
@@ -117,7 +117,7 @@
+ {
+ // create an XGraphicObject
+ ::comphelper::ComponentContext aContext( xServiceManager );
-+ xGrfObj = graphic::GraphicObjectFactory::createGraphicObject( aContext.getUNOContext() );
++ xGrfObj = graphic::GraphicObject::create( aContext.getUNOContext() );
+ xGrfObj->setGraphic(xGraphic);
+ }
+ }
Modified: trunk/patches/dev300/controls-with-images-in-document.diff
==============================================================================
--- trunk/patches/dev300/controls-with-images-in-document.diff (original)
+++ trunk/patches/dev300/controls-with-images-in-document.diff Thu Aug 21 11:41:31 2008
@@ -1,12 +1,12 @@
diff --git extensions/source/propctrlr/formcomponenthandler.cxx extensions/source/propctrlr/formcomponenthandler.cxx
-index e8ef25c..50b418b 100644
+index e8ef25c..3665d96 100644
--- extensions/source/propctrlr/formcomponenthandler.cxx
+++ extensions/source/propctrlr/formcomponenthandler.cxx
@@ -80,6 +80,7 @@
#include <com/sun/star/inspection/PropertyLineElement.hpp>
#include <com/sun/star/resource/XStringResourceManager.hpp>
#include <com/sun/star/resource/MissingResourceException.hpp>
-+#include <com/sun/star/graphic/GraphicObjectFactory.hpp>
++#include <com/sun/star/graphic/GraphicObject.hpp>
/** === end UNO includes === **/
#include <connectivity/dbexception.hxx>
#include <vcl/wrkwin.hxx>
@@ -18,16 +18,7 @@
//------------------------------------------------------------------------
extern "C" void SAL_CALL createRegistryInfo_FormComponentPropertyHandler()
{
-@@ -328,6 +330,8 @@ namespace pcr
- //--------------------------------------------------------------------
- void SAL_CALL FormComponentPropertyHandler::setPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException)
- {
-+ rtl::OUString sVal;
-+ _rValue >>= sVal;
- if( _rPropertyName == PROPERTY_ROWSET )
- {
- ::comphelper::OPropertyContainer::setPropertyValue( _rPropertyName, _rValue );
-@@ -336,7 +340,16 @@ namespace pcr
+@@ -336,7 +338,15 @@ namespace pcr
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); // check if property is known by the handler
@@ -36,16 +27,33 @@
+ if ( PROPERTY_ID_IMAGE_URL == nPropId && ( _rValue >>= xGrfObj ) )
+ {
+ DBG_ASSERT( xGrfObj.is(), "FormComponentPropertyHandler::setPropertyValue() xGrfObj is invalid");
-+ rtl::OUString ObjectID( RTL_CONSTASCII_USTRINGPARAM( GRAPHOBJ_URLPREFIX ) );
-+ ObjectID = ObjectID + xGrfObj->getUniqueID();
-+ Any aValue( ObjectID );
-+ m_xComponent->setPropertyValue( _rPropertyName, aValue );
++ rtl::OUString sObjectID( RTL_CONSTASCII_USTRINGPARAM( GRAPHOBJ_URLPREFIX ) );
++ sObjectID = sObjectID + xGrfObj->getUniqueID();
++ m_xComponent->setPropertyValue( _rPropertyName, uno::makeAny( sObjectID ) );
+ }
+ else if ( PROPERTY_ID_FONT_NAME == nPropId )
{
// special handling, the value is a faked value we generated ourself in impl_executeFontDialog_nothrow
Sequence< NamedValue > aFontPropertyValues;
-@@ -2658,12 +2673,18 @@ namespace pcr
+@@ -561,9 +571,14 @@ namespace pcr
+ {
+ ::rtl::OUString sControlValue;
+ OSL_VERIFY( _rControlValue >>= sControlValue );
+-
+- INetURLObject aDocURL( impl_getDocumentURL_nothrow() );
+- aPropertyValue <<= (::rtl::OUString)URIHelper::SmartRel2Abs( aDocURL, sControlValue, Link(), false, true, INetURLObject::WAS_ENCODED, INetURLObject::DECODE_TO_IURI );
++ // Don't convert a placeholder
++ if ( nPropId == PROPERTY_ID_IMAGE_URL && sControlValue.equals( String( PcrRes( RID_EMBED_IMAGE_PLACEHOLDER ) ) ) )
++ aPropertyValue <<= sControlValue;
++ else
++ {
++ INetURLObject aDocURL( impl_getDocumentURL_nothrow() );
++ aPropertyValue <<= (::rtl::OUString)URIHelper::SmartRel2Abs( aDocURL, sControlValue, Link(), false, true, INetURLObject::WAS_ENCODED, INetURLObject::DECODE_TO_IURI );
++ }
+ }
+ break;
+
+@@ -2658,12 +2673,16 @@ namespace pcr
//------------------------------------------------------------------------
bool FormComponentPropertyHandler::impl_browseForImage_nothrow( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
{
@@ -56,16 +64,14 @@
aFileDlg.SetTitle(aStrTrans);
-
-+ // Bit of a hack to allow basic dialogs to override support for
+ // non-linked images ( e.g. those located in the document
-+ // stream ) Even though the toolkit control CAN handle this but
-+ // the dialog code can't ( right now ) hopefully it will soon
++ // stream ) cannot *currently* be handled by openoffice basic dialogs.
+ bool bHandleNonLink = ( m_eComponentClass == eFormControl );
+
Reference< XFilePickerControlAccess > xController(aFileDlg.GetFilePicker(), UNO_QUERY);
DBG_ASSERT(xController.is(), "FormComponentPropertyHandler::impl_browseForImage_nothrow: missing the controller interface on the file picker!");
if (xController.is())
-@@ -2671,14 +2692,14 @@ namespace pcr
+@@ -2671,14 +2690,14 @@ namespace pcr
// do a preview by default
xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0, ::cppu::bool2any(sal_True));
@@ -84,7 +90,7 @@
{
aFileDlg.SetDisplayDirectory( sCurValue );
// TODO: need to set the display directory _and_ the default name
-@@ -2687,7 +2708,26 @@ namespace pcr
+@@ -2687,7 +2706,26 @@ namespace pcr
_rClearBeforeDialog.clear();
bool bSuccess = ( 0 == aFileDlg.Execute() );
if ( bSuccess )
@@ -99,7 +105,7 @@
+ Graphic aGraphic;
+ aFileDlg.GetGraphic( aGraphic );
+
-+ Reference< graphic::XGraphicObject > xGrfObj = graphic::GraphicObjectFactory::createGraphicObject( m_aContext.getUNOContext() );
++ Reference< graphic::XGraphicObject > xGrfObj = graphic::GraphicObject::create( m_aContext.getUNOContext() );
+ xGrfObj->setGraphic( aGraphic.GetXGraphic() );
+
+
@@ -112,37 +118,196 @@
return bSuccess;
}
+diff --git extensions/source/propctrlr/propcontroller.cxx extensions/source/propctrlr/propcontroller.cxx
+index 80c07a6..bc1257d 100644
+--- extensions/source/propctrlr/propcontroller.cxx
++++ extensions/source/propctrlr/propcontroller.cxx
+@@ -1384,6 +1384,22 @@ namespace pcr
+ {
+ try
+ {
++ rtl::OUString sPlcHolder = String( PcrRes( RID_EMBED_IMAGE_PLACEHOLDER ) );
++ bool bIsPlaceHolderValue = false;
++
++ if ( rName.equals( PROPERTY_IMAGE_URL ) )
++ {
++ // if the prop value is the PlaceHolder
++ // can ignore it
++ rtl::OUString sVal;
++ _rValue >>= sVal;
++ if ( sVal.equals( sPlcHolder ) )
++ // #FIXME ? I wonder is it safe to just return here?
++ // For the moment, leave the code path as is, just
++ // ensure that the placeholder doesn't get set as
++ // the propery value
++ bIsPlaceHolderValue = true;
++ }
+ m_sCommittingProperty = rName;
+
+ bool bIsActuatingProperty = impl_isActuatingProperty_nothrow( rName );
+@@ -1396,12 +1412,18 @@ namespace pcr
+ PropertyHandlerRef handler = impl_getHandlerForProperty_throw( rName );
+
+ //////////////////////////////////////////////////////////////////////
++ Any aNormalizedValue;
+ // set the value
+- handler->setPropertyValue( rName, _rValue );
++ if ( !bIsPlaceHolderValue ) // don't set the property with the placeholder value
++ {
++ handler->setPropertyValue( rName, _rValue );
+
+- //////////////////////////////////////////////////////////////////////
+- // re-retrieve the value
+- Any aNormalizedValue = handler->getPropertyValue( rName );
++ //////////////////////////////////////////////////////////////////////
++ // re-retrieve the value
++ aNormalizedValue = handler->getPropertyValue( rName );
++ }
++ else
++ aNormalizedValue = uno::makeAny( sPlcHolder );
+
+ // care for any inter-property dependencies
+ if ( bIsActuatingProperty )
+diff --git extensions/source/propctrlr/propres.src extensions/source/propctrlr/propres.src
+index 5857d25..59a0ce6 100644
+--- extensions/source/propctrlr/propres.src
++++ extensions/source/propctrlr/propres.src
+@@ -52,3 +52,7 @@ String RID_STR_HELP_SECTION_LABEL
+ {
+ Text [ en-US ] = "Help";
+ };
++String RID_EMBED_IMAGE_PLACEHOLDER
++{
++ Text [ en-US ] = "<Embedded-Image>";
++};
+diff --git extensions/source/propctrlr/propresid.hrc extensions/source/propctrlr/propresid.hrc
+index a854df7..e6cf56f 100644
+--- extensions/source/propctrlr/propresid.hrc
++++ extensions/source/propctrlr/propresid.hrc
+@@ -46,5 +46,6 @@
+ #define RID_STR_PROPPAGE_DATA ( RID_PROPCONTROLLER_START + 2 )
+ #define RID_STR_BOOL ( RID_PROPCONTROLLER_START + 3 )
+ #define RID_STR_HELP_SECTION_LABEL ( RID_PROPCONTROLLER_START + 4 )
++#define RID_EMBED_IMAGE_PLACEHOLDER ( RID_PROPCONTROLLER_START + 5 )
+
+ #endif // EXTENSIONS_PROPRESID_HRC
diff --git extensions/source/propctrlr/usercontrol.cxx extensions/source/propctrlr/usercontrol.cxx
-index a9db7bd..6250e8d 100644
+index a9db7bd..69404a0 100644
--- extensions/source/propctrlr/usercontrol.cxx
+++ extensions/source/propctrlr/usercontrol.cxx
-@@ -282,7 +282,7 @@ namespace pcr
+@@ -42,7 +42,8 @@
+ #include <svtools/zformat.hxx>
+ #include <connectivity/dbconversion.hxx>
+ #include <com/sun/star/util/Time.hpp>
+-
++#include "modulepcr.hxx"
++#include "propresid.hrc"
+ //............................................................................
+ namespace pcr
+ {
+@@ -271,6 +272,7 @@ namespace pcr
+ :OFileUrlControl_Base( PropertyControlType::Unknown, pParent, nWinStyle | WB_DROPDOWN )
+ {
+ getTypedControlWindow()->SetDropDownLineCount( 10 );
++ getTypedControlWindow()->SetPlaceHolder( String( PcrRes( RID_EMBED_IMAGE_PLACEHOLDER ) ) ) ;
+ }
+
+ //------------------------------------------------------------------
+@@ -282,8 +284,13 @@ namespace pcr
void SAL_CALL OFileUrlControl::setValue( const Any& _rValue ) throw (IllegalTypeException, RuntimeException)
{
::rtl::OUString sURL;
- if ( _rValue >>= sURL )
-+ if ( ( _rValue >>= sURL ) && sURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) ) ) != 0 )
- getTypedControlWindow()->DisplayURL( sURL );
+- getTypedControlWindow()->DisplayURL( sURL );
++ if ( ( _rValue >>= sURL ) )
++ {
++ if ( sURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) ) ) == 0 )
++ getTypedControlWindow()->DisplayURL( getTypedControlWindow()->GetPlaceHolder() );
++ else
++ getTypedControlWindow()->DisplayURL( sURL );
++ }
else
getTypedControlWindow()->SetText( String() );
+ }
+@@ -293,7 +300,7 @@ namespace pcr
+ {
+ Any aPropValue;
+ if ( getTypedControlWindow()->GetText().Len() )
+- aPropValue <<= (::rtl::OUString)getTypedControlWindow()->GetURL();
++ aPropValue <<= (::rtl::OUString)getTypedControlWindow()->GetURL();
+ return aPropValue;
+ }
+
diff --git forms/source/component/ImageControl.cxx forms/source/component/ImageControl.cxx
-index 1ba9f90..bd8e338 100644
+index 1ba9f90..53d0626 100644
--- forms/source/component/ImageControl.cxx
+++ forms/source/component/ImageControl.cxx
-@@ -353,9 +353,9 @@ sal_Bool OImageControlModel::handleNewImageURL( const ::rtl::OUString& _rURL, Va
+@@ -57,6 +57,7 @@
+ #include <com/sun/star/io/NotConnectedException.hpp>
+ #include <com/sun/star/beans/PropertyValue.hpp>
+ #include <com/sun/star/graphic/XGraphic.hpp>
++#include <com/sun/star/graphic/GraphicObject.hpp>
+ #include <tools/urlobj.hxx>
+ #include <tools/stream.hxx>
+ #include <tools/debug.hxx>
+@@ -353,9 +354,9 @@ sal_Bool OImageControlModel::handleNewIm
::std::auto_ptr< SvStream > pImageStream;
Reference< XInputStream > xImageStream;
- if ( ::svt::ImageResourceAccess::isImageResourceURL( _rURL ) )
-+ if ( ::svt::GraphicAccess::isImageResourceURL( _rURL ) || ::svt::GraphicAccess::isGraphicObjectURL( _rURL ) )
++ if ( ::svt::GraphicAccess::isSupportedURL( _rURL ) || ::svt::GraphicAccess::isSupportedURL( _rURL ) )
{
- xImageStream = ::svt::ImageResourceAccess::getImageXStream( getORB(), _rURL );
+ xImageStream = ::svt::GraphicAccess::getImageXStream( getORB(), _rURL );
}
else
{
+@@ -646,8 +647,18 @@ void OImageControlControl::implInsertGra
+ DBG_ASSERT( xController.is(), "OImageControlControl::implInsertGraphics: invalid file picker!" );
+ if ( xController.is() )
+ {
++ // we can only give the option to choose a non-linked
++ // graphic if this control is not bound to a database
++ // column i.e. if bHasField returns false
++ // In either case, the 'Link' cb will be checked
++ Reference<XPropertySet> xBoundField;
++ if ( hasProperty( PROPERTY_BOUNDFIELD, xSet ) )
++ xSet->getPropertyValue( PROPERTY_BOUNDFIELD ) >>= xBoundField;
++ sal_Bool bHasField = xBoundField.is();
++
+ xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0, ::cppu::bool2any(sal_True));
+- xController->enableControl(ExtendedFilePickerElementIds::CHECKBOX_LINK, sal_False);
++ xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, ::cppu::bool2any( true ) );
++ xController->enableControl(ExtendedFilePickerElementIds::CHECKBOX_LINK, bHasField );
+ }
+
+ if ( ERRCODE_NONE == aDialog.Execute() )
+@@ -655,8 +666,21 @@ void OImageControlControl::implInsertGra
+ // reset the url property in case it already has the value we're about to set - in this case
+ // our propertyChanged would not get called without this.
+ implClearGraphics( sal_False );
+-
+- xSet->setPropertyValue( PROPERTY_IMAGE_URL, makeAny( ::rtl::OUString( aDialog.GetPath() ) ) );
++ sal_Bool bIsLink = sal_False;
++ xController->getValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0) >>= bIsLink;
++ if ( !bIsLink )
++ {
++ Graphic aGraphic;
++ aDialog.GetGraphic( aGraphic );
++
++ Reference< graphic::XGraphicObject > xGrfObj = graphic::GraphicObject::create( m_aContext.getUNOContext() );
++ xGrfObj->setGraphic( aGraphic.GetXGraphic() );
++ rtl::OUString sObjectID( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) );
++ sObjectID = sObjectID + xGrfObj->getUniqueID();
++ xSet->setPropertyValue( PROPERTY_IMAGE_URL, makeAny( ::rtl::OUString( sObjectID ) ) );
++ }
++ else
++ xSet->setPropertyValue( PROPERTY_IMAGE_URL, makeAny( ::rtl::OUString( aDialog.GetPath() ) ) );
+ }
+ }
+ catch(Exception&)
diff --git forms/source/component/clickableimage.cxx forms/source/component/clickableimage.cxx
-index 2a3e691..c7b31ec 100644
+index 2a3e691..07bd00d 100644
--- forms/source/component/clickableimage.cxx
+++ forms/source/component/clickableimage.cxx
@@ -52,7 +52,7 @@
@@ -166,7 +331,7 @@
- // caution: the medium may be NULL if somebody gave us a invalid URL to work with
- // 11/24/2000 - 79667 - FS
- pImgProd->SetImage(String());
-+ if ( ::svt::GraphicAccess::isGraphicObjectURL( sURL ) )
++ if ( ::svt::GraphicAccess::isSupportedURL( sURL ) )
+ pImgProd->SetImage( sURL );
+ else
+ // caution: the medium may be NULL if somebody gave us a invalid URL to work with
@@ -185,7 +350,7 @@
- if (rURL.getLength())
- {
-+ if (rURL.getLength() && !::svt::GraphicAccess::isGraphicObjectURL( rURL ) )
++ if (rURL.getLength() && !::svt::GraphicAccess::isSupportedURL( rURL ) )
+ {
if (m_pMedium)
delete m_pMedium;
@@ -194,27 +359,39 @@
}
else
{
-+ if ( ::svt::GraphicAccess::isGraphicObjectURL( rURL ) )
++ if ( ::svt::GraphicAccess::isSupportedURL( rURL ) )
+ GetImageProducer()->SetImage( rURL );
GetImageProducer()->startProduction();
}
}
diff --git forms/source/component/imgprod.cxx forms/source/component/imgprod.cxx
-index 01fa8ac..79d8510 100644
+index 01fa8ac..05fbe13 100644
--- forms/source/component/imgprod.cxx
+++ forms/source/component/imgprod.cxx
-@@ -267,9 +267,9 @@ void ImageProducer::SetImage( const ::rtl::OUString& rPath )
+@@ -267,9 +267,9 @@ void ImageProducer::SetImage( const ::rt
mbAsync = sal_False;
delete mpStm;
- if ( ::svt::ImageResourceAccess::isImageResourceURL( maURL ) )
-+ if ( ::svt::GraphicAccess::isImageResourceURL( maURL ) || ::svt::GraphicAccess::isGraphicObjectURL( maURL ) )
++ if ( ::svt::GraphicAccess::isSupportedURL( maURL ) )
{
- mpStm = ::svt::ImageResourceAccess::getImageStream( ::comphelper::getProcessServiceFactory(), maURL );
+ mpStm = ::svt::GraphicAccess::getImageStream( ::comphelper::getProcessServiceFactory(), maURL );
}
else if( maURL.getLength() )
{
+diff --git forms/source/inc/FormComponent.hxx forms/source/inc/FormComponent.hxx
+index a78cce5..5388bbe 100644
+--- forms/source/inc/FormComponent.hxx
++++ forms/source/inc/FormComponent.hxx
+@@ -89,7 +89,6 @@
+ namespace frm
+ {
+ //.........................................................................
+-
+ // default tab index for components
+ const sal_Int16 FRM_DEFAULT_TABINDEX = 0;
+
diff --git goodies/source/unographic/graphicuno.cxx goodies/source/unographic/graphicuno.cxx
index 645c048..b39f7a7 100755
--- goodies/source/unographic/graphicuno.cxx
@@ -234,7 +411,7 @@
// --------------------
// - *_createInstance -
// --------------------
-@@ -72,7 +74,7 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char*
+@@ -72,7 +74,7 @@ extern "C" void SAL_CALL component_getIm
// - component_writeInfo -
// -----------------------
@@ -243,7 +420,7 @@
{
sal_Bool bRet = sal_False;
-@@ -105,6 +107,9 @@ extern "C" sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/, voi
+@@ -105,6 +107,9 @@ extern "C" sal_Bool SAL_CALL component_w
for( i = 0; i < aServices.getLength(); i++ )
xNewKey->createKey( aServices.getConstArray()[ i ] );
@@ -253,7 +430,7 @@
bRet = true;
}
-@@ -121,7 +126,7 @@ extern "C" sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/, voi
+@@ -121,7 +126,7 @@ extern "C" sal_Bool SAL_CALL component_w
// - component_getFactory -
// ------------------------
@@ -262,7 +439,7 @@
{
void * pRet = 0;
-@@ -153,7 +158,11 @@ extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void*
+@@ -153,7 +158,11 @@ extern "C" void* SAL_CALL component_getF
pRet = xFactory.get();
}
}
@@ -274,8 +451,120 @@
return pRet;
}
+diff --git goodies/source/unographic/graphicunofactory.cxx goodies/source/unographic/graphicunofactory.cxx
+new file mode 100644
+index 0000000..ddd7d5d
+--- /dev/null
++++ goodies/source/unographic/graphicunofactory.cxx
+@@ -0,0 +1,106 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: graphicuno.cxx,v $
++ * $Revision: 1.6 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * 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.
++ *
++ * 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).
++ *
++ * 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.
++ *
++ ************************************************************************/
++
++
++// MARKER(update_precomp.py): autogen include statement, do not remove
++#include "precompiled_goodies.hxx"
++#include <comphelper/servicedecl.hxx>
++#include <cppuhelper/implbase1.hxx>
++#include <com/sun/star/graphic/XGraphicObject.hpp>
++#include <com/sun/star/lang/IllegalArgumentException.hpp>
++#include "grfmgr.hxx"
++
++using namespace com::sun::star;
++
++namespace unographic {
++
++typedef ::cppu::WeakImplHelper1< graphic::XGraphicObject > GObjectAccess_BASE;
++ // Simple uno wrapper around the GraphicObject class to allow basic
++ // access. ( and solves a horrible cyclic link problem between
++ // goodies/toolkit/extensions )
++class GObjectImpl : public GObjectAccess_BASE
++{
++ ::osl::Mutex m_aMutex;
++ std::auto_ptr< GraphicObject > mpGObject;
++public:
++ GObjectImpl( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & xComponentContext ) throw (uno::RuntimeException);
++
++ // XGraphicObject
++ virtual uno::Reference< graphic::XGraphic > SAL_CALL getGraphic() throw (uno::RuntimeException);
++ virtual void SAL_CALL setGraphic( const uno::Reference< graphic::XGraphic >& _graphic ) throw (uno::RuntimeException);
++ ::rtl::OUString SAL_CALL getUniqueID() throw (uno::RuntimeException);
++};
++
++GObjectImpl::GObjectImpl( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & /*xComponentContext*/ ) throw (uno::RuntimeException)
++{
++ if ( args.getLength() == 1 )
++ {
++ rtl::OUString sId;
++ if ( !( args[ 0 ] >>= sId ) || sId.getLength() == 0 )
++ throw lang::IllegalArgumentException();
++ ByteString bsId( sId.getStr(), RTL_TEXTENCODING_UTF8 );
++ mpGObject.reset( new GraphicObject( bsId ) );
++ }
++ else
++ mpGObject.reset( new GraphicObject() );
++}
++
++uno::Reference< graphic::XGraphic > SAL_CALL GObjectImpl::getGraphic() throw (uno::RuntimeException)
++{
++ ::osl::MutexGuard aGuard( m_aMutex );
++ if ( !mpGObject.get() )
++ throw uno::RuntimeException();
++ return mpGObject->GetGraphic().GetXGraphic();
++}
++
++void SAL_CALL GObjectImpl::setGraphic( const uno::Reference< graphic::XGraphic >& _graphic ) throw (uno::RuntimeException)
++{
++ ::osl::MutexGuard aGuard( m_aMutex );
++ if ( !mpGObject.get() )
++ throw uno::RuntimeException();
++ Graphic aGraphic( _graphic );
++ mpGObject->SetGraphic( aGraphic );
++}
++
++::rtl::OUString SAL_CALL GObjectImpl::getUniqueID() throw (uno::RuntimeException)
++{
++ ::osl::MutexGuard aGuard( m_aMutex );
++ rtl::OUString sId;
++ if ( mpGObject.get() )
++ sId = String( mpGObject->GetUniqueID().GetBuffer(), RTL_TEXTENCODING_ASCII_US );
++ return sId;
++}
++
++
++namespace sdecl = comphelper::service_decl;
++sdecl::class_<GObjectImpl, sdecl::with_args<true> > serviceBI;
++extern sdecl::ServiceDecl const serviceDecl( serviceBI, "com.sun.star.graphic.GraphicObject", "com.sun.star.graphic.GraphicObject" );
++
++}
diff --git goodies/source/unographic/makefile.mk goodies/source/unographic/makefile.mk
-index 7eee7f2..7702beb 100755
+index 7eee7f2..614996f 100755
--- goodies/source/unographic/makefile.mk
+++ goodies/source/unographic/makefile.mk
@@ -47,6 +47,7 @@ CXXFILES= \
@@ -314,7 +603,7 @@
// -------------------
// - GraphicProvider -
// -------------------
-@@ -159,6 +162,24 @@ uno::Sequence< sal_Int8 > SAL_CALL GraphicProvider::getImplementationId()
+@@ -159,6 +162,24 @@ uno::Sequence< sal_Int8 > SAL_CALL Graph
// ------------------------------------------------------------------------------
@@ -339,7 +628,7 @@
uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadMemory( const ::rtl::OUString& rResourceURL ) const
{
uno::Reference< ::graphic::XGraphic > xRet;
-@@ -382,9 +403,10 @@ uno::Reference< beans::XPropertySet > SAL_CALL GraphicProvider::queryGraphicDesc
+@@ -382,9 +403,10 @@ uno::Reference< beans::XPropertySet > SA
else if( aURL.getLength() )
{
uno::Reference< ::graphic::XGraphic > xGraphic( implLoadMemory( aURL ) );
@@ -351,7 +640,7 @@
if ( !xGraphic.is() )
xGraphic = implLoadRepositoryImage( aURL );
-@@ -453,6 +475,9 @@ uno::Reference< ::graphic::XGraphic > SAL_CALL GraphicProvider::queryGraphic( co
+@@ -453,6 +475,9 @@ uno::Reference< ::graphic::XGraphic > SA
else if( aPath.Len() )
{
xRet = implLoadMemory( aPath );
@@ -373,12 +662,12 @@
::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > implLoadResource( const ::rtl::OUString& rResourceURL ) const;
::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > implLoadRepositoryImage( const ::rtl::OUString& rResourceURL ) const;
::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > implLoadBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >& rBitmap ) const;
-diff --git offapi/com/sun/star/graphic/GraphicObjectFactory.idl offapi/com/sun/star/graphic/GraphicObjectFactory.idl
+diff --git offapi/com/sun/star/graphic/GraphicObject.idl offapi/com/sun/star/graphic/GraphicObject.idl
new file mode 100644
-index 0000000..a01e2cd
+index 0000000..79794c3
--- /dev/null
-+++ offapi/com/sun/star/graphic/GraphicObjectFactory.idl
-@@ -0,0 +1,47 @@
++++ offapi/com/sun/star/graphic/GraphicObject.idl
+@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -409,18 +698,34 @@
+ *
+ ************************************************************************/
+
-+#ifndef com_sun_star_graphic_GraphicObjectFactory_idl
-+#define com_sun_star_graphic_GraphicObjectFactory_idl
++#ifndef com_sun_star_graphic_GraphicObject_idl
++#define com_sun_star_graphic_GraphicObject_idl
+
+#include <com/sun/star/graphic/XGraphicObject.idl>
+
+module com { module sun { module star { module graphic
+{
++/** The <type>GraphicObject</type> service can be used to create <type>XGraphicObject</type> instances.
++<p>
++<type>XGraphicObject</type> objects are accessable using GraphicObject scheme urls like <code>vnd.sun.star.GraphicObject:10000000000001940000012FB99807BD</code>
++As long as at least one instance of <type>XGraphicObject</type> with a particular UniqueID exists, the associated image/graphic is available.
++ @see GraphicObject
++ @see GraphicProvider
++ @see MediaProperties
++</p>
++*/
+
-+service GraphicObjectFactory : XGraphicObject
++service GraphicObject : XGraphicObject
+{
-+ createGraphicObject();
-+ createGraphicObjectWithId( [in] string uniqueId );
++ /** Creates an <type>GraphicObject</type>
++ */
++
++ create();
++ /** Creates an <type>GraphicObject</type> with <code>uniqueId</code>
++ @param uniqueId
++ If another <type>XGraphicObject</type> with <code>uniqueId</code> exists, this GraphicObject is populated with the other <type>GraphicObject</type>'s data.
++ */
++ createWithId( [in] string uniqueId );
+};
+
+} ; } ; } ; } ;
@@ -449,10 +754,10 @@
diff --git offapi/com/sun/star/graphic/XGraphicObject.idl offapi/com/sun/star/graphic/XGraphicObject.idl
new file mode 100644
-index 0000000..97b4920
+index 0000000..a320d0d
--- /dev/null
+++ offapi/com/sun/star/graphic/XGraphicObject.idl
-@@ -0,0 +1,47 @@
+@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -491,9 +796,25 @@
+module com { module sun { module star { module graphic
+{
+interface XGraphic;
++/** <p>
++ <type>XGraphicObject</type> objects represent in-memory image and graphic
++ objects. Such objects are accessable using GraphicObject scheme urls like
++<ul> <li>vnd.sun.star.GraphicObject:10000000000001940000012FB99807BD</li> </ul>
++ The numeric portion of the url is formed from <member>UniqueID</member>. As long as at least one instance of <type>XGraphicObject</type> with a particular UniqueID exists, the associated image/graphic is available.
++ @see XGraphicObject
++ @see GraphicProvider
++ @see MediaProperties
++ </p>
++*/
++
+interface XGraphicObject : ::com::sun::star::uno::XInterface
+{
++ /** is the associated image/graphic for this object.
++ */
++
+ [attribute ] XGraphic Graphic;
++ /** is the id that can be used to form the <code>vnd.sun.star.GraphicObject:</code> url to address this object.
++ */
+ [attribute, readonly ] string UniqueID;
+};
+
@@ -501,7 +822,7 @@
+
+#endif
diff --git offapi/com/sun/star/graphic/makefile.mk offapi/com/sun/star/graphic/makefile.mk
-index 600f60d..9224b90 100755
+index 600f60d..d6f1ed9 100755
--- offapi/com/sun/star/graphic/makefile.mk
+++ offapi/com/sun/star/graphic/makefile.mk
@@ -53,6 +53,8 @@ IDLFILES= \
@@ -509,15 +830,15 @@
XGraphicProvider.idl \
XGraphicRenderer.idl \
+ XGraphicObject.idl \
-+ GraphicObjectFactory.idl \
++ GraphicObject.idl \
XGraphicTransformer.idl
# --- Targets ------------------------------------------------------
diff --git svtools/inc/imageresourceaccess.hxx svtools/inc/imageresourceaccess.hxx
-index 7469b5c..6d46087 100644
+index 7469b5c..deeaa8e 100644
--- svtools/inc/imageresourceaccess.hxx
+++ svtools/inc/imageresourceaccess.hxx
-@@ -45,22 +45,26 @@ namespace svt
+@@ -45,22 +45,23 @@ namespace svt
//........................................................................
//====================================================================
@@ -536,19 +857,17 @@
public:
/** determines whether the given URL denotes an image within a resource
++ ( or an image specified by a vnd.sun.star.GraphicObject scheme URL )
*/
- SVT_DLLPUBLIC static bool isImageResourceURL( const ::rtl::OUString& _rURL );
+- SVT_DLLPUBLIC static bool isImageResourceURL( const ::rtl::OUString& _rURL );
++ SVT_DLLPUBLIC static bool isSupportedURL( const ::rtl::OUString& _rURL );
- /** for a given URL of an image within a resource, this method retrieves
-+ /** determines whether the given URL denotes an image specified by the
-+ vnd.sun.star.GraphicObject scheme
-+ */
-+ SVT_DLLPUBLIC static bool isGraphicObjectURL( const ::rtl::OUString& _rURL );
+ /** for a given URL of an image within a resource ( or an image specified by a vnd.sun.star.GraphicObject scheme URL ), this method retrieves
an SvStream for this image.
This method works for arbitrary URLs denoting an image, since the
-@@ -74,7 +78,7 @@ namespace svt
+@@ -74,7 +75,7 @@ namespace svt
const ::rtl::OUString& _rImageResourceURL
);
@@ -557,8 +876,57 @@
an <type scope="com::sun::star::io">XInputStream</type> for this image.
*/
SVT_DLLPUBLIC static ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+diff --git svtools/inc/svtools/inettbc.hxx svtools/inc/svtools/inettbc.hxx
+index 97a83e5..6cd8a05 100644
+--- svtools/inc/svtools/inettbc.hxx
++++ svtools/inc/svtools/inettbc.hxx
+@@ -50,6 +50,7 @@ friend class SvtMatchContext_Impl;
+ friend class SvtURLBox_Impl;
+ Link aOpenHdl;
+ String aBaseURL;
++ String aPlaceHolder;
+ SvtMatchContext_Impl* pCtx;
+ SvtURLBox_Impl* pImp;
+ INetProtocol eSmartProtocol;
+@@ -104,6 +105,9 @@ public:
+
+ inline void EnableAutocompletion( BOOL _bEnable = TRUE )
+ { bIsAutoCompleteEnabled = _bEnable; }
++ void SetPlaceHolder( const String& sPlaceHolder ) { aPlaceHolder = sPlaceHolder; }
++ String GetPlaceHolder() { return aPlaceHolder; }
++ bool MatchesPlaceHolder( const String& sToMatch ) { return ( ( aPlaceHolder.Len() > 0 ) && ( aPlaceHolder == sToMatch ) ); }
+ };
+
+ #endif
+diff --git svtools/source/control/inettbc.cxx svtools/source/control/inettbc.cxx
+index 9623762..13f00f8 100644
+--- svtools/source/control/inettbc.cxx
++++ svtools/source/control/inettbc.cxx
+@@ -1079,6 +1076,13 @@ long SvtURLBox::PreNotify( NotifyEvent&
+ SetSelection( Selection( nLen, GetText().Len() ) );
+ return TRUE;
+ }
++
++ if ( MatchesPlaceHolder( GetText() ) )
++ {
++ // set the selection so a key stroke will overwrite
++ // the placeholder rather than edit it
++ SetSelection( Selection( 0, GetText().Len() ) );
++ }
+ }
+
+ return ComboBox::PreNotify( rNEvt );
+@@ -1148,6 +1152,8 @@ String SvtURLBox::GetURL()
+ ::vos::OGuard aGuard( SvtMatchContext_Impl::GetMutex() );
+
+ String aText( GetText() );
++ if ( MatchesPlaceHolder( aText ) )
++ return aPlaceHolder;
+ // try to get the right case preserving URL from the list of URLs
+ if ( pImp->pCompletions && pImp->pURLs )
+ {
diff --git svtools/source/misc/imageresourceaccess.cxx svtools/source/misc/imageresourceaccess.cxx
-index 039ba89..6ee9ff8 100644
+index 039ba89..46a2954 100644
--- svtools/source/misc/imageresourceaccess.cxx
+++ svtools/source/misc/imageresourceaccess.cxx
@@ -51,6 +51,8 @@ namespace svt
@@ -570,7 +938,7 @@
using namespace ::utl;
using namespace ::comphelper;
using namespace ::com::sun::star::io;
-@@ -137,17 +139,22 @@ namespace svt
+@@ -137,17 +139,17 @@ namespace svt
}
//====================================================================
@@ -579,24 +947,20 @@
//====================================================================
//--------------------------------------------------------------------
- bool ImageResourceAccess::isImageResourceURL( const ::rtl::OUString& _rURL )
-+ bool GraphicAccess::isImageResourceURL( const ::rtl::OUString& _rURL )
++ bool GraphicAccess::isSupportedURL( const ::rtl::OUString& _rURL )
{
::rtl::OUString sIndicator( RTL_CONSTASCII_USTRINGPARAM( "private:resource/" ) );
- return _rURL.indexOf( sIndicator ) == 0;
+- return _rURL.indexOf( sIndicator ) == 0;
++ return ( ( _rURL.indexOf( sIndicator ) == 0 ) || ( _rURL.compareToAscii( GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( GRAPHOBJ_URLPREFIX ) ) == 0 ) );
}
-+ bool GraphicAccess::isGraphicObjectURL( const ::rtl::OUString& _rURL )
-+ {
-+ return ( _rURL.compareToAscii( GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( GRAPHOBJ_URLPREFIX ) ) == 0 );
-+ }
-+
//--------------------------------------------------------------------
- SvStream* ImageResourceAccess::getImageStream( const Reference< XMultiServiceFactory >& _rxORB, const ::rtl::OUString& _rImageResourceURL )
+ SvStream* GraphicAccess::getImageStream( const Reference< XMultiServiceFactory >& _rxORB, const ::rtl::OUString& _rImageResourceURL )
{
SvStream* pReturn = NULL;
-@@ -157,7 +164,7 @@ namespace svt
+@@ -157,7 +159,7 @@ namespace svt
Reference< XGraphicProvider > xProvider;
if ( _rxORB.is() )
xProvider = xProvider.query( _rxORB->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.graphic.GraphicProvider" ) ) ) );
@@ -605,7 +969,7 @@
if ( !xProvider.is() )
return pReturn;
-@@ -167,7 +174,7 @@ namespace svt
+@@ -167,7 +169,7 @@ namespace svt
aMediaProperties[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
aMediaProperties[0].Value <<= _rImageResourceURL;
Reference< XGraphic > xGraphic( xProvider->queryGraphic( aMediaProperties ) );
@@ -614,7 +978,7 @@
if ( !xGraphic.is() )
return pReturn;
-@@ -190,14 +197,14 @@ namespace svt
+@@ -190,14 +192,14 @@ namespace svt
}
catch( const Exception& )
{
@@ -665,18 +1029,18 @@
ImageProducerControlModel() : mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
ImageProducerControlModel( const ImageProducerControlModel& _rSource ) : com::sun::star::awt::XImageProducer(), UnoControlModel( _rSource ), mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
diff --git toolkit/source/controls/unocontrols.cxx toolkit/source/controls/unocontrols.cxx
-index 821c1b9..e817f69 100644
+index 821c1b9..24fe231 100644
--- toolkit/source/controls/unocontrols.cxx
+++ toolkit/source/controls/unocontrols.cxx
@@ -37,6 +37,7 @@
#include <com/sun/star/awt/VisualEffect.hpp>
#include <com/sun/star/awt/LineEndFormat.hpp>
#include <com/sun/star/graphic/XGraphicProvider.hpp>
-+#include <com/sun/star/graphic/GraphicObjectFactory.hpp>
++#include <com/sun/star/graphic/GraphicObject.hpp>
#include <com/sun/star/util/Date.hpp>
-@@ -576,11 +577,21 @@ uno::Any ImageProducerControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) co
+@@ -576,11 +577,21 @@ uno::Any ImageProducerControlModel::Impl
return UnoControlModel::ImplGetDefaultValue( nPropId );
}
@@ -693,7 +1057,7 @@
+ rtl::OUString sID = _rURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 );
+ // get the DefaultContext
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
-+ mxGrfObj = graphic::GraphicObjectFactory::createGraphicObjectWithId( aContext.getUNOContext(), sID );
++ mxGrfObj = graphic::GraphicObject::createWithId( aContext.getUNOContext(), sID );
+ }
+ else // linked
+ mxGrfObj = NULL; // release the GraphicObject
@@ -709,12 +1073,11 @@
void SAL_CALL ImageProducerControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
{
-@@ -621,7 +631,8 @@ void SAL_CALL ImageProducerControlModel::setFastPropertyValue_NoBroadcast( sal_I
+@@ -621,7 +631,7 @@ void SAL_CALL ImageProducerControlModel:
mbAdjustingGraphic = true;
::rtl::OUString sImageURL;
OSL_VERIFY( rValue >>= sImageURL );
- setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( lcl_getGraphicFromURL_nothrow( sImageURL ) ) );
-+
+ setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( sImageURL ) ) );
mbAdjustingGraphic = false;
}
@@ -751,115 +1114,3 @@
AddAttribute(OAttributeMetaData::getCommonControlAttributeNamespace(_nProperty)
,OAttributeMetaData::getCommonControlAttributeName(_nProperty)
, sTargetLocation);
-diff --git goodies/source/unographic/graphicunofactory.cxx goodies/source/unographic/graphicunofactory.cxx
-new file mode 100644
-index 0000000..d8b25bc
---- /dev/null
-+++ goodies/source/unographic/graphicunofactory.cxx
-@@ -0,0 +1,106 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: graphicuno.cxx,v $
-+ * $Revision: 1.6 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * 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.
-+ *
-+ * 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).
-+ *
-+ * 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.
-+ *
-+ ************************************************************************/
-+
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_goodies.hxx"
-+#include <comphelper/servicedecl.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/graphic/XGraphicObject.hpp>
-+#include <com/sun/star/lang/IllegalArgumentException.hpp>
-+#include "grfmgr.hxx"
-+
-+using namespace com::sun::star;
-+
-+namespace unographic {
-+
-+typedef ::cppu::WeakImplHelper1< graphic::XGraphicObject > GObjectAccess_BASE;
-+ // Simple uno wrapper around the GraphicObject class to allow basic
-+ // access. ( and solves a horrible cyclic link problem between
-+ // goodies/toolkit/extensions )
-+class GObjectImpl : public GObjectAccess_BASE
-+{
-+ ::osl::Mutex m_aMutex;
-+ std::auto_ptr< GraphicObject > mpGObject;
-+public:
-+ GObjectImpl( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & xComponentContext ) throw (uno::RuntimeException);
-+
-+ // XGraphicObject
-+ virtual uno::Reference< graphic::XGraphic > SAL_CALL getGraphic() throw (uno::RuntimeException);
-+ virtual void SAL_CALL setGraphic( const uno::Reference< graphic::XGraphic >& _graphic ) throw (uno::RuntimeException);
-+ ::rtl::OUString SAL_CALL getUniqueID() throw (uno::RuntimeException);
-+};
-+
-+GObjectImpl::GObjectImpl( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & /*xComponentContext*/ ) throw (uno::RuntimeException)
-+{
-+ if ( args.getLength() == 1 )
-+ {
-+ rtl::OUString sId;
-+ if ( !( args[ 0 ] >>= sId ) || sId.getLength() == 0 )
-+ throw lang::IllegalArgumentException();
-+ ByteString bsId( sId.getStr(), RTL_TEXTENCODING_UTF8 );
-+ mpGObject.reset( new GraphicObject( bsId ) );
-+ }
-+ else
-+ mpGObject.reset( new GraphicObject() );
-+}
-+
-+uno::Reference< graphic::XGraphic > SAL_CALL GObjectImpl::getGraphic() throw (uno::RuntimeException)
-+{
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ if ( !mpGObject.get() )
-+ throw uno::RuntimeException();
-+ return mpGObject->GetGraphic().GetXGraphic();
-+}
-+
-+void SAL_CALL GObjectImpl::setGraphic( const uno::Reference< graphic::XGraphic >& _graphic ) throw (uno::RuntimeException)
-+{
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ if ( !mpGObject.get() )
-+ throw uno::RuntimeException();
-+ Graphic aGraphic( _graphic );
-+ mpGObject->SetGraphic( aGraphic );
-+}
-+
-+::rtl::OUString SAL_CALL GObjectImpl::getUniqueID() throw (uno::RuntimeException)
-+{
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ rtl::OUString sId;
-+ if ( mpGObject.get() )
-+ sId = String( mpGObject->GetUniqueID().GetBuffer(), RTL_TEXTENCODING_ASCII_US );
-+ return sId;
-+}
-+
-+
-+namespace sdecl = comphelper::service_decl;
-+sdecl::class_<GObjectImpl, sdecl::with_args<true> > serviceBI;
-+extern sdecl::ServiceDecl const serviceDecl( serviceBI, "com.sun.star.graphic.GraphicObjectFactory", "com.sun.star.graphic.GraphicObjectFactory" );
-+
-+}
Modified: trunk/patches/vba/enhanced-form-userform-controls.diff
==============================================================================
--- trunk/patches/vba/enhanced-form-userform-controls.diff (original)
+++ trunk/patches/vba/enhanced-form-userform-controls.diff Thu Aug 21 11:41:31 2008
@@ -169,34 +169,137 @@
void SetWindow( Window* pWindow );
diff --git basic/source/classes/eventatt.cxx basic/source/classes/eventatt.cxx
-index a3d4293..6bdd42a 100644
+index a3d4293..8339749 100644
--- basic/source/classes/eventatt.cxx
+++ basic/source/classes/eventatt.cxx
-@@ -556,11 +556,23 @@ void RTL_Impl_CreateUnoDialog( StarBASIC
+@@ -58,7 +58,10 @@
+ #include <com/sun/star/awt/XDialogProvider.hpp>
+
+ #include <com/sun/star/frame/XModel.hpp>
+-
++#include <com/sun/star/frame/XDesktop.hpp>
++#include <com/sun/star/container/XEnumerationAccess.hpp>
++#include <basic/basicmanagerrepository.hxx>
++#include <basic/basmgr.hxx>
+ //==================================================================================================
+
+ #include <xmlscript/xmldlg_imexp.hxx>
+@@ -458,6 +461,43 @@ Any implFindDialogLibForDialog( const An
+ return aRetDlgLibAny;
+ }
+
++Any implFindDialogLibForDialogBasic( const Any& aAnyISP, SbxObject* pBasic, StarBASIC*& pFoundBasic )
++{
++ Any aDlgLibAny;
++ // Find dialog library for dialog, direct access is not possible here
++ StarBASIC* pStartedBasic = (StarBASIC*)pBasic;
++ SbxObject* pParentBasic = pStartedBasic ? pStartedBasic->GetParent() : NULL;
++ SbxObject* pParentParentBasic = pParentBasic ? pParentBasic->GetParent() : NULL;
++
++ SbxObject* pSearchBasic1 = NULL;
++ SbxObject* pSearchBasic2 = NULL;
++ if( pParentParentBasic )
++ {
++ pSearchBasic1 = pParentBasic;
++ pSearchBasic2 = pParentParentBasic;
++ }
++ else
++ {
++ pSearchBasic1 = pStartedBasic;
++ pSearchBasic2 = pParentBasic;
++ }
++ if( pSearchBasic1 )
++ {
++ aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic1 );
++
++ if ( aDlgLibAny.hasValue() )
++ pFoundBasic = (StarBASIC*)pSearchBasic1;
++
++ else if( pSearchBasic2 )
++ {
++ aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic2 );
++ if ( aDlgLibAny.hasValue() )
++ pFoundBasic = (StarBASIC*)pSearchBasic2;
++ }
++ }
++ return aDlgLibAny;
++}
++
+ static ::rtl::OUString aDecorationPropName =
+ ::rtl::OUString::createFromAscii( "Decoration" );
+ static ::rtl::OUString aTitlePropName =
+@@ -537,39 +577,51 @@ void RTL_Impl_CreateUnoDialog( StarBASIC
+ {}
}
+- // Find dialog library for dialog, direct access is not possible here
+- StarBASIC* pStartedBasic = pINST->GetBasic();
+- SbxObject* pParentBasic = pStartedBasic ? pStartedBasic->GetParent() : NULL;
+- SbxObject* pParentParentBasic = pParentBasic ? pParentBasic->GetParent() : NULL;
+-
+- SbxObject* pSearchBasic1 = NULL;
+- SbxObject* pSearchBasic2 = NULL;
+- if( pParentParentBasic )
+- {
+- pSearchBasic1 = pParentBasic;
+- pSearchBasic2 = pParentParentBasic;
+- }
+- else
+- {
+- pSearchBasic1 = pStartedBasic;
+- pSearchBasic2 = pParentBasic;
+- }
+-
Any aDlgLibAny;
+- if( pSearchBasic1 )
+- {
+- aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic1 );
+- if( pSearchBasic2 && aDlgLibAny.getValueType().getTypeClass() == TypeClass_VOID )
+- aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic2 );
+- }
+-
+-
+ bool bDocDialog = false;
- if( pSearchBasic1 )
- {
-+ StarBASIC* pSearch = (StarBASIC*)pSearchBasic1;
- aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic1 );
- if( pSearchBasic2 && aDlgLibAny.getValueType().getTypeClass() == TypeClass_VOID )
++ StarBASIC* pFoundBasic = NULL;
+ OSL_TRACE("About to try get a hold of ThisComponent");
+- Reference< frame::XModel > xModel = getModelFromBasic( pStartedBasic ) ;
++ Reference< frame::XModel > xModel = getModelFromBasic( pINST->GetBasic() ) ;
++ aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pINST->GetBasic(), pFoundBasic );
++ // If we found the dialog then it belongs to the Search basic
++ if ( !pFoundBasic )
+ {
-+ pSearch = (StarBASIC*)pSearchBasic2;
- aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic2 );
++ Reference< frame::XDesktop > xDesktop( xMSF->createInstance
++ ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ),
++ UNO_QUERY );
++ Reference< container::XEnumeration > xModels;
++ if ( xDesktop.is() )
++ {
++ Reference< container::XEnumerationAccess > xComponents( xDesktop->getComponents(), UNO_QUERY );
++ if ( xComponents.is() )
++ xModels.set( xComponents->createEnumeration(), UNO_QUERY );
++ if ( xModels.is() )
++ {
++ while ( xModels->hasMoreElements() )
++ {
++ Reference< frame::XModel > xNextModel( xModels->nextElement(), UNO_QUERY );
++ if ( xNextModel.is() )
++ {
++ BasicManager* pMgr = basic::BasicManagerRepository::getDocumentBasicManager( xNextModel );
++ if ( pMgr )
++ aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pMgr->GetLib(0), pFoundBasic );
++ if ( aDlgLibAny.hasValue() )
++ {
++ bDocDialog = true;
++ xModel = xNextModel;
++ break;
++ }
++ }
++ }
++ }
++ }
+ }
-+ // If we found the dialog then it belongs to the Search basic
-+ if ( aDlgLibAny.hasValue() )
-+ bDocDialog = pSearch->IsDocBasic();
-+ // otherwise it belongs to the opposite,
-+ // and yes, this algorithm doesn't scale does it
-+ else
-+ bDocDialog = !( pSearch->IsDocBasic() );
- }
-
-
-@@ -569,7 +581,7 @@ void RTL_Impl_CreateUnoDialog( StarBASIC
++ if ( pFoundBasic )
++ bDocDialog = pFoundBasic->IsDocBasic();
Reference< XScriptListener > xScriptListener = new BasicScriptListener_Impl( pBasic, xModel );
Sequence< Any > aArgs( 4 );
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]