diff options
284 files changed, 8822 insertions, 17435 deletions
diff --git a/UnoControls/util/makefile.mk b/UnoControls/util/makefile.mk index c7483269b62f..d2c225a4b214 100644 --- a/UnoControls/util/makefile.mk +++ b/UnoControls/util/makefile.mk @@ -56,7 +56,6 @@ SHL1STDLIBS= \ $(TOOLSLIB) \ $(CPPUHELPERLIB) \ $(CPPULIB) \ - $(VOSLIB) \ $(SALLIB) SHL1DEPN= makefile.mk diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleKeyBinding.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleKeyBinding.java index 09133cbf7a8a..bb9e32856f32 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleKeyBinding.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleKeyBinding.java @@ -57,6 +57,11 @@ public class AccessibleKeyBinding extends Object implements javax.accessibility. if ((s & com.sun.star.awt.KeyModifier.MOD2) != 0) { modifiers = modifiers | java.awt.event.KeyEvent.ALT_DOWN_MASK; } + + if ((s & com.sun.star.awt.KeyModifier.MOD3) != 0) { + modifiers = modifiers | java.awt.event.KeyEvent.META_DOWN_MASK; + } + return modifiers; } diff --git a/accessibility/inc/accessibility/extended/accessiblelistboxentry.hxx b/accessibility/inc/accessibility/extended/accessiblelistboxentry.hxx index df352ddacf0e..6ffd0fa1d5ba 100644 --- a/accessibility/inc/accessibility/extended/accessiblelistboxentry.hxx +++ b/accessibility/inc/accessibility/extended/accessiblelistboxentry.hxx @@ -97,18 +97,6 @@ namespace accessibility m_aParent; private: - /** notifies all listeners that this object has changed - @param _nEventId - is the event id - @param _aOldValue - is the old value - @param _aNewValue - is the new value - */ - void NotifyAccessibleEvent( sal_Int16 _nEventId, - const ::com::sun::star::uno::Any& _aOldValue, - const ::com::sun::star::uno::Any& _aNewValue ); - Rectangle GetBoundingBox_Impl() const; Rectangle GetBoundingBoxOnScreen_Impl() const; sal_Bool IsAlive_Impl() const; diff --git a/accessibility/source/extended/accessiblelistboxentry.cxx b/accessibility/source/extended/accessiblelistboxentry.cxx index ecaed921b06f..a18d828ffb0f 100644 --- a/accessibility/source/extended/accessiblelistboxentry.cxx +++ b/accessibility/source/extended/accessiblelistboxentry.cxx @@ -118,17 +118,6 @@ namespace accessibility } // ----------------------------------------------------------------------------- - void AccessibleListBoxEntry::NotifyAccessibleEvent( sal_Int16 _nEventId, - const ::com::sun::star::uno::Any& _aOldValue, - const ::com::sun::star::uno::Any& _aNewValue ) - { - Reference< uno::XInterface > xSource( *this ); - AccessibleEventObject aEventObj( xSource, _nEventId, _aNewValue, _aOldValue ); - - if (m_nClientId) - comphelper::AccessibleEventNotifier::addEvent( m_nClientId, aEventObj ); - } - // ----------------------------------------------------------------------------- Rectangle AccessibleListBoxEntry::GetBoundingBox_Impl() const { Rectangle aRect; diff --git a/accessibility/source/extended/accessibletabbarbase.cxx b/accessibility/source/extended/accessibletabbarbase.cxx index 08a3b7cb6c03..99f5a9b1c073 100644 --- a/accessibility/source/extended/accessibletabbarbase.cxx +++ b/accessibility/source/extended/accessibletabbarbase.cxx @@ -66,7 +66,7 @@ IMPL_LINK( AccessibleTabBarBase, WindowEventListener, VclSimpleEvent*, pEvent ) DBG_ASSERT( pEventWindow, "AccessibleTabBarBase::WindowEventListener: no window!" ); if( ( pWinEvent->GetId() == VCLEVENT_TABBAR_PAGEREMOVED ) && - ( (sal_uInt16)(sal_IntPtr) pWinEvent->GetData() == TAB_PAGE_NOTFOUND ) && + ( (sal_uInt16)(sal_IntPtr) pWinEvent->GetData() == TABBAR_PAGE_NOTFOUND ) && ( dynamic_cast< AccessibleTabBarPageList *> (this) != NULL ) ) { return 0; diff --git a/accessibility/source/extended/accessibletabbarpagelist.cxx b/accessibility/source/extended/accessibletabbarpagelist.cxx index 0fb49025f261..9d8a3d378a86 100644 --- a/accessibility/source/extended/accessibletabbarpagelist.cxx +++ b/accessibility/source/extended/accessibletabbarpagelist.cxx @@ -316,7 +316,7 @@ namespace accessibility { sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData(); - if ( nPageId == TAB_PAGE_NOTFOUND ) + if ( nPageId == TABBAR_PAGE_NOTFOUND ) { for ( sal_Int32 i = m_aAccessibleChildren.size() - 1; i >= 0; --i ) RemoveChild( i ); diff --git a/accessibility/source/standard/vclxaccessiblebutton.cxx b/accessibility/source/standard/vclxaccessiblebutton.cxx index 562e1a98f8d2..41f8c686bdde 100644 --- a/accessibility/source/standard/vclxaccessiblebutton.cxx +++ b/accessibility/source/standard/vclxaccessiblebutton.cxx @@ -247,6 +247,8 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleButton::getAccessibleActionKeyB aKeyStroke.Modifiers |= awt::KeyModifier::MOD1; if ( aKeyCode.IsMod2() ) aKeyStroke.Modifiers |= awt::KeyModifier::MOD2; + if ( aKeyCode.IsMod3() ) + aKeyStroke.Modifiers |= awt::KeyModifier::MOD3; aKeyStroke.KeyCode = aKeyCode.GetCode(); aKeyStroke.KeyChar = aKeyEvent.GetCharCode(); aKeyStroke.KeyFunc = static_cast< sal_Int16 >( aKeyCode.GetFunction() ); diff --git a/accessibility/source/standard/vclxaccessiblecheckbox.cxx b/accessibility/source/standard/vclxaccessiblecheckbox.cxx index f90537b576bf..c6ea1603d647 100644 --- a/accessibility/source/standard/vclxaccessiblecheckbox.cxx +++ b/accessibility/source/standard/vclxaccessiblecheckbox.cxx @@ -275,6 +275,8 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleCheckBox::getAccessibleActionKe aKeyStroke.Modifiers |= awt::KeyModifier::MOD1; if ( aKeyCode.IsMod2() ) aKeyStroke.Modifiers |= awt::KeyModifier::MOD2; + if ( aKeyCode.IsMod3() ) + aKeyStroke.Modifiers |= awt::KeyModifier::MOD3; aKeyStroke.KeyCode = aKeyCode.GetCode(); aKeyStroke.KeyChar = aKeyEvent.GetCharCode(); aKeyStroke.KeyFunc = static_cast< sal_Int16 >( aKeyCode.GetFunction() ); diff --git a/accessibility/source/standard/vclxaccessiblemenuitem.cxx b/accessibility/source/standard/vclxaccessiblemenuitem.cxx index 0683ffc85bfd..2548ad0a7dbb 100644 --- a/accessibility/source/standard/vclxaccessiblemenuitem.cxx +++ b/accessibility/source/standard/vclxaccessiblemenuitem.cxx @@ -531,6 +531,8 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleMenuItem::getAccessibleActionKe aSeq3[0].Modifiers |= awt::KeyModifier::MOD1; if ( aAccelKeyCode.IsMod2() ) aSeq3[0].Modifiers |= awt::KeyModifier::MOD2; + if ( aAccelKeyCode.IsMod3() ) + aSeq3[0].Modifiers |= awt::KeyModifier::MOD3; aSeq3[0].KeyCode = aAccelKeyCode.GetCode(); aSeq3[0].KeyFunc = static_cast< sal_Int16 >( aAccelKeyCode.GetFunction() ); pKeyBindingHelper->AddKeyBinding( aSeq3 ); diff --git a/accessibility/source/standard/vclxaccessibleradiobutton.cxx b/accessibility/source/standard/vclxaccessibleradiobutton.cxx index 040881b7e347..f797ff2d70ae 100644 --- a/accessibility/source/standard/vclxaccessibleradiobutton.cxx +++ b/accessibility/source/standard/vclxaccessibleradiobutton.cxx @@ -235,6 +235,8 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleRadioButton::getAccessibleActio aKeyStroke.Modifiers |= awt::KeyModifier::MOD1; if ( aKeyCode.IsMod2() ) aKeyStroke.Modifiers |= awt::KeyModifier::MOD2; + if ( aKeyCode.IsMod3() ) + aKeyStroke.Modifiers |= awt::KeyModifier::MOD3; aKeyStroke.KeyCode = aKeyCode.GetCode(); aKeyStroke.KeyChar = aKeyEvent.GetCharCode(); aKeyStroke.KeyFunc = static_cast< sal_Int16 >( aKeyCode.GetFunction() ); diff --git a/automation/util/makefile.mk b/automation/util/makefile.mk index 3d936164bff9..f96910a01325 100644 --- a/automation/util/makefile.mk +++ b/automation/util/makefile.mk @@ -111,16 +111,10 @@ SHL3IMPLIB= icommuni SHL3STDLIBS= \ $(TOOLSLIB) \ - $(SVTOOLLIB) \ $(SVLLIB) \ $(VCLLIB) \ - $(BASICLIB) \ $(VOSLIB) \ $(SALLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(COMPHELPERLIB) \ - $(SOTLIB) \ $(VOSLIB) \ $(SIMPLECMLIB) @@ -167,12 +161,8 @@ APP1STDLIBS+= \ $(VOSLIB) \ $(UCBHELPERLIB) \ $(COMPHELPERLIB) \ - $(SOTLIB) \ $(BASICLIB) \ $(SIMPLECMLIB) \ - $(BASEGFXLIB) $(I18NISOLANGLIB) $(TKLIB) $(I18NUTILLIB) \ - $(ICUUCLIB) $(ICULELIB) $(ICUDATALIB) $(JVMFWKLIB) $(JVMACCESSLIB) \ - $(SALHELPERLIB) $(XMLSCRIPTLIB) \ $(COMMUNILIB) .IF "$(GUI)"=="UNX" @@ -232,10 +222,6 @@ APP3STDLIBS= \ $(TOOLSLIB) \ $(SVTOOLLIB) \ $(VCLLIB) \ - $(BASEGFXLIB) $(I18NISOLANGLIB) $(TKLIB) $(I18NUTILLIB) \ - $(ICUUCLIB) $(ICULELIB) $(ICUDATALIB) $(JVMFWKLIB) $(JVMACCESSLIB) \ - $(SALHELPERLIB) $(UNOTOOLSLIB) $(SVLLIB) $(BASICLIB) $(SOTLIB) \ - $(XMLSCRIPTLIB) \ $(SJLIB) .IF "$(GUI)"=="UNX" diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx index 02d527aace8c..88ce05ccc4b3 100644 --- a/basctl/source/basicide/bastypes.cxx +++ b/basctl/source/basicide/bastypes.cxx @@ -649,7 +649,7 @@ long BasicIDETabBar::AllowRenaming() if ( !bValid ) ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_BADSBXNAME ) ) ).Execute(); - return bValid ? TAB_RENAMING_YES : TAB_RENAMING_NO; + return bValid ? TABBAR_RENAMING_YES : TABBAR_RENAMING_NO; } diff --git a/basctl/source/basicide/doceventnotifier.cxx b/basctl/source/basicide/doceventnotifier.cxx index e4332891d1d1..f97420da5926 100644 --- a/basctl/source/basicide/doceventnotifier.cxx +++ b/basctl/source/basicide/doceventnotifier.cxx @@ -140,8 +140,7 @@ namespace basctl //-------------------------------------------------------------------- void SAL_CALL DocumentEventNotifier_Impl::notifyEvent( const EventObject& _rEvent ) throw (RuntimeException) { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); - ::osl::MutexGuard aGuard( m_aMutex ); + ::osl::ClearableMutexGuard aGuard( m_aMutex ); OSL_PRECOND( !impl_isDisposed_nothrow(), "DocumentEventNotifier_Impl::notifyEvent: disposed, but still getting events?" ); if ( impl_isDisposed_nothrow() ) @@ -151,7 +150,6 @@ namespace basctl OSL_ENSURE( xDocument.is(), "DocumentEventNotifier_Impl::notifyEvent: illegal source document!" ); if ( !xDocument.is() ) return; - ScriptDocument aDocument( xDocument ); struct EventEntry { @@ -172,8 +170,24 @@ namespace basctl for ( size_t i=0; i < sizeof( aEvents ) / sizeof( aEvents[0] ); ++i ) { - if ( _rEvent.EventName.equalsAscii( aEvents[i].pEventName ) ) + if ( !_rEvent.EventName.equalsAscii( aEvents[i].pEventName ) ) + continue; + + ScriptDocument aDocument( xDocument ); + { + // the listener implementations usually require the SolarMutex, so lock it here. + // But ensure the proper order of locking the solar and the own mutex + aGuard.clear(); + ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard2( m_aMutex ); + + if ( impl_isDisposed_nothrow() ) + // somebody took the chance to dispose us -> bail out + return; + (m_pListener->*aEvents[i].listenerMethod)( aDocument ); + } + break; } } @@ -250,7 +264,6 @@ namespace basctl //-------------------------------------------------------------------- void DocumentEventNotifier::dispose() { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); m_pImpl->dispose(); } diff --git a/bean/com/sun/star/beans/JavaWindowPeerFake.java b/bean/com/sun/star/beans/JavaWindowPeerFake.java index ff679c1ac14d..4a1b223e651d 100644 --- a/bean/com/sun/star/beans/JavaWindowPeerFake.java +++ b/bean/com/sun/star/beans/JavaWindowPeerFake.java @@ -30,14 +30,7 @@ package com.sun.star.beans; -import java.awt.*; - -import com.sun.star.uno.*; -import com.sun.star.lang.*; import com.sun.star.awt.*; -import com.sun.star.util.*; -import com.sun.star.beans.*; -import com.sun.star.container.*; /** <p>Class to pass the system window handle to the OpenOffice.org toolkit.</p> * @deprecated diff --git a/bean/com/sun/star/beans/LocalOfficeConnection.java b/bean/com/sun/star/beans/LocalOfficeConnection.java index 5baccac7a43c..ec2a535e2b18 100644 --- a/bean/com/sun/star/beans/LocalOfficeConnection.java +++ b/bean/com/sun/star/beans/LocalOfficeConnection.java @@ -30,35 +30,17 @@ package com.sun.star.beans; -import java.awt.Component; import java.awt.Container; import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.net.MalformedURLException; import java.util.Iterator; import java.util.List; import java.util.Vector; -import java.util.Properties; -import java.util.Enumeration; - -import com.sun.star.comp.helper.Bootstrap; import com.sun.star.lang.XMultiComponentFactory; -import com.sun.star.lang.XComponent; import com.sun.star.lang.XEventListener; -import com.sun.star.lang.XInitialization; -import com.sun.star.container.XSet; -import com.sun.star.connection.XConnection; -import com.sun.star.bridge.XBridge; -import com.sun.star.bridge.XBridgeFactory; import com.sun.star.bridge.XUnoUrlResolver; -import com.sun.star.comp.loader.JavaLoader; -import com.sun.star.loader.XImplementationLoader; import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.Type; import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.Exception; import com.sun.star.lib.uno.helper.UnoUrl; import com.sun.star.lib.util.NativeLibraryLoader; diff --git a/bean/com/sun/star/beans/LocalOfficeWindow.java b/bean/com/sun/star/beans/LocalOfficeWindow.java index e89382c67916..1c3ae9ccfacb 100644 --- a/bean/com/sun/star/beans/LocalOfficeWindow.java +++ b/bean/com/sun/star/beans/LocalOfficeWindow.java @@ -31,11 +31,9 @@ package com.sun.star.beans; import java.awt.Component; -import java.awt.Canvas; import com.sun.star.lang.EventObject; import com.sun.star.lang.SystemDependent; -import com.sun.star.lang.XComponent; import com.sun.star.lang.XEventListener; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.lang.XMultiComponentFactory; @@ -49,7 +47,6 @@ import com.sun.star.awt.WindowAttribute; import com.sun.star.awt.WindowClass; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.Exception; /** * This class represents a local office window. diff --git a/bean/com/sun/star/beans/OfficeConnection.java b/bean/com/sun/star/beans/OfficeConnection.java index 2c7833a3c075..56a9a5f55a9a 100644 --- a/bean/com/sun/star/beans/OfficeConnection.java +++ b/bean/com/sun/star/beans/OfficeConnection.java @@ -31,7 +31,6 @@ package com.sun.star.beans; import java.awt.Container; -import java.net.MalformedURLException; import com.sun.star.lang.XComponent; import com.sun.star.uno.XComponentContext; diff --git a/bean/com/sun/star/comp/beans/JavaWindowPeerFake.java b/bean/com/sun/star/comp/beans/JavaWindowPeerFake.java index 98cff2e59890..04581d54a260 100644 --- a/bean/com/sun/star/comp/beans/JavaWindowPeerFake.java +++ b/bean/com/sun/star/comp/beans/JavaWindowPeerFake.java @@ -30,14 +30,8 @@ package com.sun.star.comp.beans; -import java.awt.*; - import com.sun.star.uno.*; -import com.sun.star.lang.*; import com.sun.star.awt.*; -import com.sun.star.util.*; -import com.sun.star.beans.*; -import com.sun.star.container.*; /** <p>Class to pass the system window handle to the OpenOffice.org toolkit.</p> * diff --git a/bean/com/sun/star/comp/beans/LocalOfficeConnection.java b/bean/com/sun/star/comp/beans/LocalOfficeConnection.java index 0f888412c225..6843fa10288d 100644 --- a/bean/com/sun/star/comp/beans/LocalOfficeConnection.java +++ b/bean/com/sun/star/comp/beans/LocalOfficeConnection.java @@ -30,36 +30,21 @@ package com.sun.star.comp.beans; -import java.awt.Component; import java.awt.Container; import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.net.MalformedURLException; import java.util.Iterator; import java.util.List; import java.util.Vector; -import java.util.Properties; -import java.util.Enumeration; - -import com.sun.star.comp.helper.Bootstrap; import com.sun.star.lang.XMultiComponentFactory; import com.sun.star.lang.XComponent; import com.sun.star.lang.XEventListener; -import com.sun.star.lang.XInitialization; -import com.sun.star.container.XSet; import com.sun.star.connection.XConnection; import com.sun.star.connection.XConnector; -import com.sun.star.connection.ConnectionSetupException; -import com.sun.star.lang.IllegalArgumentException; import com.sun.star.bridge.XBridge; import com.sun.star.bridge.XBridgeFactory; -import com.sun.star.comp.loader.JavaLoader; -import com.sun.star.loader.XImplementationLoader; import com.sun.star.beans.XPropertySet; import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.Type; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.Exception; import com.sun.star.lib.uno.helper.UnoUrl; diff --git a/bean/com/sun/star/comp/beans/LocalOfficeWindow.java b/bean/com/sun/star/comp/beans/LocalOfficeWindow.java index aab53218faa6..07b07126c23c 100644 --- a/bean/com/sun/star/comp/beans/LocalOfficeWindow.java +++ b/bean/com/sun/star/comp/beans/LocalOfficeWindow.java @@ -31,11 +31,9 @@ package com.sun.star.comp.beans; import java.awt.Component; -import java.awt.Canvas; import com.sun.star.lang.EventObject; import com.sun.star.lang.SystemDependent; -import com.sun.star.lang.XComponent; import com.sun.star.lang.XEventListener; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.lang.XMultiComponentFactory; @@ -49,7 +47,6 @@ import com.sun.star.awt.WindowAttribute; import com.sun.star.awt.WindowClass; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.Exception; import com.sun.star.uno.Any; import com.sun.star.uno.Type; import com.sun.star.beans.NamedValue; diff --git a/bean/com/sun/star/comp/beans/OfficeConnection.java b/bean/com/sun/star/comp/beans/OfficeConnection.java index 8bfd4945e231..912cf244948e 100644 --- a/bean/com/sun/star/comp/beans/OfficeConnection.java +++ b/bean/com/sun/star/comp/beans/OfficeConnection.java @@ -31,7 +31,6 @@ package com.sun.star.comp.beans; import java.awt.Container; -import java.net.MalformedURLException; import com.sun.star.lang.XComponent; import com.sun.star.uno.XComponentContext; diff --git a/crashrep/source/win32/rcheader.txt b/crashrep/source/win32/rcheader.txt index 840d929c024a..a33940e672b9 100755 --- a/crashrep/source/win32/rcheader.txt +++ b/crashrep/source/win32/rcheader.txt @@ -28,23 +28,6 @@ * #*************************************************************************/ -#define VERSION 2 -#define SUBVERSION 3 -//#define VERVARIANT 0 -// .0 + VER_CONCEPT -// .100 + VER_ALPHA -// .200 + VER_BETA -// .300 + VER_GAMMA -// .500 + VER_FINAL -//#define VER_CONCEPT 0 -//#define VER_BETA 6 -#define VER_FINAL 0 - -#define VER_DAY 1 -#define VER_MONTH 9 -#define VER_YEAR 07 - - // Header #include "resource.h" #if defined(_MSC_VER) && (_MSC_VER < 1500) @@ -57,9 +40,9 @@ #define IDC_STATIC (-1) #endif -#include "verinfo.hrc" +#define VER_FIRSTYEAR 2003 -#define VER_FIRSTYEAR 03 +#include "version.hrc" #ifdef FONTSIZE #undef FONTSIZE @@ -131,11 +114,4 @@ VS_VERSION_INFO versioninfo } } -// version binary entry -VS_VERSION_INFO rcdata -{ - 0xF0, "sw", 0x0F, VER_YEAR, VER_MONTH, VER_DAY, - VERSION, SUBVERSION, VERVARIANT, VER_COUNT -}; - diff --git a/extensions/inc/extensio.hrc b/extensions/inc/extensio.hrc index a831143b5eeb..c2b627d25ecf 100644 --- a/extensions/inc/extensio.hrc +++ b/extensions/inc/extensio.hrc @@ -216,7 +216,7 @@ #define HID_PROP_SUBMIT_ENCODING (HID_FORMS_START + 58) #define HID_PROP_DEFAULTVALUE (HID_FORMS_START + 59) #define HID_PROP_SUBMIT_TARGET (HID_FORMS_START + 60) -#define HID_PROP_DEFAULT_CHECKED (HID_FORMS_START + 61) +#define HID_PROP_DEFAULT_STATE (HID_FORMS_START + 61) #define HID_PROP_IMAGE_URL (HID_FORMS_START + 62) #define HID_PROP_DEFAULT_SELECT_SEQ (HID_FORMS_START + 63) #define HID_PROP_MULTISELECTION (HID_FORMS_START + 64) @@ -458,9 +458,10 @@ #define HID_PROP_IMAGEPOSITION (HID_FORMS_START + 339) #define HID_PROP_NOLABEL (HID_FORMS_START + 340) #define HID_PROP_WRITING_MODE (HID_FORMS_START + 341) +#define HID_PROP_ANCHOR_TYPE (HID_FORMS_START + 343) // please adjust HID_LAST_FORMS_ID if you add new ids here! -#define HID_LAST_FORMS_ID HID_PROP_WRITING_MODE +#define HID_LAST_FORMS_ID HID_PROP_ANCHOR_TYPE #if HID_LAST_FORMS_ID > HID_FORMS_END #error id overflow diff --git a/extensions/source/abpilot/abspilot.cxx b/extensions/source/abpilot/abspilot.cxx index 2477970ed1b6..c28d28481884 100644 --- a/extensions/source/abpilot/abspilot.cxx +++ b/extensions/source/abpilot/abspilot.cxx @@ -324,9 +324,12 @@ namespace abp const sal_Char* pGuess = NULL; switch ( getSettings().eType ) { - case AST_MORK : - case AST_THUNDERBIRD: pGuess = "Personal Address Book"; break; - case AST_LDAP : pGuess = "LDAP Directory"; break; + case AST_MORK : + case AST_THUNDERBIRD : pGuess = "Personal Address book"; break; + case AST_LDAP : pGuess = "LDAP Directory"; break; + case AST_EVOLUTION : + case AST_EVOLUTION_GROUPWISE: + case AST_EVOLUTION_LDAP : pGuess = "Personal"; break; default: DBG_ERROR( "OAddessBookSourcePilot::implDefaultTableName: unhandled case!" ); return; diff --git a/extensions/source/abpilot/abspilot.hxx b/extensions/source/abpilot/abspilot.hxx index 0bcce1d6a11a..7429f10d91cc 100644 --- a/extensions/source/abpilot/abspilot.hxx +++ b/extensions/source/abpilot/abspilot.hxx @@ -117,7 +117,9 @@ namespace abp inline sal_Bool needManualFieldMapping( AddressSourceType _eType ) const { - return ( AST_OTHER == _eType ) || ( AST_KAB == _eType ); + return ( AST_OTHER == _eType ) || ( AST_KAB == _eType ) || + ( AST_EVOLUTION == _eType ) || ( AST_EVOLUTION_GROUPWISE == _eType ) || + ( AST_EVOLUTION_LDAP == _eType ); } /// checks if we need a manual (user-guided) field mapping inline sal_Bool needManualFieldMapping() const @@ -128,8 +130,7 @@ namespace abp /// determines whether the given address book type does provide one table only inline bool needTableSelection( AddressSourceType _eType ) const { - return ( AST_LDAP != _eType ) && ( AST_KAB != _eType ) && ( AST_EVOLUTION != _eType ) - && ( AST_EVOLUTION_GROUPWISE != _eType ) && ( AST_EVOLUTION_LDAP != _eType ); + return ( AST_LDAP != _eType ) && ( AST_KAB != _eType ); } inline bool needTableSelection() const diff --git a/extensions/source/abpilot/abspilot.src b/extensions/source/abpilot/abspilot.src index 5a5bb53e2abd..3bfa6ea844d6 100644 --- a/extensions/source/abpilot/abspilot.src +++ b/extensions/source/abpilot/abspilot.src @@ -94,83 +94,59 @@ TabPage RID_PAGE_SELECTABTYPE Text [ en-US ] = "Please select the type of your external address book:"; }; - RadioButton RB_MORK - { - Pos = MAP_APPFONT ( 15, 68 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Group = TRUE; - - Text [ en-US ] = "Mozilla / Netscape"; - }; -// All position & size/height data below this is not used - RadioButton RB_THUNDERBIRD - { - Pos = MAP_APPFONT ( 15, 79 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - - Text [ en-US ] = "Thunderbird"; - }; RadioButton RB_EVOLUTION { - Pos = MAP_APPFONT ( 15, 90 ) ; Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "Evolution"; }; RadioButton RB_EVOLUTION_GROUPWISE { - Pos = MAP_APPFONT ( 15, 90 ) ; Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "Groupwise"; }; RadioButton RB_EVOLUTION_LDAP { - Pos = MAP_APPFONT ( 15, 90 ) ; Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "Evolution LDAP"; }; + RadioButton RB_MORK + { + Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; + Text [ en-US ] = "Mozilla / Netscape"; + }; + RadioButton RB_THUNDERBIRD + { + Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; + Text [ en-US ] = "Thunderbird"; + }; RadioButton RB_KAB { - Pos = MAP_APPFONT ( 15, 101 ) ; Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "KDE address book"; }; RadioButton RB_MACAB { - Pos = MAP_APPFONT ( 15, 101 ) ; Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "Mac OS X address book"; }; RadioButton RB_LDAP { - Pos = MAP_APPFONT ( 15, 112 ) ; Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "LDAP address data"; }; RadioButton RB_OUTLOOK { - Pos = MAP_APPFONT ( 15, 123 ) ; Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "Outlook address book"; }; RadioButton RB_OUTLOOKEXPRESS { - Pos = MAP_APPFONT ( 15,134 ) ; Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "Windows system address book"; }; RadioButton RB_OTHER { - Pos = MAP_APPFONT ( 15, 145 ) ; Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "Other external data source"; }; }; diff --git a/extensions/source/abpilot/typeselectionpage.cxx b/extensions/source/abpilot/typeselectionpage.cxx index e521ebd96fe1..f7cfafe39c10 100644 --- a/extensions/source/abpilot/typeselectionpage.cxx +++ b/extensions/source/abpilot/typeselectionpage.cxx @@ -50,27 +50,25 @@ namespace abp //--------------------------------------------------------------------- TypeSelectionPage::TypeSelectionPage( OAddessBookSourcePilot* _pParent ) :AddressBookSourcePage(_pParent, ModuleRes(RID_PAGE_SELECTABTYPE)) - ,m_aHint (this, ModuleRes(FT_TYPE_HINTS)) - ,m_aTypeSep (this, ModuleRes(FL_TYPE)) - ,m_aMORK (this, ModuleRes(RB_MORK)) - ,m_aThunderbird (this, ModuleRes(RB_THUNDERBIRD)) - ,m_aEvolutionGroupwise (this, ModuleRes(RB_EVOLUTION_GROUPWISE)) - ,m_aEvolutionLdap (this, ModuleRes(RB_EVOLUTION_LDAP)) - ,m_aEvolution (this, ModuleRes(RB_EVOLUTION)) - ,m_aKab (this, ModuleRes(RB_KAB)) - ,m_aMacab (this, ModuleRes(RB_MACAB)) - ,m_aLDAP (this, ModuleRes(RB_LDAP)) - ,m_aOutlook (this, ModuleRes(RB_OUTLOOK)) - ,m_aOE (this, ModuleRes(RB_OUTLOOKEXPRESS)) - ,m_aOther (this, ModuleRes(RB_OTHER)) + ,m_aHint (this, ModuleRes(FT_TYPE_HINTS)) + ,m_aTypeSep (this, ModuleRes(FL_TYPE)) + ,m_aEvolution (this, ModuleRes(RB_EVOLUTION)) + ,m_aEvolutionGroupwise (this, ModuleRes(RB_EVOLUTION_GROUPWISE)) + ,m_aEvolutionLdap (this, ModuleRes(RB_EVOLUTION_LDAP)) + ,m_aMORK (this, ModuleRes(RB_MORK)) + ,m_aThunderbird (this, ModuleRes(RB_THUNDERBIRD)) + ,m_aKab (this, ModuleRes(RB_KAB)) + ,m_aMacab (this, ModuleRes(RB_MACAB)) + ,m_aLDAP (this, ModuleRes(RB_LDAP)) + ,m_aOutlook (this, ModuleRes(RB_OUTLOOK)) + ,m_aOE (this, ModuleRes(RB_OUTLOOKEXPRESS)) + ,m_aOther (this, ModuleRes(RB_OTHER)) { - Point aTopLeft; - Size aItemSize; - FreeResource(); - aTopLeft = m_aMORK.GetPosPixel(); - aItemSize = m_aMORK.GetSizePixel(); + Point aTopLeft( LogicToPixel( Point( 15, 68 ), MAP_APPFONT ) ); + Size aItemSize( LogicToPixel( Size( 0, 8 ), MAP_APPFONT ) ); + aItemSize.Width() = GetOutputSizePixel().Width() - 30; bool bWithMozilla = true, bUnx = true; bool bHaveEvolution = true, bHaveKab = true; @@ -116,6 +114,7 @@ namespace abp m_aAllTypes.push_back( ButtonItem( &m_aOE, AST_OE, bWithMozilla && !bUnx ) ); m_aAllTypes.push_back( ButtonItem( &m_aOther, AST_OTHER, true ) ); + bool bFirstVisible = true; Link aTypeSelectionHandler = LINK(this, TypeSelectionPage, OnTypeSelected ); for ( ::std::vector< ButtonItem >::const_iterator loop = m_aAllTypes.begin(); loop != m_aAllTypes.end(); ++loop ) @@ -126,14 +125,30 @@ namespace abp else { aItem.m_pItem->SetPosPixel( aTopLeft ); - aTopLeft.Y() += (aItemSize.Height() * 5) / 4; + aTopLeft.Y() += aItemSize.Height(); aItem.m_pItem->SetClickHdl( aTypeSelectionHandler ); aItem.m_pItem->Show(); + + if ( bFirstVisible ) + { + aItem.m_pItem->SetStyle( aItem.m_pItem->GetStyle() | WB_GROUP ); + bFirstVisible = false; + } } } } //--------------------------------------------------------------------- + TypeSelectionPage::~TypeSelectionPage() + { + for ( ::std::vector< ButtonItem >::iterator loop = m_aAllTypes.begin(); + loop != m_aAllTypes.end(); ++loop ) + { + loop->m_bVisible = false; + } + } + + //--------------------------------------------------------------------- void TypeSelectionPage::ActivatePage() { AddressBookSourcePage::ActivatePage(); @@ -141,10 +156,10 @@ namespace abp for ( ::std::vector< ButtonItem >::const_iterator loop = m_aAllTypes.begin(); loop != m_aAllTypes.end(); ++loop ) { - ButtonItem aItem = (*loop); - if( aItem.m_pItem->IsChecked() && aItem.m_bVisible ) + const ButtonItem& rItem = (*loop); + if( rItem.m_pItem->IsChecked() && rItem.m_bVisible ) { - aItem.m_pItem->GrabFocus(); + rItem.m_pItem->GrabFocus(); break; } } diff --git a/extensions/source/abpilot/typeselectionpage.hxx b/extensions/source/abpilot/typeselectionpage.hxx index 66fb449657fd..0d647f696a39 100644 --- a/extensions/source/abpilot/typeselectionpage.hxx +++ b/extensions/source/abpilot/typeselectionpage.hxx @@ -48,11 +48,11 @@ namespace abp protected: FixedText m_aHint; FixedLine m_aTypeSep; - RadioButton m_aMORK; - RadioButton m_aThunderbird; + RadioButton m_aEvolution; RadioButton m_aEvolutionGroupwise; RadioButton m_aEvolutionLdap; - RadioButton m_aEvolution; + RadioButton m_aMORK; + RadioButton m_aThunderbird; RadioButton m_aKab; RadioButton m_aMacab; RadioButton m_aLDAP; @@ -78,6 +78,7 @@ namespace abp public: TypeSelectionPage( OAddessBookSourcePilot* _pParent ); + ~TypeSelectionPage(); // retrieves the currently selected type AddressSourceType getSelectedType() const; diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx index 01427e1a8bf5..3d9667b94f06 100644 --- a/extensions/source/bibliography/bibload.cxx +++ b/extensions/source/bibliography/bibload.cxx @@ -692,7 +692,7 @@ sal_Bool BibliographyLoader::hasElements(void) throw ( RuntimeException ) Reference< XPropertySetInfo > BibliographyLoader::getPropertySetInfo(void) throw ( RuntimeException ) { - static SfxItemPropertyMap aBibProps_Impl[] = + static SfxItemPropertyMapEntry aBibProps_Impl[] = { { MAP_CHAR_LEN("BibliographyDataFieldNames"), 0, &::getCppuType((Sequence<PropertyValue>*)0), PropertyAttribute::READONLY, 0}, {0,0,0,0,0,0} diff --git a/extensions/source/dbpilots/gridwizard.cxx b/extensions/source/dbpilots/gridwizard.cxx index 1c0e9a684e05..ad09e2d7122c 100644 --- a/extensions/source/dbpilots/gridwizard.cxx +++ b/extensions/source/dbpilots/gridwizard.cxx @@ -218,8 +218,8 @@ namespace dbp xColumn->setPropertyValue(s_sDataFieldProperty, makeAny(*pFormFieldName)); // the label xColumn->setPropertyValue(s_sLabelProperty, makeAny(::rtl::OUString(*pFormFieldName) += *pColumnLabelPostfix)); - // the width (0 => column will be auto-sized) - xColumn->setPropertyValue(s_sWidthProperty, makeAny(sal_Int32(0))); + // the width (<void/> => column will be auto-sized) + xColumn->setPropertyValue(s_sWidthProperty, Any()); // insert the column xColumnContainer->insertByName(sColumnName, makeAny(xColumn)); diff --git a/extensions/source/oooimprovecore/core.cxx b/extensions/source/oooimprovecore/core.cxx index adf3a49bf9a1..2d6fc581f3a6 100644 --- a/extensions/source/oooimprovecore/core.cxx +++ b/extensions/source/oooimprovecore/core.cxx @@ -141,7 +141,7 @@ namespace oooimprovecore SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if ( pFact ) { - AbstractSfxSingleTabDialog *pDlg = pFact->CreateSfxSingleTabDialog( NULL, aSet, 0, RID_SVXPAGE_IMPROVEMENT ); + SfxAbstractDialog *pDlg = pFact->CreateSfxDialog( NULL, aSet, 0, RID_SVXPAGE_IMPROVEMENT ); pDlg->Execute(); delete pDlg; } diff --git a/extensions/source/oooimprovement/config.cxx b/extensions/source/oooimprovement/config.cxx index 8733cbd577e4..daf1e81bc60d 100644 --- a/extensions/source/oooimprovement/config.cxx +++ b/extensions/source/oooimprovement/config.cxx @@ -72,7 +72,7 @@ namespace static const OUString SOAPID = OUString::createFromAscii("OpenOffice.org Improvement Report - Version 1\n"); - static const sal_Int32 incrementCfgValue( + static sal_Int32 incrementCfgValue( const Reference<XMultiServiceFactory> sm, const OUString& package, const OUString& rel_path, @@ -103,7 +103,7 @@ namespace oooimprovement : m_ServiceFactory(sf) {} - const OUString Config::getSoapUrl() + OUString Config::getSoapUrl() const { OUString result; MyConfigurationHelper::readDirectKey( @@ -113,7 +113,7 @@ namespace oooimprovement return result; } - const OUString Config::getSoapId() + OUString Config::getSoapId() const { OUString value; OUStringBuffer result = SOAPID; @@ -125,7 +125,7 @@ namespace oooimprovement return result.makeStringAndClear(); } - const OUString Config::getReporterEmail() + OUString Config::getReporterEmail() const { OUString result; MyConfigurationHelper::readDirectKey( @@ -135,7 +135,7 @@ namespace oooimprovement return result; } - const OUString Config::getLogPath() + OUString Config::getLogPath() const { OUString result; MyConfigurationHelper::readDirectKey( @@ -145,7 +145,7 @@ namespace oooimprovement return result; } - bool Config::getEnablingAllowed() + bool Config::getEnablingAllowed() const { bool result = false; MyConfigurationHelper::readDirectKey( @@ -155,7 +155,7 @@ namespace oooimprovement return result; } - bool Config::getInvitationAccepted() + bool Config::getInvitationAccepted() const { bool result = false; MyConfigurationHelper::readDirectKey( @@ -165,7 +165,7 @@ namespace oooimprovement return result; }; - bool Config::getShowedInvitation() + bool Config::getShowedInvitation() const { bool result = false; MyConfigurationHelper::readDirectKey( @@ -175,7 +175,7 @@ namespace oooimprovement return result; }; - const OUString Config::getCompleteProductname() + OUString Config::getCompleteProductname() const { OUStringBuffer result; OUString value; @@ -202,7 +202,7 @@ namespace oooimprovement return result.makeStringAndClear(); } - const OUString Config::getSetupLocale() + OUString Config::getSetupLocale() const { OUString result; MyConfigurationHelper::readDirectKey( @@ -212,7 +212,7 @@ namespace oooimprovement return result; } - const sal_Int32 Config::getReportCount() + sal_Int32 Config::getReportCount() const { sal_Int32 result = 0; MyConfigurationHelper::readDirectKey( @@ -222,7 +222,7 @@ namespace oooimprovement return result; } - const sal_Int32 Config::getFailedAttempts() + sal_Int32 Config::getFailedAttempts() const { sal_Int32 result = 0; MyConfigurationHelper::readDirectKey( @@ -232,7 +232,7 @@ namespace oooimprovement return result; } - const sal_Int32 Config::getOfficeStartCounterdown() + sal_Int32 Config::getOfficeStartCounterdown() const { sal_Int32 result = 0; MyConfigurationHelper::readDirectKey( diff --git a/extensions/source/oooimprovement/config.hxx b/extensions/source/oooimprovement/config.hxx index d081c77577d4..ff032a6032a5 100644 --- a/extensions/source/oooimprovement/config.hxx +++ b/extensions/source/oooimprovement/config.hxx @@ -43,18 +43,18 @@ namespace oooimprovement { public: Config(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& sf); - bool getEnablingAllowed(); - bool getInvitationAccepted(); - bool getShowedInvitation(); - const ::rtl::OUString getCompleteProductname(); - const ::rtl::OUString getLogPath(); - const ::rtl::OUString getReporterEmail(); - const ::rtl::OUString getSetupLocale(); - const ::rtl::OUString getSoapId(); - const ::rtl::OUString getSoapUrl(); - const sal_Int32 getReportCount(); - const sal_Int32 getFailedAttempts(); - const sal_Int32 getOfficeStartCounterdown(); + bool getEnablingAllowed() const; + bool getInvitationAccepted() const; + bool getShowedInvitation() const; + ::rtl::OUString getCompleteProductname() const; + ::rtl::OUString getLogPath() const; + ::rtl::OUString getReporterEmail() const; + ::rtl::OUString getSetupLocale() const; + ::rtl::OUString getSoapId() const; + ::rtl::OUString getSoapUrl() const; + sal_Int32 getReportCount() const; + sal_Int32 getFailedAttempts() const; + sal_Int32 getOfficeStartCounterdown() const; sal_Int32 incrementEventCount(sal_Int32 by); sal_Int32 incrementReportCount(sal_Int32 by); sal_Int32 incrementFailedAttempts(sal_Int32 by); diff --git a/extensions/source/plugin/base/nfuncs.cxx b/extensions/source/plugin/base/nfuncs.cxx index 73cf259aeccd..e965a5696f94 100644 --- a/extensions/source/plugin/base/nfuncs.cxx +++ b/extensions/source/plugin/base/nfuncs.cxx @@ -122,7 +122,7 @@ static ::rtl::OString normalizeURL( XPlugin_Impl* plugin, const ::rtl::OString& int nPos; if( ( nPos = aLoadURL.indexOf( "://" ) ) != -1 ) { - if( url.getLength() && url.getStr()[ 0 ] == '/' || url.indexOf( '/' ) != -1 ) + if( url.getLength() && (url.getStr()[ 0 ] == '/' || url.indexOf( '/' ) != -1) ) { // this means same server but new path nPos = aLoadURL.indexOf( '/', nPos+3 ); diff --git a/extensions/source/plugin/base/plcom.cxx b/extensions/source/plugin/base/plcom.cxx index 1d3566bd2873..b19a7e58d249 100644 --- a/extensions/source/plugin/base/plcom.cxx +++ b/extensions/source/plugin/base/plcom.cxx @@ -42,11 +42,12 @@ #include <tools/fsys.hxx> #include <plugin/impl.hxx> -PluginComm::PluginComm( const ::rtl::OString& rLibName ) : +PluginComm::PluginComm( const ::rtl::OString& rLibName, bool bReusable ) : m_nRefCount( 0 ), m_aLibName( rLibName ) { - PluginManager::get().getPluginComms().push_back( this ); + if( bReusable ) + PluginManager::get().getPluginComms().push_back( this ); } PluginComm::~PluginComm() diff --git a/extensions/source/plugin/inc/plugin/impl.hxx b/extensions/source/plugin/inc/plugin/impl.hxx index d3d583476686..28524770521c 100644 --- a/extensions/source/plugin/inc/plugin/impl.hxx +++ b/extensions/source/plugin/inc/plugin/impl.hxx @@ -75,17 +75,15 @@ #include "plugin/win/sysplug.hxx" #endif -#ifdef OS2 +#ifdef WNT +#include <plugin/win/sysplug.hxx> +#elif defined(OS2) #include "plugin/os2/sysplug.hxx" -#endif - -#if defined(UNX) -#if defined(QUARTZ) +#elif defined(QUARTZ) #include "plugin/aqua/sysplug.hxx" -#else +#elif defined(UNX) #include "plugin/unx/sysplug.hxx" #endif -#endif #if ! defined (QUARTZ) // the QUARTZ implementation needs special instance data diff --git a/extensions/source/plugin/inc/plugin/plcom.hxx b/extensions/source/plugin/inc/plugin/plcom.hxx index 1ea42d933467..0c5845667887 100644 --- a/extensions/source/plugin/inc/plugin/plcom.hxx +++ b/extensions/source/plugin/inc/plugin/plcom.hxx @@ -42,7 +42,7 @@ protected: ::rtl::OString m_aLibName; std::list< String > m_aFilesToDelete; public: - PluginComm( const ::rtl::OString& rLibName ); + PluginComm( const ::rtl::OString& rLibName, bool bReusable = true ); virtual ~PluginComm(); int getRefCount() { return m_nRefCount; } diff --git a/extensions/source/plugin/unx/makefile.mk b/extensions/source/plugin/unx/makefile.mk index d2cb4b888f37..902348f0cb7d 100644 --- a/extensions/source/plugin/unx/makefile.mk +++ b/extensions/source/plugin/unx/makefile.mk @@ -74,7 +74,6 @@ OBJFILES=\ APP1TARGET=pluginapp.bin APP1OBJS=$(OBJFILES) APP1STDLIBS=\ - $(TOOLSLIB) \ $(VOSLIB) \ $(SALLIB) .IF "$(OS)"=="SOLARIS" || "$(OS)"=="SCO" || "$(OS)"=="HPUX" diff --git a/extensions/source/plugin/unx/npnapi.cxx b/extensions/source/plugin/unx/npnapi.cxx index 45730edebc73..003b4d0943a5 100644 --- a/extensions/source/plugin/unx/npnapi.cxx +++ b/extensions/source/plugin/unx/npnapi.cxx @@ -365,7 +365,12 @@ static void l_NPN_ReloadPlugins( NPBool /*reloadPages*/ ) static NPError l_NPN_GetValue( NPP, NPNVariable variable, void* value ) { - switch( variable ) + /* + * We want to handle values injected into a NPNVariable which aren't in + * the old enum we build against, but that we know are in the new enum + * we want to support + */ + switch( (int)variable ) { case NPNVxDisplay: *((Display**)value) = pXtAppDisplay; @@ -396,14 +401,14 @@ static NPError l_NPN_GetValue( NPP, NPNVariable variable, void* value ) medDebug( 1, "xembed requested\n" ); break; case NPNVToolkit: - #ifdef ENABLE_GTK +# ifdef ENABLE_GTK *(int*)value = NPNVGtk2; - #else +# else *(int*)value = 0; - #endif +# endif medDebug( 1, "toolkit requested\n" ); break; - default: + default: medDebug( 1, "unknown NPNVariable %x requested\n", variable ); return NPERR_INVALID_PARAM; } @@ -449,13 +454,13 @@ static NPNetscapeFuncs aNetscapeFuncs = l_NPN_MemFree, l_NPN_MemFlush, l_NPN_ReloadPlugins, - #ifdef OJI +# ifdef OJI l_NPN_GetJavaEnv, l_NPN_GetJavaPeer, - #else +# else NULL, NULL, - #endif +# endif l_NPN_GetURLNotify, l_NPN_PostURLNotify, l_NPN_GetValue, diff --git a/extensions/source/plugin/unx/npwrap.cxx b/extensions/source/plugin/unx/npwrap.cxx index f9a333c77dda..f121342874d8 100644 --- a/extensions/source/plugin/unx/npwrap.cxx +++ b/extensions/source/plugin/unx/npwrap.cxx @@ -262,6 +262,17 @@ static GSourceFuncs aXtEventFuncs = NULL }; +static gboolean pollXtTimerCallback(gpointer) +{ + for(int i = 0; i < 5; i++) + { + if( (XtAppPending(app_context) & (XtIMAll & ~XtIMXEvent)) == 0 ) + break; + XtAppProcessEvent(app_context, XtIMAll & ~XtIMXEvent); + } + return TRUE; +} + static gboolean prepareWakeupEvent( GSource*, gint* ) { struct pollfd aPoll = { wakeup_fd[0], POLLIN, 0 }; @@ -411,6 +422,7 @@ int main( int argc, char **argv) aXtPollDesc.revents = 0; g_source_add_poll( pXTSource, &aXtPollDesc ); + gint xt_polling_timer_id = g_timeout_add( 25, pollXtTimerCallback, NULL); // Initialize wakeup events listener GSource *pWakeupSource = g_source_new( &aWakeupEventFuncs, sizeof(GSource) ); if ( pWakeupSource == NULL ) @@ -473,6 +485,8 @@ int main( int argc, char **argv) medDebug( 1, "left plugin app main loop\n" ); + g_source_remove(xt_polling_timer_id); + pNP_Shutdown(); medDebug( 1, "NP_Shutdown done\n" ); osl_unloadModule( pPluginLib ); diff --git a/extensions/source/plugin/unx/sysplug.cxx b/extensions/source/plugin/unx/sysplug.cxx index 4b8e0454c893..573e79d22cb2 100644 --- a/extensions/source/plugin/unx/sysplug.cxx +++ b/extensions/source/plugin/unx/sysplug.cxx @@ -50,7 +50,7 @@ UnxPluginComm::UnxPluginComm( int nDescriptor1, int nDescriptor2 ) : - PluginComm( ::rtl::OUStringToOString( library, osl_getThreadTextEncoding() ) ), + PluginComm( ::rtl::OUStringToOString( library, osl_getThreadTextEncoding() ), false ), PluginConnector( nDescriptor2 ) { char pDesc[32]; diff --git a/extensions/source/preload/makefile.mk b/extensions/source/preload/makefile.mk index 54de572a875d..db8b58b6e118 100644 --- a/extensions/source/preload/makefile.mk +++ b/extensions/source/preload/makefile.mk @@ -64,7 +64,6 @@ SHL1TARGET= $(TARGET)$(DLLPOSTFIX) SHL1VERSIONMAP= $(TARGET).map SHL1STDLIBS= \ - $(SVXLIB) \ $(SFXLIB) \ $(SVTOOLLIB)\ $(VCLLIB) \ diff --git a/extensions/source/propctrlr/browserlistbox.cxx b/extensions/source/propctrlr/browserlistbox.cxx index 4cb35e9f0c6f..23008fc9a1de 100644 --- a/extensions/source/propctrlr/browserlistbox.cxx +++ b/extensions/source/propctrlr/browserlistbox.cxx @@ -667,11 +667,21 @@ namespace pcr } //------------------------------------------------------------------ - void OBrowserListBox::SetPropertyValue(const ::rtl::OUString& _rEntryName, const Any& _rValue) + void OBrowserListBox::SetPropertyValue(const ::rtl::OUString& _rEntryName, const Any& _rValue, bool _bUnknownValue ) { ListBoxLines::iterator line = m_aLines.find( _rEntryName ); if ( line != m_aLines.end() ) - impl_setControlAsPropertyValue( line->second, _rValue ); + { + if ( _bUnknownValue ) + { + Reference< XPropertyControl > xControl( line->second.pLine->getControl() ); + OSL_ENSURE( xControl.is(), "OBrowserListBox::SetPropertyValue: illegal control!" ); + if ( xControl.is() ) + xControl->setValue( Any() ); + } + else + impl_setControlAsPropertyValue( line->second, _rValue ); + } } //------------------------------------------------------------------------ diff --git a/extensions/source/propctrlr/browserlistbox.hxx b/extensions/source/propctrlr/browserlistbox.hxx index faa6facb6fe4..a89e1dc83c39 100644 --- a/extensions/source/propctrlr/browserlistbox.hxx +++ b/extensions/source/propctrlr/browserlistbox.hxx @@ -164,7 +164,7 @@ namespace pcr sal_Bool RemoveEntry( const ::rtl::OUString& _rName ); void ChangeEntry( const OLineDescriptor&, sal_uInt16 nPos ); - void SetPropertyValue( const ::rtl::OUString& rEntryName, const ::com::sun::star::uno::Any& rValue ); + void SetPropertyValue( const ::rtl::OUString& rEntryName, const ::com::sun::star::uno::Any& rValue, bool _bUnknownValue ); ::com::sun::star::uno::Any GetPropertyValue( const ::rtl::OUString& rEntryName ) const; sal_uInt16 GetPropertyPos( const ::rtl::OUString& rEntryName ) const; ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl > diff --git a/extensions/source/propctrlr/cellbindinghelper.cxx b/extensions/source/propctrlr/cellbindinghelper.cxx index e1fc88553e76..d609dea69436 100644 --- a/extensions/source/propctrlr/cellbindinghelper.cxx +++ b/extensions/source/propctrlr/cellbindinghelper.cxx @@ -44,8 +44,10 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> #include <unotools/transliterationwrapper.hxx> #include <osl/diagnose.h> +#include <tools/diagnose_ex.h> #include "formstrings.hxx" #include <functional> @@ -109,7 +111,7 @@ namespace pcr } //------------------------------------------------------------------------ - sal_Int16 CellBindingHelper::getControlSheetIndex( ) const + sal_Int16 CellBindingHelper::getControlSheetIndex( Reference< XSpreadsheet >& _out_rxSheet ) const { sal_Int16 nSheetIndex = -1; // every sheet has a draw page, and every draw page has a forms collection. @@ -137,18 +139,13 @@ namespace pcr { for ( sal_Int32 i = 0; i < xSheets->getCount(); ++i ) { - Reference< XDrawPageSupplier > xSuppPage; - xSheets->getByIndex( i ) >>= xSuppPage; + Reference< XDrawPageSupplier > xSuppPage( xSheets->getByIndex( i ), UNO_QUERY_THROW ); + Reference< XFormsSupplier > xSuppForms( xSuppPage->getDrawPage(), UNO_QUERY_THROW ); - Reference< XFormsSupplier > xSuppForms; - if ( xSuppPage.is() ) - xSuppForms = xSuppForms.query( xSuppPage->getDrawPage() ); - - OSL_ENSURE( xSuppForms.is(), "CellBindingHelper::getControlSheetIndex: could not determine the forms supplier!" ); - - if ( xSuppForms.is() && ( xSuppForms->getForms() == xFormsCollection ) ) + if ( xSuppForms->getForms() == xFormsCollection ) { // found it nSheetIndex = (sal_Int16)i; + _out_rxSheet.set( xSuppPage, UNO_QUERY_THROW ); break; } } @@ -156,7 +153,7 @@ namespace pcr } catch( const Exception& ) { - OSL_ENSURE( sal_False, "CellBindingHelper::getControlSheetIndex: caught an exception!" ); + DBG_UNHANDLED_EXCEPTION(); } return nSheetIndex; @@ -195,7 +192,8 @@ namespace pcr { try { - xConverter->setPropertyValue( PROPERTY_REFERENCE_SHEET, makeAny( (sal_Int32)getControlSheetIndex() ) ); + Reference< XSpreadsheet > xSheet; + xConverter->setPropertyValue( PROPERTY_REFERENCE_SHEET, makeAny( (sal_Int32)getControlSheetIndex( xSheet ) ) ); xConverter->setPropertyValue( _rInputProperty, _rInputValue ); _rOutputValue = xConverter->getPropertyValue( _rOutputProperty ); bSuccess = true; diff --git a/extensions/source/propctrlr/cellbindinghelper.hxx b/extensions/source/propctrlr/cellbindinghelper.hxx index 4660bb681507..e612bda0983a 100644 --- a/extensions/source/propctrlr/cellbindinghelper.hxx +++ b/extensions/source/propctrlr/cellbindinghelper.hxx @@ -40,6 +40,7 @@ #include <com/sun/star/form/binding/XValueBinding.hpp> #include <com/sun/star/form/binding/XListEntrySource.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> /** === end UNO includes === **/ //............................................................................ @@ -205,6 +206,13 @@ namespace pcr const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XListEntrySource >& _rxSource ) const; + /** retrieves the index of the sheet which our control belongs to + @return the index of the sheet which our control belongs to or -1, if an error occured + */ + sal_Int16 getControlSheetIndex( + ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet >& _out_rxSheet + ) const; + protected: /** creates an address object from a string representation of a cell address */ @@ -220,11 +228,6 @@ namespace pcr ::com::sun::star::table::CellRangeAddress& /* [out] */ _rAddress ) const; - /** retrieves the index of the sheet which our control belongs to - @return the index of the sheet which our control belongs to or -1, if an error occured - */ - sal_Int16 getControlSheetIndex( ) const; - /** determines if our document is a spreadsheet document, *and* can supply the given service */ diff --git a/extensions/source/propctrlr/defaultforminspection.cxx b/extensions/source/propctrlr/defaultforminspection.cxx index de4a907157d7..aed1d120bb09 100644 --- a/extensions/source/propctrlr/defaultforminspection.cxx +++ b/extensions/source/propctrlr/defaultforminspection.cxx @@ -163,7 +163,10 @@ namespace pcr { "com.sun.star.form.inspection.XSDValidationPropertyHandler", true }, // a handler which cares for XForms submissions - { "com.sun.star.form.inspection.SubmissionPropertyHandler", true } + { "com.sun.star.form.inspection.SubmissionPropertyHandler", true }, + + // a handler which cares for geometry properties of form controls + { "com.sun.star.form.inspection.FormGeometryHandler", true } }; sal_Int32 nFactories = sizeof( aFactories ) / sizeof( aFactories[ 0 ] ); diff --git a/extensions/source/propctrlr/editpropertyhandler.cxx b/extensions/source/propctrlr/editpropertyhandler.cxx index 0de64030db41..cd9d197e3fb5 100644 --- a/extensions/source/propctrlr/editpropertyhandler.cxx +++ b/extensions/source/propctrlr/editpropertyhandler.cxx @@ -293,7 +293,7 @@ namespace pcr _rxInspectorUI->enablePropertyUI( PROPERTY_WORDBREAK, nTextType == TEXTTYPE_RICHTEXT ); _rxInspectorUI->enablePropertyUI( PROPERTY_MAXTEXTLEN, nTextType != TEXTTYPE_RICHTEXT ); _rxInspectorUI->enablePropertyUI( PROPERTY_ECHO_CHAR, nTextType == TEXTTYPE_SINGLELINE ); - _rxInspectorUI->enablePropertyUI( PROPERTY_FONT_NAME, nTextType != TEXTTYPE_RICHTEXT ); + _rxInspectorUI->enablePropertyUI( PROPERTY_FONT, nTextType != TEXTTYPE_RICHTEXT ); _rxInspectorUI->enablePropertyUI( PROPERTY_ALIGN, nTextType != TEXTTYPE_RICHTEXT ); _rxInspectorUI->enablePropertyUI( PROPERTY_DEFAULT_TEXT, nTextType != TEXTTYPE_RICHTEXT ); _rxInspectorUI->enablePropertyUI( PROPERTY_SHOW_SCROLLBARS, nTextType != TEXTTYPE_SINGLELINE ); diff --git a/extensions/source/propctrlr/eventhandler.cxx b/extensions/source/propctrlr/eventhandler.cxx index ad607469937d..4d7c09563b5d 100644 --- a/extensions/source/propctrlr/eventhandler.cxx +++ b/extensions/source/propctrlr/eventhandler.cxx @@ -40,6 +40,7 @@ #include "modulepcr.hxx" #include "pcrcommon.hxx" #include "pcrstrings.hxx" +#include "propertycontrolextender.hxx" /** === begin UNO includes === **/ #include <com/sun/star/awt/XTabControllerModel.hpp> @@ -59,6 +60,8 @@ #include <com/sun/star/script/XEventAttacherManager.hpp> #include <com/sun/star/script/XScriptEventsSupplier.hpp> #include <com/sun/star/util/XModifiable.hpp> +#include <com/sun/star/uri/UriReferenceFactory.hpp> +#include <com/sun/star/uri/XVndSunStarScriptUrlReference.hpp> /** === end UNO includes === **/ #include <comphelper/namedvaluecollection.hxx> @@ -136,6 +139,10 @@ namespace pcr using ::com::sun::star::frame::XModel; using ::com::sun::star::frame::XController; using ::com::sun::star::uno::UNO_SET_THROW; + using com::sun::star::uri::UriReferenceFactory; + using com::sun::star::uri::XUriReferenceFactory; + using com::sun::star::uri::XVndSunStarScriptUrlReference; + using ::com::sun::star::lang::XEventListener; /** === end UNO using === **/ namespace PropertyControlType = ::com::sun::star::inspection::PropertyControlType; namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute; @@ -676,9 +683,8 @@ namespace pcr { ::osl::MutexGuard aGuard( m_aMutex ); - OSL_ENSURE( false, "EventHandler::convertToPropertyValue: why calling this for read-only controls?" ); - // since currently, the controls to display the script events are readonly, this method should normally - // not be called. + ::rtl::OUString sNewScriptCode; + OSL_VERIFY( _rControlValue >>= sNewScriptCode ); Sequence< ScriptEventDescriptor > aAllAssignedEvents; impl_getComponentScriptEvents_nothrow( aAllAssignedEvents ); @@ -686,14 +692,17 @@ namespace pcr const EventDescription& rEvent = impl_getEventForName_throw( _rPropertyName ); ScriptEventDescriptor aAssignedScript = lcl_getAssignedScriptEvent( rEvent, aAllAssignedEvents ); -#if OSL_DEBUG_LEVEL > 0 - ::rtl::OUString sControlValue; - OSL_VERIFY( _rControlValue >>= sControlValue ); - OSL_ENSURE( sControlValue == aAssignedScript.ScriptCode, "EventHandler::convertToPropertyValue: somebody really managed to enter a new value in the control?" ); -#else - (void)_rControlValue; -#endif + OSL_ENSURE( !sNewScriptCode.getLength(), "EventHandler::convertToPropertyValue: cannot convert a non-empty display name!" ); + // Usually, there is no possibility for the user to change the content of an event binding directly in the + // input field, this instead is done with the macro assignment dialog. + // The only exception is the user pressing "DEL" while the control has the focus, in this case, we reset the + // control content to an empty string. So this is the only scenario where this method is allowed to be called. + // Striclty, we would be able to convert the display value to a property value, + // using the "name (location, language)" format we used in convertToControlValue. However, + // there is no need for this code ... + + aAssignedScript.ScriptCode = sNewScriptCode; return makeAny( aAssignedScript ); } @@ -708,7 +717,58 @@ namespace pcr OSL_ENSURE( _rControlValueType.getTypeClass() == TypeClass_STRING, "EventHandler::convertToControlValue: unexpected ControlValue type class!" ); (void)_rControlValueType; - return makeAny( aScriptEvent.ScriptCode ); + + ::rtl::OUString sScript( aScriptEvent.ScriptCode ); + if ( sScript.getLength() ) + { + // format is: "name (location, language)" + try + { + // parse + Reference< XUriReferenceFactory > xUriRefFac = UriReferenceFactory::create( m_aContext.getUNOContext() ); + Reference< XVndSunStarScriptUrlReference > xScriptUri( xUriRefFac->parse( sScript ), UNO_QUERY_THROW ); + + ::rtl::OUStringBuffer aComposeBuffer; + + // name + aComposeBuffer.append( xScriptUri->getName() ); + + // location + const ::rtl::OUString sLocationParamName( RTL_CONSTASCII_USTRINGPARAM( "location" ) ); + const ::rtl::OUString sLocation = xScriptUri->getParameter( sLocationParamName ); + const ::rtl::OUString sLangParamName( RTL_CONSTASCII_USTRINGPARAM( "language" ) ); + const ::rtl::OUString sLanguage = xScriptUri->getParameter( sLangParamName ); + + if ( sLocation.getLength() || sLanguage.getLength() ) + { + aComposeBuffer.appendAscii( " (" ); + + // location + OSL_ENSURE( sLocation.getLength(), "EventHandler::convertToControlValue: unexpected: no location!" ); + if ( sLocation.getLength() ) + { + aComposeBuffer.append( sLocation ); + aComposeBuffer.appendAscii( ", " ); + } + + // language + if ( sLanguage.getLength() ) + { + aComposeBuffer.append( sLanguage ); + } + + aComposeBuffer.append( sal_Unicode( ')' ) ); + } + + sScript = aComposeBuffer.makeStringAndClear(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + return makeAny( sScript ); } //-------------------------------------------------------------------- @@ -829,7 +889,10 @@ namespace pcr ::osl::MutexGuard aGuard( m_aMutex ); LineDescriptor aDescriptor; + aDescriptor.Control = _rxControlFactory->createPropertyControl( PropertyControlType::TextField, sal_True ); + Reference< XEventListener > xControlExtender = new PropertyControlExtender( aDescriptor.Control ); + const EventDescription& rEvent = impl_getEventForName_throw( _rPropertyName ); aDescriptor.DisplayName = rEvent.sDisplayName; aDescriptor.HelpURL = HelpIdUrl::getHelpURL( rEvent.nHelpId ); diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index c413de6e7e44..e28eb2e89224 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -103,7 +103,6 @@ #include <svx/svxids.hrc> #include <toolkit/helper/vclunohelper.hxx> #include <tools/diagnose_ex.h> -#include <unotools/confignode.hxx> #include <vcl/msgbox.hxx> #include <vcl/stdtext.hxx> #include <vcl/wrkwin.hxx> @@ -344,7 +343,7 @@ namespace pcr sObjectID = sObjectID + xGrfObj->getUniqueID(); m_xComponent->setPropertyValue( _rPropertyName, uno::makeAny( sObjectID ) ); } - else if ( PROPERTY_ID_FONT_NAME == nPropId ) + else if ( PROPERTY_ID_FONT == nPropId ) { // special handling, the value is a faked value we generated ourself in impl_executeFontDialog_nothrow Sequence< NamedValue > aFontPropertyValues; @@ -559,8 +558,12 @@ namespace pcr ::rtl::OUString sControlValue; OSL_VERIFY( _rControlValue >>= sControlValue ); - String sShowHide = String( PcrRes( RID_STR_SHOW_HIDE ) ); - aPropertyValue <<= (sal_Bool)( sShowHide.GetToken(1) == String( sControlValue ) ); + ::std::vector< ::rtl::OUString > aListEntries; + tools::StringListResource aRes( PcrRes( RID_RSC_ENUM_SHOWHIDE ), aListEntries ); + OSL_ENSURE( aListEntries.size() == 2, "FormComponentPropertyHandler::convertToPropertyValue: broken resource for Show/Hide!" ); + sal_Bool bShow = ( aListEntries.size() < 2 ) || ( sControlValue == aListEntries[1] ); + + aPropertyValue <<= bShow; } break; @@ -615,7 +618,7 @@ namespace pcr case 1: nWritingMode = WritingMode2::RL_TB; break; case 2: nWritingMode = WritingMode2::CONTEXT; break; default: - OSL_ENSURE( false, "FormComponentPropertyHandler::convertToControlValue: unexpected 'normalized value' for WritingMode!" ); + OSL_ENSURE( false, "FormComponentPropertyHandler::convertToPropertyValue: unexpected 'normalized value' for WritingMode!" ); nWritingMode = WritingMode2::CONTEXT; break; } @@ -661,10 +664,17 @@ namespace pcr case PROPERTY_ID_SHOW_RECORDACTIONS: case PROPERTY_ID_SHOW_FILTERSORT: { - String aEntries = PcrRes( RID_STR_SHOW_HIDE ); - ::rtl::OUString sControlValue( - ::comphelper::getBOOL( _rPropertyValue ) ? aEntries.GetToken( 1 ) : aEntries.GetToken( 0 ) ); - aControlValue <<= sControlValue; + ::std::vector< ::rtl::OUString > aListEntries; + tools::StringListResource aRes( PcrRes( RID_RSC_ENUM_SHOWHIDE ), aListEntries ); + OSL_ENSURE( aListEntries.size() == 2, "FormComponentPropertyHandler::convertToControlValue: broken resource for Show/Hide!" ); + + if ( aListEntries.size() == 2 ) + { + ::rtl::OUString sControlValue = ::comphelper::getBOOL( _rPropertyValue ) + ? aListEntries[1] + : aListEntries[0]; + aControlValue <<= sControlValue; + } } break; @@ -753,6 +763,51 @@ namespace pcr } break; + case PROPERTY_ID_FONT: + { + FontDescriptor aFont; + OSL_VERIFY( _rPropertyValue >>= aFont ); + + ::rtl::OUStringBuffer displayName; + if ( !aFont.Name.getLength() ) + { + displayName.append( String( PcrRes( RID_STR_FONT_DEFAULT ) ) ); + } + else + { + // font name + displayName.append( aFont.Name ); + displayName.appendAscii( ", " ); + + // font style + ::FontWeight eWeight = VCLUnoHelper::ConvertFontWeight( aFont.Weight ); + USHORT nStyleResID = RID_STR_FONTSTYLE_REGULAR; + if ( aFont.Slant == FontSlant_ITALIC ) + { + if ( eWeight > WEIGHT_NORMAL ) + nStyleResID = RID_STR_FONTSTYLE_BOLD_ITALIC; + else + nStyleResID = RID_STR_FONTSTYLE_ITALIC; + } + else + { + if ( eWeight > WEIGHT_NORMAL ) + nStyleResID = RID_STR_FONTSTYLE_BOLD; + } + displayName.append( String( PcrRes( nStyleResID ) ) ); + + // font size + if ( aFont.Height ) + { + displayName.appendAscii( ", " ); + displayName.append( sal_Int32( aFont.Height ) ); + } + } + + aControlValue <<= displayName.makeStringAndClear(); + } + break; + default: aControlValue = FormComponentPropertyHandler_Base::convertToControlValue( _rPropertyName, _rPropertyValue, _rControlValueType ); break; @@ -913,6 +968,7 @@ namespace pcr aInterestingProperties.push_back( PROPERTY_SHOWTHOUSANDSEP ); aInterestingProperties.push_back( PROPERTY_FORMATKEY ); aInterestingProperties.push_back( PROPERTY_EMPTY_IS_NULL ); + aInterestingProperties.push_back( PROPERTY_TOGGLE ); return Sequence< ::rtl::OUString >( &(*aInterestingProperties.begin()), aInterestingProperties.size() ); } @@ -999,7 +1055,7 @@ namespace pcr }; break; - case PROPERTY_ID_FONT_NAME: + case PROPERTY_ID_FONT: bReadOnly = sal_True; aDescriptor.PrimaryButtonId = UID_PROP_DLG_FONT_TYPE; break; @@ -1227,7 +1283,7 @@ namespace pcr ::std::vector< ::rtl::OUString >::const_iterator pEnd = aEnumValues.end(); // for a checkbox: if "ambiguous" is not allowed, remove this from the sequence - if ( ( PROPERTY_ID_DEFAULTCHECKED == nPropId ) + if ( ( PROPERTY_ID_DEFAULT_STATE == nPropId ) || ( PROPERTY_ID_STATE == nPropId ) ) { @@ -1423,7 +1479,7 @@ namespace pcr eResult = InteractiveSelectionResult_ObtainedValue; break; - case PROPERTY_ID_FONT_NAME: + case PROPERTY_ID_FONT: if ( impl_executeFontDialog_nothrow( _rData, aGuard ) ) eResult = InteractiveSelectionResult_ObtainedValue; break; @@ -1650,7 +1706,7 @@ namespace pcr // ----- TriState ----- case PROPERTY_ID_TRISTATE: if ( !_bFirstTimeInit ) - _rxInspectorUI->rebuildPropertyUI( m_eComponentClass == eFormControl ? PROPERTY_DEFAULTCHECKED : PROPERTY_STATE ); + _rxInspectorUI->rebuildPropertyUI( m_eComponentClass == eFormControl ? PROPERTY_DEFAULT_STATE : PROPERTY_STATE ); break; // case PROPERTY_ID_TRISTATE // ----- DecimalAccuracy ----- @@ -1736,6 +1792,14 @@ namespace pcr } break; + case PROPERTY_ID_TOGGLE: + { + sal_Bool bIsToggleButton = sal_False; + OSL_VERIFY( _rNewValue >>= bIsToggleButton ); + _rxInspectorUI->enablePropertyUI( PROPERTY_DEFAULT_STATE, bIsToggleButton ); + } + break; + default: DBG_ERROR( "FormComponentPropertyHandler::actuatingPropertyChanged: did not register for this property!" ); break; @@ -2249,67 +2313,6 @@ namespace pcr } //------------------------------------------------------------------------ - sal_Int16 FormComponentPropertyHandler::impl_getDocumentMeasurementUnit_throw() const - { - FieldUnit eUnit = FUNIT_NONE; - - Reference< XServiceInfo > xDocumentSI( impl_getContextDocument_nothrow(), UNO_QUERY ); - OSL_ENSURE( xDocumentSI.is(), "FormComponentPropertyHandler::impl_getDocumentMeasurementUnit_throw: No context document - where do I live?" ); - if ( xDocumentSI.is() ) - { - // determine the application type we live in - ::rtl::OUString sConfigurationLocation; - ::rtl::OUString sConfigurationProperty; - if ( xDocumentSI->supportsService( SERVICE_WEB_DOCUMENT ) ) - { // writer - sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.WriterWeb/Layout/Other" ) ); - sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MeasureUnit" ) ); - } - else if ( xDocumentSI->supportsService( SERVICE_TEXT_DOCUMENT ) ) - { // writer - sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Writer/Layout/Other" ) ); - sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MeasureUnit" ) ); - } - else if ( xDocumentSI->supportsService( SERVICE_SPREADSHEET_DOCUMENT ) ) - { // calc - sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Calc/Layout/Other/MeasureUnit" ) ); - sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Metric" ) ); - } - else if ( xDocumentSI->supportsService( SERVICE_DRAWING_DOCUMENT ) ) - { - sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Draw/Layout/Other/MeasureUnit" ) ); - sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Metric" ) ); - } - else if ( xDocumentSI->supportsService( SERVICE_PRESENTATION_DOCUMENT ) ) - { - sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Impress/Layout/Other/MeasureUnit" ) ); - sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Metric" ) ); - } - - // read the measurement unit from the configuration - if ( sConfigurationLocation.getLength() && sConfigurationProperty.getLength() ) - { - ::utl::OConfigurationTreeRoot aConfigTree( ::utl::OConfigurationTreeRoot::createWithServiceFactory( - m_aContext.getLegacyServiceFactory(), sConfigurationLocation, -1, ::utl::OConfigurationTreeRoot::CM_READONLY ) ); - sal_Int32 nUnitAsInt = (sal_Int32)FUNIT_NONE; - aConfigTree.getNodeValue( sConfigurationProperty ) >>= nUnitAsInt; - - // if this denotes a valid (and accepted) unit, then use it - if ( ( nUnitAsInt > FUNIT_NONE ) && ( nUnitAsInt <= FUNIT_100TH_MM ) ) - eUnit = static_cast< FieldUnit >( nUnitAsInt ); - } - } - - if ( FUNIT_NONE == eUnit ) - { - MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum(); - eUnit = MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH; - } - - return VCLUnoHelper::ConvertToMeasurementUnit( eUnit, 1 ); - } - - //------------------------------------------------------------------------ Reference< XRowSet > FormComponentPropertyHandler::impl_getRowSet_throw( ) const { Reference< XRowSet > xRowSet = m_xRowSet; diff --git a/extensions/source/propctrlr/formcomponenthandler.hxx b/extensions/source/propctrlr/formcomponenthandler.hxx index ad6f19cce98b..9b972896e856 100644 --- a/extensions/source/propctrlr/formcomponenthandler.hxx +++ b/extensions/source/propctrlr/formcomponenthandler.hxx @@ -174,10 +174,6 @@ namespace pcr */ bool impl_shouldExcludeProperty_nothrow( const ::com::sun::star::beans::Property& _rProperty ) const; - /** determines the default measure unit for the document in which our component lives - */ - sal_Int16 impl_getDocumentMeasurementUnit_throw() const; - /** initializes the list of field names, if we're handling a control which supports the DataField property */ diff --git a/extensions/source/propctrlr/formgeometryhandler.cxx b/extensions/source/propctrlr/formgeometryhandler.cxx new file mode 100644 index 000000000000..00cfb70ee31e --- /dev/null +++ b/extensions/source/propctrlr/formgeometryhandler.cxx @@ -0,0 +1,825 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* 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_extensions.hxx" + +#include "propertyhandler.hxx" +#include "formmetadata.hxx" +#include "formstrings.hxx" +#include "handlerhelper.hxx" +#include "cellbindinghelper.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/inspection/XObjectInspectorUI.hpp> +#include <com/sun/star/awt/XControlModel.hpp> +#include <com/sun/star/drawing/XControlShape.hpp> +#include <com/sun/star/container/XMap.hpp> +#include <com/sun/star/inspection/XNumericControl.hpp> +#include <com/sun/star/util/MeasureUnit.hpp> +#include <com/sun/star/text/TextContentAnchorType.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/table/XColumnRowRange.hpp> +#include <com/sun/star/table/XCellRange.hpp> +#include <com/sun/star/container/XChild.hpp> +#include <com/sun/star/form/XGridColumnFactory.hpp> +/** === end UNO includes === **/ + +#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/componentbase.hxx> +#include <tools/debug.hxx> +#include <tools/diagnose_ex.h> + +//........................................................................ +namespace pcr +{ +//........................................................................ + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::uno::XComponentContext; + using ::com::sun::star::beans::UnknownPropertyException; + using ::com::sun::star::beans::Property; + using ::com::sun::star::awt::XControlModel; + using ::com::sun::star::drawing::XControlShape; + using ::com::sun::star::container::XMap; + using ::com::sun::star::inspection::LineDescriptor; + using ::com::sun::star::inspection::XPropertyControlFactory; + using ::com::sun::star::lang::NullPointerException; + using ::com::sun::star::beans::Optional; + using ::com::sun::star::inspection::XNumericControl; + using ::com::sun::star::drawing::XShape; + using ::com::sun::star::beans::PropertyChangeEvent; + using ::com::sun::star::lang::EventObject; + using ::com::sun::star::beans::XPropertySet; + using ::com::sun::star::beans::XPropertyChangeListener; + using ::com::sun::star::text::TextContentAnchorType; + using ::com::sun::star::text::TextContentAnchorType_AT_PARAGRAPH; + using ::com::sun::star::text::TextContentAnchorType_AS_CHARACTER; + using ::com::sun::star::beans::XPropertySetInfo; + using ::com::sun::star::inspection::XObjectInspectorUI; + using ::com::sun::star::lang::XServiceInfo; + using ::com::sun::star::sheet::XSpreadsheet; + using ::com::sun::star::table::XColumnRowRange; + using ::com::sun::star::table::XTableColumns; + using ::com::sun::star::table::XTableRows; + using ::com::sun::star::table::XCellRange; + using ::com::sun::star::container::XIndexAccess; + using ::com::sun::star::container::XChild; + using ::com::sun::star::form::XGridColumnFactory; + /** === end UNO using === **/ + namespace MeasureUnit = ::com::sun::star::util::MeasureUnit; + + typedef ::com::sun::star::awt::Point AwtPoint; + typedef ::com::sun::star::awt::Size AwtSize; + + #define ANCHOR_TO_SHEET 0 + #define ANCHOR_TO_CELL 1 + + //==================================================================== + //= BroadcastHelperBase + //==================================================================== + class BroadcastHelperBase + { + protected: + BroadcastHelperBase( ::osl::Mutex& _rMutex ) + :maBHelper( _rMutex ) + { + } + + protected: + ::cppu::OBroadcastHelper& getBroadcastHelper() { return maBHelper; } + + private: + ::cppu::OBroadcastHelper maBHelper; + }; + + //==================================================================== + //= ShapeGeometryChangeNotifier - declaration + //==================================================================== + /** helper class to work around the ...unfortunate implementation of property change broadcasts + in the XShape implementation, which broadcasts way too generous and unspecified + */ + typedef ::comphelper::ComponentBase ShapeGeometryChangeNotifier_CBase; + typedef ::cppu::WeakImplHelper1 < ::com::sun::star::beans::XPropertyChangeListener + > ShapeGeometryChangeNotifier_IBase; + + class ShapeGeometryChangeNotifier :public BroadcastHelperBase + ,public ShapeGeometryChangeNotifier_CBase + ,public ShapeGeometryChangeNotifier_IBase + { + public: + ShapeGeometryChangeNotifier( ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rParentMutex, const Reference< XShape >& _shape ) + :BroadcastHelperBase( _rParentMutex ) + ,ShapeGeometryChangeNotifier_CBase( BroadcastHelperBase::getBroadcastHelper(), ::comphelper::ComponentBase::NoInitializationNeeded() ) + ,ShapeGeometryChangeNotifier_IBase() + ,m_rParent( _rParent ) + ,m_aPropertyChangeListeners( _rParentMutex ) + ,m_xShape( _shape ) + { + ENSURE_OR_THROW( m_xShape.is(), "illegal shape!" ); + impl_init_nothrow(); + } + + // property change broadcasting + void addPropertyChangeListener( const Reference< XPropertyChangeListener >& _listener ) + { + m_aPropertyChangeListeners.addInterface( _listener ); + } + void removePropertyChangeListener( const Reference< XPropertyChangeListener >& _listener ) + { + m_aPropertyChangeListeners.removeInterface( _listener ); + } + + // XComponent equivalent + void dispose() + { + ::osl::MutexGuard aGuard( getMutex() ); + impl_dispose_nothrow(); + } + + // XInterface + virtual void SAL_CALL acquire( ) throw () + { + m_rParent.acquire(); + } + + virtual void SAL_CALL release( ) throw () + { + m_rParent.release(); + } + + // XPropertyChangeListener + virtual void SAL_CALL propertyChange( const PropertyChangeEvent& _event ) throw (RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const EventObject& _event ) throw (RuntimeException); + + protected: + virtual ~ShapeGeometryChangeNotifier() + { + if ( !getBroadcastHelper().bDisposed ) + { + acquire(); + dispose(); + } + } + + protected: + ::cppu::OBroadcastHelper& getBroadcastHelper() { return BroadcastHelperBase::getBroadcastHelper(); } + + private: + void impl_init_nothrow(); + void impl_dispose_nothrow(); + + private: + ::cppu::OWeakObject& m_rParent; + ::cppu::OInterfaceContainerHelper m_aPropertyChangeListeners; + Reference< XShape > m_xShape; + }; + + //==================================================================== + //= FormGeometryHandler - declaration + //==================================================================== + class FormGeometryHandler; + typedef HandlerComponentBase< FormGeometryHandler > FormGeometryHandler_Base; + /** a property handler for any virtual string properties + */ + class FormGeometryHandler : public FormGeometryHandler_Base + { + public: + FormGeometryHandler( + const Reference< XComponentContext >& _rxContext + ); + + static ::rtl::OUString SAL_CALL getImplementationName_static( ) throw (RuntimeException); + static Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static( ) throw (RuntimeException); + + protected: + ~FormGeometryHandler(); + + protected: + // XPropertyHandler overriables + virtual Any SAL_CALL getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException); + virtual LineDescriptor SAL_CALL describePropertyLine( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException); + virtual Sequence< ::rtl::OUString > SAL_CALL getActuatingProperties( ) throw (RuntimeException); + virtual void SAL_CALL actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const Any& _rNewValue, const Any& _rOldValue, const Reference< XObjectInspectorUI >& _rxInspectorUI, sal_Bool _bFirstTimeInit ) throw (NullPointerException, RuntimeException); + + // OComponentHandler overridables + virtual void SAL_CALL disposing(); + + // PropertyHandler overridables + virtual Sequence< Property > SAL_CALL doDescribeSupportedProperties() const; + + protected: + virtual void onNewComponent(); + + private: + bool impl_haveTextAnchorType_nothrow() const; + bool impl_haveSheetAnchorType_nothrow() const; + void impl_setSheetAnchorType_nothrow( const sal_Int32 _nAnchorType ) const; + + private: + Reference< XControlShape > m_xAssociatedShape; + Reference< XPropertySet > m_xShapeProperties; + ::rtl::Reference< ShapeGeometryChangeNotifier > m_xChangeNotifier; + }; + + //==================================================================== + //= FormGeometryHandler - implementation + //==================================================================== + DBG_NAME( FormGeometryHandler ) + //-------------------------------------------------------------------- + FormGeometryHandler::FormGeometryHandler( const Reference< XComponentContext >& _rxContext ) + :FormGeometryHandler_Base( _rxContext ) + { + DBG_CTOR( FormGeometryHandler, NULL ); + } + + //-------------------------------------------------------------------- + FormGeometryHandler::~FormGeometryHandler( ) + { + if ( !rBHelper.bDisposed ) + { + acquire(); + dispose(); + } + + DBG_DTOR( FormGeometryHandler, NULL ); + } + + //-------------------------------------------------------------------- + void FormGeometryHandler::onNewComponent() + { + if ( m_xChangeNotifier.is() ) + { + m_xChangeNotifier->dispose(); + m_xChangeNotifier.clear(); + } + m_xAssociatedShape.clear(); + m_xShapeProperties.clear(); + + FormGeometryHandler_Base::onNewComponent(); + + try + { + Reference< XControlModel > xControlModel( m_xComponent, UNO_QUERY ); + if ( xControlModel.is() ) + { + // do not ask the map for shapes for grid control columns .... + Reference< XChild > xCompChild( m_xComponent, UNO_QUERY_THROW ); + Reference< XGridColumnFactory > xCheckGrid( xCompChild->getParent(), UNO_QUERY ); + if ( !xCheckGrid.is() ) + { + Reference< XMap > xControlMap( m_aContext.getContextValueByAsciiName( "ControlShapeAccess" ), UNO_QUERY_THROW ); + m_xAssociatedShape.set( xControlMap->get( makeAny( xControlModel ) ), UNO_QUERY_THROW ); + m_xShapeProperties.set( m_xAssociatedShape, UNO_QUERY_THROW ); + } + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + if ( m_xAssociatedShape.is() ) + m_xChangeNotifier = new ShapeGeometryChangeNotifier( *this, m_aMutex, m_xAssociatedShape.get() ); + } + + //-------------------------------------------------------------------- + ::rtl::OUString SAL_CALL FormGeometryHandler::getImplementationName_static( ) throw (RuntimeException) + { + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.extensions.FormGeometryHandler" ) ); + } + + //-------------------------------------------------------------------- + Sequence< ::rtl::OUString > SAL_CALL FormGeometryHandler::getSupportedServiceNames_static( ) throw (RuntimeException) + { + Sequence< ::rtl::OUString > aSupported( 1 ); + aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.inspection.FormGeometryHandler" ) ); + return aSupported; + } + + //-------------------------------------------------------------------- + Any SAL_CALL FormGeometryHandler::getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException) + { + ::osl::MutexGuard aGuard( m_aMutex ); + PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); + + ENSURE_OR_THROW2( m_xAssociatedShape.is(), "internal error: properties, but no shape!", *this ); + ENSURE_OR_THROW2( m_xShapeProperties.is(), "internal error: no shape properties!", *this ); + + Any aReturn; + try + { + switch ( nPropId ) + { + case PROPERTY_ID_POSITIONX: + aReturn <<= m_xAssociatedShape->getPosition().X; + break; + case PROPERTY_ID_POSITIONY: + aReturn <<= m_xAssociatedShape->getPosition().Y; + break; + case PROPERTY_ID_WIDTH: + aReturn <<= m_xAssociatedShape->getSize().Width; + break; + case PROPERTY_ID_HEIGHT: + aReturn <<= m_xAssociatedShape->getSize().Height; + break; + case PROPERTY_ID_TEXT_ANCHOR_TYPE: + aReturn = m_xShapeProperties->getPropertyValue( PROPERTY_ANCHOR_TYPE ); + OSL_ENSURE( aReturn.hasValue(), "FormGeometryHandler::getPropertyValue: illegal anchor type!" ); + break; + case PROPERTY_ID_SHEET_ANCHOR_TYPE: + { + Reference< XSpreadsheet > xAnchorSheet( m_xShapeProperties->getPropertyValue( PROPERTY_ANCHOR ), UNO_QUERY ); + aReturn <<= sal_Int32( xAnchorSheet.is() ? ANCHOR_TO_SHEET : ANCHOR_TO_CELL ); + } + break; + + default: + OSL_ENSURE( false, "FormGeometryHandler::getPropertyValue: huh?" ); + break; + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return aReturn; + } + + //-------------------------------------------------------------------- + void SAL_CALL FormGeometryHandler::setPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException) + { + ::osl::MutexGuard aGuard( m_aMutex ); + PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); + + ENSURE_OR_THROW2( m_xAssociatedShape.is(), "internal error: properties, but no shape!", *this ); + ENSURE_OR_THROW2( m_xShapeProperties.is(), "internal error: properties, but no shape!", *this ); + + try + { + switch ( nPropId ) + { + case PROPERTY_ID_POSITIONX: + case PROPERTY_ID_POSITIONY: + { + sal_Int32 nPosition(0); + OSL_VERIFY( _rValue >>= nPosition ); + + AwtPoint aPos( m_xAssociatedShape->getPosition() ); + if ( nPropId == PROPERTY_ID_POSITIONX ) + aPos.X = nPosition; + else + aPos.Y = nPosition; + m_xAssociatedShape->setPosition( aPos ); + } + break; + + case PROPERTY_ID_WIDTH: + case PROPERTY_ID_HEIGHT: + { + sal_Int32 nSize(0); + OSL_VERIFY( _rValue >>= nSize ); + + AwtSize aSize( m_xAssociatedShape->getSize() ); + if ( nPropId == PROPERTY_ID_WIDTH ) + aSize.Width = nSize; + else + aSize.Height = nSize; + m_xAssociatedShape->setSize( aSize ); + } + break; + + case PROPERTY_ID_TEXT_ANCHOR_TYPE: + m_xShapeProperties->setPropertyValue( PROPERTY_ANCHOR_TYPE, _rValue ); + break; + + case PROPERTY_ID_SHEET_ANCHOR_TYPE: + { + sal_Int32 nSheetAnchorType = 0; + OSL_VERIFY( _rValue >>= nSheetAnchorType ); + impl_setSheetAnchorType_nothrow( nSheetAnchorType ); + } + break; + + default: + OSL_ENSURE( false, "FormGeometryHandler::getPropertyValue: huh?" ); + break; + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //-------------------------------------------------------------------- + LineDescriptor SAL_CALL FormGeometryHandler::describePropertyLine( const ::rtl::OUString& _rPropertyName, + const Reference< XPropertyControlFactory >& _rxControlFactory ) + throw (UnknownPropertyException, NullPointerException, RuntimeException) + { + ::osl::MutexGuard aGuard( m_aMutex ); + PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); + + LineDescriptor aLineDesc( PropertyHandler::describePropertyLine( _rPropertyName, _rxControlFactory ) ); + try + { + bool bIsSize = false; + switch ( nPropId ) + { + case PROPERTY_ID_WIDTH: + case PROPERTY_ID_HEIGHT: + bIsSize = true; + // NO break! + case PROPERTY_ID_POSITIONX: + case PROPERTY_ID_POSITIONY: + { + Optional< double > aZero( sal_True, 0 ); + Optional< double > aValueNotPresent( sal_False, 0 ); + aLineDesc.Control = PropertyHandlerHelper::createNumericControl( + _rxControlFactory, 2, bIsSize ? aZero : aValueNotPresent, aValueNotPresent, sal_False ); + + Reference< XNumericControl > xNumericControl( aLineDesc.Control, UNO_QUERY_THROW ); + xNumericControl->setValueUnit( MeasureUnit::MM_100TH ); + xNumericControl->setDisplayUnit( impl_getDocumentMeasurementUnit_throw() ); + } + break; + + case PROPERTY_ID_TEXT_ANCHOR_TYPE: + case PROPERTY_ID_SHEET_ANCHOR_TYPE: + // default handling from PropertyHandler is sufficient + break; + + default: + OSL_ENSURE( false, "FormGeometryHandler::describePropertyLine: huh?" ); + break; + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return aLineDesc; + } + + //-------------------------------------------------------------------- + void SAL_CALL FormGeometryHandler::addPropertyChangeListener( const Reference< XPropertyChangeListener >& _listener ) throw (RuntimeException) + { + ::osl::MutexGuard aGuard( m_aMutex ); + OSL_PRECOND( m_xChangeNotifier.is(), "FormGeometryHandler::addPropertyChangeListener: no notified, implies no shape!?" ); + if ( m_xChangeNotifier.is() ) + m_xChangeNotifier->addPropertyChangeListener( _listener ); + } + + //-------------------------------------------------------------------- + void SAL_CALL FormGeometryHandler::removePropertyChangeListener( const Reference< XPropertyChangeListener >& _listener ) throw (RuntimeException) + { + ::osl::MutexGuard aGuard( m_aMutex ); + OSL_PRECOND( m_xChangeNotifier.is(), "FormGeometryHandler::removePropertyChangeListener: no notified, implies no shape!?" ); + if ( m_xChangeNotifier.is() ) + m_xChangeNotifier->removePropertyChangeListener( _listener ); + } + + //-------------------------------------------------------------------- + Sequence< ::rtl::OUString > SAL_CALL FormGeometryHandler::getActuatingProperties( ) throw (RuntimeException) + { + Sequence< ::rtl::OUString > aInterestedIn(1); + aInterestedIn[0] = PROPERTY_TEXT_ANCHOR_TYPE; + return aInterestedIn; + } + + //-------------------------------------------------------------------- + void SAL_CALL FormGeometryHandler::actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const Any& _rNewValue, const Any& /*_rOldValue*/, const Reference< XObjectInspectorUI >& _rxInspectorUI, sal_Bool /*_bFirstTimeInit*/ ) throw (NullPointerException, RuntimeException) + { + if ( !_rxInspectorUI.is() ) + throw NullPointerException(); + + ::osl::MutexGuard aGuard( m_aMutex ); + PropertyId nActuatingPropId( impl_getPropertyId_throw( _rActuatingPropertyName ) ); + + switch ( nActuatingPropId ) + { + case PROPERTY_ID_TEXT_ANCHOR_TYPE: + { + TextContentAnchorType eAnchorType( TextContentAnchorType_AT_PARAGRAPH ); + OSL_VERIFY( _rNewValue >>= eAnchorType ); + _rxInspectorUI->enablePropertyUI( PROPERTY_POSITIONX, eAnchorType != TextContentAnchorType_AS_CHARACTER ); + } + break; + default: + OSL_ENSURE( false, "FormGeometryHandler::actuatingPropertyChanged: not registered for this property!" ); + break; + } + } + + //-------------------------------------------------------------------- + Sequence< Property > SAL_CALL FormGeometryHandler::doDescribeSupportedProperties() const + { + if ( !m_xAssociatedShape.is() ) + return Sequence< Property >(); + + ::std::vector< Property > aProperties; + + addInt32PropertyDescription( aProperties, PROPERTY_POSITIONX ); + addInt32PropertyDescription( aProperties, PROPERTY_POSITIONY ); + addInt32PropertyDescription( aProperties, PROPERTY_WIDTH ); + addInt32PropertyDescription( aProperties, PROPERTY_HEIGHT ); + + if ( impl_haveTextAnchorType_nothrow() ) + implAddPropertyDescription( aProperties, PROPERTY_TEXT_ANCHOR_TYPE, ::cppu::UnoType< TextContentAnchorType >::get() ); + + if ( impl_haveSheetAnchorType_nothrow() ) + addInt32PropertyDescription( aProperties, PROPERTY_SHEET_ANCHOR_TYPE ); + + return Sequence< Property >( &(*aProperties.begin()), aProperties.size() ); + } + + //-------------------------------------------------------------------- + void SAL_CALL FormGeometryHandler::disposing() + { + FormGeometryHandler_Base::disposing(); + + if ( m_xChangeNotifier.is() ) + { + m_xChangeNotifier->dispose(); + m_xChangeNotifier.clear(); + } + } + + //-------------------------------------------------------------------- + bool FormGeometryHandler::impl_haveTextAnchorType_nothrow() const + { + ENSURE_OR_THROW( m_xShapeProperties.is(), "not to be called without shape properties" ); + try + { + Reference< XPropertySetInfo > xPSI( m_xShapeProperties->getPropertySetInfo(), UNO_SET_THROW ); + if ( xPSI->hasPropertyByName( PROPERTY_ANCHOR_TYPE ) ) + return true; + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return false; + } + + //-------------------------------------------------------------------- + bool FormGeometryHandler::impl_haveSheetAnchorType_nothrow() const + { + ENSURE_OR_THROW( m_xShapeProperties.is(), "not to be called without shape properties" ); + try + { + Reference< XPropertySetInfo > xPSI( m_xShapeProperties->getPropertySetInfo(), UNO_SET_THROW ); + if ( !xPSI->hasPropertyByName( PROPERTY_ANCHOR ) ) + return false; + Reference< XServiceInfo > xSI( m_xAssociatedShape, UNO_QUERY_THROW ); + if ( xSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.Shape" ) ) ) ) + return true; + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return false; + } + + //-------------------------------------------------------------------- + namespace + { + static sal_Int32 lcl_getLowerBoundRowOrColumn( const Reference< XIndexAccess >& _rxRowsOrColumns, const bool _bRows, + const AwtPoint& _rRelativePosition ) + { + sal_Int32 nAccumulated = 0; + + const sal_Int32& rRelativePos = _bRows ? _rRelativePosition.Y : _rRelativePosition.X; + + sal_Int32 nElements = _rxRowsOrColumns->getCount(); + sal_Int32 currentPos = 0; + for ( currentPos=0; currentPos<nElements; ++currentPos ) + { + Reference< XPropertySet > xRowOrColumn( _rxRowsOrColumns->getByIndex( currentPos ), UNO_QUERY_THROW ); + + sal_Bool bIsVisible = sal_True; + OSL_VERIFY( xRowOrColumn->getPropertyValue( PROPERTY_IS_VISIBLE ) >>= bIsVisible ); + if ( !bIsVisible ) + continue; + + sal_Int32 nHeightOrWidth( 0 ); + OSL_VERIFY( xRowOrColumn->getPropertyValue( _bRows ? PROPERTY_HEIGHT : PROPERTY_WIDTH ) >>= nHeightOrWidth ); + + if ( nAccumulated + nHeightOrWidth > rRelativePos ) + break; + + nAccumulated += nHeightOrWidth; + } + + return currentPos; + } + } + + //-------------------------------------------------------------------- + void FormGeometryHandler::impl_setSheetAnchorType_nothrow( const sal_Int32 _nAnchorType ) const + { + ENSURE_OR_THROW( m_xShapeProperties.is(), "illegal to be called without shape properties." ); + try + { + CellBindingHelper aHelper( m_xComponent, impl_getContextDocument_nothrow() ); + // find the sheet which the control belongs to + Reference< XSpreadsheet > xSheet; + aHelper.getControlSheetIndex( xSheet ); + + switch ( _nAnchorType ) + { + case ANCHOR_TO_SHEET: + OSL_ENSURE( xSheet.is(), + "FormGeometryHandler::impl_setSheetAnchorType_nothrow: sheet not found!" ); + if ( xSheet.is() ) + { + AwtPoint aPreservePosition( m_xAssociatedShape->getPosition() ); + m_xShapeProperties->setPropertyValue( PROPERTY_ANCHOR, makeAny( xSheet ) ); + m_xAssociatedShape->setPosition( aPreservePosition ); + } + break; + + case ANCHOR_TO_CELL: + { + Reference< XColumnRowRange > xColsRows( xSheet, UNO_QUERY_THROW ); + + // get the current anchor + Reference< XSpreadsheet > xCurrentAnchor; + OSL_VERIFY( m_xShapeProperties->getPropertyValue( PROPERTY_ANCHOR ) >>= xCurrentAnchor ); + OSL_ENSURE( xCurrentAnchor.is(), "FormGeometryHandler::impl_setSheetAnchorType_nothrow: only to be called when currently anchored to a sheet!" ); + + // get the current position + AwtPoint aRelativePosition( m_xAssociatedShape->getPosition() ); + + Reference< XTableColumns > xCols( xColsRows->getColumns(), UNO_SET_THROW ); + sal_Int32 nNewAnchorCol = lcl_getLowerBoundRowOrColumn( xCols.get(), false, aRelativePosition ); + + Reference< XTableRows > xRows( xColsRows->getRows(), UNO_SET_THROW ); + sal_Int32 nNewAnchorRow = lcl_getLowerBoundRowOrColumn( xRows.get(), true, aRelativePosition ); + + Reference< XCellRange > xSheetCellRange( xSheet, UNO_QUERY_THROW ); + Any aNewAnchorCell( xSheetCellRange->getCellByPosition( nNewAnchorCol, nNewAnchorRow ) ); + m_xShapeProperties->setPropertyValue( PROPERTY_ANCHOR, aNewAnchorCell ); + } + break; + + default: + OSL_ENSURE( false, "FormGeometryHandler::impl_setSheetAnchorType_nothrow: illegal anchor type!" ); + break; + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //==================================================================== + //= ShapeGeometryChangeNotifier - implementation + //==================================================================== + namespace + { + struct EventTranslation + { + ::rtl::OUString sPropertyName; + Any aNewPropertyValue; + + EventTranslation( const ::rtl::OUString& _propertyName, const Any& _newPropertyValue ) + :sPropertyName( _propertyName ) + ,aNewPropertyValue( _newPropertyValue ) + { + } + }; + } + + //-------------------------------------------------------------------- + void SAL_CALL ShapeGeometryChangeNotifier::propertyChange( const PropertyChangeEvent& _event ) throw (RuntimeException) + { + ::comphelper::ComponentMethodGuard aGuard( *this ); + + ::std::vector< EventTranslation > aEventTranslations; + aEventTranslations.reserve(2); + + if ( _event.PropertyName.equalsAscii( "Position" ) ) + { + AwtPoint aPos = m_xShape->getPosition(); + aEventTranslations.push_back( EventTranslation( PROPERTY_POSITIONX, makeAny( aPos.X ) ) ); + aEventTranslations.push_back( EventTranslation( PROPERTY_POSITIONY, makeAny( aPos.Y ) ) ); + } + else if ( _event.PropertyName.equalsAscii( "Size" ) ) + { + AwtSize aSize = m_xShape->getSize(); + aEventTranslations.push_back( EventTranslation( PROPERTY_WIDTH, makeAny( aSize.Width ) ) ); + aEventTranslations.push_back( EventTranslation( PROPERTY_HEIGHT, makeAny( aSize.Height ) ) ); + } + else if ( _event.PropertyName == PROPERTY_ANCHOR_TYPE ) + { + aEventTranslations.push_back( EventTranslation( PROPERTY_TEXT_ANCHOR_TYPE, makeAny( _event.NewValue ) ) ); + } + else if ( _event.PropertyName == PROPERTY_ANCHOR ) + { + aEventTranslations.push_back( EventTranslation( PROPERTY_SHEET_ANCHOR_TYPE, makeAny( _event.NewValue ) ) ); + } + + PropertyChangeEvent aTranslatedEvent( _event ); + aTranslatedEvent.Source = m_rParent; + + aGuard.clear(); + for ( ::std::vector< EventTranslation >::const_iterator t = aEventTranslations.begin(); + t != aEventTranslations.end(); + ++t + ) + { + aTranslatedEvent.PropertyName = t->sPropertyName; + aTranslatedEvent.NewValue = t->aNewPropertyValue; + m_aPropertyChangeListeners.notifyEach( &XPropertyChangeListener::propertyChange, aTranslatedEvent ); + } + } + + //-------------------------------------------------------------------- + void SAL_CALL ShapeGeometryChangeNotifier::disposing( const EventObject& /*_event*/ ) throw (RuntimeException) + { + ::comphelper::ComponentMethodGuard aGuard( *this ); + impl_dispose_nothrow(); + } + + //-------------------------------------------------------------------- + void ShapeGeometryChangeNotifier::impl_init_nothrow() + { + osl_incrementInterlockedCount( &m_refCount ); + try + { + Reference< XPropertySet > xShapeProperties( m_xShape, UNO_QUERY_THROW ); + xShapeProperties->addPropertyChangeListener( ::rtl::OUString(), this ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + osl_decrementInterlockedCount( &m_refCount ); + } + + //-------------------------------------------------------------------- + void ShapeGeometryChangeNotifier::impl_dispose_nothrow() + { + try + { + Reference< XPropertySet > xShapeProperties( m_xShape, UNO_QUERY_THROW ); + xShapeProperties->removePropertyChangeListener( ::rtl::OUString(), this ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + getBroadcastHelper().bDisposed = true; + } + +//........................................................................ +} // namespace pcr +//........................................................................ + +extern "C" void SAL_CALL createRegistryInfo_FormGeometryHandler() +{ + ::pcr::FormGeometryHandler::registerImplementation(); +} diff --git a/extensions/source/propctrlr/formmetadata.cxx b/extensions/source/propctrlr/formmetadata.cxx index 70ae992e7044..ccfc3f746ef7 100644 --- a/extensions/source/propctrlr/formmetadata.cxx +++ b/extensions/source/propctrlr/formmetadata.cxx @@ -284,21 +284,23 @@ namespace pcr DEF_INFO_3( SPIN, SPIN, SPIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), DEF_INFO_3( REPEAT, REPEAT, REPEAT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), DEF_INFO_3( REPEAT_DELAY, REPEAT_DELAY, REPEAT_DELAY, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( TOGGLE, TOGGLE, TOGGLE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( FOCUSONCLICK, FOCUSONCLICK, FOCUSONCLICK, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), DEF_INFO_3( VISIBLESIZE, VISIBLESIZE, VISIBLESIZE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), DEF_INFO_4( ORIENTATION, ORIENTATION, ORIENTATION, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ), + DEF_INFO_3( FOCUSONCLICK, FOCUSONCLICK, FOCUSONCLICK, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), + DEF_INFO_3( TOGGLE, TOGGLE, TOGGLE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), + DEF_INFO_3( DEFAULT_STATE, DEFAULT_STATE, DEFAULT_STATE, FORM_VISIBLE, ENUM, COMPOSEABLE ), - DEF_INFO_2( CLASSID, CLASSID, CLASSID, FORM_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( HEIGHT, HEIGHT, HEIGHT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( WIDTH, WIDTH, WIDTH, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), + DEF_INFO_3( TEXT_ANCHOR_TYPE, ANCHOR_TYPE, ANCHOR_TYPE, FORM_VISIBLE, ENUM, COMPOSEABLE ), + DEF_INFO_3( SHEET_ANCHOR_TYPE, ANCHOR_TYPE, ANCHOR_TYPE, FORM_VISIBLE, ENUM, COMPOSEABLE ), DEF_INFO_3( POSITIONX, POSITIONX, POSITIONX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), DEF_INFO_3( POSITIONY, POSITIONY, POSITIONY, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), + DEF_INFO_3( WIDTH, WIDTH, WIDTH, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), + DEF_INFO_3( HEIGHT, HEIGHT, HEIGHT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), DEF_INFO_1( LISTINDEX, LISTINDEX, LISTINDEX, FORM_VISIBLE ), DEF_INFO_3( STRINGITEMLIST, STRINGITEMLIST, STRINGITEMLIST, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), DEF_INFO_2( DEFAULT_TEXT, DEFAULTTEXT, DEFAULTVALUE, FORM_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( FONT_NAME, FONT, FONT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), + DEF_INFO_3( FONT, FONT, FONT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), DEF_INFO_4( VISUALEFFECT, VISUALEFFECT, VISUALEFFECT, FORM_VISIBLE, DIALOG_VISIBLE, ENUM_ONE, COMPOSEABLE ), DEF_INFO_4( ALIGN, ALIGN, ALIGN, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ), DEF_INFO_3( VERTICAL_ALIGN, VERTICAL_ALIGN, VERTICAL_ALIGN, FORM_VISIBLE, ENUM, COMPOSEABLE ), @@ -337,7 +339,6 @@ namespace pcr DEF_INFO_3( SUBMIT_ENCODING, SUBMIT_ENCODING, SUBMIT_ENCODING, FORM_VISIBLE, ENUM, COMPOSEABLE ), DEF_INFO_3( SUBMIT_METHOD, SUBMIT_METHOD, SUBMIT_METHOD, FORM_VISIBLE, ENUM, COMPOSEABLE ), DEF_INFO_3( STATE, STATE, STATE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ), - DEF_INFO_3( DEFAULTCHECKED, DEFAULT_CHECKED, DEFAULT_CHECKED, FORM_VISIBLE, ENUM, COMPOSEABLE ), DEF_INFO_3( DEFAULTBUTTON, DEFAULT_BUTTON, DEFAULT_BUTTON, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), DEF_INFO_3( IMAGE_URL, IMAGE_URL, IMAGE_URL, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), DEF_INFO_4( IMAGEPOSITION, IMAGEPOSITION, IMAGEPOSITION, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ), @@ -469,7 +470,7 @@ namespace pcr case PROPERTY_ID_TIMEFORMAT: nStringItemsResId = RID_RSC_ENUM_TIMEFORMAT_LIST; break; - case PROPERTY_ID_DEFAULTCHECKED: + case PROPERTY_ID_DEFAULT_STATE: case PROPERTY_ID_STATE: nStringItemsResId = RID_RSC_ENUM_CHECKED; break; @@ -512,6 +513,12 @@ namespace pcr case PROPERTY_ID_WRITING_MODE: nStringItemsResId = RID_RSC_ENUM_WRITING_MODE; break; + case PROPERTY_ID_TEXT_ANCHOR_TYPE: + nStringItemsResId = RID_RSC_ENUM_TEXT_ANCHOR_TYPE; + break; + case PROPERTY_ID_SHEET_ANCHOR_TYPE: + nStringItemsResId = RID_RSC_ENUM_SHEET_ANCHOR_TYPE; + break; default: OSL_ENSURE( sal_False, "OPropertyInfoService::getPropertyEnumRepresentations: unknown enum property!" ); break; diff --git a/extensions/source/propctrlr/formmetadata.hxx b/extensions/source/propctrlr/formmetadata.hxx index b1b23153dbdb..b49fae5cf3d8 100644 --- a/extensions/source/propctrlr/formmetadata.hxx +++ b/extensions/source/propctrlr/formmetadata.hxx @@ -200,7 +200,7 @@ namespace pcr #define PROPERTY_ID_LISTINDEX 56 #define PROPERTY_ID_STRINGITEMLIST 57 #define PROPERTY_ID_DEFAULT_TEXT 58 - #define PROPERTY_ID_FONT_NAME 59 + #define PROPERTY_ID_FONT 59 #define PROPERTY_ID_ALIGN 60 #define PROPERTY_ID_ROWHEIGHT 61 #define PROPERTY_ID_BACKGROUNDCOLOR 62 @@ -225,7 +225,7 @@ namespace pcr #define PROPERTY_ID_SUBMIT_TARGET 81 #define PROPERTY_ID_SUBMIT_METHOD 82 #define PROPERTY_ID_SUBMIT_ENCODING 83 - #define PROPERTY_ID_DEFAULTCHECKED 84 + #define PROPERTY_ID_DEFAULT_STATE 84 #define PROPERTY_ID_DEFAULTBUTTON 85 #define PROPERTY_ID_IMAGE_URL 86 #define PROPERTY_ID_DEFAULT_SELECT_SEQ 87 @@ -340,6 +340,8 @@ namespace pcr #define PROPERTY_ID_SCALE_MODE 196 #define PROPERTY_ID_INPUT_REQUIRED 197 #define PROPERTY_ID_WRITING_MODE 198 + #define PROPERTY_ID_TEXT_ANCHOR_TYPE 199 + #define PROPERTY_ID_SHEET_ANCHOR_TYPE 200 //............................................................................ } // namespace pcr diff --git a/extensions/source/propctrlr/formres.src b/extensions/source/propctrlr/formres.src index 3700667dd0e9..224587b11729 100644 --- a/extensions/source/propctrlr/formres.src +++ b/extensions/source/propctrlr/formres.src @@ -77,7 +77,7 @@ String RID_STR_SHOWTHOUSANDSEP }; String RID_STR_PRINTABLE { - Text [ en-US ] = "Print" ; + Text [ en-US ] = "Printable" ; }; String RID_STR_TARGET_URL { @@ -426,7 +426,7 @@ String RID_STR_SUBMIT_METHOD { Text [ en-US ] = "Type of submission" ; }; -String RID_STR_DEFAULT_CHECKED +String RID_STR_DEFAULT_STATE { Text [ en-US ] = "Default status" ; }; @@ -744,7 +744,7 @@ String RID_STR_EVT_APPROVEPARAMETER }; String RID_STR_EVT_ACTIONPERFORMED { - Text [ en-US ] = "When initiating" ; + Text [ en-US ] = "Execute action" ; }; String RID_STR_EVT_AFTERUPDATE { @@ -844,7 +844,7 @@ String RID_STR_EVT_APPROVERESETTED }; String RID_STR_EVT_APPROVEACTIONPERFORMED { - Text [ en-US ] = "Before commencing" ; + Text [ en-US ] = "Approve action" ; }; String RID_STR_EVT_SUBMITTED { @@ -1430,3 +1430,73 @@ Resource RID_RSC_ENUM_WRITING_MODE Text [ en-US ] = "Use superordinate object settings"; }; }; + +String RID_STR_ANCHOR_TYPE +{ + Text [ en-US ] = "Anchor"; +}; + +Resource RID_RSC_ENUM_TEXT_ANCHOR_TYPE +{ + String 1 + { + Text [ en-US ] = "To Paragraph"; + }; + String 2 + { + Text [ en-US ] = "As Character"; + }; + String 3 + { + Text [ en-US ] = "To Page"; + }; + String 4 + { + Text [ en-US ] = "To Frame"; + }; + String 5 + { + Text [ en-US ] = "To Character"; + }; +}; + +Resource RID_RSC_ENUM_SHEET_ANCHOR_TYPE +{ + String 1 + { + Text [ en-US ] = "To Page"; + }; + String 2 + { + Text [ en-US ] = "To Cell"; + }; +}; + +String RID_STR_FONTSTYLE_REGULAR +{ + Text [ en-US ] = "Regular"; + Text [ x-comment ] = "That's the 'Regular' as used for a font style (as opposed to 'italic' and 'bold'), so please use a consistent translation."; +}; + +String RID_STR_FONTSTYLE_BOLD_ITALIC +{ + Text [ en-US ] = "Bold Italic"; + Text [ x-comment ] = "That's the 'Bold Italic' as used for a font style, so please use a consistent translation."; +}; + +String RID_STR_FONTSTYLE_ITALIC +{ + Text [ en-US ] = "Italic"; + Text [ x-comment ] = "That's the 'Italic' as used for a font style, so please use a consistent translation."; +}; + +String RID_STR_FONTSTYLE_BOLD +{ + Text [ en-US ] = "Bold"; + Text [ x-comment ] = "That's the 'Bold' as used for a font style, so please use a consistent translation."; +}; + +String RID_STR_FONT_DEFAULT +{ + Text [ en-US ] = "(Default)"; +}; diff --git a/extensions/source/propctrlr/formresid.hrc b/extensions/source/propctrlr/formresid.hrc index badda59d2d2c..ad10cfd379e2 100644 --- a/extensions/source/propctrlr/formresid.hrc +++ b/extensions/source/propctrlr/formresid.hrc @@ -132,7 +132,7 @@ #define RID_STR_SUBMIT_TARGET ( RID_FORMBROWSER_START + 101 ) #define RID_STR_SUBMIT_METHOD ( RID_FORMBROWSER_START + 102 ) #define RID_STR_SUBMIT_ENCODING ( RID_FORMBROWSER_START + 103 ) -#define RID_STR_DEFAULT_CHECKED ( RID_FORMBROWSER_START + 104 ) +#define RID_STR_DEFAULT_STATE ( RID_FORMBROWSER_START + 104 ) #define RID_STR_DEFAULT_BUTTON ( RID_FORMBROWSER_START + 105 ) #define RID_STR_IMAGE_URL ( RID_FORMBROWSER_START + 106 ) #define RID_STR_DEFAULT_SELECT_SEQ ( RID_FORMBROWSER_START + 107 ) @@ -222,7 +222,7 @@ #define RID_STR_BOUND_CELL ( RID_FORMBROWSER_START + 191 ) #define RID_STR_LIST_CELL_RANGE ( RID_FORMBROWSER_START + 192 ) #define RID_STR_CELL_EXCHANGE_TYPE ( RID_FORMBROWSER_START + 193 ) - // FREE +#define RID_STR_ANCHOR_TYPE ( RID_FORMBROWSER_START + 194 ) #define RID_STR_SCROLLVALUE_MIN ( RID_FORMBROWSER_START + 195 ) #define RID_STR_DEFAULT_SCROLLVALUE ( RID_FORMBROWSER_START + 196 ) #define RID_STR_REPEAT_DELAY ( RID_FORMBROWSER_START + 197 ) @@ -248,7 +248,7 @@ #define RID_STR_HIDEINACTIVESELECTION ( RID_FORMBROWSER_START + 217 ) #define RID_STR_VISUALEFFECT ( RID_FORMBROWSER_START + 218 ) #define RID_STR_BORDERCOLOR ( RID_FORMBROWSER_START + 219 ) -#define RID_STR_SHOW_HIDE ( RID_FORMBROWSER_START + 220 ) + // FREE #define RID_STR_XML_DATA_MODEL ( RID_FORMBROWSER_START + 221 ) #define RID_STR_BIND_EXPRESSION ( RID_FORMBROWSER_START + 222 ) #define RID_STR_XSD_REQUIRED ( RID_FORMBROWSER_START + 223 ) @@ -279,7 +279,12 @@ #define RID_STR_SHOWS_ROOT_HANDLES ( RID_FORMBROWSER_START + 247 ) #define RID_STR_EDITABLE ( RID_FORMBROWSER_START + 248 ) #define RID_STR_INVOKES_STOP_NOT_EDITING ( RID_FORMBROWSER_START + 249 ) -#define RID_STR_NOLABEL ( RID_FORMBROWSER_START + 250 ) +#define RID_STR_NOLABEL ( RID_FORMBROWSER_START + 250 ) +#define RID_STR_FONTSTYLE_REGULAR ( RID_FORMBROWSER_START + 251 ) +#define RID_STR_FONTSTYLE_BOLD_ITALIC ( RID_FORMBROWSER_START + 252 ) +#define RID_STR_FONTSTYLE_ITALIC ( RID_FORMBROWSER_START + 253 ) +#define RID_STR_FONTSTYLE_BOLD ( RID_FORMBROWSER_START + 254 ) +#define RID_STR_FONT_DEFAULT ( RID_FORMBROWSER_START + 255 ) // ----------------------------------------------------------------------- @@ -340,6 +345,8 @@ #define RID_RSC_ENUM_YESNO ( RID_PROPCONTROLLER_START + 27 ) #define RID_RSC_ENUM_SHOWHIDE ( RID_PROPCONTROLLER_START + 28 ) #define RID_RSC_ENUM_WRITING_MODE ( RID_PROPCONTROLLER_START + 29 ) +#define RID_RSC_ENUM_TEXT_ANCHOR_TYPE ( RID_PROPCONTROLLER_START + 30 ) +#define RID_RSC_ENUM_SHEET_ANCHOR_TYPE ( RID_PROPCONTROLLER_START + 31 ) // ----------------------------------------------------------------------- // - ImageList - local ids diff --git a/extensions/source/propctrlr/formstrings.hxx b/extensions/source/propctrlr/formstrings.hxx index 0d77b45bb6cf..cc6bc9db824b 100644 --- a/extensions/source/propctrlr/formstrings.hxx +++ b/extensions/source/propctrlr/formstrings.hxx @@ -74,7 +74,7 @@ namespace pcr PCR_CONSTASCII_STRING( PROPERTY_XFORMS_BUTTONTYPE, "XFormsButtonType"); PCR_CONSTASCII_STRING( PROPERTY_STRINGITEMLIST, "StringItemList"); PCR_CONSTASCII_STRING( PROPERTY_DEFAULT_TEXT, "DefaultText"); - PCR_CONSTASCII_STRING( PROPERTY_DEFAULTCHECKED, "DefaultState"); + PCR_CONSTASCII_STRING( PROPERTY_DEFAULT_STATE, "DefaultState"); PCR_CONSTASCII_STRING( PROPERTY_FORMATKEY, "FormatKey"); PCR_CONSTASCII_STRING( PROPERTY_FORMATSSUPPLIER, "FormatsSupplier"); PCR_CONSTASCII_STRING( PROPERTY_SUBMIT_ACTION, "SubmitAction"); @@ -130,6 +130,7 @@ namespace pcr PCR_CONSTASCII_STRING( PROPERTY_ECHO_CHAR, "EchoChar"); PCR_CONSTASCII_STRING( PROPERTY_ROWHEIGHT, "RowHeight"); PCR_CONSTASCII_STRING( PROPERTY_HELPTEXT, "HelpText"); + PCR_CONSTASCII_STRING( PROPERTY_FONT, "FontDescriptor"); PCR_CONSTASCII_STRING( PROPERTY_FONT_NAME, "FontName"); PCR_CONSTASCII_STRING( PROPERTY_FONT_STYLENAME, "FontStyleName"); PCR_CONSTASCII_STRING( PROPERTY_FONT_FAMILY, "FontFamily"); @@ -263,6 +264,11 @@ namespace pcr PCR_CONSTASCII_STRING( PROPERTY_BINDING_ID, "BindingID" ); PCR_CONSTASCII_STRING( PROPERTY_ID, "ID" ); PCR_CONSTASCII_STRING( PROPERTY_WRITING_MODE, "WritingMode" ); + PCR_CONSTASCII_STRING( PROPERTY_TEXT_ANCHOR_TYPE, "TextAnchorType" ); + PCR_CONSTASCII_STRING( PROPERTY_SHEET_ANCHOR_TYPE, "SheetAnchorType" ); + PCR_CONSTASCII_STRING( PROPERTY_ANCHOR_TYPE, "AnchorType" ); + PCR_CONSTASCII_STRING( PROPERTY_ANCHOR, "Anchor" ); + PCR_CONSTASCII_STRING( PROPERTY_IS_VISIBLE, "IsVisible" ); PCR_CONSTASCII_STRING( PROPERTY_MODEL, "Model" ); diff --git a/extensions/source/propctrlr/makefile.mk b/extensions/source/propctrlr/makefile.mk index 62ca941f3751..c043850e3c73 100644 --- a/extensions/source/propctrlr/makefile.mk +++ b/extensions/source/propctrlr/makefile.mk @@ -97,7 +97,9 @@ SLOFILES= $(SLO)$/controlfontdialog.obj \ $(SLO)$/inspectorhelpwindow.obj \ $(SLO)$/defaulthelpprovider.obj \ $(SLO)$/MasterDetailLinkDialog.obj \ - $(SLO)$/inspectormodelbase.obj + $(SLO)$/inspectormodelbase.obj \ + $(SLO)$/propertycontrolextender.obj \ + $(SLO)$/formgeometryhandler.obj SRS1NAME=$(TARGET) SRC1FILES= propres.src \ diff --git a/extensions/source/propctrlr/pcrservices.cxx b/extensions/source/propctrlr/pcrservices.cxx index 0673c9ff5f3c..b4c87ab58ef2 100644 --- a/extensions/source/propctrlr/pcrservices.cxx +++ b/extensions/source/propctrlr/pcrservices.cxx @@ -62,6 +62,7 @@ extern "C" void SAL_CALL createRegistryInfo_ObjectInspectorModel(); extern "C" void SAL_CALL createRegistryInfo_SubmissionPropertyHandler(); extern "C" void SAL_CALL createRegistryInfo_StringRepresentation(); extern "C" void SAL_CALL createRegistryInfo_MasterDetailLinkDialog(); +extern "C" void SAL_CALL createRegistryInfo_FormGeometryHandler(); //--------------------------------------------------------------------------------------- @@ -88,6 +89,7 @@ extern "C" void SAL_CALL pcr_initializeModule() createRegistryInfo_SubmissionPropertyHandler(); createRegistryInfo_StringRepresentation(); createRegistryInfo_MasterDetailLinkDialog(); + createRegistryInfo_FormGeometryHandler(); s_bInit = sal_True; } } diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx index 1789ff0e9c00..c4dff2512a29 100644 --- a/extensions/source/propctrlr/propcontroller.cxx +++ b/extensions/source/propctrlr/propcontroller.cxx @@ -755,23 +755,32 @@ namespace pcr return; } - if ( m_sCommittingProperty != _rEvent.PropertyName ) + if ( m_sCommittingProperty == _rEvent.PropertyName ) + return; + + if ( !haveView() ) + return; + + Any aNewValue( _rEvent.NewValue ); + if ( impl_hasPropertyHandlerFor_nothrow( _rEvent.PropertyName ) ) { - Any aNewValue( _rEvent.NewValue ); - if ( impl_hasPropertyHandlerFor_nothrow( _rEvent.PropertyName ) ) - { - aNewValue = impl_getPropertyValue_throw( _rEvent.PropertyName ); + // forward the new value to the property box, to reflect the change in the UI + aNewValue = impl_getPropertyValue_throw( _rEvent.PropertyName ); - if ( haveView() ) - // forward the new value to the property box, to reflect the change in the UI - getPropertyBox().SetPropertyValue( _rEvent.PropertyName, aNewValue ); - } + // check whether the state is ambiguous. This is interesting in case we display the properties + // for multiple objects at once: In this case, we'll get a notification from one of the objects, + // but need to care for the "composed" value, which can be "ambiguous". + PropertyHandlerRef xHandler( impl_getHandlerForProperty_throw( _rEvent.PropertyName ), UNO_SET_THROW ); + PropertyState ePropertyState( xHandler->getPropertyState( _rEvent.PropertyName ) ); + bool bAmbiguousValue = ( PropertyState_AMBIGUOUS_VALUE == ePropertyState ); - // if it's a actuating property, then update the UI for any dependent - // properties - if ( impl_isActuatingProperty_nothrow( _rEvent.PropertyName ) ) - impl_broadcastPropertyChange_nothrow( _rEvent.PropertyName, aNewValue, _rEvent.OldValue, false ); + getPropertyBox().SetPropertyValue( _rEvent.PropertyName, aNewValue, bAmbiguousValue ); } + + // if it's a actuating property, then update the UI for any dependent + // properties + if ( impl_isActuatingProperty_nothrow( _rEvent.PropertyName ) ) + impl_broadcastPropertyChange_nothrow( _rEvent.PropertyName, aNewValue, _rEvent.OldValue, false ); } //------------------------------------------------------------------------ @@ -1423,14 +1432,14 @@ namespace pcr impl_broadcastPropertyChange_nothrow( rName, aNormalizedValue, aOldValue, false ); // and display it again. This ensures proper formatting - getPropertyBox().SetPropertyValue( rName, aNormalizedValue ); + getPropertyBox().SetPropertyValue( rName, aNormalizedValue, false ); } catch(PropertyVetoException& eVetoException) { InfoBox(m_pView, eVetoException.Message).Execute(); PropertyHandlerRef handler = impl_getHandlerForProperty_throw( rName ); Any aNormalizedValue = handler->getPropertyValue( rName ); - getPropertyBox().SetPropertyValue( rName, aNormalizedValue ); + getPropertyBox().SetPropertyValue( rName, aNormalizedValue, false ); } catch(Exception&) { diff --git a/extensions/source/propctrlr/propertycontrolextender.cxx b/extensions/source/propctrlr/propertycontrolextender.cxx new file mode 100644 index 000000000000..205f7c423025 --- /dev/null +++ b/extensions/source/propctrlr/propertycontrolextender.cxx @@ -0,0 +1,148 @@ +/************************************************************************* +* 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: code,v $ +* +* $Revision: 1.3 $ +* +* 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_extensions.hxx" + +#ifndef EXTENSIONS_PROPERTYCONTROLEXTENDER_HXX +#include "propertycontrolextender.hxx" +#endif + +/** === begin UNO includes === **/ +#include <com/sun/star/awt/KeyFunction.hpp> +/** === end UNO includes === **/ + +#include <tools/diagnose_ex.h> + +//........................................................................ +namespace pcr +{ +//........................................................................ + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::awt::XWindow; + using ::com::sun::star::awt::KeyEvent; + using ::com::sun::star::inspection::XPropertyControl; + using ::com::sun::star::lang::EventObject; + using ::com::sun::star::inspection::XPropertyControlContext; + /** === end UNO using === **/ + namespace KeyFunction = ::com::sun::star::awt::KeyFunction; + + //==================================================================== + //= PropertyControlExtender_Data + //==================================================================== + struct PropertyControlExtender_Data + { + Reference< XPropertyControl > xControl; + Reference< XWindow > xControlWindow; + }; + + //==================================================================== + //= PropertyControlExtender + //==================================================================== + //-------------------------------------------------------------------- + PropertyControlExtender::PropertyControlExtender( const Reference< XPropertyControl >& _rxObservedControl ) + :m_pData( new PropertyControlExtender_Data ) + { + try + { + m_pData->xControl.set( _rxObservedControl, UNO_SET_THROW ); + m_pData->xControlWindow.set( m_pData->xControl->getControlWindow(), UNO_SET_THROW ); + m_pData->xControlWindow->addKeyListener( this ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //-------------------------------------------------------------------- + PropertyControlExtender::~PropertyControlExtender() + { + } + + //-------------------------------------------------------------------- + void SAL_CALL PropertyControlExtender::keyPressed( const KeyEvent& _event ) throw (RuntimeException) + { + OSL_ENSURE( _event.Source == m_pData->xControlWindow, "PropertyControlExtender::keyPressed: where does this come from?" ); + if ( ( _event.KeyFunc == KeyFunction::DELETE ) + && ( _event.Modifiers == 0 ) + ) + { + try + { + Reference< XPropertyControl > xControl( m_pData->xControl, UNO_SET_THROW ); + + // reset the value + xControl->setValue( Any() ); + + // and notify the change + // don't use XPropertyControl::notifyModifiedValue. It only notifies when the control content + // is recognized as being modified by the user, which is not the case, since we just modified + // it programmatically. + Reference< XPropertyControlContext > xControlContext( xControl->getControlContext(), UNO_SET_THROW ); + xControlContext->valueChanged( xControl ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + } + + //-------------------------------------------------------------------- + void SAL_CALL PropertyControlExtender::keyReleased( const KeyEvent& /*_event*/ ) throw (RuntimeException) + { + // not interested in + } + + //-------------------------------------------------------------------- + void SAL_CALL PropertyControlExtender::disposing( const EventObject& Source ) throw (RuntimeException) + { + OSL_ENSURE( Source.Source == m_pData->xControlWindow, "PropertyControlExtender::disposing: where does this come from?" ); + (void)Source.Source; + m_pData->xControlWindow.clear(); + m_pData->xControl.clear(); + } + + +//........................................................................ +} // namespace pcr +//........................................................................ diff --git a/extensions/source/propctrlr/propertycontrolextender.hxx b/extensions/source/propctrlr/propertycontrolextender.hxx new file mode 100644 index 000000000000..591df0be6de7 --- /dev/null +++ b/extensions/source/propctrlr/propertycontrolextender.hxx @@ -0,0 +1,77 @@ +/************************************************************************* +* 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: code,v $ +* +* $Revision: 1.3 $ +* +* 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. +************************************************************************/ +
+#ifndef EXTENSIONS_PROPERTYCONTROLEXTENDER_HXX +#define EXTENSIONS_PROPERTYCONTROLEXTENDER_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/awt/XKeyListener.hpp> +#include <com/sun/star/inspection/XPropertyControl.hpp> +/** === end UNO includes === **/ + +#include <cppuhelper/implbase1.hxx> + +#include <memory> + +//........................................................................ +namespace pcr +{ +//........................................................................ + + //==================================================================== + //= PropertyControlExtender + //==================================================================== + struct PropertyControlExtender_Data; + typedef ::cppu::WeakImplHelper1 < ::com::sun::star::awt::XKeyListener + > PropertyControlExtender_Base; + class PropertyControlExtender : public PropertyControlExtender_Base + { + public: + PropertyControlExtender( + const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& _rxObservedControl + ); + + // XKeyListener + virtual void SAL_CALL keyPressed( const ::com::sun::star::awt::KeyEvent& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL keyReleased( const ::com::sun::star::awt::KeyEvent& e ) throw (::com::sun::star::uno::RuntimeException); + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); + + protected: + virtual ~PropertyControlExtender(); + + private: + ::std::auto_ptr< PropertyControlExtender_Data > m_pData; + }; + +//........................................................................ +} // namespace pcr +//........................................................................ + +#endif // EXTENSIONS_PROPERTYCONTROLEXTENDER_HXX diff --git a/extensions/source/propctrlr/propertyeditor.cxx b/extensions/source/propctrlr/propertyeditor.cxx index d2ccc1ee83d5..f076da707800 100644 --- a/extensions/source/propctrlr/propertyeditor.cxx +++ b/extensions/source/propctrlr/propertyeditor.cxx @@ -437,11 +437,11 @@ namespace pcr } //------------------------------------------------------------------ - void OPropertyEditor::SetPropertyValue( const ::rtl::OUString& rEntryName, const Any& _rValue ) + void OPropertyEditor::SetPropertyValue( const ::rtl::OUString& rEntryName, const Any& _rValue, bool _bUnknownValue ) { OBrowserPage* pPage = getPage( rEntryName ); if ( pPage ) - pPage->getListBox().SetPropertyValue( rEntryName, _rValue ); + pPage->getListBox().SetPropertyValue( rEntryName, _rValue, _bUnknownValue ); } //------------------------------------------------------------------ diff --git a/extensions/source/propctrlr/propertyeditor.hxx b/extensions/source/propctrlr/propertyeditor.hxx index e2715e2fd425..5881b579c3e0 100644 --- a/extensions/source/propctrlr/propertyeditor.hxx +++ b/extensions/source/propctrlr/propertyeditor.hxx @@ -107,7 +107,7 @@ namespace pcr sal_uInt16 GetCurPage(); void ClearAll(); - void SetPropertyValue(const ::rtl::OUString& _rEntryName, const ::com::sun::star::uno::Any& _rValue ); + void SetPropertyValue(const ::rtl::OUString& _rEntryName, const ::com::sun::star::uno::Any& _rValue, bool _bUnknownValue ); ::com::sun::star::uno::Any GetPropertyValue(const ::rtl::OUString& rEntryName ) const; sal_uInt16 GetPropertyPos(const ::rtl::OUString& rEntryName ) const; ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl > diff --git a/extensions/source/propctrlr/propertyhandler.cxx b/extensions/source/propctrlr/propertyhandler.cxx index 5b3eb4919764..8d730d3e8c9c 100644 --- a/extensions/source/propctrlr/propertyhandler.cxx +++ b/extensions/source/propctrlr/propertyhandler.cxx @@ -34,13 +34,19 @@ #include "formmetadata.hxx" #include "formbrowsertools.hxx" #include "handlerhelper.hxx" +#include "formstrings.hxx" /** === begin UNO includes === **/ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/lang/NullPointerException.hpp> #include <com/sun/star/util/XModifiable.hpp> /** === end UNO includes === **/ + #include <tools/debug.hxx> +#include <unotools/confignode.hxx> +#include <unotools/localedatawrapper.hxx> +#include <svtools/syslocale.hxx> +#include <toolkit/helper/vclunohelper.hxx> #include <algorithm> @@ -374,6 +380,67 @@ namespace pcr return m_xComponentPropertyInfo.is() && m_xComponentPropertyInfo->hasPropertyByName( _rPropName ); } + //-------------------------------------------------------------------- + sal_Int16 PropertyHandler::impl_getDocumentMeasurementUnit_throw() const + { + FieldUnit eUnit = FUNIT_NONE; + + Reference< XServiceInfo > xDocumentSI( impl_getContextDocument_nothrow(), UNO_QUERY ); + OSL_ENSURE( xDocumentSI.is(), "PropertyHandlerHelper::impl_getDocumentMeasurementUnit_throw: No context document - where do I live?" ); + if ( xDocumentSI.is() ) + { + // determine the application type we live in + ::rtl::OUString sConfigurationLocation; + ::rtl::OUString sConfigurationProperty; + if ( xDocumentSI->supportsService( SERVICE_WEB_DOCUMENT ) ) + { // writer + sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.WriterWeb/Layout/Other" ) ); + sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MeasureUnit" ) ); + } + else if ( xDocumentSI->supportsService( SERVICE_TEXT_DOCUMENT ) ) + { // writer + sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Writer/Layout/Other" ) ); + sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MeasureUnit" ) ); + } + else if ( xDocumentSI->supportsService( SERVICE_SPREADSHEET_DOCUMENT ) ) + { // calc + sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Calc/Layout/Other/MeasureUnit" ) ); + sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Metric" ) ); + } + else if ( xDocumentSI->supportsService( SERVICE_DRAWING_DOCUMENT ) ) + { + sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Draw/Layout/Other/MeasureUnit" ) ); + sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Metric" ) ); + } + else if ( xDocumentSI->supportsService( SERVICE_PRESENTATION_DOCUMENT ) ) + { + sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Impress/Layout/Other/MeasureUnit" ) ); + sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Metric" ) ); + } + + // read the measurement unit from the configuration + if ( sConfigurationLocation.getLength() && sConfigurationProperty.getLength() ) + { + ::utl::OConfigurationTreeRoot aConfigTree( ::utl::OConfigurationTreeRoot::createWithServiceFactory( + m_aContext.getLegacyServiceFactory(), sConfigurationLocation, -1, ::utl::OConfigurationTreeRoot::CM_READONLY ) ); + sal_Int32 nUnitAsInt = (sal_Int32)FUNIT_NONE; + aConfigTree.getNodeValue( sConfigurationProperty ) >>= nUnitAsInt; + + // if this denotes a valid (and accepted) unit, then use it + if ( ( nUnitAsInt > FUNIT_NONE ) && ( nUnitAsInt <= FUNIT_100TH_MM ) ) + eUnit = static_cast< FieldUnit >( nUnitAsInt ); + } + } + + if ( FUNIT_NONE == eUnit ) + { + MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum(); + eUnit = MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH; + } + + return VCLUnoHelper::ConvertToMeasurementUnit( eUnit, 1 ); + } + //==================================================================== //= PropertyHandlerComponent //==================================================================== diff --git a/extensions/source/propctrlr/propertyhandler.hxx b/extensions/source/propctrlr/propertyhandler.hxx index d44252cca0e7..4f1aa8f3e82f 100644 --- a/extensions/source/propctrlr/propertyhandler.hxx +++ b/extensions/source/propctrlr/propertyhandler.hxx @@ -298,6 +298,10 @@ namespace pcr /// determines whether our component has a given property bool impl_componentHasProperty_throw( const ::rtl::OUString& _rPropName ) const; + /** determines the default measure unit for the document in which our component lives + */ + sal_Int16 impl_getDocumentMeasurementUnit_throw() const; + private: PropertyHandler(); // never implemented PropertyHandler( const PropertyHandler& ); // never implemented diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx index 4f5560462f86..26d46aa7dec9 100644 --- a/extensions/source/propctrlr/standardcontrol.cxx +++ b/extensions/source/propctrlr/standardcontrol.cxx @@ -917,6 +917,7 @@ namespace pcr :OComboboxControl_Base( PropertyControlType::ComboBox, pParent, nWinStyle ) { getTypedControlWindow()->SetDropDownLineCount( LB_DEFAULT_COUNT ); + getTypedControlWindow()->SetSelectHdl( LINK( this, OComboboxControl, OnEntrySelected ) ); } //------------------------------------------------------------------ @@ -968,6 +969,15 @@ namespace pcr return aRet; } + //------------------------------------------------------------------ + IMPL_LINK( OComboboxControl, OnEntrySelected, void*, /*_pNothing*/ ) + { + if ( !getTypedControlWindow()->IsTravelSelect() ) + // fire a commit + m_aImplControl.notifyModifiedValue(); + return 0L; + } + //================================================================== //= OMultilineFloatingEdit //================================================================== @@ -1045,7 +1055,7 @@ namespace pcr { SetCompoundControl( TRUE ); - m_pImplEdit = new MultiLineEdit( this, WB_TABSTOP | WB_IGNORETAB | WB_NOBORDER | _nStyle & WB_READONLY ); + m_pImplEdit = new MultiLineEdit( this, WB_TABSTOP | WB_IGNORETAB | WB_NOBORDER | (_nStyle & WB_READONLY) ); SetSubEdit( m_pImplEdit ); m_pImplEdit->Show(); diff --git a/extensions/source/propctrlr/standardcontrol.hxx b/extensions/source/propctrlr/standardcontrol.hxx index 0e64f2c65c42..ebe5b7c4ed48 100644 --- a/extensions/source/propctrlr/standardcontrol.hxx +++ b/extensions/source/propctrlr/standardcontrol.hxx @@ -337,6 +337,8 @@ namespace pcr virtual void SAL_CALL appendListEntry( const ::rtl::OUString& NewEntry ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getListEntries( ) throw (::com::sun::star::uno::RuntimeException); + protected: + DECL_LINK( OnEntrySelected, void* ); }; //======================================================================== diff --git a/extensions/source/propctrlr/taborder.cxx b/extensions/source/propctrlr/taborder.cxx index 9ce48b313e82..f8021b55229c 100644 --- a/extensions/source/propctrlr/taborder.cxx +++ b/extensions/source/propctrlr/taborder.cxx @@ -288,13 +288,13 @@ namespace pcr //------------------------------------------------------------------------ IMPL_LINK( TabOrderDialog, OKClickHdl, Button*, /*pButton*/ ) { - sal_uInt32 nEntryCount = aLB_Controls.GetEntryCount(); + ULONG nEntryCount = aLB_Controls.GetEntryCount(); Sequence< Reference< XControlModel > > aSortedControlModelSeq( nEntryCount ); Sequence< Reference< XControlModel > > aControlModels( m_xTempModel->getControlModels()); Reference< XControlModel > * pSortedControlModels = aSortedControlModelSeq.getArray(); const Reference< XControlModel > * pControlModels = aControlModels.getConstArray(); - for (sal_uInt32 i=0; i < nEntryCount; i++) + for (ULONG i=0; i < nEntryCount; i++) { SvLBoxEntry* pEntry = aLB_Controls.GetEntry(i); @@ -340,6 +340,14 @@ namespace pcr } //------------------------------------------------------------------------ + void TabOrderListBox::ModelHasMoved( SvListEntry* _pSource ) + { + SvTreeListBox::ModelHasMoved( _pSource ); + + ((TabOrderDialog*)Window::GetParent())->SetModified(); + } + + //------------------------------------------------------------------------ void TabOrderListBox::MoveSelection( long nRelPos ) { UniString aSelEntryPrevText,aSelEntryNextText; @@ -354,13 +362,13 @@ namespace pcr { SvLBoxEntry* pFirstSelected = FirstSelected(); if( !pFirstSelected ) return; - sal_uInt32 nFirstSelPos = GetModel()->GetAbsPos( pFirstSelected ); + ULONG nFirstSelPos = GetModel()->GetAbsPos( pFirstSelected ); if( nFirstSelPos == 0 ) return; SvLBoxEntry* pSelEntry = pFirstSelected; while( pSelEntry ) { - sal_uInt32 nSelEntryPos = GetModel()->GetAbsPos( pSelEntry ); + ULONG nSelEntryPos = GetModel()->GetAbsPos( pSelEntry ); SvLBoxEntry* pSelEntryPrev = GetEntry( nSelEntryPos-1 ); aSelEntryPrevText = GetEntryText( pSelEntryPrev ); aImage = GetExpandedEntryBmp(pSelEntryPrev); @@ -377,12 +385,12 @@ namespace pcr { SvLBoxEntry* pLastSelected = LastSelected(); if( !pLastSelected ) return; - sal_uInt32 nLastSelPos = GetModel()->GetAbsPos( pLastSelected ); + ULONG nLastSelPos = GetModel()->GetAbsPos( pLastSelected ); if( (nLastSelPos + nRelPos - i) > (GetEntryCount()-1) ) return; #if OSL_DEBUG_LEVEL > 0 - sal_uInt32 nSelCount = GetSelectionCount(); + ULONG nSelCount = GetSelectionCount(); (void)nSelCount; #endif @@ -390,7 +398,7 @@ namespace pcr SvLBoxEntry* pSelEntry = pLastSelected; while( pSelEntry ) { - sal_uInt32 nSelEntryPos = GetModel()->GetAbsPos( pSelEntry ); + ULONG nSelEntryPos = GetModel()->GetAbsPos( pSelEntry ); SvLBoxEntry* pSelEntryNext = GetEntry( nSelEntryPos+1 ); void* pData = pSelEntryNext->GetUserData(); diff --git a/extensions/source/propctrlr/taborder.hxx b/extensions/source/propctrlr/taborder.hxx index e47954fd2a22..b8dae415a1dc 100644 --- a/extensions/source/propctrlr/taborder.hxx +++ b/extensions/source/propctrlr/taborder.hxx @@ -69,6 +69,10 @@ namespace pcr virtual ~TabOrderListBox(); void MoveSelection( long nRelPos ); + + protected: + virtual void ModelHasMoved(SvListEntry* pSource ); + private: using SvTreeListBox::MoveSelection; }; diff --git a/extensions/source/resource/makefile.mk b/extensions/source/resource/makefile.mk index 26d40800b9e0..5fdd7ee03603 100644 --- a/extensions/source/resource/makefile.mk +++ b/extensions/source/resource/makefile.mk @@ -55,12 +55,8 @@ SHL1TARGET= $(TARGET)$(DLLPOSTFIX) SHL1STDLIBS= \ $(CPPULIB) \ $(CPPUHELPERLIB) \ - $(VOSLIB) \ $(SALLIB) \ $(VCLLIB) \ - $(COMPHELPERLIB) \ - $(SVTOOLLIB) \ - $(UNOTOOLSLIB) \ $(TOOLSLIB) SHL1DEPN= diff --git a/extensions/source/scanner/makefile.mk b/extensions/source/scanner/makefile.mk index f1bf116e456d..e4e36e44a790 100644 --- a/extensions/source/scanner/makefile.mk +++ b/extensions/source/scanner/makefile.mk @@ -79,8 +79,7 @@ SHL1STDLIBS=\ $(ONELIB) \ $(TOOLSLIB) \ $(VCLLIB) \ - $(SVTOOLLIB) \ - $(GOODIESLIB) + $(SVTOOLLIB) .IF "$(GUI)"=="UNX" .IF "$(OS)"!="FREEBSD" diff --git a/extensions/source/scanner/sane.cxx b/extensions/source/scanner/sane.cxx index a20a915a6cc3..97a30043c1c7 100644 --- a/extensions/source/scanner/sane.cxx +++ b/extensions/source/scanner/sane.cxx @@ -763,7 +763,7 @@ BOOL Sane::Start( BitmapTransporter& rBitmap ) if( ! nHeightMM ) nHeightMM = (int)(((double)nHeight / fResl) * 25.4); #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "set dimensions to (%d, %d) Pixel, (%d, %d) mm, resolution is %lg\n", nWidth, nHeight, nWidthMM, nHeightMM, fResl ); + fprintf( stderr, "set dimensions to (%d, %d) Pixel, (%d, %d) mm, resolution is %lg\n", (int)nWidth, (int)nHeight, (int)nWidthMM, (int)nHeightMM, fResl ); #endif aConverter.Seek( 18 ); diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx index e5417db939b4..c0374bbb3ce5 100644 --- a/extensions/source/scanner/sanedlg.cxx +++ b/extensions/source/scanner/sanedlg.cxx @@ -722,7 +722,7 @@ void SaneDlg::AcquirePreview() { #if OSL_DEBUG_LEVEL > 1 aTransporter.getStream().Seek( STREAM_SEEK_TO_END ); - fprintf( stderr, "Previewbitmapstream contains %d bytes\n", aTransporter.getStream().Tell() ); + fprintf( stderr, "Previewbitmapstream contains %d bytes\n", (int)aTransporter.getStream().Tell() ); #endif aTransporter.getStream().Seek( STREAM_SEEK_TO_BEGIN ); maPreviewBitmap.Read( aTransporter.getStream(), TRUE ); diff --git a/extensions/source/update/check/updatecheckconfig.cxx b/extensions/source/update/check/updatecheckconfig.cxx index 704b8c4fc065..45a7c15ecb2e 100644 --- a/extensions/source/update/check/updatecheckconfig.cxx +++ b/extensions/source/update/check/updatecheckconfig.cxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: updatecheckconfig.cxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -213,8 +210,14 @@ rtl::OUString UpdateCheckConfig::getDesktopDirectory() } #else // This should become a desktop specific setting in some system backend .. - osl::Security().getHomeDir(aRet); - aRet += rtl::OUString::createFromAscii("/Desktop"); + rtl::OUString aHomeDir; + osl::Security().getHomeDir( aHomeDir ); + aRet = aHomeDir + rtl::OUString::createFromAscii("/Desktop"); + + // Set path to home directory when there is no /Desktop directory + osl::Directory aDocumentsDir( aRet ); + if( osl::FileBase::E_None != aDocumentsDir.open() ) + aRet = aHomeDir; #endif return aRet; diff --git a/extensions/source/update/check/updatecheckjob.cxx b/extensions/source/update/check/updatecheckjob.cxx index 38abc9e28bc5..3bc292e4c8ef 100644 --- a/extensions/source/update/check/updatecheckjob.cxx +++ b/extensions/source/update/check/updatecheckjob.cxx @@ -51,6 +51,27 @@ namespace uno = com::sun::star::uno ; namespace { +class InitUpdateCheckJobThread : public osl::Thread +{ +public: + InitUpdateCheckJobThread( const uno::Reference< uno::XComponentContext > &xContext, + const uno::Sequence< beans::NamedValue > &xParameters ); + + virtual void SAL_CALL run(); + virtual void SAL_CALL onTerminated(); + + void showDialog(); + +protected: + ~InitUpdateCheckJobThread(); + +private: + osl::Condition m_aCondition; + uno::Reference<uno::XComponentContext> m_xContext; + uno::Sequence<beans::NamedValue> m_xParameters; + bool m_bShowDialog; +}; + class UpdateCheckJob : public ::cppu::WeakImplHelper2< task::XJob, lang::XServiceInfo > { @@ -80,15 +101,64 @@ public: throw (uno::RuntimeException); private: - uno::Reference<uno::XComponentContext> m_xContext; + uno::Reference<uno::XComponentContext> m_xContext; + InitUpdateCheckJobThread *m_pInitThread; void handleExtensionUpdates( const uno::Sequence< beans::NamedValue > &rListProp ); }; //------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +InitUpdateCheckJobThread::InitUpdateCheckJobThread( + const uno::Reference< uno::XComponentContext > &xContext, + const uno::Sequence< beans::NamedValue > &xParameters ) : + m_xContext( xContext ), + m_xParameters( xParameters ), + m_bShowDialog( false ) +{ + create(); +} + +//------------------------------------------------------------------------------ +InitUpdateCheckJobThread::~InitUpdateCheckJobThread() +{ +} + +//------------------------------------------------------------------------------ +void SAL_CALL InitUpdateCheckJobThread::run() +{ + TimeValue tv = { 25, 0 }; + + m_aCondition.wait( &tv ); + + rtl::Reference< UpdateCheck > aController( UpdateCheck::get() ); + aController->initialize( m_xParameters, m_xContext ); + + if ( m_bShowDialog ) + aController->showDialog( true ); +} + +//------------------------------------------------------------------------------ +void SAL_CALL InitUpdateCheckJobThread::onTerminated() +{ + delete this; +} + +//------------------------------------------------------------------------------ +void InitUpdateCheckJobThread::showDialog() +{ + m_bShowDialog = true; + m_aCondition.set(); +} + +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ UpdateCheckJob::UpdateCheckJob(const uno::Reference<uno::XComponentContext>& xContext) : - m_xContext(xContext) + m_xContext(xContext), + m_pInitThread( NULL ) { } @@ -141,11 +211,10 @@ UpdateCheckJob::execute(const uno::Sequence<beans::NamedValue>& namedValues) } } } + uno::Sequence<beans::NamedValue> aConfig = getValue< uno::Sequence<beans::NamedValue> > (namedValues, "JobConfig"); - - rtl::Reference<UpdateCheck> aController(UpdateCheck::get()); - aController->initialize(aConfig, m_xContext); + m_pInitThread = new InitUpdateCheckJobThread( m_xContext, aConfig ); /* Determine the way we got invoked here - * see Developers Guide Chapter "4.7.2 Jobs" to understand the magic @@ -158,7 +227,7 @@ UpdateCheckJob::execute(const uno::Sequence<beans::NamedValue>& namedValues) if( ! aEventName.equalsAscii("onFirstVisibleTask") ) { - aController->showDialog(true); + m_pInitThread->showDialog(); } return uno::Any(); diff --git a/extensions/util/hidother.src b/extensions/util/hidother.src index 0b82734c645d..5c14a2e8d08e 100644 --- a/extensions/util/hidother.src +++ b/extensions/util/hidother.src @@ -308,3 +308,4 @@ hidspecial HID_CHECK_FOR_UPD_CANCEL { HelpId = HID_CHECK_FOR_UPD_CAN hidspecial HID_PROP_NOLABEL { HelpId = HID_PROP_NOLABEL; } hidspecial HID_PROP_INPUT_REQUIRED { HelpId = HID_PROP_INPUT_REQUIRED; } hidspecial HID_PROP_WRITING_MODE { HelpId = HID_PROP_WRITING_MODE; } +hidspecial HID_PROP_ANCHOR_TYPE { HelpId = HID_PROP_ANCHOR_TYPE; } diff --git a/forms/qa/integration/forms/ShowTargets.java b/forms/qa/integration/forms/ShowTargets.java deleted file mode 100644 index 3c747adfb2bc..000000000000 --- a/forms/qa/integration/forms/ShowTargets.java +++ /dev/null @@ -1,103 +0,0 @@ -/************************************************************************* - * - * 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: ShowTargets.java,v $ - * $Revision: 1.4 $ - * - * 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. - * - ************************************************************************/ - -package integration.forms; - -/** - * - * @author fs93730 - */ -public class ShowTargets -{ - /** Creates a new instance of ShowTargets */ - public ShowTargets() - { - } - - public static void main( String[] args ) - { - System.out.println( "possible targets (* denotes a test case which requires user interaction):" ); - System.out.println( " run" ); - - for ( int i = 0; i < args.length; ++i ) - { - // filter - if ( args[i].equals( "TestCase" ) ) - continue; - if ( args[i].equals( "TestSkeleton" ) ) - continue; - - String completePotentialClassName = args[i].replace( '/', '.' ); - - // get the class - Class potentialTestClass = null; - try { potentialTestClass = Class.forName( completePotentialClassName ); } - catch( java.lang.ClassNotFoundException e ) - { - continue; - } - - // see if it is derived from complexlib.ComplexTestCase - Class superClass = potentialTestClass.getSuperclass(); - while ( superClass != null ) - { - if ( superClass.getName().equals( "complexlib.ComplexTestCase" ) ) - { - if ( isInteractiveTest( potentialTestClass ) ) - System.out.print( "* " ); - else - System.out.print( " " ); - System.out.println( "run_" + args[i] ); - } - superClass = superClass.getSuperclass(); - } - } - } - - /** determines if the test denoted by a given Class is an interactive test - */ - static private boolean isInteractiveTest( Class testClass ) - { - java.lang.reflect.Method interactiveTestMethod = null; - try { interactiveTestMethod = testClass.getMethod( "isInteractiveTest", new Class[]{} ); } - catch( Exception e ) { } - - if ( interactiveTestMethod != null ) - { - try - { - Boolean result = (Boolean)interactiveTestMethod.invoke( null, new Object[]{} ); - return result.booleanValue(); - } - catch( Exception e ) { } - } - return false; - } -} diff --git a/forms/qa/makefile.mk b/forms/qa/makefile.mk index 7be518dc063b..822f67e1bb46 100644 --- a/forms/qa/makefile.mk +++ b/forms/qa/makefile.mk @@ -56,7 +56,7 @@ JARCOMPRESS = TRUE # --- Runner Settings ---------------------------------------------- # classpath and argument list -RUNNER_CLASSPATH = -cp $(CLASSPATH)$(PATH_SEPERATOR)$(SOLARBINDIR)$/OOoRunner.jar$(PATH_SEPERATOR)$(CLASSPATH)$(PATH_SEPERATOR)$(SOLARBINDIR)$/ConnectivityTools.jar +RUNNER_CLASSPATH = -cp "$(CLASSPATH)$(PATH_SEPERATOR)$(SOLARBINDIR)$/OOoRunner.jar$(PATH_SEPERATOR)$(SOLARBINDIR)$/ConnectivityTools.jar" RUNNER_ARGS = org.openoffice.Runner -TestBase java_complex .END @@ -75,7 +75,7 @@ ALL: ALLDEP .IF "$(BUILD_QADEVOOO)" == "YES" show_targets: - +@java $(RUNNER_CLASSPATH) integration.forms.ShowTargets $(foreach,i,$(JAVAFILES) $(i:s/.\$///:s/.java//)) + +@java $(RUNNER_CLASSPATH) complexlib.ShowTargets $(foreach,i,$(JAVAFILES) $(i:s/.\$///:s/.java//)) run: +$(COPY) integration$/forms$/*.props $(CLASSDIR)$/$(PACKAGE) && java $(RUNNER_CLASSPATH) $(RUNNER_ARGS) -sce forms_all.sce diff --git a/forms/source/component/Button.cxx b/forms/source/component/Button.cxx index 5b41b825ff9c..8907dcd82712 100644 --- a/forms/source/component/Button.cxx +++ b/forms/source/component/Button.cxx @@ -30,14 +30,18 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_forms.hxx" + #include "Button.hxx" + +#include <com/sun/star/awt/XVclWindowPeer.hpp> + +#include <comphelper/streamsection.hxx> +#include <comphelper/basicio.hxx> +#include <tools/diagnose_ex.h> #include <tools/debug.hxx> #include <tools/urlobj.hxx> -#include <vos/mutex.hxx> #include <vcl/svapp.hxx> -#include <comphelper/streamsection.hxx> -#include <comphelper/basicio.hxx> -#include <com/sun/star/awt/XVclWindowPeer.hpp> +#include <vos/mutex.hxx> //......................................................................... namespace frm @@ -71,16 +75,40 @@ InterfaceRef SAL_CALL OButtonModel_CreateInstance(const Reference<XMultiServiceF OButtonModel::OButtonModel(const Reference<XMultiServiceFactory>& _rxFactory) :OClickableImageBaseModel( _rxFactory, VCL_CONTROLMODEL_COMMANDBUTTON, FRM_SUN_CONTROL_COMMANDBUTTON ) // use the old control name for compatibility reasons + ,m_aResetHelper( *this, m_aMutex ) + ,m_eDefaultState( STATE_NOCHECK ) { DBG_CTOR( OButtonModel, NULL ); m_nClassId = FormComponentType::COMMANDBUTTON; } //------------------------------------------------------------------ +Any SAL_CALL OButtonModel::queryAggregation( const Type& _type ) throw(RuntimeException) +{ + Any aReturn = OClickableImageBaseModel::queryAggregation( _type ); + if ( !aReturn.hasValue() ) + aReturn = OButtonModel_Base::queryInterface( _type ); + return aReturn; +} + +//------------------------------------------------------------------ +Sequence< Type > OButtonModel::_getTypes() +{ + return ::comphelper::concatSequences( + OClickableImageBaseModel::_getTypes(), + OButtonModel_Base::getTypes() + ); +} + +//------------------------------------------------------------------ OButtonModel::OButtonModel( const OButtonModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory ) :OClickableImageBaseModel( _pOriginal, _rxFactory ) + ,m_aResetHelper( *this, m_aMutex ) + ,m_eDefaultState( _pOriginal->m_eDefaultState ) { DBG_CTOR( OButtonModel, NULL ); + m_nClassId = FormComponentType::COMMANDBUTTON; + implInitializeImageURL(); } @@ -93,12 +121,13 @@ OButtonModel::~OButtonModel() //------------------------------------------------------------------------------ void OButtonModel::describeFixedProperties( Sequence< Property >& _rProps ) const { - BEGIN_DESCRIBE_PROPERTIES( 5, OClickableImageBaseModel ) - DECL_PROP1(BUTTONTYPE, FormButtonType, BOUND); - DECL_PROP1(DISPATCHURLINTERNAL, sal_Bool, BOUND); - DECL_PROP1(TARGET_URL, ::rtl::OUString, BOUND); - DECL_PROP1(TARGET_FRAME, ::rtl::OUString, BOUND); - DECL_PROP1(TABINDEX, sal_Int16, BOUND); + BEGIN_DESCRIBE_PROPERTIES( 6, OClickableImageBaseModel ) + DECL_PROP1( BUTTONTYPE, FormButtonType, BOUND ); + DECL_PROP1( DEFAULT_STATE, sal_Int16, BOUND ); + DECL_PROP1( DISPATCHURLINTERNAL, sal_Bool, BOUND ); + DECL_PROP1( TARGET_URL, ::rtl::OUString, BOUND ); + DECL_PROP1( TARGET_FRAME, ::rtl::OUString, BOUND ); + DECL_PROP1( TABINDEX, sal_Int16, BOUND ); END_DESCRIBE_PROPERTIES(); } @@ -205,6 +234,118 @@ void OButtonModel::read(const Reference<XObjectInputStream>& _rxInStream) throw } } +//-------------------------------------------------------------------- +void SAL_CALL OButtonModel::disposing() +{ + m_aResetHelper.disposing(); + OClickableImageBaseModel::disposing(); +} + +//-------------------------------------------------------------------- +void SAL_CALL OButtonModel::reset() throw (RuntimeException) +{ + if ( !m_aResetHelper.approveReset() ) + return; + + impl_resetNoBroadcast_nothrow(); + + m_aResetHelper.notifyResetted(); +} + +//-------------------------------------------------------------------- +void SAL_CALL OButtonModel::addResetListener( const Reference< XResetListener >& _listener ) throw (RuntimeException) +{ + m_aResetHelper.addResetListener( _listener ); +} + +//-------------------------------------------------------------------- +void SAL_CALL OButtonModel::removeResetListener( const Reference< XResetListener >& _listener ) throw (RuntimeException) +{ + m_aResetHelper.removeResetListener( _listener ); +} + +//-------------------------------------------------------------------- +void SAL_CALL OButtonModel::getFastPropertyValue( Any& _rValue, sal_Int32 _nHandle ) const +{ + switch ( _nHandle ) + { + case PROPERTY_ID_DEFAULT_STATE: + _rValue <<= (sal_Int16)m_eDefaultState; + break; + + default: + OClickableImageBaseModel::getFastPropertyValue( _rValue, _nHandle ); + break; + } +} + +//-------------------------------------------------------------------- +void SAL_CALL OButtonModel::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue ) throw (Exception) +{ + switch ( _nHandle ) + { + case PROPERTY_ID_DEFAULT_STATE: + { + sal_Int16 nDefaultState( (sal_Int16)STATE_NOCHECK ); + OSL_VERIFY( _rValue >>= nDefaultState ); + m_eDefaultState = (ToggleState)nDefaultState; + impl_resetNoBroadcast_nothrow(); + } + break; + + default: + OClickableImageBaseModel::setFastPropertyValue_NoBroadcast( _nHandle, _rValue ); + break; + } +} + +//-------------------------------------------------------------------- +sal_Bool SAL_CALL OButtonModel::convertFastPropertyValue( Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue ) throw (IllegalArgumentException) +{ + sal_Bool bModified = sal_False; + switch ( _nHandle ) + { + case PROPERTY_ID_DEFAULT_STATE: + bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_eDefaultState ); + break; + + default: + bModified = OClickableImageBaseModel::convertFastPropertyValue( _rConvertedValue, _rOldValue, _nHandle, _rValue ); + break; + } + return bModified; +} + +//-------------------------------------------------------------------- +Any OButtonModel::getPropertyDefaultByHandle( sal_Int32 _nHandle ) const +{ + Any aDefault; + switch ( _nHandle ) + { + case PROPERTY_ID_DEFAULT_STATE: + aDefault <<= (sal_Int16)STATE_NOCHECK; + break; + + default: + aDefault = OClickableImageBaseModel::getPropertyDefaultByHandle( _nHandle ); + break; + } + return aDefault; +} + +//-------------------------------------------------------------------- +void OButtonModel::impl_resetNoBroadcast_nothrow() +{ + try + { + setPropertyValue( PROPERTY_STATE, getPropertyValue( PROPERTY_DEFAULT_STATE ) ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + //================================================================== // OButtonControl //================================================================== @@ -555,7 +696,7 @@ sal_Int32 OButtonControl::getModelUrlFeatureId( ) const // is it a feature URL? if ( isFormControllerURL( sUrl ) ) { - OFormNavigationMapper aMapper( getORB() ); + OFormNavigationMapper aMapper( m_aContext.getLegacyServiceFactory() ); nFeatureId = aMapper.getFeatureId( sUrl ); } } diff --git a/forms/source/component/Button.hxx b/forms/source/component/Button.hxx index 038f5b1e8aec..5bbb7f387f85 100644 --- a/forms/source/component/Button.hxx +++ b/forms/source/component/Button.hxx @@ -32,13 +32,19 @@ #define _FRM_BUTTON_HXX_ #include "clickableimage.hxx" +#include "togglestate.hxx" +#include "formnavigation.hxx" +#include "resettable.hxx" + #include <com/sun/star/awt/MouseEvent.hpp> #include <com/sun/star/lang/EventObject.hpp> #include <com/sun/star/awt/ActionEvent.hpp> #include <com/sun/star/awt/XActionListener.hpp> #include <com/sun/star/awt/XButton.hpp> +#include <com/sun/star/form/XReset.hpp> #include <com/sun/star/beans/PropertyChangeEvent.hpp> -#include "formnavigation.hxx" + +#include <cppuhelper/implbase1.hxx> //......................................................................... namespace frm @@ -48,12 +54,20 @@ namespace frm //================================================================== // OButtonModel //================================================================== -class OButtonModel - :public OClickableImageBaseModel +typedef ::cppu::ImplHelper1 < ::com::sun::star::form::XReset + > OButtonModel_Base; +class OButtonModel :public OClickableImageBaseModel + ,public OButtonModel_Base { public: DECLARE_DEFAULT_LEAF_XTOR( OButtonModel ); + // UNO + DECLARE_UNO3_AGG_DEFAULTS( OButtonModel, OClickableImageBaseModel ); + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException); + + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); + // ::com::sun::star::lang::XServiceInfo IMPLEMENTATION_NAME(OButtonModel); virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); @@ -63,13 +77,44 @@ public: virtual void SAL_CALL write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + // XReset + virtual void SAL_CALL reset( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addResetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeResetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); + // OControlModel's property handling virtual void describeFixedProperties( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps ) const; + // XPropertySet and friends + virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const; + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) + throw (::com::sun::star::uno::Exception); + virtual sal_Bool SAL_CALL convertFastPropertyValue( + ::com::sun::star::uno::Any& _rConvertedValue, ::com::sun::star::uno::Any& _rOldValue, sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) + throw (::com::sun::star::lang::IllegalArgumentException); + virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const; + + // OComponentHelper + virtual void SAL_CALL disposing(); + protected: DECLARE_XCLONEABLE(); + +private: + void impl_resetNoBroadcast_nothrow(); + + using ::cppu::OPropertySetHelper::getFastPropertyValue; + +private: + ResetHelper m_aResetHelper; + + // <properties> + ToggleState m_eDefaultState; // the default check state + // </properties> +protected: + using OClickableImageBaseModel::disposing; }; //================================================================== diff --git a/forms/source/component/CheckBox.cxx b/forms/source/component/CheckBox.cxx index a8086d39b597..8e66ebc60ab6 100644 --- a/forms/source/component/CheckBox.cxx +++ b/forms/source/component/CheckBox.cxx @@ -209,7 +209,7 @@ void SAL_CALL OCheckBoxModel::read(const Reference<stario::XObjectInputStream>& break; } setReferenceValue( sReferenceValue ); - setDefaultChecked( static_cast< CheckState >( nDefaultChecked ) ); + setDefaultChecked( static_cast< ToggleState >( nDefaultChecked ) ); // Nach dem Lesen die Defaultwerte anzeigen if ( getControlSource().getLength() ) diff --git a/forms/source/component/Columns.cxx b/forms/source/component/Columns.cxx index fae95b36f180..b9b2b6cb5936 100644 --- a/forms/source/component/Columns.cxx +++ b/forms/source/component/Columns.cxx @@ -204,11 +204,11 @@ Any SAL_CALL OGridColumn::queryAggregation( const Type& _rType ) throw (RuntimeE DBG_NAME(OGridColumn); //------------------------------------------------------------------------------ -OGridColumn::OGridColumn(const Reference<XMultiServiceFactory>& _rxFactory, const ::rtl::OUString& _sModelName) +OGridColumn::OGridColumn( const comphelper::ComponentContext& _rContext, const ::rtl::OUString& _sModelName ) :OGridColumn_BASE(m_aMutex) ,OPropertySetAggregationHelper(OGridColumn_BASE::rBHelper) ,m_aHidden( makeAny( sal_False ) ) - ,m_xORB( _rxFactory ) + ,m_aContext( _rContext ) ,m_aModelName(_sModelName) { DBG_CTOR(OGridColumn,NULL); @@ -218,15 +218,13 @@ OGridColumn::OGridColumn(const Reference<XMultiServiceFactory>& _rxFactory, cons { increment( m_refCount ); - // Muss im eigenen Block, - // da xAgg vor dem delegator setzen wieder freigesetzt sein muss! { - m_xAggregate = Reference< XAggregation >( _rxFactory->createInstance( m_aModelName ), UNO_QUERY ); + m_xAggregate.set( m_aContext.createComponent( m_aModelName ), UNO_QUERY ); setAggregation( m_xAggregate ); } - if (m_xAggregate.is()) - { // don't omit this brackets - they ensure that the following temporary is properly deleted + if ( m_xAggregate.is() ) + { // don't omit those brackets - they ensure that the following temporary is properly deleted m_xAggregate->setDelegator( static_cast< ::cppu::OWeakObject* >( this ) ); } @@ -239,7 +237,7 @@ OGridColumn::OGridColumn(const Reference<XMultiServiceFactory>& _rxFactory, cons OGridColumn::OGridColumn( const OGridColumn* _pOriginal ) :OGridColumn_BASE( m_aMutex ) ,OPropertySetAggregationHelper( OGridColumn_BASE::rBHelper ) - ,m_xORB( _pOriginal->m_xORB ) + ,m_aContext( _pOriginal->m_aContext ) { DBG_CTOR(OGridColumn,NULL); @@ -283,13 +281,6 @@ OGridColumn::~OGridColumn() DBG_DTOR(OGridColumn,NULL); } -// XChild -//------------------------------------------------------------------------------ -void SAL_CALL OGridColumn::setParent(const InterfaceRef& Parent) throw(NoSupportException, RuntimeException) -{ - m_xParent = Parent; -} - // XEventListener //------------------------------------------------------------------------------ void SAL_CALL OGridColumn::disposing(const EventObject& _rSource) throw(RuntimeException) @@ -311,8 +302,6 @@ void OGridColumn::disposing() Reference<XComponent> xComp; if (query_aggregation(m_xAggregate, xComp)) xComp->dispose(); - - setParent(InterfaceRef ()); } //------------------------------------------------------------------------------ diff --git a/forms/source/component/Columns.hxx b/forms/source/component/Columns.hxx index 0e5c7a570c62..f1aafd47cb5d 100644 --- a/forms/source/component/Columns.hxx +++ b/forms/source/component/Columns.hxx @@ -31,19 +31,23 @@ #ifndef _FRM_COLUMNS_HXX #define _FRM_COLUMNS_HXX -#include <cppuhelper/component.hxx> -#include <comphelper/proparrhlp.hxx> -#include <comphelper/propagg.hxx> -#include <comphelper/uno3.hxx> -#include "frm_strings.hxx" -#include <com/sun/star/container/XChild.hpp> -#include <com/sun/star/io/XObjectOutputStream.hpp> -#include <com/sun/star/io/XObjectInputStream.hpp> -#include <com/sun/star/util/XCloneable.hpp> -#include <com/sun/star/lang/XUnoTunnel.hpp> -#include <cppuhelper/compbase3.hxx> -#include <comphelper/broadcasthelper.hxx> -#include "cloneable.hxx" +#include "cloneable.hxx"
+#include "frm_strings.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/io/XObjectInputStream.hpp>
+#include <com/sun/star/io/XObjectOutputStream.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/broadcasthelper.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/propagg.hxx>
+#include <comphelper/proparrhlp.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/compbase2.hxx>
+#include <cppuhelper/component.hxx>
using namespace comphelper; @@ -55,8 +59,7 @@ namespace frm //================================================================== // OGridColumn //================================================================== -typedef ::cppu::WeakAggComponentImplHelper3 < ::com::sun::star::container::XChild - , ::com::sun::star::lang::XUnoTunnel +typedef ::cppu::WeakAggComponentImplHelper2 < ::com::sun::star::lang::XUnoTunnel , ::com::sun::star::util::XCloneable > OGridColumn_BASE; class OGridColumn :public ::comphelper::OBaseMutex ,public OGridColumn_BASE @@ -70,17 +73,15 @@ protected: ::com::sun::star::uno::Any m_aHidden; // column hidden? // [properties] - InterfaceRef m_xParent; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> - m_xORB; - ::rtl::OUString m_aModelName; + ::comphelper::ComponentContext m_aContext; + ::rtl::OUString m_aModelName; // [properties] ::rtl::OUString m_aLabel; // Name der Spalte // [properties] public: - OGridColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory, const ::rtl::OUString& _sModelName = ::rtl::OUString()); + OGridColumn(const ::comphelper::ComponentContext& _rContext, const ::rtl::OUString& _sModelName = ::rtl::OUString()); OGridColumn(const OGridColumn* _pOriginal ); virtual ~OGridColumn(); @@ -102,10 +103,6 @@ public: // XEventListener virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException); - // XChild - virtual InterfaceRef SAL_CALL getParent() throw(::com::sun::star::uno::RuntimeException){return m_xParent;} - virtual void SAL_CALL setParent(const InterfaceRef& Parent) throw(::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); - // XPersistObject virtual void SAL_CALL write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream); virtual void SAL_CALL read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream); @@ -135,30 +132,30 @@ protected: virtual OGridColumn* createCloneColumn() const = 0; }; -#define DECL_COLUMN(ClassName) \ -class ClassName \ - :public OGridColumn \ - ,public OAggregationArrayUsageHelper< ClassName > \ -{ \ -public: \ - ClassName(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);\ - ClassName(const ClassName* _pCloneFrom);\ - \ +#define DECL_COLUMN(ClassName) \ +class ClassName \ + :public OGridColumn \ + ,public OAggregationArrayUsageHelper< ClassName > \ +{ \ +public: \ + ClassName(const ::comphelper::ComponentContext& _rContext ); \ + ClassName(const ClassName* _pCloneFrom); \ + \ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); \ - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); \ - \ - virtual void fillProperties( \ - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, \ + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); \ + \ + virtual void fillProperties( \ + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, \ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps \ - ) const; \ - \ - virtual OGridColumn* createCloneColumn() const; \ + ) const; \ + \ + virtual OGridColumn* createCloneColumn() const; \ }; #define IMPL_COLUMN(ClassName, Model, bAllowDropDown) \ -ClassName::ClassName(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory) \ - :OGridColumn(_rxFactory, Model) \ + ClassName::ClassName( const ::comphelper::ComponentContext& _rContext ) \ + :OGridColumn(_rContext, Model) \ { \ } \ ClassName::ClassName( const ClassName* _pCloneFrom ) \ diff --git a/forms/source/component/ComboBox.cxx b/forms/source/component/ComboBox.cxx index fc8cd78fdfde..3491c2142449 100644 --- a/forms/source/component/ComboBox.cxx +++ b/forms/source/component/ComboBox.cxx @@ -143,7 +143,7 @@ DBG_NAME( OComboBoxModel ) OComboBoxModel::OComboBoxModel(const Reference<XMultiServiceFactory>& _rxFactory) :OBoundControlModel( _rxFactory, VCL_CONTROLMODEL_COMBOBOX, FRM_SUN_CONTROL_COMBOBOX, sal_True, sal_True, sal_True ) // use the old control name for compytibility reasons - ,OEntryListHelper( m_aMutex ) + ,OEntryListHelper( (OControlModel&)*this ) ,OErrorBroadcaster( OComponentHelper::rBHelper ) ,m_aListRowSet( getContext() ) ,m_eListSourceType(ListSourceType_TABLE) @@ -158,7 +158,7 @@ OComboBoxModel::OComboBoxModel(const Reference<XMultiServiceFactory>& _rxFactory //------------------------------------------------------------------ OComboBoxModel::OComboBoxModel( const OComboBoxModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory ) :OBoundControlModel( _pOriginal, _rxFactory ) - ,OEntryListHelper( *_pOriginal, m_aMutex ) + ,OEntryListHelper( *_pOriginal, (OControlModel&)*this ) ,OErrorBroadcaster( OComponentHelper::rBHelper ) ,m_aListRowSet( getContext() ) ,m_aListSource( _pOriginal->m_aListSource ) @@ -265,8 +265,8 @@ void OComboBoxModel::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const case PROPERTY_ID_STRINGITEMLIST: { - ::osl::ResettableMutexGuard aGuard( m_aMutex ); - setNewStringItemList( _rValue, aGuard ); + ControlModelLock aLock( *this ); + setNewStringItemList( _rValue, aLock ); // TODO: this is bogus. setNewStringItemList expects a guard which has the *only* // lock to the mutex, but setFastPropertyValue_NoBroadcast is already called with // a lock - so we effectively has two locks here, of which setNewStringItemList can @@ -384,7 +384,7 @@ void SAL_CALL OComboBoxModel::write(const Reference<stario::XObjectOutputStream> void SAL_CALL OComboBoxModel::read(const Reference<stario::XObjectInputStream>& _rxInStream) throw(stario::IOException, RuntimeException) { OBoundControlModel::read(_rxInStream); - ::osl::ResettableMutexGuard aGuard(m_aMutex); + ControlModelLock aLock( *this ); // since we are "overwriting" the StringItemList of our aggregate (means we have // an own place to store the value, instead of relying on our aggregate storing it), @@ -392,7 +392,7 @@ void SAL_CALL OComboBoxModel::read(const Reference<stario::XObjectInputStream>& try { if ( m_xAggregateSet.is() ) - setNewStringItemList( m_xAggregateSet->getPropertyValue( PROPERTY_STRINGITEMLIST ), aGuard ); + setNewStringItemList( m_xAggregateSet->getPropertyValue( PROPERTY_STRINGITEMLIST ), aLock ); } catch( const Exception& ) { @@ -853,7 +853,7 @@ Any OComboBoxModel::getDefaultForReset() const } //-------------------------------------------------------------------- -void OComboBoxModel::stringItemListChanged( ::osl::ResettableMutexGuard& /*_rInstanceLock*/ ) +void OComboBoxModel::stringItemListChanged( ControlModelLock& /*_rInstanceLock*/ ) { if ( m_xAggregateSet.is() ) m_xAggregateSet->setPropertyValue( PROPERTY_STRINGITEMLIST, makeAny( getStringItemList() ) ); diff --git a/forms/source/component/ComboBox.hxx b/forms/source/component/ComboBox.hxx index 28e17ebe9f42..835099a7637c 100644 --- a/forms/source/component/ComboBox.hxx +++ b/forms/source/component/ComboBox.hxx @@ -146,7 +146,7 @@ protected: getDefaultForReset() const; // OEntryListHelper overriables - virtual void stringItemListChanged( ::osl::ResettableMutexGuard& _rInstanceLock ); + virtual void stringItemListChanged( ControlModelLock& _rInstanceLock ); virtual void connectedExternalListSource( ); virtual void disconnectedExternalListSource( ); virtual void refreshInternalEntryList(); diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index f524142865e5..96412feed10a 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -31,72 +31,72 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_forms.hxx" -#include <stdio.h> -#include <ctype.h> -#include <hash_map> - -#include "DatabaseForm.hxx" -#include "EventThread.hxx" -#include "frm_resource.hxx" -#include "frm_resource.hrc" -#include "GroupManager.hxx" -#include "property.hrc" -#include "property.hxx" -#include "services.hxx" -#include "frm_module.hxx" -#include "componenttools.hxx" -#include <com/sun/star/sdb/XColumnUpdate.hpp> -#include <com/sun/star/util/XCancellable.hpp> -#include <com/sun/star/sdbc/ResultSetType.hpp> -#include <com/sun/star/sdbc/ResultSetConcurrency.hpp> -#include <com/sun/star/sdbc/DataType.hpp> -#include <com/sun/star/io/XObjectInputStream.hpp> -#include <com/sun/star/io/XObjectOutputStream.hpp> -#include <com/sun/star/form/DataSelectionType.hpp> -#include <com/sun/star/sdb/SQLContext.hpp> -#include <com/sun/star/form/FormComponentType.hpp> -#include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/frame/FrameSearchFlag.hpp> -#include <com/sun/star/frame/XDispatch.hpp> -#include <com/sun/star/frame/XModel.hpp> -#include <com/sun/star/sdb/CommandType.hpp> -#include <com/sun/star/sdb/RowSetVetoException.hpp> -#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> -#include <com/sun/star/sdbcx/Privilege.hpp> -#include <com/sun/star/sdbc/XRowSet.hpp> -#include <com/sun/star/form/TabulatorCycle.hpp> -#include <com/sun/star/awt/XControlContainer.hpp> -#include <com/sun/star/awt/XTextComponent.hpp> -#include <com/sun/star/util/XURLTransformer.hpp> - -#include <tools/debug.hxx> -#include <tools/diagnose_ex.h> -#include <vcl/timer.hxx> -#include <tools/fsys.hxx> -#include <tools/inetmsg.hxx> -#ifndef _INETSTRM_HXX //autogen -#include <svtools/inetstrm.hxx> -#endif -#include <cppuhelper/implbase2.hxx> -#include <comphelper/stl_types.hxx> -#include <comphelper/sequence.hxx> -#include <comphelper/stl_types.hxx> -#include <comphelper/uno3.hxx> -#include <comphelper/seqstream.hxx> -#include <comphelper/enumhelper.hxx> -#include <comphelper/container.hxx> -#include <comphelper/basicio.hxx> -#include <connectivity/dbtools.hxx> -#include <osl/mutex.hxx> -#include <tools/urlobj.hxx> -#include <rtl/math.hxx> -#include <svtools/inettype.hxx> -#include <comphelper/extract.hxx> -#include <vos/mutex.hxx> -#include <vcl/svapp.hxx> -#include <rtl/tencinfo.h> -#include <unotools/ucblockbytes.hxx> -#include <unotools/ucbstreamhelper.hxx> +#include "componenttools.hxx"
+#include "DatabaseForm.hxx"
+#include "EventThread.hxx"
+#include "frm_module.hxx"
+#include "frm_resource.hrc"
+#include "frm_resource.hxx"
+#include "GroupManager.hxx"
+#include "property.hrc"
+#include "property.hxx"
+#include "services.hxx"
+
+#include <com/sun/star/awt/XControlContainer.hpp>
+#include <com/sun/star/awt/XTextComponent.hpp>
+#include <com/sun/star/form/DataSelectionType.hpp>
+#include <com/sun/star/form/FormComponentType.hpp>
+#include <com/sun/star/form/TabulatorCycle.hpp>
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/io/XObjectInputStream.hpp>
+#include <com/sun/star/io/XObjectOutputStream.hpp>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/sdb/RowSetVetoException.hpp>
+#include <com/sun/star/sdb/SQLContext.hpp>
+#include <com/sun/star/sdb/XColumnUpdate.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
+#include <com/sun/star/sdbc/ResultSetType.hpp>
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#include <com/sun/star/sdbcx/Privilege.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/util/XCancellable.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/util/XModifiable2.hpp> +
+#include <comphelper/basicio.hxx>
+#include <comphelper/container.hxx>
+#include <comphelper/enumhelper.hxx>
+#include <comphelper/extract.hxx>
+#include <comphelper/seqstream.hxx>
+#include <comphelper/sequence.hxx>
+#include <comphelper/stl_types.hxx>
+#include <comphelper/uno3.hxx>
+#include <connectivity/dbtools.hxx>
+#include <cppuhelper/exc_hlp.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <osl/mutex.hxx>
+#include <rtl/math.hxx>
+#include <rtl/tencinfo.h>
+#include <svtools/inetstrm.hxx>
+#include <svtools/inettype.hxx>
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+#include <tools/fsys.hxx>
+#include <tools/inetmsg.hxx>
+#include <tools/urlobj.hxx>
+#include <unotools/ucblockbytes.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/timer.hxx>
+#include <vos/mutex.hxx>
+ +#include <ctype.h>
+#include <hash_map>
+//#include <stdio.h>
// compatiblity: DatabaseCursorType is dead, but for compatiblity reasons we still have to write it ... namespace com { @@ -115,8 +115,6 @@ enum DatabaseCursorType } } } } -#define DATABASEFORM_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.comp.forms.ODatabaseForm") - using namespace ::dbtools; using namespace ::comphelper; using namespace ::com::sun::star::uno; @@ -146,6 +144,41 @@ namespace frm //......................................................................... //================================================================== +//= DocumentModifyGuard +//================================================================== +class DocumentModifyGuard +{ +public: + DocumentModifyGuard( const Reference< XInterface >& _rxFormComponent ) + :m_xDocumentModify( getXModel( _rxFormComponent ), UNO_QUERY ) + { + OSL_ENSURE( m_xDocumentModify.is(), "DocumentModifyGuard::DocumentModifyGuard: no document, or no XModifiable2!" ); + impl_changeModifiableFlag_nothrow( false ); + } + ~DocumentModifyGuard() + { + impl_changeModifiableFlag_nothrow( true ); + } + +private: + void impl_changeModifiableFlag_nothrow( const bool _enable ) + { + try + { + if ( m_xDocumentModify.is() ) + _enable ? m_xDocumentModify->enableSetModified() : m_xDocumentModify->disableSetModified(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + +private: + Reference< XModifiable2 > m_xDocumentModify; +}; + +//================================================================== //= OFormSubmitResetThread //=----------------------------------------------------------------- //= submitting and resetting html-forms asynchronously @@ -261,51 +294,152 @@ Any SAL_CALL ODatabaseForm::queryAggregation(const Type& _rType) throw(RuntimeEx DBG_NAME(ODatabaseForm); //------------------------------------------------------------------ ODatabaseForm::ODatabaseForm(const Reference<XMultiServiceFactory>& _rxFactory) - :OFormComponents(_rxFactory) - ,OPropertySetAggregationHelper(OComponentHelper::rBHelper) - ,OPropertyChangeListener(m_aMutex) - ,m_aLoadListeners(m_aMutex) - ,m_aRowSetApproveListeners(m_aMutex) - ,m_aRowSetListeners(m_aMutex) - ,m_aSubmitListeners(m_aMutex) - ,m_aErrorListeners(m_aMutex) - ,m_aResetListeners( *this, m_aMutex ) - ,m_aPropertyBagHelper( *this ) - ,m_pAggregatePropertyMultiplexer(NULL) - ,m_pGroupManager( NULL ) - ,m_aParameterManager( m_aMutex, _rxFactory ) - ,m_aFilterManager( _rxFactory ) - ,m_pLoadTimer(NULL) - ,m_pThread(NULL) - ,m_nResetsPending(0) - ,m_nPrivileges(0) - ,m_bInsertOnly( sal_False ) - ,m_eSubmitMethod(FormSubmitMethod_GET) - ,m_eSubmitEncoding(FormSubmitEncoding_URL) - ,m_eNavigation(NavigationBarMode_CURRENT) - ,m_bAllowInsert(sal_True) - ,m_bAllowUpdate(sal_True) - ,m_bAllowDelete(sal_True) - ,m_bLoaded(sal_False) - ,m_bSubForm(sal_False) - ,m_bForwardingConnection(sal_False) - ,m_bSharingConnection( sal_False ) -{ - DBG_CTOR(ODatabaseForm,NULL); + :OFormComponents(_rxFactory) + ,OPropertySetAggregationHelper(OComponentHelper::rBHelper) + ,OPropertyChangeListener(m_aMutex) + ,m_aLoadListeners(m_aMutex) + ,m_aRowSetApproveListeners(m_aMutex) + ,m_aRowSetListeners(m_aMutex) + ,m_aSubmitListeners(m_aMutex) + ,m_aErrorListeners(m_aMutex) + ,m_aResetListeners( *this, m_aMutex ) + ,m_aPropertyBagHelper( *this ) + ,m_pAggregatePropertyMultiplexer(NULL) + ,m_pGroupManager( NULL ) + ,m_aParameterManager( m_aMutex, _rxFactory ) + ,m_aFilterManager( _rxFactory ) + ,m_pLoadTimer(NULL) + ,m_pThread(NULL) + ,m_nResetsPending(0) + ,m_nPrivileges(0) + ,m_bInsertOnly( sal_False ) + ,m_eSubmitMethod(FormSubmitMethod_GET) + ,m_eSubmitEncoding(FormSubmitEncoding_URL) + ,m_eNavigation(NavigationBarMode_CURRENT) + ,m_bAllowInsert(sal_True) + ,m_bAllowUpdate(sal_True) + ,m_bAllowDelete(sal_True) + ,m_bLoaded(sal_False) + ,m_bSubForm(sal_False) + ,m_bForwardingConnection(sal_False) + ,m_bSharingConnection( sal_False ) +{ + DBG_CTOR( ODatabaseForm, NULL ); + impl_construct(); +} + +//------------------------------------------------------------------ +ODatabaseForm::ODatabaseForm( const ODatabaseForm& _cloneSource ) + :OFormComponents( _cloneSource ) + ,OPropertySetAggregationHelper( OComponentHelper::rBHelper ) + ,OPropertyChangeListener( m_aMutex ) + ,ODatabaseForm_BASE1() + ,ODatabaseForm_BASE2() + ,ODatabaseForm_BASE3() + ,IPropertyBagHelperContext() + ,m_aLoadListeners( m_aMutex ) + ,m_aRowSetApproveListeners( m_aMutex ) + ,m_aRowSetListeners( m_aMutex ) + ,m_aSubmitListeners( m_aMutex ) + ,m_aErrorListeners( m_aMutex ) + ,m_aResetListeners( *this, m_aMutex ) + ,m_aPropertyBagHelper( *this ) + ,m_pAggregatePropertyMultiplexer( NULL ) + ,m_pGroupManager( NULL ) + ,m_aParameterManager( m_aMutex, _cloneSource.m_xServiceFactory ) + ,m_aFilterManager( _cloneSource.m_xServiceFactory ) + ,m_pLoadTimer( NULL ) + ,m_pThread( NULL ) + ,m_nResetsPending( 0 ) + ,m_nPrivileges( 0 ) + ,m_bInsertOnly( _cloneSource.m_bInsertOnly ) + ,m_aControlBorderColorFocus( _cloneSource.m_aControlBorderColorFocus ) + ,m_aControlBorderColorMouse( _cloneSource.m_aControlBorderColorMouse ) + ,m_aControlBorderColorInvalid( _cloneSource.m_aControlBorderColorInvalid ) + ,m_aDynamicControlBorder( _cloneSource.m_aDynamicControlBorder ) + ,m_sName( _cloneSource.m_sName ) + ,m_aTargetURL( _cloneSource.m_aTargetURL ) + ,m_aTargetFrame( _cloneSource.m_aTargetFrame ) + ,m_eSubmitMethod( _cloneSource.m_eSubmitMethod ) + ,m_eSubmitEncoding( _cloneSource.m_eSubmitEncoding ) + ,m_eNavigation( _cloneSource.m_eNavigation ) + ,m_bAllowInsert( _cloneSource.m_bAllowInsert ) + ,m_bAllowUpdate( _cloneSource.m_bAllowUpdate ) + ,m_bAllowDelete( _cloneSource.m_bAllowDelete ) + ,m_bLoaded( sal_False ) + ,m_bSubForm( sal_False ) + ,m_bForwardingConnection( sal_False ) + ,m_bSharingConnection( sal_False ) +{ + DBG_CTOR( ODatabaseForm, NULL ); + + impl_construct(); + + osl_incrementInterlockedCount( &m_refCount ); + { + // our aggregated rowset itself is not cloneable, so simply copy the properties + ::comphelper::copyProperties( _cloneSource.m_xAggregateSet, m_xAggregateSet ); + + // also care for the dynamic properties: If the clone source has properties which we do not have, + // then add them + try + { + Reference< XPropertySet > xSourceProps( const_cast< ODatabaseForm& >( _cloneSource ).queryAggregation( + XPropertySet::static_type() ), UNO_QUERY_THROW ); + Reference< XPropertySetInfo > xSourcePSI( xSourceProps->getPropertySetInfo(), UNO_SET_THROW ); + Reference< XPropertyState > xSourcePropState( xSourceProps, UNO_QUERY ); + Reference< XPropertySetInfo > xDestPSI( getPropertySetInfo(), UNO_QUERY_THROW ); + + Sequence< Property > aSourceProperties( xSourcePSI->getProperties() ); + for ( const Property* pSourceProperty = aSourceProperties.getConstArray(); + pSourceProperty != aSourceProperties.getConstArray() + aSourceProperties.getLength(); + ++pSourceProperty + ) + { + if ( xDestPSI->hasPropertyByName( pSourceProperty->Name ) ) + continue; + + // the initial value passed to XPropertyContainer is also used as default, usually. So, try + // to retrieve the default of the source property + Any aInitialValue; + if ( xSourcePropState.is() ) + { + aInitialValue = xSourcePropState->getPropertyDefault( pSourceProperty->Name ); + } + else + { + aInitialValue = xSourceProps->getPropertyValue( pSourceProperty->Name ); + } + addProperty( pSourceProperty->Name, pSourceProperty->Attributes, aInitialValue ); + setPropertyValue( pSourceProperty->Name, xSourceProps->getPropertyValue( pSourceProperty->Name ) ); + } + } + catch( const Exception& ) + { + throw WrappedTargetException( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Could not clone the given database form." ) ), + *const_cast< ODatabaseForm* >( &_cloneSource ), + ::cppu::getCaughtException() + ); + } + } + osl_decrementInterlockedCount( &m_refCount ); +} + +//------------------------------------------------------------------ +void ODatabaseForm::impl_construct() +{ // aggregate a row set increment(m_refCount); - { - m_xAggregate = Reference<XAggregation>(m_xServiceFactory->createInstance(SRV_SDB_ROWSET), UNO_QUERY); - // m_xAggregate = Reference<XAggregation>(m_xServiceFactory->createInstance(rtl::OUString::createFromAscii("com.sun.star.sdb.dbaccess.ORowSet")), UNO_QUERY); - DBG_ASSERT(m_xAggregate.is(), "ODatabaseForm::ODatabaseForm : could not instantiate an SDB rowset !"); - m_xAggregateAsRowSet = Reference<XRowSet> (m_xAggregate,UNO_QUERY); - setAggregation(m_xAggregate); + m_xAggregate = Reference< XAggregation >( m_xServiceFactory->createInstance( SRV_SDB_ROWSET ), UNO_QUERY_THROW ); + m_xAggregateAsRowSet.set( m_xAggregate, UNO_QUERY_THROW ); + setAggregation( m_xAggregate ); } // listen for the properties, important for Parameters - if (m_xAggregateSet.is()) + if ( m_xAggregateSet.is() ) { m_pAggregatePropertyMultiplexer = new OPropertyChangeMultiplexer(this, m_xAggregateSet, sal_False); m_pAggregatePropertyMultiplexer->acquire(); @@ -313,9 +447,14 @@ ODatabaseForm::ODatabaseForm(const Reference<XMultiServiceFactory>& _rxFactory) m_pAggregatePropertyMultiplexer->addProperty(PROPERTY_ACTIVE_CONNECTION); } - if (m_xAggregate.is()) { - m_xAggregate->setDelegator(static_cast<XWeak*>(this)); + Reference< XWarningsSupplier > xRowSetWarnings( m_xAggregate, UNO_QUERY ); + m_aWarnings.setExternalWarnings( xRowSetWarnings ); + } + + if ( m_xAggregate.is() ) + { + m_xAggregate->setDelegator( static_cast< XWeak* >( this ) ); } { @@ -324,10 +463,9 @@ ODatabaseForm::ODatabaseForm(const Reference<XMultiServiceFactory>& _rxFactory) declareForwardedProperty( PROPERTY_ID_ACTIVE_CONNECTION ); } + decrement( m_refCount ); - decrement(m_refCount); - - m_pGroupManager = new OGroupManager(this); + m_pGroupManager = new OGroupManager( this ); m_pGroupManager->acquire(); } @@ -337,9 +475,12 @@ ODatabaseForm::~ODatabaseForm() DBG_DTOR(ODatabaseForm,NULL); m_pGroupManager->release(); + m_pGroupManager = NULL; if (m_xAggregate.is()) - m_xAggregate->setDelegator(InterfaceRef()); + m_xAggregate->setDelegator( NULL ); + + m_aWarnings.setExternalWarnings( NULL ); if (m_pAggregatePropertyMultiplexer) { @@ -354,14 +495,18 @@ ODatabaseForm::~ODatabaseForm() //------------------------------------------------------------------------ ::rtl::OUString ODatabaseForm::GetDataURLEncoded(const Reference<XControl>& SubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt) { - + return GetDataEncoded(true,SubmitButton,MouseEvt); +} +// ----------------------------------------------------------------------------- +::rtl::OUString ODatabaseForm::GetDataEncoded(bool _bURLEncoded,const Reference<XControl>& SubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt) +{ // Liste von successful Controls fuellen HtmlSuccessfulObjList aSuccObjList; FillSuccessfulList( aSuccObjList, SubmitButton, MouseEvt ); // Liste zu ::rtl::OUString zusammensetzen - ::rtl::OUString aResult; + ::rtl::OUStringBuffer aResult; ::rtl::OUString aName; ::rtl::OUString aValue; @@ -384,17 +529,24 @@ ODatabaseForm::~ODatabaseForm() } Encode( aName ); Encode( aValue ); - aResult += aName; - aResult += UniString('='); - aResult += aValue; + + aResult.append(aName); + aResult.append(sal_Unicode('=')); + aResult.append(aValue); + if (pSuccObj < aSuccObjList.end() - 1) - aResult += UniString('&'); + { + if ( _bURLEncoded ) + aResult.append(sal_Unicode('&')); + else + aResult.appendAscii("\r\n"); + } } aSuccObjList.clear(); - return aResult; + return aResult.makeStringAndClear(); } //============================================================================== @@ -402,46 +554,7 @@ ODatabaseForm::~ODatabaseForm() //------------------------------------------------------------------------ ::rtl::OUString ODatabaseForm::GetDataTextEncoded(const Reference<XControl>& SubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt) { - - // Liste von successful Controls fuellen - HtmlSuccessfulObjList aSuccObjList; - FillSuccessfulList( aSuccObjList, SubmitButton, MouseEvt ); - // Liste zu ::rtl::OUString zusammensetzen - ::rtl::OUString aResult; - ::rtl::OUString aName; - ::rtl::OUString aValue; - - for ( HtmlSuccessfulObjListIterator pSuccObj = aSuccObjList.begin(); - pSuccObj < aSuccObjList.end(); - ++pSuccObj - ) - { - aName = pSuccObj->aName; - aValue = pSuccObj->aValue; - if (pSuccObj->nRepresentation == SUCCESSFUL_REPRESENT_FILE && aValue.getLength()) - { - // Bei File-URLs wird der Dateiname und keine URL uebertragen, - // weil Netscape dies so macht. - INetURLObject aURL; - aURL.SetSmartProtocol(INET_PROT_FILE); - aURL.SetSmartURL(aValue); - if( INET_PROT_FILE == aURL.GetProtocol() ) - aValue = INetURLObject::decode(aURL.PathToFileName(), '%', INetURLObject::DECODE_UNAMBIGUOUS); - } - Encode( aName ); - Encode( aValue ); - aResult += pSuccObj->aName; - aResult += UniString('='); - aResult += pSuccObj->aValue; - if (pSuccObj < aSuccObjList.end() - 1) - aResult += ::rtl::OUString::createFromAscii("\r\n"); - } - - - // Liste loeschen - aSuccObjList.clear(); - - return aResult; + return GetDataEncoded(false,SubmitButton,MouseEvt); } //------------------------------------------------------------------------ @@ -1368,6 +1481,28 @@ void SAL_CALL ODatabaseForm::setPropertyValues( const Sequence< PropertyValue >& } //------------------------------------------------------------------------------ +Any SAL_CALL ODatabaseForm::getWarnings( ) throw (SQLException, RuntimeException) +{ + return m_aWarnings.getWarnings(); +} + +//------------------------------------------------------------------------------ +void SAL_CALL ODatabaseForm::clearWarnings( ) throw (SQLException, RuntimeException) +{ + m_aWarnings.clearWarnings(); +} + +//------------------------------------------------------------------------------ +Reference< XCloneable > SAL_CALL ODatabaseForm::createClone( ) throw (RuntimeException) +{ + ODatabaseForm* pClone = new ODatabaseForm( *this ); + osl_incrementInterlockedCount( &pClone->m_refCount ); + pClone->clonedFrom( *this ); + osl_decrementInterlockedCount( &pClone->m_refCount ); + return pClone; +} + +//------------------------------------------------------------------------------ void ODatabaseForm::fire( sal_Int32* pnHandles, const Any* pNewValues, const Any* pOldValues, sal_Int32 nCount, sal_Bool bVetoable ) { // same as in getFastPropertyValue(INT32) : if we're resetting currently don't fire any changes of the @@ -2040,7 +2175,36 @@ void SAL_CALL ODatabaseForm::submit( const Reference<XControl>& Control, submit_impl( Control, MouseEvt, true ); } } +// ----------------------------------------------------------------------------- +void lcl_dispatch(const Reference< XFrame >& xFrame,const Reference<XURLTransformer>& xTransformer,const ::rtl::OUString& aURLStr,const ::rtl::OUString& aReferer,const ::rtl::OUString& aTargetName + ,const ::rtl::OUString& aData,rtl_TextEncoding _eEncoding) +{ + URL aURL; + aURL.Complete = aURLStr; + xTransformer->parseStrict(aURL); + + Reference< XDispatch > xDisp = Reference< XDispatchProvider > (xFrame,UNO_QUERY)->queryDispatch(aURL, aTargetName, + FrameSearchFlag::SELF | FrameSearchFlag::PARENT | FrameSearchFlag::CHILDREN | + FrameSearchFlag::SIBLINGS | FrameSearchFlag::CREATE | FrameSearchFlag::TASKS); + + if (xDisp.is()) + { + Sequence<PropertyValue> aArgs(2); + aArgs.getArray()[0].Name = ::rtl::OUString::createFromAscii("Referer"); + aArgs.getArray()[0].Value <<= aReferer; + + // build a sequence from the to-be-submitted string + ByteString a8BitData(aData.getStr(), (sal_uInt16)aData.getLength(), _eEncoding); + // always ANSI #58641 + Sequence< sal_Int8 > aPostData((sal_Int8*)a8BitData.GetBuffer(), a8BitData.Len()); + Reference< XInputStream > xPostData = new SequenceInputStream(aPostData); + aArgs.getArray()[1].Name = ::rtl::OUString::createFromAscii("PostData"); + aArgs.getArray()[1].Value <<= xPostData; + + xDisp->dispatch(aURL, aArgs); + } // if (xDisp.is()) +} //------------------------------------------------------------------------------ void ODatabaseForm::submit_impl(const Reference<XControl>& Control, const ::com::sun::star::awt::MouseEvent& MouseEvt, bool _bAproveByListeners) { @@ -2088,6 +2252,9 @@ void ODatabaseForm::submit_impl(const Reference<XControl>& Control, const ::com: if (!xModel.is()) return; + Reference< XFrame > xFrame = xModel->getCurrentController()->getFrame(); + if (!xFrame.is()) + return; Reference<XURLTransformer> xTransformer(m_xServiceFactory->createInstance( @@ -2103,10 +2270,6 @@ void ODatabaseForm::submit_impl(const Reference<XControl>& Control, const ::com: aData = GetDataURLEncoded( Control, MouseEvt ); } - Reference< XFrame > xFrame = xModel->getCurrentController()->getFrame(); - if (!xFrame.is()) - return; - URL aURL; // FormMethod GET if( eSubmitMethod == FormSubmitMethod_GET ) @@ -2132,38 +2295,11 @@ void ODatabaseForm::submit_impl(const Reference<XControl>& Control, const ::com: // FormMethod POST else if( eSubmitMethod == FormSubmitMethod_POST ) { - aURL.Complete = aURLStr; - xTransformer->parseStrict(aURL); - - Reference< XDispatch > xDisp = Reference< XDispatchProvider > (xFrame,UNO_QUERY)->queryDispatch(aURL, aTargetName, - FrameSearchFlag::SELF | FrameSearchFlag::PARENT | FrameSearchFlag::CHILDREN | - FrameSearchFlag::SIBLINGS | FrameSearchFlag::CREATE | FrameSearchFlag::TASKS); - - if (xDisp.is()) - { - Sequence<PropertyValue> aArgs(2); - aArgs.getArray()[0].Name = ::rtl::OUString::createFromAscii("Referer"); - aArgs.getArray()[0].Value <<= aReferer; - - // build a sequence from the to-be-submitted string - ByteString a8BitData(aData.getStr(), (sal_uInt16)aData.getLength(), RTL_TEXTENCODING_MS_1252); - // always ANSI #58641 - Sequence< sal_Int8 > aPostData((sal_Int8*)a8BitData.GetBuffer(), a8BitData.Len()); - Reference< XInputStream > xPostData = new SequenceInputStream(aPostData); - - aArgs.getArray()[1].Name = ::rtl::OUString::createFromAscii("PostData"); - aArgs.getArray()[1].Value <<= xPostData; - - xDisp->dispatch(aURL, aArgs); - } + lcl_dispatch(xFrame,xTransformer,aURLStr,aReferer,aTargetName,aData,RTL_TEXTENCODING_MS_1252); } } else if( eSubmitEncoding == FormSubmitEncoding_MULTIPART ) { - Reference< XFrame > xFrame = xModel->getCurrentController()->getFrame(); - if (!xFrame.is()) - return; - URL aURL; aURL.Complete = aURLStr; xTransformer->parseStrict(aURL); @@ -2206,35 +2342,7 @@ void ODatabaseForm::submit_impl(const Reference<XControl>& Control, const ::com: aData = GetDataTextEncoded( Reference<XControl> (), MouseEvt ); } - Reference< XFrame > xFrame = xModel->getCurrentController()->getFrame(); - if (!xFrame.is()) - return; - - URL aURL; - - aURL.Complete = aURLStr; - xTransformer->parseStrict(aURL); - - Reference< XDispatch > xDisp = Reference< XDispatchProvider > (xFrame,UNO_QUERY)->queryDispatch(aURL, aTargetName, - FrameSearchFlag::SELF | FrameSearchFlag::PARENT | FrameSearchFlag::CHILDREN | - FrameSearchFlag::SIBLINGS | FrameSearchFlag::CREATE | FrameSearchFlag::TASKS); - - if (xDisp.is()) - { - Sequence<PropertyValue> aArgs(2); - aArgs.getArray()[0].Name = ::rtl::OUString::createFromAscii("Referer"); - aArgs.getArray()[0].Value <<= aReferer; - - // build a sequence from the to-be-submitted string - ByteString aSystemEncodedData(aData.getStr(), (sal_uInt16)aData.getLength(), osl_getThreadTextEncoding()); - Sequence< sal_Int8 > aPostData((sal_Int8*)aSystemEncodedData.GetBuffer(), aSystemEncodedData.Len()); - Reference< XInputStream > xPostData = new SequenceInputStream(aPostData); - - aArgs.getArray()[1].Name = ::rtl::OUString::createFromAscii("PostData"); - aArgs.getArray()[1].Value <<= xPostData; - - xDisp->dispatch(aURL, aArgs); - } + lcl_dispatch(xFrame,xTransformer,aURLStr,aReferer,aTargetName,aData,osl_getThreadTextEncoding()); } else { DBG_ERROR("ODatabaseForm::submit_Impl : wrong encoding !"); @@ -2888,6 +2996,10 @@ void ODatabaseForm::reload_impl(sal_Bool bMoveToFirst, const Reference< XInterac if (!isLoaded()) return; + DocumentModifyGuard aModifyGuard( *this ); + // ensures the document is not marked as "modified" just because we change some control's content during + // reloading ... + EventObject aEvent(static_cast<XWeak*>(this)); { // only if there is no approve listener we can post the event at this time @@ -3694,7 +3806,7 @@ void SAL_CALL ODatabaseForm::propertyChange( const PropertyChangeEvent& evt ) th //------------------------------------------------------------------------------ ::rtl::OUString SAL_CALL ODatabaseForm::getImplementationName_Static() { - return DATABASEFORM_IMPLEMENTATION_NAME; + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.forms.ODatabaseForm" ) ); } //------------------------------------------------------------------------------ diff --git a/forms/source/component/DatabaseForm.hxx b/forms/source/component/DatabaseForm.hxx index 47b43fb53f03..a19d20930538 100644 --- a/forms/source/component/DatabaseForm.hxx +++ b/forms/source/component/DatabaseForm.hxx @@ -63,13 +63,15 @@ #include <com/sun/star/task/XInteractionHandler.hpp> #include <com/sun/star/beans/XPropertyContainer.hpp> #include <com/sun/star/beans/XPropertyAccess.hpp> +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> #include <tools/link.hxx> #include "InterfaceContainer.hxx" -#include "connectivity/parameters.hxx" -#include "connectivity/filtermanager.hxx" +#include <connectivity/parameters.hxx> +#include <connectivity/filtermanager.hxx> +#include <connectivity/warningscontainer.hxx> #ifndef FORMS_SOURCE_MISC_LISTENERCONTAINERS_HXX #include "listenercontainers.hxx" @@ -79,7 +81,7 @@ #include <comphelper/uno3.hxx> #include <comphelper/proparrhlp.hxx> #include <cppuhelper/implbase12.hxx> -#include <cppuhelper/implbase3.hxx> +#include <cppuhelper/implbase4.hxx> #include <cppuhelper/implbase7.hxx> namespace com { namespace sun { namespace star { namespace sdbc { @@ -143,9 +145,10 @@ typedef ::cppu::ImplHelper12 < ::com::sun::star::form::XForm > ODatabaseForm_BASE1; -typedef ::cppu::ImplHelper3 < ::com::sun::star::lang::XServiceInfo +typedef ::cppu::ImplHelper4 < ::com::sun::star::lang::XServiceInfo , ::com::sun::star::beans::XPropertyContainer , ::com::sun::star::beans::XPropertyAccess + , ::com::sun::star::sdbc::XWarningsSupplier > ODatabaseForm_BASE2; typedef ::cppu::ImplHelper7< ::com::sun::star::sdbc::XCloseable, @@ -188,6 +191,7 @@ class ODatabaseForm :public OFormComponents ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet> m_xAggregateAsRowSet; PropertyBagHelper m_aPropertyBagHelper; + ::dbtools::WarningsContainer m_aWarnings; OPropertyChangeMultiplexer* m_pAggregatePropertyMultiplexer; // Verwaltung der ControlGruppen OGroupManager* m_pGroupManager; @@ -228,6 +232,7 @@ class ODatabaseForm :public OFormComponents public: ODatabaseForm(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); + ODatabaseForm( const ODatabaseForm& _cloneSource ); ~ODatabaseForm(); // UNO binding @@ -440,6 +445,13 @@ public: virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProps ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); using OPropertySetAggregationHelper::setPropertyValues; + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearWarnings( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + // XCloneable + virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException); + inline void submitNBC( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& Control, const ::com::sun::star::awt::MouseEvent& MouseEvt ); protected: @@ -520,6 +532,7 @@ private: void onError(const ::com::sun::star::sdbc::SQLException&, const ::rtl::OUString& _rContextDescription); // html tools + ::rtl::OUString GetDataEncoded(bool _bURLEncoded,const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& SubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt); ::rtl::OUString GetDataURLEncoded(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& SubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt); ::rtl::OUString GetDataTextEncoded(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& SubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt); ::com::sun::star::uno::Sequence<sal_Int8> GetDataMultiPartEncoded(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& SubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt, @@ -538,6 +551,8 @@ private: void impl_createLoadTimer(); + void impl_construct(); + DECL_LINK( OnTimeout, void* ); protected: using OPropertySetHelper::getPropertyValues; diff --git a/forms/source/component/Edit.cxx b/forms/source/component/Edit.cxx index 4ada0ca85861..0f4abd687d65 100644 --- a/forms/source/component/Edit.cxx +++ b/forms/source/component/Edit.cxx @@ -519,7 +519,8 @@ void OEditModel::writeAggregate( const Reference< XObjectOutputStream >& _rxOutS // but for compatibility, we need to use an "old" aggregate for writing and reading Reference< XPropertySet > xFakedAggregate( - getORB()->createInstance( VCL_CONTROLMODEL_EDIT ), UNO_QUERY + getContext().createComponent( (rtl::OUString)VCL_CONTROLMODEL_EDIT ), + UNO_QUERY ); OSL_ENSURE( xFakedAggregate.is(), "OEditModel::writeAggregate: could not create an old EditControlModel!" ); if ( !xFakedAggregate.is() ) @@ -540,7 +541,8 @@ void OEditModel::readAggregate( const Reference< XObjectInputStream >& _rxInStre // but for compatibility, we need to use an "old" aggregate for writing and reading Reference< XPropertySet > xFakedAggregate( - getORB()->createInstance( VCL_CONTROLMODEL_EDIT ), UNO_QUERY + getContext().createComponent( (rtl::OUString)VCL_CONTROLMODEL_EDIT ), + UNO_QUERY ); Reference< XPersistObject > xFakedPersist( xFakedAggregate, UNO_QUERY ); OSL_ENSURE( xFakedPersist.is(), "OEditModel::readAggregate: no XPersistObject, or no faked aggregate at all!" ); diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx index 4b1bc5515836..6e700c28f6d8 100644 --- a/forms/source/component/FormComponent.cxx +++ b/forms/source/component/FormComponent.cxx @@ -30,35 +30,39 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_forms.hxx" + +#include "componenttools.hxx" #include "FormComponent.hxx" -#include <tools/debug.hxx> -#include <tools/diagnose_ex.h> -#include <cppuhelper/queryinterface.hxx> +#include "frm_resource.hrc" +#include "frm_resource.hxx" +#include "property.hrc" +#include "services.hxx" + +/** === begin UNO includes === **/ #include <com/sun/star/awt/XTextComponent.hpp> +#include <com/sun/star/awt/XVclWindowPeer.hpp> #include <com/sun/star/awt/XWindow.hpp> -#include <com/sun/star/io/XMarkableStream.hpp> -#include <com/sun/star/form/XLoadable.hpp> #include <com/sun/star/form/XForm.hpp> -#include <com/sun/star/sdbc/DataType.hpp> +#include <com/sun/star/form/XLoadable.hpp> +#include <com/sun/star/io/XMarkableStream.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/sdb/XRowSetChangeBroadcaster.hpp> +#include <com/sun/star/sdb/XRowSetSupplier.hpp> #include <com/sun/star/sdbc/ColumnValue.hpp> +#include <com/sun/star/sdbc/DataType.hpp> #include <com/sun/star/util/XModifyBroadcaster.hpp> -#include <com/sun/star/awt/XVclWindowPeer.hpp> -#include <com/sun/star/lang/DisposedException.hpp> -#include <comphelper/property.hxx> +/** === end UNO includes === **/ + +#include <comphelper/basicio.hxx> #include <comphelper/guarding.hxx> +#include <comphelper/listenernotification.hxx> +#include <comphelper/property.hxx> #include <connectivity/dbtools.hxx> -#ifndef _FRM_PROPERTY_HRC_ -#include "property.hrc" -#endif -#include "services.hxx" -#include "componenttools.hxx" +#include <cppuhelper/queryinterface.hxx> #include <rtl/logfile.hxx> -#include <comphelper/basicio.hxx> -#include <comphelper/listenernotification.hxx> #include <toolkit/helper/emptyfontdescriptor.hxx> - -#include "frm_resource.hxx" -#include "frm_resource.hrc" +#include <tools/debug.hxx> +#include <tools/diagnose_ex.h> #include <functional> #include <algorithm> @@ -88,15 +92,67 @@ namespace frm using namespace ::dbtools; using namespace ::comphelper; -//========================================================================= + //========================================================================= + //= FieldChangeNotifier + //========================================================================= + //------------------------------------------------------------------------- + void ControlModelLock::impl_notifyAll_nothrow() + { + m_rModel.firePropertyChanges( m_aHandles, m_aOldValues, m_aNewValues, OControlModel::LockAccess() ); + } + + //------------------------------------------------------------------------- + void ControlModelLock::addPropertyNotification( const sal_Int32 _nHandle, const Any& _rOldValue, const Any& _rNewValue ) + { + sal_Int32 nOldLength = m_aHandles.getLength(); + if ( ( nOldLength != m_aOldValues.getLength() ) + || ( nOldLength != m_aNewValues.getLength() ) + ) + throw RuntimeException( ::rtl::OUString(), m_rModel ); + + m_aHandles.realloc( nOldLength + 1 ); + m_aHandles[ nOldLength ] = _nHandle; + m_aOldValues.realloc( nOldLength + 1 ); + m_aOldValues[ nOldLength ] = _rOldValue; + m_aNewValues.realloc( nOldLength + 1 ); + m_aNewValues[ nOldLength ] = _rNewValue; + } + + //========================================================================= + //= FieldChangeNotifier + //========================================================================= + //------------------------------------------------------------------------- + class FieldChangeNotifier + { + public: + FieldChangeNotifier( ControlModelLock& _rLock ) + :m_rLock( _rLock ) + ,m_rModel( dynamic_cast< OBoundControlModel& >( _rLock.getModel() ) ) + { + m_xOldField = m_rModel.getField(); + } + + ~FieldChangeNotifier() + { + Reference< XPropertySet > xNewField( m_rModel.getField() ); + if ( m_xOldField != xNewField ) + m_rLock.addPropertyNotification( PROPERTY_ID_BOUNDFIELD, makeAny( m_xOldField ), makeAny( xNewField ) ); + } + + private: + ControlModelLock& m_rLock; + OBoundControlModel& m_rModel; + Reference< XPropertySet > m_xOldField; + }; + +//============================================================================= //= base class for form layer controls -//========================================================================= +//============================================================================= DBG_NAME(frm_OControl) //------------------------------------------------------------------------------ OControl::OControl( const Reference< XMultiServiceFactory >& _rxFactory, const rtl::OUString& _rAggregateService, const sal_Bool _bSetDelegator ) :OComponentHelper(m_aMutex) ,m_aContext( _rxFactory ) - ,m_xServiceFactory(_rxFactory) { DBG_CTOR(frm_OControl, NULL); // VCL-Control aggregieren @@ -467,12 +523,14 @@ DBG_NAME(OControlModel) //------------------------------------------------------------------ Sequence<sal_Int8> SAL_CALL OControlModel::getImplementationId() throw(RuntimeException) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::getImplementationId" ); return OImplementationIds::getImplementationId(getTypes()); } //------------------------------------------------------------------ Sequence<Type> SAL_CALL OControlModel::getTypes() throw(RuntimeException) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::getTypes" ); TypeBag aTypes( _getTypes() ); Reference< XTypeProvider > xProv; @@ -485,6 +543,7 @@ Sequence<Type> SAL_CALL OControlModel::getTypes() throw(RuntimeException) //------------------------------------------------------------------------------ Sequence<Type> OControlModel::_getTypes() { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::_getTypes" ); return TypeBag( OComponentHelper::getTypes(), OPropertySetAggregationHelper::getTypes(), OControlModel_BASE::getTypes() @@ -494,6 +553,7 @@ Sequence<Type> OControlModel::_getTypes() //------------------------------------------------------------------ Any SAL_CALL OControlModel::queryAggregation(const Type& _rType) throw (RuntimeException) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::queryAggregation" ); // base class 1 Any aReturn(OComponentHelper::queryAggregation(_rType)); @@ -517,6 +577,7 @@ Any SAL_CALL OControlModel::queryAggregation(const Type& _rType) throw (RuntimeE //------------------------------------------------------------------------------ void OControlModel::readHelpTextCompatibly(const staruno::Reference< stario::XObjectInputStream >& _rxInStream) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::readHelpTextCompatibly" ); ::rtl::OUString sHelpText; ::comphelper::operator>>( _rxInStream, sHelpText); try @@ -533,6 +594,7 @@ void OControlModel::readHelpTextCompatibly(const staruno::Reference< stario::XOb //------------------------------------------------------------------------------ void OControlModel::writeHelpTextCompatibly(const staruno::Reference< stario::XObjectOutputStream >& _rxOutStream) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::writeHelpTextCompatibly" ); ::rtl::OUString sHelpText; try { @@ -554,7 +616,7 @@ OControlModel::OControlModel( :OComponentHelper(m_aMutex) ,OPropertySetAggregationHelper(OComponentHelper::rBHelper) ,m_aContext( _rxFactory ) - ,m_xServiceFactory(_rxFactory) + ,m_lockCount( 0 ) ,m_aPropertyBagHelper( *this ) ,m_nTabIndex(FRM_DEFAULT_TABINDEX) ,m_nClassId(FormComponentType::CONTROL) @@ -563,6 +625,7 @@ OControlModel::OControlModel( // the native look is ugly .... // #i37342# / 2004-11-19 / frank.schoenheit@sun.com { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::OControlModel" ); DBG_CTOR(OControlModel, NULL); if (_rUnoControlModelTypeName.getLength()) // the is a model we have to aggregate { @@ -599,11 +662,12 @@ OControlModel::OControlModel( const OControlModel* _pOriginal, const Reference< :OComponentHelper( m_aMutex ) ,OPropertySetAggregationHelper( OComponentHelper::rBHelper ) ,m_aContext( _rxFactory ) - ,m_xServiceFactory( _rxFactory ) + ,m_lockCount( 0 ) ,m_aPropertyBagHelper( *this ) ,m_nTabIndex( FRM_DEFAULT_TABINDEX ) ,m_nClassId( FormComponentType::CONTROL ) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::OControlModel(copy)" ); DBG_CTOR( OControlModel, NULL ); DBG_ASSERT( _pOriginal, "OControlModel::OControlModel: invalid original!" ); @@ -648,12 +712,14 @@ OControlModel::~OControlModel() //------------------------------------------------------------------ void OControlModel::clonedFrom( const OControlModel* /*_pOriginal*/ ) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::clonedFrom" ); // nothing to do in this base class } //------------------------------------------------------------------------------ void OControlModel::doResetDelegator() { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::doResetDelegator" ); if (m_xAggregate.is()) m_xAggregate->setDelegator(NULL); } @@ -661,6 +727,7 @@ void OControlModel::doResetDelegator() //------------------------------------------------------------------------------ void OControlModel::doSetDelegator() { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::doSetDelegator" ); increment(m_refCount); if (m_xAggregate.is()) { @@ -673,32 +740,32 @@ void OControlModel::doSetDelegator() //------------------------------------------------------------------------------ InterfaceRef SAL_CALL OControlModel::getParent() throw(RuntimeException) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::getParent" ); return m_xParent; } //------------------------------------------------------------------------------ void SAL_CALL OControlModel::setParent(const InterfaceRef& _rxParent) throw(com::sun::star::lang::NoSupportException, RuntimeException) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::setParent" ); osl::MutexGuard aGuard(m_aMutex); Reference<XComponent> xComp(m_xParent, UNO_QUERY); if (xComp.is()) xComp->removeEventListener(static_cast<XPropertiesChangeListener*>(this)); - { - xComp = xComp.query( _rxParent ); - RTL_LOGFILE_CONTEXT( aLogger, "OControlModel::setParent::logOnEventListener" ); - if ( xComp.is() ) - xComp->addEventListener(static_cast<XPropertiesChangeListener*>(this)); - } - m_xParent = _rxParent; + xComp = xComp.query( m_xParent ); + + if ( xComp.is() ) + xComp->addEventListener(static_cast<XPropertiesChangeListener*>(this)); } // XNamed //------------------------------------------------------------------------------ ::rtl::OUString SAL_CALL OControlModel::getName() throw(RuntimeException) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::getName" ); ::rtl::OUString aReturn; OPropertySetHelper::getFastPropertyValue(PROPERTY_ID_NAME) >>= aReturn; return aReturn; @@ -707,6 +774,7 @@ void SAL_CALL OControlModel::setParent(const InterfaceRef& _rxParent) throw(com: //------------------------------------------------------------------------------ void SAL_CALL OControlModel::setName(const ::rtl::OUString& _rName) throw(RuntimeException) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::setName" ); setFastPropertyValue(PROPERTY_ID_NAME, makeAny(_rName)); } @@ -714,6 +782,7 @@ void SAL_CALL OControlModel::setName(const ::rtl::OUString& _rName) throw(Runtim //------------------------------------------------------------------------------ sal_Bool SAL_CALL OControlModel::supportsService(const rtl::OUString& _rServiceName) throw ( RuntimeException) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::supportsService" ); Sequence<rtl::OUString> aSupported = getSupportedServiceNames(); const rtl::OUString* pSupported = aSupported.getConstArray(); for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) @@ -725,6 +794,7 @@ sal_Bool SAL_CALL OControlModel::supportsService(const rtl::OUString& _rServiceN //------------------------------------------------------------------------------ Sequence< ::rtl::OUString > OControlModel::getAggregateServiceNames() { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::getAggregateServiceNames" ); Sequence< ::rtl::OUString > aAggServices; Reference< XServiceInfo > xInfo; if ( query_aggregation( m_xAggregate, xInfo ) ) @@ -735,6 +805,7 @@ Sequence< ::rtl::OUString > OControlModel::getAggregateServiceNames() //------------------------------------------------------------------------------ Sequence<rtl::OUString> SAL_CALL OControlModel::getSupportedServiceNames() throw(RuntimeException) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::getSupportedServiceNames" ); return ::comphelper::concatSequences( getAggregateServiceNames(), getSupportedServiceNames_Static() @@ -744,6 +815,7 @@ Sequence<rtl::OUString> SAL_CALL OControlModel::getSupportedServiceNames() throw //------------------------------------------------------------------------------ Sequence< ::rtl::OUString > SAL_CALL OControlModel::getSupportedServiceNames_Static() throw( RuntimeException ) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::getSupportedServiceNames_Static" ); Sequence< ::rtl::OUString > aServiceNames( 2 ); aServiceNames[ 0 ] = FRM_SUN_FORMCOMPONENT; aServiceNames[ 1 ] = ::rtl::OUString::createFromAscii( "com.sun.star.form.FormControlModel" ); @@ -754,6 +826,7 @@ Sequence< ::rtl::OUString > SAL_CALL OControlModel::getSupportedServiceNames_Sta //------------------------------------------------------------------------------ void SAL_CALL OControlModel::disposing(const com::sun::star::lang::EventObject& _rSource) throw (RuntimeException) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::disposing" ); // release the parent if (_rSource.Source == m_xParent) { @@ -775,6 +848,7 @@ void SAL_CALL OControlModel::disposing(const com::sun::star::lang::EventObject& //----------------------------------------------------------------------------- void OControlModel::disposing() { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::disposing" ); OPropertySetAggregationHelper::disposing(); Reference<com::sun::star::lang::XComponent> xComp; @@ -789,6 +863,7 @@ void OControlModel::disposing() //------------------------------------------------------------------------------ void OControlModel::writeAggregate( const Reference< XObjectOutputStream >& _rxOutStream ) const { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::writeAggregate" ); Reference< XPersistObject > xPersist; if ( query_aggregation( m_xAggregate, xPersist ) ) xPersist->write( _rxOutStream ); @@ -797,6 +872,7 @@ void OControlModel::writeAggregate( const Reference< XObjectOutputStream >& _rxO //------------------------------------------------------------------------------ void OControlModel::readAggregate( const Reference< XObjectInputStream >& _rxInStream ) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::readAggregate" ); Reference< XPersistObject > xPersist; if ( query_aggregation( m_xAggregate, xPersist ) ) xPersist->read( _rxInStream ); @@ -806,6 +882,7 @@ void OControlModel::readAggregate( const Reference< XObjectInputStream >& _rxInS void SAL_CALL OControlModel::write(const Reference<stario::XObjectOutputStream>& _rxOutStream) throw(stario::IOException, RuntimeException) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::write" ); osl::MutexGuard aGuard(m_aMutex); // 1. Schreiben des UnoControls @@ -851,6 +928,7 @@ void SAL_CALL OControlModel::write(const Reference<stario::XObjectOutputStream>& //------------------------------------------------------------------------------ void OControlModel::read(const Reference<stario::XObjectInputStream>& InStream) throw (::com::sun::star::io::IOException, RuntimeException) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::read" ); osl::MutexGuard aGuard(m_aMutex); Reference<stario::XMarkableStream> xMark(InStream, UNO_QUERY); @@ -904,6 +982,7 @@ void OControlModel::read(const Reference<stario::XObjectInputStream>& InStream) //------------------------------------------------------------------------------ PropertyState OControlModel::getPropertyStateByHandle( sal_Int32 _nHandle ) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::getPropertyStateByHandle" ); // simply compare the current and the default value Any aCurrentValue = getPropertyDefaultByHandle( _nHandle ); Any aDefaultValue; getFastPropertyValue( aDefaultValue, _nHandle ); @@ -920,6 +999,7 @@ PropertyState OControlModel::getPropertyStateByHandle( sal_Int32 _nHandle ) //------------------------------------------------------------------------------ void OControlModel::setPropertyToDefaultByHandle( sal_Int32 _nHandle) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::setPropertyToDefaultByHandle" ); Any aDefault = getPropertyDefaultByHandle( _nHandle ); Any aConvertedValue, aOldValue; @@ -933,6 +1013,7 @@ void OControlModel::setPropertyToDefaultByHandle( sal_Int32 _nHandle) //------------------------------------------------------------------------------ Any OControlModel::getPropertyDefaultByHandle( sal_Int32 _nHandle ) const { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::getPropertyDefaultByHandle" ); Any aReturn; switch ( _nHandle ) { @@ -965,6 +1046,7 @@ Any OControlModel::getPropertyDefaultByHandle( sal_Int32 _nHandle ) const //------------------------------------------------------------------------------ void OControlModel::getFastPropertyValue( Any& _rValue, sal_Int32 _nHandle ) const { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::getFastPropertyValue" ); switch ( _nHandle ) { case PROPERTY_ID_NAME: @@ -996,6 +1078,7 @@ sal_Bool OControlModel::convertFastPropertyValue( Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue) throw (com::sun::star::lang::IllegalArgumentException) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::convertFastPropertyValue" ); sal_Bool bModified(sal_False); switch (_nHandle) { @@ -1025,6 +1108,7 @@ sal_Bool OControlModel::convertFastPropertyValue( void OControlModel::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const Any& _rValue) throw (Exception) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::setFastPropertyValue_NoBroadcast" ); switch (_nHandle) { case PROPERTY_ID_NAME: @@ -1057,6 +1141,7 @@ void OControlModel::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const A //------------------------------------------------------------------------------ void OControlModel::describeFixedProperties( Sequence< Property >& _rProps ) const { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::describeFixedProperties" ); BEGIN_DESCRIBE_BASE_PROPERTIES( 4 ) DECL_PROP2 (CLASSID, sal_Int16, READONLY, TRANSIENT); DECL_PROP1 (NAME, ::rtl::OUString, BOUND); @@ -1068,6 +1153,7 @@ void OControlModel::describeFixedProperties( Sequence< Property >& _rProps ) con //------------------------------------------------------------------------------ void OControlModel::describeAggregateProperties( Sequence< Property >& /* [out] */ _rAggregateProps ) const { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::describeAggregateProperties" ); if ( m_xAggregateSet.is() ) { Reference< XPropertySetInfo > xPSI( m_xAggregateSet->getPropertySetInfo() ); @@ -1079,12 +1165,14 @@ void OControlModel::describeAggregateProperties( Sequence< Property >& /* [out] //------------------------------------------------------------------------------ ::osl::Mutex& OControlModel::getMutex() { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::getMutex" ); return m_aMutex; } //------------------------------------------------------------------------------ void OControlModel::describeFixedAndAggregateProperties( Sequence< Property >& _out_rFixedProperties, Sequence< Property >& _out_rAggregateProperties ) const { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::describeFixedAndAggregateProperties" ); describeFixedProperties( _out_rFixedProperties ); describeAggregateProperties( _out_rAggregateProperties ); } @@ -1092,45 +1180,81 @@ void OControlModel::describeFixedAndAggregateProperties( Sequence< Property >& _ //------------------------------------------------------------------------------ Reference< XMultiPropertySet > OControlModel::getPropertiesInterface() { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::getPropertiesInterface" ); return Reference< XMultiPropertySet >( *this, UNO_QUERY ); } //------------------------------------------------------------------------------ Reference< XPropertySetInfo> SAL_CALL OControlModel::getPropertySetInfo() throw( RuntimeException) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::getPropertySetInfo" ); return createPropertySetInfo( getInfoHelper() ); } //------------------------------------------------------------------------------ ::cppu::IPropertyArrayHelper& OControlModel::getInfoHelper() { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::getInfoHelper" ); return m_aPropertyBagHelper.getInfoHelper(); } //-------------------------------------------------------------------- void SAL_CALL OControlModel::addProperty( const ::rtl::OUString& _rName, ::sal_Int16 _nAttributes, const Any& _rInitialValue ) throw (PropertyExistException, IllegalTypeException, IllegalArgumentException, RuntimeException) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::addProperty" ); m_aPropertyBagHelper.addProperty( _rName, _nAttributes, _rInitialValue ); } //-------------------------------------------------------------------- void SAL_CALL OControlModel::removeProperty( const ::rtl::OUString& _rName ) throw (UnknownPropertyException, NotRemoveableException, RuntimeException) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::removeProperty" ); m_aPropertyBagHelper.removeProperty( _rName ); } //-------------------------------------------------------------------- Sequence< PropertyValue > SAL_CALL OControlModel::getPropertyValues() throw (RuntimeException) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::getPropertyValues" ); return m_aPropertyBagHelper.getPropertyValues(); } //-------------------------------------------------------------------- void SAL_CALL OControlModel::setPropertyValues( const Sequence< PropertyValue >& _rProps ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::setPropertyValues" ); m_aPropertyBagHelper.setPropertyValues( _rProps ); } +//-------------------------------------------------------------------- +void OControlModel::lockInstance( LockAccess ) +{ + m_aMutex.acquire(); + osl_incrementInterlockedCount( &m_lockCount ); +} + +//-------------------------------------------------------------------- +oslInterlockedCount OControlModel::unlockInstance( LockAccess ) +{ + OSL_ENSURE( m_lockCount > 0, "OControlModel::unlockInstance: not locked!" ); + oslInterlockedCount lockCount = osl_decrementInterlockedCount( &m_lockCount ); + m_aMutex.release(); + return lockCount; +} + +//-------------------------------------------------------------------- +void OControlModel::firePropertyChanges( const Sequence< sal_Int32 >& _rHandles, const Sequence< Any >& _rOldValues, + const Sequence< Any >& _rNewValues, LockAccess ) +{ + OPropertySetHelper::fire( + const_cast< Sequence< sal_Int32 >& >( _rHandles ).getArray(), + _rNewValues.getConstArray(), + _rOldValues.getConstArray(), + _rHandles.getLength(), + sal_False + ); +} + //================================================================== //= OBoundControlModel //================================================================== @@ -1141,6 +1265,7 @@ Any SAL_CALL OBoundControlModel::queryAggregation( const Type& _rType ) throw (R Any aReturn( OControlModel::queryAggregation(_rType) ); if (!aReturn.hasValue()) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::queryAggregation" ); aReturn = OBoundControlModel_BASE1::queryInterface(_rType); if ( !aReturn.hasValue() && m_bCommitable ) @@ -1163,15 +1288,17 @@ OBoundControlModel::OBoundControlModel( const sal_Bool _bCommitable, const sal_Bool _bSupportExternalBinding, const sal_Bool _bSupportsValidation ) :OControlModel( _rxFactory, _rUnoControlModelTypeName, _rDefault, sal_False ) ,OPropertyChangeListener( m_aMutex ) + ,m_xField() + ,m_xAmbientForm() ,m_nValuePropertyAggregateHandle( -1 ) ,m_nFieldType( DataType::OTHER ) ,m_bValuePropertyMayBeVoid( false ) + ,m_aResetHelper( *this, m_aMutex ) ,m_aUpdateListeners(m_aMutex) - ,m_aResetListeners(m_aMutex) ,m_aFormComponentListeners( m_aMutex ) ,m_bInputRequired( sal_True ) ,m_pAggPropMultiplexer( NULL ) - ,m_bLoadListening( sal_False ) + ,m_bFormListening( false ) ,m_bLoaded(sal_False) ,m_bRequired(sal_False) ,m_bCommitable(_bCommitable) @@ -1196,16 +1323,18 @@ OBoundControlModel::OBoundControlModel( const OBoundControlModel* _pOriginal, const Reference< XMultiServiceFactory>& _rxFactory ) :OControlModel( _pOriginal, _rxFactory, sal_True, sal_False ) ,OPropertyChangeListener( m_aMutex ) + ,m_xField() + ,m_xAmbientForm() ,m_nValuePropertyAggregateHandle( _pOriginal->m_nValuePropertyAggregateHandle ) ,m_nFieldType( DataType::OTHER ) ,m_bValuePropertyMayBeVoid( _pOriginal->m_bValuePropertyMayBeVoid ) + ,m_aResetHelper( *this, m_aMutex ) ,m_aUpdateListeners( m_aMutex ) - ,m_aResetListeners( m_aMutex ) ,m_aFormComponentListeners( m_aMutex ) ,m_xValidator( _pOriginal->m_xValidator ) ,m_bInputRequired( sal_True ) ,m_pAggPropMultiplexer( NULL ) - ,m_bLoadListening( sal_False ) + ,m_bFormListening( false ) ,m_bLoaded( sal_False ) ,m_bRequired( sal_False ) ,m_bCommitable( _pOriginal->m_bCommitable ) @@ -1382,6 +1511,7 @@ Sequence< Type > OBoundControlModel::_getTypes() //----------------------------------------------------------------------------- void OBoundControlModel::disposing() { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::_getTypes" ); OControlModel::disposing(); ::osl::ClearableMutexGuard aGuard(m_aMutex); @@ -1391,11 +1521,11 @@ void OBoundControlModel::disposing() // notify all our listeners com::sun::star::lang::EventObject aEvt( static_cast< XWeak* >( this ) ); - m_aResetListeners.disposeAndClear( aEvt ); m_aUpdateListeners.disposeAndClear( aEvt ); + m_aResetHelper.disposing(); // disconnect from our database column - // TODO: could we replace the following 5 lines with a call to disconnectDatabaseColumn? + // TODO: could we replace the following 5 lines with a call to impl_disconnectDatabaseColumn_noNotify? // The only more thing which it does is calling onDisconnectedDbColumn - could this // cause trouble? At least when we continue to call OControlModel::disposing before, it *may*. if ( hasField() ) @@ -1421,7 +1551,7 @@ void OBoundControlModel::disposing() //------------------------------------------------------------------------------ void OBoundControlModel::_propertyChanged( const PropertyChangeEvent& _rEvt ) throw ( RuntimeException ) { - ::osl::ResettableMutexGuard aGuard( m_aMutex ); + ControlModelLock aLock( *this ); OSL_ENSURE( _rEvt.PropertyName == m_sValuePropertyName, "OBoundControlModel::_propertyChanged: where did this come from (1)?" ); @@ -1435,7 +1565,7 @@ void OBoundControlModel::_propertyChanged( const PropertyChangeEvent& _rEvt ) th { // the control value changed, while we have an external value binding // -> forward the value to it if ( m_eControlValueChangeInstigator != eExternalBinding ) - transferControlValueToExternal( aGuard ); + transferControlValueToExternal( aLock ); } else if ( !m_bCommitable && m_xColumnUpdate.is() ) { // the control value changed, while we are bound to a database column, @@ -1465,56 +1595,71 @@ void OBoundControlModel::startAggregatePropertyListening( const ::rtl::OUString& } //------------------------------------------------------------------------------ -void OBoundControlModel::startLoadListening( ) +void OBoundControlModel::doFormListening( const bool _bStart ) { - OSL_PRECOND( !isLoadListening(), "OBoundControlModel::startLoadListening: already listening!" ); - OSL_PRECOND( m_xParent.is(), "OBoundControlModel::startLoadListening: no parent to listen at!" ); - OSL_PRECOND( !hasExternalValueBinding(), "OBoundControlModel::startLoadListening: external value binding should overrule the database binding!" ); + OSL_PRECOND( !hasExternalValueBinding(), "OBoundControlModel::doFormListening: external value binding should overrule the database binding!" ); - Reference< XLoadable > xLoadable( m_xParent, UNO_QUERY ); - if ( xLoadable.is() ) - { - RTL_LOGFILE_CONTEXT( aLogger, "forms::OBoundControlModel::startLoadListening" ); - xLoadable->addLoadListener( this ); - m_bLoadListening = sal_True; - } -} + if ( isFormListening() == _bStart ) + return; -//------------------------------------------------------------------------------ -void OBoundControlModel::stopLoadListening( ) -{ - OSL_PRECOND( isLoadListening(), "OBoundControlModel::stopLoadListening: not listening!" ); + if ( m_xAmbientForm.is() ) + _bStart ? m_xAmbientForm->addLoadListener( this ) : m_xAmbientForm->removeLoadListener( this ); - Reference< XLoadable > xLoadable( m_xParent, UNO_QUERY ); - if ( xLoadable.is() && isLoadListening() ) + Reference< XLoadable > xParentLoadable( getParent(), UNO_QUERY ); + if ( getParent().is() && !xParentLoadable.is() ) { - xLoadable->removeLoadListener( this ); - m_bLoadListening = sal_False; + // if our parent does not directly support the XLoadable interface, then it might support the + // XRowSetSupplier/XRowSetChangeBroadcaster interfaces. In this case we have to listen for changes + // broadcasted by the latter. + Reference< XRowSetChangeBroadcaster > xRowSetBroadcaster( getParent(), UNO_QUERY ); + if ( xRowSetBroadcaster.is() ) + _bStart ? xRowSetBroadcaster->addRowSetChangeListener( this ) : xRowSetBroadcaster->removeRowSetChangeListener( this ); } + + m_bFormListening = _bStart && m_xAmbientForm.is(); } // XChild //------------------------------------------------------------------------------ void SAL_CALL OBoundControlModel::setParent(const Reference<XInterface>& _rxParent) throw(com::sun::star::lang::NoSupportException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); + ControlModelLock aLock( *this ); + FieldChangeNotifier aBoundFieldNotifier( aLock ); + + if ( getParent() == _rxParent ) + return; + + // disconnect from database column (which is controlled by parent, directly or indirectly) + if ( hasField() ) + impl_disconnectDatabaseColumn_noNotify(); // log off old listeners - if ( isLoadListening() ) - stopLoadListening( ); + if ( isFormListening() ) + doFormListening( false ); - OControlModel::setParent(_rxParent); + // actually set the new parent + OControlModel::setParent( _rxParent ); - // log on new listeners - only in case we do not have an external value binding - if ( m_xParent.is() && !hasExternalValueBinding() ) - startLoadListening( ); + // a new parent means a new ambient form + impl_determineAmbientForm_nothrow(); + + if ( !hasExternalValueBinding() ) + { + // log on new listeners + doFormListening( true ); + + // re-connect to database column of the new parent + if ( m_xAmbientForm.is() && m_xAmbientForm->isLoaded() ) + impl_connectDatabaseColumn_noNotify( false ); + } } // XEventListener //------------------------------------------------------------------------------ void SAL_CALL OBoundControlModel::disposing(const com::sun::star::lang::EventObject& _rEvent) throw (RuntimeException) { - ::osl::ClearableMutexGuard aGuard( m_aMutex ); + ControlModelLock aLock( *this ); + if ( _rEvent.Source == getField() ) { resetField(); @@ -1524,11 +1669,8 @@ void SAL_CALL OBoundControlModel::disposing(const com::sun::star::lang::EventObj Reference<XPropertySet> xOldValue = m_xLabelControl; m_xLabelControl = NULL; - // fire a property change event - Any aOldValue; aOldValue <<= xOldValue; - Any aNewValue; aNewValue <<= m_xLabelControl; - sal_Int32 nHandle = PROPERTY_ID_CONTROLLABEL; - OPropertySetHelper::fire( &nHandle, &aNewValue, &aOldValue, 1, sal_False ); + // fire a propertyChanged (when we leave aLock's scope) + aLock.addPropertyNotification( PROPERTY_ID_CONTROLLABEL, makeAny( xOldValue ), makeAny( m_xLabelControl ) ); } else if ( _rEvent.Source == m_xExternalBinding ) { // *first* check for the external binding @@ -1547,6 +1689,7 @@ void SAL_CALL OBoundControlModel::disposing(const com::sun::star::lang::EventObj //------------------------------------------------------------------------------ StringSequence SAL_CALL OBoundControlModel::getSupportedServiceNames() throw(RuntimeException) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::disposing" ); return ::comphelper::concatSequences( getAggregateServiceNames(), getSupportedServiceNames_Static() @@ -1569,6 +1712,7 @@ Sequence< ::rtl::OUString > SAL_CALL OBoundControlModel::getSupportedServiceName //------------------------------------------------------------------------------ void SAL_CALL OBoundControlModel::write( const Reference<stario::XObjectOutputStream>& _rxOutStream ) throw(stario::IOException, RuntimeException) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::getSupportedServiceNames_Static" ); OControlModel::write(_rxOutStream); osl::MutexGuard aGuard(m_aMutex); @@ -1669,6 +1813,7 @@ void SAL_CALL OBoundControlModel::read( const Reference< stario::XObjectInputStr //------------------------------------------------------------------------------ void OBoundControlModel::getFastPropertyValue(Any& rValue, sal_Int32 nHandle) const { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OBoundControlModel::getFastPropertyValue" ); switch (nHandle) { case PROPERTY_ID_INPUT_REQUIRED: @@ -1737,6 +1882,7 @@ sal_Bool OBoundControlModel::convertFastPropertyValue( //------------------------------------------------------------------------------ Any OBoundControlModel::getPropertyDefaultByHandle( sal_Int32 _nHandle ) const { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::convertFastPropertyValue" ); Any aDefault; switch ( _nHandle ) { @@ -1844,6 +1990,7 @@ void OBoundControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, co //------------------------------------------------------------------------------ void SAL_CALL OBoundControlModel::propertyChange( const PropertyChangeEvent& evt ) throw(RuntimeException) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "OControlModel::setFastPropertyValue_NoBroadcast" ); // if the DBColumn value changed, transfer it to the control if ( evt.PropertyName.equals( PROPERTY_VALUE ) ) { @@ -1884,6 +2031,31 @@ void SAL_CALL OBoundControlModel::propertyChange( const PropertyChangeEvent& evt } } +//------------------------------------------------------------------------------ +void SAL_CALL OBoundControlModel::onRowSetChanged( const EventObject& /*i_Event*/ ) throw (RuntimeException) +{ + ControlModelLock aLock( *this ); + FieldChangeNotifier aBoundFieldNotifier( aLock ); + + // disconnect from database column (which is controlled by parent, directly or indirectly) + if ( hasField() ) + impl_disconnectDatabaseColumn_noNotify(); + + // log off old listeners + if ( isFormListening() ) + doFormListening( false ); + + // determine the new ambient form + impl_determineAmbientForm_nothrow(); + + // log on new listeners + doFormListening( true ); + + // re-connect to database column if needed and possible + if ( m_xAmbientForm.is() && m_xAmbientForm->isLoaded() ) + impl_connectDatabaseColumn_noNotify( false ); +} + // XBoundComponent //------------------------------------------------------------------------------ void SAL_CALL OBoundControlModel::addUpdateListener(const Reference<XUpdateListener>& _rxListener) throw(RuntimeException) @@ -1900,7 +2072,7 @@ void SAL_CALL OBoundControlModel::removeUpdateListener(const Reference< XUpdateL //------------------------------------------------------------------------------ sal_Bool SAL_CALL OBoundControlModel::commit() throw(RuntimeException) { - ::osl::ResettableMutexGuard aGuard( m_aMutex ); + ControlModelLock aLock( *this ); OSL_PRECOND( m_bCommitable, "OBoundControlModel::commit: invalid call (I'm not commitable !) " ); if ( hasExternalValueBinding() ) @@ -1911,7 +2083,7 @@ sal_Bool SAL_CALL OBoundControlModel::commit() throw(RuntimeException) if ( !m_sValuePropertyName.getLength() ) // but for those derivees which did not use this feature, we need an // explicit transfer - transferControlValueToExternal( aGuard ); + transferControlValueToExternal( aLock ); return sal_True; } @@ -1926,12 +2098,12 @@ sal_Bool SAL_CALL OBoundControlModel::commit() throw(RuntimeException) aEvent.Source = static_cast< XWeak* >( this ); sal_Bool bSuccess = sal_True; - aGuard.clear(); + aLock.release(); // >>>>>>>> ----- UNSAFE ----- >>>>>>>> while (aIter.hasMoreElements() && bSuccess) bSuccess = static_cast< XUpdateListener* >( aIter.next() )->approveUpdate( aEvent ); // <<<<<<<< ----- UNSAFE ----- <<<<<<<< - aGuard.reset(); + aLock.acquire(); if ( bSuccess ) { @@ -1948,7 +2120,7 @@ sal_Bool SAL_CALL OBoundControlModel::commit() throw(RuntimeException) if ( bSuccess ) { - aGuard.clear(); + aLock.release(); m_aUpdateListeners.notifyEach( &XUpdateListener::updated, aEvent ); } @@ -1997,24 +2169,31 @@ sal_Bool OBoundControlModel::connectToField(const Reference<XRowSet>& rForm) sal_Int32 nFieldType = 0; xFieldCandidate->getPropertyValue( PROPERTY_FIELDTYPE ) >>= nFieldType; if ( approveDbColumnType( nFieldType ) ) + impl_setField_noNotify( xFieldCandidate ); + } + else + impl_setField_noNotify( NULL ); + + if ( m_xField.is() ) + { + if( m_xField->getPropertySetInfo()->hasPropertyByName( PROPERTY_VALUE ) ) { - m_xField = xFieldCandidate; + // an wertaenderungen horchen m_xField->addPropertyChangeListener( PROPERTY_VALUE, this ); - m_nFieldType = nFieldType; - - // listen to value changes m_xColumnUpdate = Reference< XColumnUpdate >( m_xField, UNO_QUERY ); m_xColumn = Reference< XColumn >( m_xField, UNO_QUERY ); INT32 nNullableFlag = ColumnValue::NO_NULLS; - m_xField->getPropertyValue( PROPERTY_ISNULLABLE ) >>= nNullableFlag; - m_bRequired = ( ColumnValue::NO_NULLS == nNullableFlag ); + m_xField->getPropertyValue(PROPERTY_ISNULLABLE) >>= nNullableFlag; + m_bRequired = (ColumnValue::NO_NULLS == nNullableFlag); // we're optimistic : in case of ColumnValue_NULLABLE_UNKNOWN we assume nullability .... } + else + { + OSL_ENSURE(sal_False, "OBoundControlModel::connectToField: property NAME not supported!"); + impl_setField_noNotify( NULL ); + } } - else - resetField(); - } catch( const Exception& ) { @@ -2056,25 +2235,39 @@ sal_Bool OBoundControlModel::approveDbColumnType(sal_Int32 _nColumnType) return sal_True; } -//============================================================================== -// value binding handling +//------------------------------------------------------------------------------ +void OBoundControlModel::impl_determineAmbientForm_nothrow() +{ + Reference< XInterface > xParent( const_cast< OBoundControlModel* >( this )->getParent() ); + + m_xAmbientForm.set( xParent, UNO_QUERY ); + if ( !m_xAmbientForm.is() ) + { + Reference< XRowSetSupplier > xSupRowSet( xParent, UNO_QUERY ); + if ( xSupRowSet.is() ) + m_xAmbientForm.set( xSupRowSet->getRowSet(), UNO_QUERY ); + } +} //------------------------------------------------------------------------------ -void OBoundControlModel::connectDatabaseColumn( const Reference< XRowSet >& _rxRowSet, bool _bFromReload ) +void OBoundControlModel::impl_connectDatabaseColumn_noNotify( bool _bFromReload ) { - OSL_PRECOND( !hasExternalValueBinding(), "OBoundControlModel::connectDatabaseColumn: not to be called with an external value binding!" ); - ::osl::MutexGuard aGuard( m_aMutex ); + OSL_PRECOND( !hasExternalValueBinding(), "OBoundControlModel::impl_connectDatabaseColumn_noNotify: not to be called with an external value binding!" ); // consistency checks DBG_ASSERT( !( hasField() && !_bFromReload ), - "OBoundControlModel::connectDatabaseColumn: the form is just *loaded*, but we already have a field!" ); + "OBoundControlModel::impl_connectDatabaseColumn_noNotify: the form is just *loaded*, but we already have a field!" ); (void)_bFromReload; - Reference< XPropertySet > xOldField = getField(); + Reference< XRowSet > xRowSet( m_xAmbientForm, UNO_QUERY ); + OSL_ENSURE( xRowSet.is(), "OBoundControlModel::impl_connectDatabaseColumn_noNotify: no row set!" ); + if ( !xRowSet.is() ) + return; + if ( !hasField() ) { // connect to the column - connectToField( _rxRowSet ); + connectToField( xRowSet ); } // now that we're connected (more or less, even if we did not find a column), @@ -2083,26 +2276,17 @@ void OBoundControlModel::connectDatabaseColumn( const Reference< XRowSet >& _rxR // let derived classes react on this new connection m_bLoaded = sal_True; - onConnectedDbColumn( _rxRowSet ); + onConnectedDbColumn( xRowSet ); // initially transfer the db column value to the control, if we successfully connected to a database column if ( hasField() ) - initFromField( _rxRowSet ); - - if ( xOldField != getField() ) - { - Any aNewValue; aNewValue <<= getField(); - Any aOldValue; aOldValue <<= xOldField; - sal_Int32 nHandle = PROPERTY_ID_BOUNDFIELD; - OPropertySetHelper::fire(&nHandle, &aNewValue, &aOldValue, 1, sal_False); - } + initFromField( xRowSet ); } //------------------------------------------------------------------------------ -void OBoundControlModel::disconnectDatabaseColumn( ) +void OBoundControlModel::impl_disconnectDatabaseColumn_noNotify() { - OSL_PRECOND( !hasExternalValueBinding(), "OBoundControlModel::disconnectDatabaseColumn: not to be called with an external value binding!" ); - ::osl::MutexGuard aGuard( m_aMutex ); + OSL_PRECOND( !hasExternalValueBinding(), "OBoundControlModel::impl_disconnectDatabaseColumn_noNotify: not to be called with an external value binding!" ); // let derived classes react on this onDisconnectedDbColumn(); @@ -2122,14 +2306,17 @@ void OBoundControlModel::disconnectDatabaseColumn( ) //------------------------------------------------------------------------------ void SAL_CALL OBoundControlModel::loaded( const EventObject& _rEvent ) throw(RuntimeException) { + ControlModelLock aLock( *this ); + FieldChangeNotifier aBoundFieldNotifier( aLock ); + + OSL_ENSURE( _rEvent.Source == m_xAmbientForm, "OBoundControlModel::loaded: where does this come from?" ); + (void)_rEvent; + OSL_PRECOND( !hasExternalValueBinding(), "OBoundControlModel::loaded: we should never reach this with an external value binding!" ); if ( hasExternalValueBinding() ) return; - // connect to the database column described by our SQL-binding-related properties - Reference< XRowSet > xRowSet( _rEvent.Source, UNO_QUERY ); - DBG_ASSERT( xRowSet.is(), "OBoundControlModel::loaded: event source is no RowSet?!" ); - connectDatabaseColumn( xRowSet, false ); + impl_connectDatabaseColumn_noNotify( false ); } @@ -2153,24 +2340,30 @@ void SAL_CALL OBoundControlModel::reloading( const com::sun::star::lang::EventOb //------------------------------------------------------------------------------ void SAL_CALL OBoundControlModel::unloading(const com::sun::star::lang::EventObject& /*aEvent*/) throw(RuntimeException) { + ControlModelLock aLock( *this ); + FieldChangeNotifier aBoundFieldNotifier( aLock ); + OSL_PRECOND( !hasExternalValueBinding(), "OBoundControlModel::unloading: we should never reach this with an external value binding!" ); if ( hasExternalValueBinding() ) return; - // disconnect from the database column described by our SQL-binding-related properties - disconnectDatabaseColumn(); + impl_disconnectDatabaseColumn_noNotify(); } //------------------------------------------------------------------------------ void SAL_CALL OBoundControlModel::reloaded( const EventObject& _rEvent ) throw(RuntimeException) { + ControlModelLock aLock( *this ); + FieldChangeNotifier aBoundFieldNotifier( aLock ); + + OSL_ENSURE( _rEvent.Source == m_xAmbientForm, "OBoundControlModel::reloaded: where does this come from?" ); + (void)_rEvent; + OSL_PRECOND( !hasExternalValueBinding(), "OBoundControlModel::reloaded: we should never reach this with an external value binding!" ); if ( hasExternalValueBinding() ) return; - Reference< XRowSet > xRowSet( _rEvent.Source, UNO_QUERY ); - DBG_ASSERT( xRowSet.is(), "OBoundControlModel::reloaded: event source is no RowSet?!" ); - connectDatabaseColumn( xRowSet, true ); + impl_connectDatabaseColumn_noNotify( true ); } //------------------------------------------------------------------------------ @@ -2289,28 +2482,22 @@ void OBoundControlModel::resetNoBroadcast() //----------------------------------------------------------------------------- void OBoundControlModel::addResetListener(const Reference<XResetListener>& l) throw (RuntimeException) { - m_aResetListeners.addInterface(l); + m_aResetHelper.addResetListener( l ); } //----------------------------------------------------------------------------- void OBoundControlModel::removeResetListener(const Reference<XResetListener>& l) throw (RuntimeException) { - m_aResetListeners.removeInterface(l); + m_aResetHelper.removeResetListener( l ); } //----------------------------------------------------------------------------- void OBoundControlModel::reset() throw (RuntimeException) { - cppu::OInterfaceIteratorHelper aIter(m_aResetListeners); - EventObject aResetEvent(static_cast<XWeak*>(this)); - sal_Bool bContinue = sal_True; - while ( aIter.hasMoreElements() && bContinue ) - bContinue = static_cast< XResetListener* >( aIter.next() )->approveReset( aResetEvent ); - - if (!bContinue) - return; + if ( !m_aResetHelper.approveReset() ) + return; - ::osl::ResettableMutexGuard aGuard( m_aMutex ); + ControlModelLock aLock( *this ); // on a new record? sal_Bool bIsNewRecord = sal_False; @@ -2414,17 +2601,25 @@ void OBoundControlModel::reset() throw (RuntimeException) // transfer to the external binding, if necessary if ( hasExternalValueBinding() ) - transferControlValueToExternal( aGuard ); + transferControlValueToExternal( aLock ); } // revalidate, if necessary if ( hasValidator() ) recheckValidity( true ); - aGuard.clear(); + aLock.release(); + + m_aResetHelper.notifyResetted(); +} - m_aResetListeners.notifyEach( &XResetListener::resetted, aResetEvent ); +// ----------------------------------------------------------------------------- +void OBoundControlModel::impl_setField_noNotify( const Reference< XPropertySet>& _rxField ) +{ + DBG_ASSERT( !hasExternalValueBinding(), "OBoundControlModel::impl_setField_noNotify: We have an external value binding!" ); + m_xField = _rxField; } + //-------------------------------------------------------------------- sal_Bool OBoundControlModel::impl_approveValueBinding_nolock( const Reference< XValueBinding >& _rxBinding ) { @@ -2433,10 +2628,10 @@ sal_Bool OBoundControlModel::impl_approveValueBinding_nolock( const Reference< X Sequence< Type > aTypeCandidates; { - // >>>>>>>> ----- SAFE ----- >>>>>>>> + // SYNCHRONIZED --> ::osl::MutexGuard aGuard( m_aMutex ); aTypeCandidates = getSupportedBindingTypes(); - // <<<<<<<< ----- SAFE ----- <<<<<<<< + // <-- SYNCHRONIZED } for ( const Type* pType = aTypeCandidates.getConstArray(); @@ -2453,18 +2648,19 @@ sal_Bool OBoundControlModel::impl_approveValueBinding_nolock( const Reference< X //-------------------------------------------------------------------- void OBoundControlModel::connectExternalValueBinding( - const Reference< XValueBinding >& _rxBinding, ::osl::ResettableMutexGuard& _rInstanceLock ) + const Reference< XValueBinding >& _rxBinding, ControlModelLock& _rInstanceLock ) { OSL_PRECOND( _rxBinding.is(), "OBoundControlModel::connectExternalValueBinding: invalid binding instance!" ); OSL_PRECOND( !hasExternalValueBinding( ), "OBoundControlModel::connectExternalValueBinding: precond not met (currently have a binding)!" ); - // Suspend being a load listener at our parent form. This is because - // an external value binding overrules a possible database binding - if ( isLoadListening() ) - stopLoadListening( ); + // if we're connected to a database column, suspend this + if ( hasField() ) + impl_disconnectDatabaseColumn_noNotify(); - // TODO: if we're already connected to a db column, we should disconnect from it here, - // shouldn't we? + // suspend listening for load-related events at out ambient form. + // This is because an external value binding overrules a possible database binding. + if ( isFormListening() ) + doFormListening( false ); // remember this new binding m_xExternalBinding = _rxBinding; @@ -2551,13 +2747,13 @@ void OBoundControlModel::disconnectExternalValueBinding( ) // no binding anymore m_xExternalBinding.clear(); - // be a load listener at our parent, again. This was suspended while we had + // be a load listener at our form, again. This was suspended while we had // an external value binding in place. - if ( m_xParent.is() ) - startLoadListening( ); + doFormListening( true ); - // TODO: anything to care for here? Changing values? Falling back to a - // database binding if appropriate? + // re-connect to database column of the new parent + if ( m_xAmbientForm.is() && m_xAmbientForm->isLoaded() ) + impl_connectDatabaseColumn_noNotify( false ); // tell the derivee onDisconnectedExternalValue(); @@ -2578,7 +2774,11 @@ void SAL_CALL OBoundControlModel::setValueBinding( const Reference< XValueBindin ); } - ::osl::ResettableMutexGuard aGuard( m_aMutex ); + ControlModelLock aLock( *this ); + + // since a ValueBinding overrules any potentially active database binding, the change in a ValueBinding + // might trigger a change in our BoundField. + FieldChangeNotifier aBoundFieldNotifier( aLock ); // disconnect from the old binding if ( hasExternalValueBinding() ) @@ -2586,7 +2786,7 @@ void SAL_CALL OBoundControlModel::setValueBinding( const Reference< XValueBindin // connect to the new binding if ( _rxBinding.is() ) - connectExternalValueBinding( _rxBinding, aGuard ); + connectExternalValueBinding( _rxBinding, aLock ); } //-------------------------------------------------------------------- @@ -2603,12 +2803,12 @@ Reference< XValueBinding > SAL_CALL OBoundControlModel::getValueBinding( ) thro //-------------------------------------------------------------------- void SAL_CALL OBoundControlModel::modified( const EventObject& _rEvent ) throw ( RuntimeException ) { - ::osl::ResettableMutexGuard aGuard( m_aMutex ); + ControlModelLock aLock( *this ); OSL_PRECOND( hasExternalValueBinding(), "OBoundControlModel::modified: Where did this come from?" ); if ( !m_bTransferingValue && ( m_xExternalBinding == _rEvent.Source ) && m_xExternalBinding.is() ) { - transferExternalValueToControl( aGuard ); + transferExternalValueToControl( aLock ); } } @@ -2619,12 +2819,12 @@ void OBoundControlModel::transferDbValueToControl( ) } //------------------------------------------------------------------------------ -void OBoundControlModel::transferExternalValueToControl( ::osl::ResettableMutexGuard& _rInstanceLock ) +void OBoundControlModel::transferExternalValueToControl( ControlModelLock& _rInstanceLock ) { Reference< XValueBinding > xExternalBinding( m_xExternalBinding ); Type aValueExchangeType( getExternalValueType() ); - _rInstanceLock.clear(); + _rInstanceLock.release(); // >>>>>>>> ----- UNSAFE ----- >>>>>>>> Any aExternalValue; try @@ -2636,13 +2836,13 @@ void OBoundControlModel::transferExternalValueToControl( ::osl::ResettableMutexG DBG_UNHANDLED_EXCEPTION(); } // <<<<<<<< ----- UNSAFE ----- <<<<<<<< - _rInstanceLock.reset(); + _rInstanceLock.acquire(); setControlValue( translateExternalValueToControlValue( aExternalValue ), eExternalBinding ); } //------------------------------------------------------------------------------ -void OBoundControlModel::transferControlValueToExternal( ::osl::ResettableMutexGuard& _rInstanceLock ) +void OBoundControlModel::transferControlValueToExternal( ControlModelLock& _rInstanceLock ) { OSL_PRECOND( m_bSupportsExternalBinding && hasExternalValueBinding(), "OBoundControlModel::transferControlValueToExternal: precondition not met!" ); @@ -2652,7 +2852,7 @@ void OBoundControlModel::transferControlValueToExternal( ::osl::ResettableMutexG Any aExternalValue( translateControlValueToExternalValue() ); m_bTransferingValue = sal_True; - _rInstanceLock.clear(); + _rInstanceLock.release(); // >>>>>>>> ----- UNSAFE ----- >>>>>>>> try { @@ -2663,7 +2863,7 @@ void OBoundControlModel::transferControlValueToExternal( ::osl::ResettableMutexG DBG_UNHANDLED_EXCEPTION(); } // <<<<<<<< ----- UNSAFE ----- <<<<<<<< - _rInstanceLock.reset(); + _rInstanceLock.acquire(); m_bTransferingValue = sal_False; } diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx index 00a8de08a5ef..bc0e952f1735 100644 --- a/forms/source/component/FormattedField.cxx +++ b/forms/source/component/FormattedField.cxx @@ -671,14 +671,14 @@ Reference<XNumberFormatsSupplier> OFormattedModel::calcFormFormatsSupplier() co Reference< XRowSet > xRowSet( xNextParentForm, UNO_QUERY ); Reference< XNumberFormatsSupplier > xSupplier; if (xRowSet.is()) - xSupplier = getNumberFormats(getConnection(xRowSet), sal_True, m_xServiceFactory); + xSupplier = getNumberFormats( getConnection(xRowSet), sal_True, getContext().getLegacyServiceFactory() ); return xSupplier; } //------------------------------------------------------------------------------ Reference< XNumberFormatsSupplier > OFormattedModel::calcDefaultFormatsSupplier() const { - return StandardFormatsSupplier::get( m_xServiceFactory ); + return StandardFormatsSupplier::get( getContext().getLegacyServiceFactory() ); } // XBoundComponent diff --git a/forms/source/component/FormsCollection.cxx b/forms/source/component/FormsCollection.cxx index 81419eca6c77..ff4e0185826c 100644 --- a/forms/source/component/FormsCollection.cxx +++ b/forms/source/component/FormsCollection.cxx @@ -46,6 +46,8 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::form; using namespace ::com::sun::star::container; +using namespace ::com::sun::star::util; + //------------------------------------------------------------------ DBG_NAME(OFormsCollection) //------------------------------------------------------------------ @@ -74,13 +76,23 @@ Sequence<Type> SAL_CALL OFormsCollection::getTypes() throw(RuntimeException) //------------------------------------------------------------------ OFormsCollection::OFormsCollection(const Reference<XMultiServiceFactory>& _rxFactory) - :FormsCollectionComponentBase(m_aMutex) - ,OInterfaceContainer(_rxFactory, m_aMutex, ::getCppuType(static_cast<Reference<XForm>*>(NULL))) + :FormsCollectionComponentBase( m_aMutex ) + ,OInterfaceContainer( _rxFactory, m_aMutex, XForm::static_type() ) + ,OFormsCollection_BASE() { DBG_CTOR(OFormsCollection, NULL); } //------------------------------------------------------------------------------ +OFormsCollection::OFormsCollection( const OFormsCollection& _cloneSource ) + :FormsCollectionComponentBase( m_aMutex ) + ,OInterfaceContainer( m_aMutex, _cloneSource ) + ,OFormsCollection_BASE() +{ + DBG_CTOR( OFormsCollection, NULL ); +} + +//------------------------------------------------------------------------------ OFormsCollection::~OFormsCollection() { DBG_DTOR(OFormsCollection, NULL); @@ -134,6 +146,17 @@ StringSequence SAL_CALL OFormsCollection::getSupportedServiceNames() throw(Runti return aReturn; } +// XCloneable +//------------------------------------------------------------------------------ +Reference< XCloneable > SAL_CALL OFormsCollection::createClone( ) throw (RuntimeException) +{ + OFormsCollection* pClone = new OFormsCollection( *this ); + osl_incrementInterlockedCount( &pClone->m_refCount ); + pClone->clonedFrom( *this ); + osl_decrementInterlockedCount( &pClone->m_refCount ); + return pClone; +} + // OComponentHelper //------------------------------------------------------------------------------ void OFormsCollection::disposing() diff --git a/forms/source/component/FormsCollection.hxx b/forms/source/component/FormsCollection.hxx index c93256d399fd..0ef86327dc52 100644 --- a/forms/source/component/FormsCollection.hxx +++ b/forms/source/component/FormsCollection.hxx @@ -63,6 +63,7 @@ class OFormsCollection public: OFormsCollection(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); + OFormsCollection( const OFormsCollection& _cloneSource ); virtual ~OFormsCollection(); public: @@ -82,6 +83,9 @@ public: virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); virtual StringSequence SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + // XCloneable + virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException); + // OComponentHelper virtual void SAL_CALL disposing(); diff --git a/forms/source/component/Grid.cxx b/forms/source/component/Grid.cxx index 270fa2c9547e..9ca5a1b02ef3 100644 --- a/forms/source/component/Grid.cxx +++ b/forms/source/component/Grid.cxx @@ -99,6 +99,7 @@ OGridControlModel::OGridControlModel(const Reference<XMultiServiceFactory>& _rxF ,FontControlModel( false ) ,m_aSelectListeners(m_aMutex) ,m_aResetListeners(m_aMutex) + ,m_aRowSetChangeListeners(m_aMutex) ,m_aDefaultControl( FRM_SUN_CONTROL_GRIDCONTROL ) ,m_nBorder(1) ,m_nWritingMode( WritingMode2::CONTEXT ) @@ -123,6 +124,7 @@ OGridControlModel::OGridControlModel( const OGridControlModel* _pOriginal, const ,FontControlModel( _pOriginal ) ,m_aSelectListeners( m_aMutex ) ,m_aResetListeners( m_aMutex ) + ,m_aRowSetChangeListeners( m_aMutex ) { DBG_CTOR(OGridControlModel,NULL); @@ -157,7 +159,17 @@ OGridControlModel::~OGridControlModel() // XCloneable //------------------------------------------------------------------------------ -IMPLEMENT_DEFAULT_CLONING( OGridControlModel ) +Reference< XCloneable > SAL_CALL OGridControlModel::createClone( ) throw (RuntimeException) +{ + OGridControlModel* pClone = new OGridControlModel( this, getContext().getLegacyServiceFactory() ); + osl_incrementInterlockedCount( &pClone->m_refCount ); + pClone->OControlModel::clonedFrom( this ); + // do not call OInterfaceContainer::clonedFrom, it would clone the elements aka columns, which is + // already done in the ctor + //pClone->OInterfaceContainer::clonedFrom( *this ); + osl_decrementInterlockedCount( &pClone->m_refCount ); + return static_cast< XCloneable* >( static_cast< OControlModel* >( pClone ) ); +} //------------------------------------------------------------------------------ void OGridControlModel::cloneColumns( const OGridControlModel* _pOriginalContainer ) @@ -234,20 +246,47 @@ void SAL_CALL OGridControlModel::errorOccured( const SQLErrorEvent& _rEvent ) th onError( _rEvent ); } +// XRowSetSupplier +//------------------------------------------------------------------------------ +Reference< XRowSet > SAL_CALL OGridControlModel::getRowSet( ) throw (RuntimeException) +{ + return Reference< XRowSet >( getParent(), UNO_QUERY ); +} + +//------------------------------------------------------------------------------ +void SAL_CALL OGridControlModel::setRowSet( const Reference< XRowSet >& /*_rxDataSource*/ ) throw (RuntimeException) +{ + OSL_ENSURE( false, "OGridControlModel::setRowSet: not supported!" ); +} + +//-------------------------------------------------------------------- +void SAL_CALL OGridControlModel::addRowSetChangeListener( const Reference< XRowSetChangeListener >& i_Listener ) throw (RuntimeException) +{ + if ( i_Listener.is() ) + m_aRowSetChangeListeners.addInterface( i_Listener ); +} + +//-------------------------------------------------------------------- +void SAL_CALL OGridControlModel::removeRowSetChangeListener( const Reference< XRowSetChangeListener >& i_Listener ) throw (RuntimeException) +{ + m_aRowSetChangeListeners.removeInterface( i_Listener ); +} + // XChild //------------------------------------------------------------------------------ -void SAL_CALL OGridControlModel::setParent(const InterfaceRef& Parent) throw(NoSupportException, RuntimeException) +void SAL_CALL OGridControlModel::setParent( const InterfaceRef& i_Parent ) throw(NoSupportException, RuntimeException) { - if (m_xParentFormLoadable.is()) - m_xParentFormLoadable->removeLoadListener(this); + ::osl::ClearableMutexGuard aGuard( m_aMutex ); + if ( i_Parent == getParent() ) + return; - OControlModel::setParent(Parent); + OControlModel::setParent( i_Parent ); - Reference< XForm > xForm(m_xParent, UNO_QUERY); - m_xParentFormLoadable = Reference< XLoadable > (xForm, UNO_QUERY); - if (m_xParentFormLoadable.is()) - m_xParentFormLoadable->addLoadListener(this); + EventObject aEvent( *this ); + aGuard.clear(); + m_aRowSetChangeListeners.notifyEach( &XRowSetChangeListener::onRowSetChanged, aEvent ); } + //------------------------------------------------------------------------------ Sequence< Type > SAL_CALL OGridControlModel::getTypes( ) throw(RuntimeException) { @@ -274,6 +313,7 @@ void OGridControlModel::disposing() EventObject aEvt(static_cast<XWeak*>(this)); m_aSelectListeners.disposeAndClear(aEvt); m_aResetListeners.disposeAndClear(aEvt); + m_aRowSetChangeListeners.disposeAndClear(aEvt); } // XEventListener @@ -288,6 +328,8 @@ void OGridControlModel::disposing(const EventObject& _rEvent) throw( RuntimeExce //----------------------------------------------------------------------------- sal_Bool SAL_CALL OGridControlModel::select(const Any& rElement) throw(IllegalArgumentException, RuntimeException) { + ::osl::ClearableMutexGuard aGuard( m_aMutex ); + Reference<XPropertySet> xSel; if (rElement.hasValue() && !::cppu::extractInterface(xSel, rElement)) { @@ -304,11 +346,11 @@ sal_Bool SAL_CALL OGridControlModel::select(const Any& rElement) throw(IllegalAr } } - if (xSel != m_xSelection) + if ( xSel != m_xSelection ) { m_xSelection = xSel; - EventObject aEvt(xMe); - m_aSelectListeners.notifyEach( &XSelectionChangeListener::selectionChanged, aEvt ); + aGuard.clear(); + m_aSelectListeners.notifyEach( &XSelectionChangeListener::selectionChanged, EventObject( *this ) ); return sal_True; } return sal_False; @@ -346,16 +388,16 @@ Reference<XPropertySet> OGridControlModel::createColumn(sal_Int32 nTypeId) cons Reference<XPropertySet> xReturn; switch (nTypeId) { - case TYPE_CHECKBOX: xReturn = new CheckBoxColumn(OControlModel::m_xServiceFactory); break; - case TYPE_COMBOBOX: xReturn = new ComboBoxColumn(OControlModel::m_xServiceFactory); break; - case TYPE_CURRENCYFIELD: xReturn = new CurrencyFieldColumn(OControlModel::m_xServiceFactory); break; - case TYPE_DATEFIELD: xReturn = new DateFieldColumn(OControlModel::m_xServiceFactory); break; - case TYPE_LISTBOX: xReturn = new ListBoxColumn(OControlModel::m_xServiceFactory); break; - case TYPE_NUMERICFIELD: xReturn = new NumericFieldColumn(OControlModel::m_xServiceFactory); break; - case TYPE_PATTERNFIELD: xReturn = new PatternFieldColumn(OControlModel::m_xServiceFactory); break; - case TYPE_TEXTFIELD: xReturn = new TextFieldColumn(OControlModel::m_xServiceFactory); break; - case TYPE_TIMEFIELD: xReturn = new TimeFieldColumn(OControlModel::m_xServiceFactory); break; - case TYPE_FORMATTEDFIELD: xReturn = new FormattedFieldColumn(OControlModel::m_xServiceFactory); break; + case TYPE_CHECKBOX: xReturn = new CheckBoxColumn( getContext() ); break; + case TYPE_COMBOBOX: xReturn = new ComboBoxColumn( getContext() ); break; + case TYPE_CURRENCYFIELD: xReturn = new CurrencyFieldColumn( getContext() ); break; + case TYPE_DATEFIELD: xReturn = new DateFieldColumn( getContext() ); break; + case TYPE_LISTBOX: xReturn = new ListBoxColumn( getContext() ); break; + case TYPE_NUMERICFIELD: xReturn = new NumericFieldColumn( getContext() ); break; + case TYPE_PATTERNFIELD: xReturn = new PatternFieldColumn( getContext() ); break; + case TYPE_TEXTFIELD: xReturn = new TextFieldColumn( getContext() ); break; + case TYPE_TIMEFIELD: xReturn = new TimeFieldColumn( getContext() ); break; + case TYPE_FORMATTEDFIELD: xReturn = new FormattedFieldColumn( getContext() ); break; default: DBG_ERROR("OGridControlModel::createColumn: Unknown Column"); break; @@ -735,72 +777,6 @@ Any OGridControlModel::getPropertyDefaultByHandle( sal_Int32 nHandle ) const return aReturn; } -// XLoadListener -//------------------------------------------------------------------------------ -void SAL_CALL OGridControlModel::loaded(const EventObject& rEvent) throw(RuntimeException) -{ - Reference<XLoadListener> xListener; - sal_Int32 nCount = getCount(); - for (sal_Int32 nIndex=0; nIndex < nCount; ++nIndex) - { - getByIndex(nIndex) >>= xListener; - if (xListener.is()) - xListener->loaded(rEvent); - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL OGridControlModel::unloaded(const EventObject& rEvent) throw(RuntimeException) -{ - Reference<XLoadListener> xListener; - sal_Int32 nCount = getCount(); - for (sal_Int32 nIndex=0; nIndex < nCount; nIndex++) - { - getByIndex(nIndex) >>= xListener; - if (xListener.is()) - xListener->unloaded(rEvent); - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL OGridControlModel::reloading(const EventObject& rEvent) throw(RuntimeException) -{ - Reference<XLoadListener> xListener; - sal_Int32 nCount = getCount(); - for (sal_Int32 nIndex=0; nIndex < nCount; nIndex++) - { - getByIndex(nIndex) >>= xListener; - if (xListener.is()) - xListener->reloading(rEvent); - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL OGridControlModel::unloading(const EventObject& rEvent) throw(RuntimeException) -{ - Reference<XLoadListener> xListener; - sal_Int32 nCount = getCount(); - for (sal_Int32 nIndex=0; nIndex < nCount; nIndex++) - { - getByIndex(nIndex) >>= xListener; - if (xListener.is()) - xListener->unloading(rEvent); - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL OGridControlModel::reloaded(const EventObject& rEvent) throw(RuntimeException) -{ - Reference<XLoadListener> xListener; - sal_Int32 nCount = getCount(); - for (sal_Int32 nIndex=0; nIndex < nCount; nIndex++) - { - getByIndex(nIndex) >>= xListener; - if (xListener.is()) - xListener->reloaded(rEvent); - } -} - //------------------------------------------------------------------------------ OGridColumn* OGridControlModel::getColumnImplementation(const InterfaceRef& _rxIFace) const { @@ -813,42 +789,32 @@ OGridColumn* OGridControlModel::getColumnImplementation(const InterfaceRef& _rxI } //------------------------------------------------------------------------------ -void OGridControlModel::gotColumn(const Reference< XInterface >& _rxColumn) +void OGridControlModel::gotColumn( const Reference< XInterface >& _rxColumn ) { - // if our form is already loaded, tell the column - // 18.05.2001 - 86558 - frank.schoenheit@germany.sun.com - if (m_xParentFormLoadable.is() && m_xParentFormLoadable->isLoaded()) - { - Reference< XLoadListener > xColumnLoadListener(_rxColumn, UNO_QUERY); - if (xColumnLoadListener.is()) - { // it's kind of a fake ... - EventObject aFakedLoadEvent; - aFakedLoadEvent.Source = m_xParentFormLoadable; - xColumnLoadListener->loaded(aFakedLoadEvent); - } - } + Reference< XSQLErrorBroadcaster > xBroadcaster( _rxColumn, UNO_QUERY ); + if ( xBroadcaster.is() ) + xBroadcaster->addSQLErrorListener( this ); } //------------------------------------------------------------------------------ void OGridControlModel::lostColumn(const Reference< XInterface >& _rxColumn) { - if (Reference<XInterface>(m_xSelection, UNO_QUERY).get() == Reference<XInterface>(_rxColumn, UNO_QUERY).get()) + if ( m_xSelection == _rxColumn ) { // the currently selected element was replaced m_xSelection.clear(); - EventObject aEvt(static_cast<XWeak*>(this)); + EventObject aEvt( static_cast< XWeak* >( this ) ); m_aSelectListeners.notifyEach( &XSelectionChangeListener::selectionChanged, aEvt ); } + + Reference< XSQLErrorBroadcaster > xBroadcaster( _rxColumn, UNO_QUERY ); + if ( xBroadcaster.is() ) + xBroadcaster->removeSQLErrorListener( this ); } //------------------------------------------------------------------------------ void OGridControlModel::implRemoved(const InterfaceRef& _rxObject) { OInterfaceContainer::implRemoved(_rxObject); - - Reference< XSQLErrorBroadcaster > xBroadcaster( _rxObject, UNO_QUERY ); - if ( xBroadcaster.is() ) - xBroadcaster->removeSQLErrorListener( this ); - lostColumn(_rxObject); } @@ -856,20 +822,30 @@ void OGridControlModel::implRemoved(const InterfaceRef& _rxObject) void OGridControlModel::implInserted( const ElementDescription* _pElement ) { OInterfaceContainer::implInserted( _pElement ); - - Reference< XSQLErrorBroadcaster > xBroadcaster( _pElement->xInterface, UNO_QUERY ); - if ( xBroadcaster.is() ) - xBroadcaster->addSQLErrorListener( this ); - gotColumn( _pElement->xInterface ); } //------------------------------------------------------------------------------ -void OGridControlModel::implReplaced( const InterfaceRef& _rxReplacedObject, const ElementDescription* _pElement ) +void OGridControlModel::impl_replacedElement( const ContainerEvent& _rEvent, ::osl::ClearableMutexGuard& _rInstanceLock ) { - OInterfaceContainer::implReplaced( _rxReplacedObject, _pElement ); - lostColumn( _rxReplacedObject ); - gotColumn( _pElement->xInterface ); + Reference< XInterface > xOldColumn( _rEvent.ReplacedElement, UNO_QUERY ); + Reference< XInterface > xNewColumn( _rEvent.Element, UNO_QUERY ); + + bool bNewSelection = ( xOldColumn == m_xSelection ); + + lostColumn( xOldColumn ); + gotColumn( xNewColumn ); + + if ( bNewSelection ) + m_xSelection.set( xNewColumn, UNO_QUERY ); + + OInterfaceContainer::impl_replacedElement( _rEvent, _rInstanceLock ); + // <<---- SYNCHRONIZED + + if ( bNewSelection ) + { + m_aSelectListeners.notifyEach( &XSelectionChangeListener::selectionChanged, EventObject( *this ) ); + } } //------------------------------------------------------------------------------ diff --git a/forms/source/component/Grid.hxx b/forms/source/component/Grid.hxx index 716f1a4ca739..56981f54349b 100644 --- a/forms/source/component/Grid.hxx +++ b/forms/source/component/Grid.hxx @@ -28,16 +28,22 @@ * ************************************************************************/ -#include "FormComponent.hxx" -#include <com/sun/star/form/XGridColumnFactory.hpp> -#include <com/sun/star/view/XSelectionSupplier.hpp> -#include <com/sun/star/form/XLoadable.hpp> -#include <tools/link.hxx> -#include "InterfaceContainer.hxx" -#include <comphelper/proparrhlp.hxx> -#include <cppuhelper/implbase6.hxx> -#include "errorbroadcaster.hxx" -#include "formcontrolfont.hxx" +#include "errorbroadcaster.hxx"
+#include "FormComponent.hxx"
+#include "formcontrolfont.hxx"
+#include "InterfaceContainer.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/form/XGridColumnFactory.hpp>
+#include <com/sun/star/form/XLoadable.hpp>
+#include <com/sun/star/sdb/XRowSetSupplier.hpp>
+#include <com/sun/star/sdb/XRowSetChangeBroadcaster.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/proparrhlp.hxx>
+#include <cppuhelper/implbase7.hxx>
+#include <tools/link.hxx>
//......................................................................... namespace frm @@ -59,12 +65,13 @@ class OGridColumn; //================================================================== // OGridControlModel //================================================================== -typedef ::cppu::ImplHelper6 < ::com::sun::star::awt::XControlModel +typedef ::cppu::ImplHelper7 < ::com::sun::star::awt::XControlModel , ::com::sun::star::form::XGridColumnFactory - , ::com::sun::star::form::XLoadListener , ::com::sun::star::form::XReset , ::com::sun::star::view::XSelectionSupplier , ::com::sun::star::sdb::XSQLErrorListener + , ::com::sun::star::sdb::XRowSetSupplier + , ::com::sun::star::sdb::XRowSetChangeBroadcaster > OGridControlModel_BASE; class OGridControlModel :public OControlModel @@ -74,7 +81,8 @@ class OGridControlModel :public OControlModel ,public OGridControlModel_BASE { ::cppu::OInterfaceContainerHelper m_aSelectListeners, - m_aResetListeners; + m_aResetListeners, + m_aRowSetChangeListeners; // [properties] ::com::sun::star::uno::Any m_aRowHeight; // Zeilenhoehe @@ -87,7 +95,6 @@ class OGridControlModel :public OControlModel // [properties] ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xSelection; - ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable > m_xParentFormLoadable; // [properties] ::rtl::OUString m_sHelpURL; // URL @@ -128,13 +135,6 @@ public: // XEventListener virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException); - // XLoadListener - virtual void SAL_CALL loaded(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL unloaded(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL unloading(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL reloading(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL reloaded(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException); - // XReset virtual void SAL_CALL reset() throw ( ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL addResetListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener>& _rxListener) throw ( ::com::sun::star::uno::RuntimeException); @@ -168,6 +168,14 @@ public: // XSQLErrorListener virtual void SAL_CALL errorOccured( const ::com::sun::star::sdb::SQLErrorEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException); + // XRowSetSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > SAL_CALL getRowSet( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setRowSet( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xDataSource ) throw (::com::sun::star::uno::RuntimeException); + + // XRowSetChangeBroadcaster + virtual void SAL_CALL addRowSetChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetChangeListener >& i_Listener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeRowSetChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetChangeListener >& i_Listener ) throw (::com::sun::star::uno::RuntimeException); + // OControlModel's property handling virtual void describeFixedProperties( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps @@ -195,7 +203,10 @@ protected: protected: virtual void implRemoved(const InterfaceRef& _rxObject); virtual void implInserted( const ElementDescription* _pElement ); - virtual void implReplaced( const InterfaceRef& _rxReplacedObject, const ElementDescription* _pElement ); + virtual void impl_replacedElement( + const ::com::sun::star::container::ContainerEvent& _rEvent, + ::osl::ClearableMutexGuard& _rInstanceLock + ); void gotColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxColumn); void lostColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxColumn); diff --git a/forms/source/component/ImageControl.cxx b/forms/source/component/ImageControl.cxx index 6376f0401a6e..5d30c2776659 100644 --- a/forms/source/component/ImageControl.cxx +++ b/forms/source/component/ImageControl.cxx @@ -378,7 +378,7 @@ sal_Bool OImageControlModel::impl_updateStreamForURL_lck( const ::rtl::OUString& if ( ::svt::GraphicAccess::isSupportedURL( _rURL ) ) { - xImageStream = ::svt::GraphicAccess::getImageXStream( getORB(), _rURL ); + xImageStream = ::svt::GraphicAccess::getImageXStream( getContext().getLegacyServiceFactory(), _rURL ); } else { @@ -591,7 +591,7 @@ void OImageControlModel::doSetControlValue( const Any& _rValue ) // OComponentHelper //------------------------------------------------------------------ -void OImageControlModel::disposing() +void SAL_CALL OImageControlModel::disposing() { OBoundControlModel::disposing(); @@ -646,25 +646,16 @@ InterfaceRef SAL_CALL OImageControlControl_CreateInstance(const Reference<XMulti //------------------------------------------------------------------------------ Sequence<Type> OImageControlControl::_getTypes() { - static Sequence<Type> aTypes; - if (!aTypes.getLength()) - { - // my base class - Sequence<Type> aBaseClassTypes = OBoundControl::_getTypes(); - - Sequence<Type> aOwnTypes(1); - Type* pOwnTypes = aOwnTypes.getArray(); - pOwnTypes[0] = getCppuType((Reference<XMouseListener>*)NULL); - - aTypes = concatSequences(aBaseClassTypes, aOwnTypes); - } - return aTypes; + return concatSequences( + OBoundControl::_getTypes(), + OImageControlControl_Base::getTypes() + ); } //------------------------------------------------------------------------------ OImageControlControl::OImageControlControl(const Reference<XMultiServiceFactory>& _rxFactory) :OBoundControl(_rxFactory, VCL_CONTROL_IMAGECONTROL) - ,m_pImageIndicator( new OImageIndicator ) + ,m_aModifyListeners( m_aMutex ) { increment(m_refCount); { @@ -677,14 +668,15 @@ OImageControlControl::OImageControlControl(const Reference<XMultiServiceFactory> decrement(m_refCount); } -// UNO Anbindung //------------------------------------------------------------------------------ Any SAL_CALL OImageControlControl::queryAggregation(const Type& _rType) throw (RuntimeException) { - Any aReturn = OBoundControl::queryAggregation(_rType); - if (!aReturn.hasValue()) - aReturn = ::cppu::queryInterface(_rType - ,static_cast<XMouseListener*>(this) + Any aReturn = OBoundControl::queryAggregation( _rType ); + if ( !aReturn.hasValue() ) + aReturn = ::cppu::queryInterface( + _rType, + static_cast< XMouseListener* >( this ), + static_cast< XModifyBroadcaster* >( this ) ); return aReturn; @@ -701,23 +693,31 @@ StringSequence OImageControlControl::getSupportedServiceNames() throw() return aSupported; } -//-------------------------------------------------------------------- -sal_Bool SAL_CALL OImageControlControl::setModel(const Reference<starawt::XControlModel>& _rxModel ) throw (RuntimeException) +//------------------------------------------------------------------------------ +void SAL_CALL OImageControlControl::addModifyListener( const Reference< XModifyListener >& _Listener ) throw (RuntimeException) { - Reference< XImageProducer > xProducer( getModel(), UNO_QUERY ); - if ( xProducer.is() ) - xProducer->removeConsumer( m_pImageIndicator.getRef() ); + m_aModifyListeners.addInterface( _Listener ); +} - sal_Bool bReturn = OBoundControl::setModel( _rxModel ); +//------------------------------------------------------------------------------ +void SAL_CALL OImageControlControl::removeModifyListener( const Reference< XModifyListener >& _Listener ) throw (RuntimeException) +{ + m_aModifyListeners.removeInterface( _Listener ); +} - xProducer = xProducer.query( getModel() ); - if ( xProducer.is() ) - { - m_pImageIndicator->reset(); - xProducer->addConsumer( m_pImageIndicator.getRef() ); - } +//------------------------------------------------------------------------------ +void SAL_CALL OImageControlControl::disposing() +{ + EventObject aEvent( *this ); + m_aModifyListeners.disposeAndClear( aEvent ); - return bReturn; + OBoundControl::disposing(); +} + +//------------------------------------------------------------------------------ +void SAL_CALL OImageControlControl::disposing( const EventObject& _Event ) throw(RuntimeException) +{ + OBoundControl::disposing( _Event ); } //------------------------------------------------------------------------------ @@ -744,11 +744,11 @@ void OImageControlControl::implClearGraphics( sal_Bool _bForce ) } //------------------------------------------------------------------------------ -void OImageControlControl::implInsertGraphics() +bool OImageControlControl::implInsertGraphics() { Reference< XPropertySet > xSet( getModel(), UNO_QUERY ); if ( !xSet.is() ) - return; + return false; ::rtl::OUString sTitle = FRM_RES_STRING(RID_STR_IMPORT_GRAPHIC); // build some arguments for the upcoming dialog @@ -757,30 +757,26 @@ void OImageControlControl::implInsertGraphics() ::sfx2::FileDialogHelper aDialog( TemplateDescription::FILEOPEN_LINK_PREVIEW, SFXWB_GRAPHIC ); aDialog.SetTitle( sTitle ); - Reference< XFilePickerControlAccess > xController(aDialog.GetFilePicker(), UNO_QUERY); - DBG_ASSERT( xController.is(), "OImageControlControl::implInsertGraphics: invalid file picker!" ); - if ( xController.is() ) - { - xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0, ::cppu::bool2any(sal_True)); + Reference< XFilePickerControlAccess > xController( aDialog.GetFilePicker(), UNO_QUERY_THROW ); + xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0, ::cppu::bool2any(sal_True)); - Reference<XPropertySet> xBoundField; - if ( hasProperty( PROPERTY_BOUNDFIELD, xSet ) ) - xSet->getPropertyValue( PROPERTY_BOUNDFIELD ) >>= xBoundField; - sal_Bool bHasField = xBoundField.is(); + Reference<XPropertySet> xBoundField; + if ( hasProperty( PROPERTY_BOUNDFIELD, xSet ) ) + xSet->getPropertyValue( PROPERTY_BOUNDFIELD ) >>= xBoundField; + sal_Bool bHasField = xBoundField.is(); - // if the control is bound to a DB field, then it's not possible to decide whether or not to link - xController->enableControl(ExtendedFilePickerElementIds::CHECKBOX_LINK, !bHasField ); + // if the control is bound to a DB field, then it's not possible to decide whether or not to link + xController->enableControl(ExtendedFilePickerElementIds::CHECKBOX_LINK, !bHasField ); - // if the control is bound to a DB field, then linking of the image depends on the type of the field - sal_Bool bImageIsLinked = sal_True; - if ( bHasField ) - { - sal_Int32 nFieldType = DataType::OTHER; - OSL_VERIFY( xBoundField->getPropertyValue( PROPERTY_FIELDTYPE ) >>= nFieldType ); - bImageIsLinked = ( lcl_getImageStoreType( nFieldType ) == ImageStoreLink ); - } - xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, makeAny( bImageIsLinked ) ); + // if the control is bound to a DB field, then linking of the image depends on the type of the field + sal_Bool bImageIsLinked = sal_True; + if ( bHasField ) + { + sal_Int32 nFieldType = DataType::OTHER; + OSL_VERIFY( xBoundField->getPropertyValue( PROPERTY_FIELDTYPE ) >>= nFieldType ); + bImageIsLinked = ( lcl_getImageStoreType( nFieldType ) == ImageStoreLink ); } + xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, makeAny( bImageIsLinked ) ); if ( ERRCODE_NONE == aDialog.Execute() ) { @@ -802,12 +798,15 @@ void OImageControlControl::implInsertGraphics() } else xSet->setPropertyValue( PROPERTY_IMAGE_URL, makeAny( ::rtl::OUString( aDialog.GetPath() ) ) ); + + return true; } } catch(Exception&) { DBG_ERROR("OImageControlControl::implInsertGraphics: caught an exception while attempting to execute the FilePicker!"); } + return false; } //------------------------------------------------------------------------------ @@ -839,10 +838,11 @@ void OImageControlControl::mousePressed(const ::com::sun::star::awt::MouseEvent& if (e.Buttons != MouseButton::LEFT) return; + bool bModified = false; // is this a request for a context menu? if ( e.PopupTrigger ) { - Reference< XPopupMenu > xMenu( m_xServiceFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.awt.PopupMenu" ) ), UNO_QUERY ); + Reference< XPopupMenu > xMenu( m_aContext.createComponent( "com.sun.star.awt.PopupMenu" ), UNO_QUERY ); DBG_ASSERT( xMenu.is(), "OImageControlControl::mousePressed: could not create a popup menu!" ); Reference< XWindowPeer > xWindowPeer = getPeer(); @@ -878,10 +878,12 @@ void OImageControlControl::mousePressed(const ::com::sun::star::awt::MouseEvent& { case ID_OPEN_GRAPHICS: implInsertGraphics(); + bModified = true; break; case ID_CLEAR_GRAPHICS: implClearGraphics( sal_True ); + bModified = true; break; } } @@ -916,9 +918,16 @@ void OImageControlControl::mousePressed(const ::com::sun::star::awt::MouseEvent& if (bReadOnly) return; - implInsertGraphics(); + if ( implInsertGraphics() ) + bModified = true; } } + + if ( bModified ) + { + EventObject aEvent( *this ); + m_aModifyListeners.notifyEach( &XModifyListener::modified, aEvent ); + } } //------------------------------------------------------------------------------ @@ -936,62 +945,6 @@ void SAL_CALL OImageControlControl::mouseExited(const awt::MouseEvent& /*e*/) th { } - -//============================================================================== -//= OImageIndicator -//============================================================================== -DBG_NAME( OImageIndicator ) -//------------------------------------------------------------------------------ -OImageIndicator::OImageIndicator( ) - :m_bIsProducing( sal_False ) - ,m_bIsEmptyImage( sal_True ) -{ - DBG_CTOR( OImageIndicator, NULL ); -} - -//------------------------------------------------------------------------------ -OImageIndicator::~OImageIndicator( ) -{ - DBG_DTOR( OImageIndicator, NULL ); -} - -//-------------------------------------------------------------------- -void OImageIndicator::reset() -{ - OSL_ENSURE( !m_bIsProducing, "OImageIndicator::reset: sure you know what you're doing? The producer is currently producing!" ); - m_bIsProducing = sal_True; -} - -//-------------------------------------------------------------------- -void SAL_CALL OImageIndicator::init( sal_Int32 /*Width*/, sal_Int32 /*Height*/ ) throw (RuntimeException) -{ - m_bIsProducing = sal_True; - m_bIsEmptyImage = sal_True; -} - -//-------------------------------------------------------------------- -void SAL_CALL OImageIndicator::setColorModel( sal_Int16 /*BitCount*/, const Sequence< sal_Int32 >& /*RGBAPal*/, sal_Int32 /*RedMask*/, sal_Int32 /*GreenMask*/, sal_Int32 /*BlueMask*/, sal_Int32 /*AlphaMask*/ ) throw (RuntimeException) -{ -} - -//-------------------------------------------------------------------- -void SAL_CALL OImageIndicator::setPixelsByBytes( sal_Int32 /*nX*/, sal_Int32 /*nY*/, sal_Int32 /*nWidth*/, sal_Int32 /*nHeight*/, const Sequence< sal_Int8 >& /*aProducerData*/, sal_Int32 /*nOffset*/, sal_Int32 /*nScanSize*/ ) throw (RuntimeException) -{ - m_bIsEmptyImage = sal_False; -} - -//-------------------------------------------------------------------- -void SAL_CALL OImageIndicator::setPixelsByLongs( sal_Int32 /*nX*/, sal_Int32 /*nY*/, sal_Int32 /*nWidth*/, sal_Int32 /*nHeight*/, const Sequence< sal_Int32 >& /*aProducerData*/, sal_Int32 /*nOffset*/, sal_Int32 /*nScanSize*/ ) throw (RuntimeException) -{ - m_bIsEmptyImage = sal_False; -} - -//-------------------------------------------------------------------- -void SAL_CALL OImageIndicator::complete( sal_Int32 /*Status*/, const Reference< XImageProducer >& /*xProducer*/ ) throw (RuntimeException) -{ - m_bIsProducing = sal_False; -} - //......................................................................... } // namespace frm //......................................................................... diff --git a/forms/source/component/ImageControl.hxx b/forms/source/component/ImageControl.hxx index 9c43484006c3..49ae9ff81964 100644 --- a/forms/source/component/ImageControl.hxx +++ b/forms/source/component/ImageControl.hxx @@ -35,6 +35,7 @@ #include "imgprod.hxx" #include <com/sun/star/form/XImageProducerSupplier.hpp> #include <com/sun/star/awt/XMouseListener.hpp> +#include <com/sun/star/util/XModifyBroadcaster.hpp> #include <comphelper/propmultiplex.hxx> #include <comphelper/implementationreference.hxx> #include <cppuhelper/implbase2.hxx> @@ -145,49 +146,17 @@ protected: }; //================================================================== -//= OImageIndicator (helper class for OImageControlControl) -//================================================================== -typedef ::cppu::WeakImplHelper1 < ::com::sun::star::awt::XImageConsumer - > OImageIndicator_Base; - -class OImageIndicator : public OImageIndicator_Base -{ -private: - sal_Bool m_bIsProducing : 1; - sal_Bool m_bIsEmptyImage : 1; - -public: - OImageIndicator( ); - - void reset(); - inline sal_Bool isEmptyImage() const { return m_bIsEmptyImage; } - -protected: - ~OImageIndicator( ); - // XImageProducer - virtual void SAL_CALL init( sal_Int32 Width, sal_Int32 Height ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setColorModel( sal_Int16 BitCount, const ::com::sun::star::uno::Sequence< sal_Int32 >& RGBAPal, sal_Int32 RedMask, sal_Int32 GreenMask, sal_Int32 BlueMask, sal_Int32 AlphaMask ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPixelsByBytes( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, const ::com::sun::star::uno::Sequence< sal_Int8 >& aProducerData, sal_Int32 nOffset, sal_Int32 nScanSize ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPixelsByLongs( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, const ::com::sun::star::uno::Sequence< sal_Int32 >& aProducerData, sal_Int32 nOffset, sal_Int32 nScanSize ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL complete( sal_Int32 Status, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer >& xProducer ) throw (::com::sun::star::uno::RuntimeException); - -private: - OImageIndicator( const OImageIndicator& ); // never implemented - OImageIndicator& operator=( const OImageIndicator& ); // never implemented -}; - -//================================================================== //= OImageControlControl //================================================================== -class OImageControlControl :public ::com::sun::star::awt::XMouseListener - ,public OBoundControl +typedef ::cppu::ImplHelper2 < ::com::sun::star::awt::XMouseListener + , ::com::sun::star::util::XModifyBroadcaster + > OImageControlControl_Base; +class OImageControlControl : public OBoundControl + , public OImageControlControl_Base { private: - typedef ::comphelper::ImplementationReference< OImageIndicator, ::com::sun::star::awt::XImageConsumer > - ImageIndicatorReference; - ImageIndicatorReference m_pImageIndicator; + ::cppu::OInterfaceContainerHelper m_aModifyListeners; -protected: // XTypeProvider virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); @@ -195,12 +164,11 @@ public: OImageControlControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); // UNO - DECLARE_UNO3_AGG_DEFAULTS(OImageControlControl, OBoundControl); - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException); + DECLARE_UNO3_AGG_DEFAULTS( OImageControlControl, OBoundControl ); + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException); // XEventListener - virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException) - { OBoundControl::disposing(_rSource); } + virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException); // XServiceInfo IMPLEMENTATION_NAME(OImageControlControl); @@ -212,15 +180,16 @@ public: virtual void SAL_CALL mouseEntered(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL mouseExited(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException); - // XControl - virtual sal_Bool SAL_CALL setModel(const ::com::sun::star::uno::Reference<starawt::XControlModel>& _rxModel ) throw (::com::sun::star::uno::RuntimeException); + // XModifyBroadcaster + virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); - // prevent method hiding - using OBoundControl::disposing; + // OComponentHelper + virtual void SAL_CALL disposing(); private: void implClearGraphics( sal_Bool _bForce ); - void implInsertGraphics(); + bool implInsertGraphics(); /** determines whether the control does currently have an empty grahic set */ diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx index a2de412fa3a4..ec953f66c6f6 100644 --- a/forms/source/component/ListBox.cxx +++ b/forms/source/component/ListBox.cxx @@ -54,27 +54,22 @@ #include <com/sun/star/sdb/CommandType.hpp> /** === end UNO includes === **/ -#include <connectivity/dbtools.hxx> -#include <connectivity/formattedcolumnvalue.hxx> -#include <connectivity/dbconversion.hxx> - -#include <vcl/svapp.hxx> - -#include <unotools/sharedunocomponent.hxx> - -#include <tools/debug.hxx> -#include <tools/diagnose_ex.h> - #include <comphelper/basicio.hxx> #include <comphelper/container.hxx> #include <comphelper/numbers.hxx> #include <comphelper/listenernotification.hxx> - +#include <connectivity/dbtools.hxx> +#include <connectivity/formattedcolumnvalue.hxx> +#include <connectivity/dbconversion.hxx> #include <cppuhelper/queryinterface.hxx> - #include <rtl/logfile.hxx> +#include <tools/debug.hxx> +#include <tools/diagnose_ex.h> +#include <unotools/sharedunocomponent.hxx> +#include <vcl/svapp.hxx> #include <algorithm> +#include <functional> //......................................................................... @@ -94,14 +89,61 @@ namespace frm using namespace ::com::sun::star::form::binding; using namespace ::dbtools; - //================================================================== - //= ItemEvent - //================================================================== + using ::connectivity::ORowSetValue; + + //============================================================================== + //= helper + //============================================================================== + namespace + { + //-------------------------------------------------------------------------- + struct RowSetValueToString : public ::std::unary_function< ORowSetValue, ::rtl::OUString > + { + ::rtl::OUString operator()( const ORowSetValue& _value ) const + { + return _value.getString(); + } + }; + + //-------------------------------------------------------------------------- + struct AppendRowSetValueString : public ::std::unary_function< ::rtl::OUString, void > + { + AppendRowSetValueString( ::rtl::OUString& _string ) + :m_string( _string ) + { + } + + void operator()( const ::rtl::OUString _append ) + { + m_string += _append; + } + + private: + ::rtl::OUString& m_string; + }; + + //-------------------------------------------------------------------------- + Sequence< ::rtl::OUString > lcl_convertToStringSequence( const ValueList& _values ) + { + Sequence< ::rtl::OUString > aStrings( _values.size() ); + ::std::transform( + _values.begin(), + _values.end(), + aStrings.getArray(), + RowSetValueToString() + ); + return aStrings; + } + } + + //============================================================================== + //= ItemEventDescription + //============================================================================== typedef ::comphelper::EventHolder< ItemEvent > ItemEventDescription; - //================================================================== + //============================================================================== //= OListBoxModel - //================================================================== + //============================================================================== //------------------------------------------------------------------ InterfaceRef SAL_CALL OListBoxModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) throw (RuntimeException) { @@ -124,7 +166,7 @@ namespace frm OListBoxModel::OListBoxModel(const Reference<XMultiServiceFactory>& _rxFactory) :OBoundControlModel( _rxFactory, VCL_CONTROLMODEL_LISTBOX, FRM_SUN_CONTROL_LISTBOX, sal_True, sal_True, sal_True ) // use the old control name for compytibility reasons - ,OEntryListHelper( m_aMutex ) + ,OEntryListHelper( (OControlModel&)*this ) ,OErrorBroadcaster( OComponentHelper::rBHelper ) ,m_aListRowSet( getContext() ) ,m_nNULLPos(-1) @@ -141,13 +183,13 @@ namespace frm //------------------------------------------------------------------ OListBoxModel::OListBoxModel( const OListBoxModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory ) :OBoundControlModel( _pOriginal, _rxFactory ) - ,OEntryListHelper( *_pOriginal, m_aMutex ) + ,OEntryListHelper( *_pOriginal, (OControlModel&)*this ) ,OErrorBroadcaster( OComponentHelper::rBHelper ) ,m_aListRowSet( getContext() ) ,m_eListSourceType( _pOriginal->m_eListSourceType ) ,m_aBoundColumn( _pOriginal->m_aBoundColumn ) - ,m_aListSourceSeq( _pOriginal->m_aListSourceSeq ) - ,m_aValueSeq( _pOriginal->m_aValueSeq ) + ,m_aListSourceValues( _pOriginal->m_aListSourceValues ) + ,m_aBoundValues( _pOriginal->m_aBoundValues ) ,m_aDefaultSelectSeq( _pOriginal->m_aDefaultSelectSeq ) ,m_nNULLPos(-1) ,m_bBoundComponent(sal_False) @@ -229,11 +271,11 @@ namespace frm break; case PROPERTY_ID_LISTSOURCE: - _rValue <<= m_aListSourceSeq; + _rValue <<= lcl_convertToStringSequence( m_aListSourceValues ); break; case PROPERTY_ID_VALUE_SEQ: - _rValue <<= m_aValueSeq; + _rValue <<= lcl_convertToStringSequence( m_aBoundValues ); break; case PROPERTY_ID_DEFAULT_SELECT_SEQ: @@ -266,24 +308,38 @@ namespace frm _rValue >>= m_eListSourceType; break; - case PROPERTY_ID_LISTSOURCE : - DBG_ASSERT(_rValue.getValueType().equals(::getCppuType(reinterpret_cast<StringSequence*>(NULL))), - "OListBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - _rValue >>= m_aListSourceSeq; - - if (m_eListSourceType == ListSourceType_VALUELIST) - m_aValueSeq = m_aListSourceSeq; - else if ( m_xCursor.is() && !hasField() && !hasExternalListSource() ) - // listbox is already connected to a database, and no external list source - // data source changed -> refresh - loadData( false ); - break; + case PROPERTY_ID_LISTSOURCE: + { + // extract + Sequence< ::rtl::OUString > aListSource; + OSL_VERIFY( _rValue >>= aListSource ); + + // copy to member + ValueList().swap(m_aListSourceValues); + ::std::copy( + aListSource.getConstArray(), + aListSource.getConstArray() + aListSource.getLength(), + ::std::insert_iterator< ValueList >( m_aListSourceValues, m_aListSourceValues.end() ) + ); + + // propagate + if ( m_eListSourceType == ListSourceType_VALUELIST ) + { + m_aBoundValues = m_aListSourceValues; + } + else + { + if ( m_xCursor.is() && !hasField() && !hasExternalListSource() ) + // listbox is already connected to a database, and no external list source + // data source changed -> refresh + loadData( false ); + } + } + break; case PROPERTY_ID_VALUE_SEQ : - DBG_ASSERT(_rValue.getValueType().equals(::getCppuType(reinterpret_cast<StringSequence*>(NULL))), - "OListBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - _rValue >>= m_aValueSeq; - break; + OSL_ENSURE( false, "ValueItemList is read-only!" ); + throw PropertyVetoException(); case PROPERTY_ID_DEFAULT_SELECT_SEQ : DBG_ASSERT(_rValue.getValueType().equals(::getCppuType(reinterpret_cast< Sequence<sal_Int16>*>(NULL))), @@ -297,8 +353,8 @@ namespace frm case PROPERTY_ID_STRINGITEMLIST: { - ::osl::ResettableMutexGuard aGuard( m_aMutex ); - setNewStringItemList( _rValue, aGuard ); + ControlModelLock aLock( *this ); + setNewStringItemList( _rValue, aLock ); // TODO: this is bogus. setNewStringItemList expects a guard which has the *only* // lock to the mutex, but setFastPropertyValue_NoBroadcast is already called with // a lock - so we effectively has two locks here, of which setNewStringItemList can @@ -329,12 +385,12 @@ namespace frm break; case PROPERTY_ID_LISTSOURCE: - bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_aListSourceSeq); + bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, lcl_convertToStringSequence( m_aListSourceValues ) ); break; case PROPERTY_ID_VALUE_SEQ : - bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_aValueSeq); - break; + OSL_ENSURE( false, "ValueItemList is read-only!" ); + throw PropertyVetoException(); case PROPERTY_ID_DEFAULT_SELECT_SEQ : bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_aDefaultSelectSeq); @@ -435,7 +491,7 @@ namespace frm _rxOutStream << nAnyMask; - _rxOutStream << m_aListSourceSeq; + _rxOutStream << lcl_convertToStringSequence( m_aListSourceValues ); _rxOutStream << (sal_Int16)m_eListSourceType; _rxOutStream << aDummySeq; _rxOutStream << m_aDefaultSelectSeq; @@ -459,7 +515,7 @@ namespace frm // Deshalb muessen sie explizit ueber setPropertyValue() gesetzt werden. OBoundControlModel::read(_rxInStream); - ::osl::ResettableMutexGuard aGuard(m_aMutex); + ControlModelLock aLock( *this ); // since we are "overwriting" the StringItemList of our aggregate (means we have // an own place to store the value, instead of relying on our aggregate storing it), @@ -467,7 +523,7 @@ namespace frm try { if ( m_xAggregateSet.is() ) - setNewStringItemList( m_xAggregateSet->getPropertyValue( PROPERTY_STRINGITEMLIST ), aGuard ); + setNewStringItemList( m_xAggregateSet->getPropertyValue( PROPERTY_STRINGITEMLIST ), aLock ); } catch( const Exception& ) { @@ -481,9 +537,9 @@ namespace frm if (nVersion > 0x0004) { DBG_ERROR("OListBoxModel::read : invalid (means unknown) version !"); - m_aListSourceSeq.realloc(0); + ValueList().swap(m_aListSourceValues); m_aBoundColumn <<= (sal_Int16)0; - m_aValueSeq.realloc(0); + ValueList().swap(m_aBoundValues); m_eListSourceType = ListSourceType_VALUELIST; m_aDefaultSelectSeq.realloc(0); defaultCommonProperties(); @@ -588,17 +644,18 @@ namespace frm // PRE2: list source ::rtl::OUString sListSource; - // if our list source type is no value list, we need to concatenete + // if our list source type is no value list, we need to concatenate // the single list source elements - const ::rtl::OUString* pListSourceItem = m_aListSourceSeq.getConstArray(); - sal_Int32 i(0); - for ( i=0; i<m_aListSourceSeq.getLength(); ++i, ++pListSourceItem ) - sListSource = sListSource + *pListSourceItem; + ::std::for_each( + m_aListSourceValues.begin(), + m_aListSourceValues.end(), + AppendRowSetValueString( sListSource ) + ); // outta here if we don't have all pre-requisites if ( !xConnection.is() || !sListSource.getLength() ) { - m_aValueSeq = StringSequence(); + ValueList().swap(m_aBoundValues); return; } @@ -742,9 +799,7 @@ namespace frm } // Anzeige- und Werteliste fuellen - ::std::vector< ::rtl::OUString > aValueList, aStringList; - aValueList.reserve(16); - aStringList.reserve(16); + ValueList aDisplayList, aValueList; sal_Bool bUseNULL = hasField() && !isRequired(); try @@ -780,23 +835,20 @@ namespace frm ::dbtools::FormattedColumnValue aValueFormatter( getContext(), m_xCursor, xDataField ); // Feld der BoundColumn des ResultSets holen - Reference< XPropertySet > xBoundField; - if ((nBoundColumn > 0) && m_xColumn.is()) + sal_Int32 nBoundColumnType = DataType::SQLNULL; + if ( ( nBoundColumn > 0 ) && m_xColumn.is() ) { // don't look for a bound column if we're not connected to a field try { - xColumns->getByIndex(nBoundColumn) >>= xBoundField; + Reference< XPropertySet > xBoundField( xColumns->getByIndex( nBoundColumn ), UNO_QUERY_THROW ); + OSL_VERIFY( xBoundField->getPropertyValue( ::rtl::OUString::createFromAscii( "Type" ) ) >>= nBoundColumnType ); } catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); } } - m_bBoundComponent = xBoundField.is(); - - ::std::auto_ptr< ::dbtools::FormattedColumnValue > pBoundFieldFormatter; - if ( xBoundField.is() ) - pBoundFieldFormatter.reset( new ::dbtools::FormattedColumnValue( getContext(), m_xCursor, xBoundField ) ); + m_bBoundComponent = ( nBoundColumnType != DataType::SQLNULL ); // Ist die LB an ein Feld gebunden und sind Leereintraege zulaessig // dann wird die Position fuer einen Leereintrag gemerkt @@ -804,20 +856,21 @@ namespace frm RTL_LOGFILE_CONTEXT( aLogContext, "OListBoxModel::loadData: string collection" ); ::rtl::OUString aStr; sal_Int16 entryPos = 0; - // per definitionem the list cursor is positioned _before_ the first row at the moment + ORowSetValue aBoundValue; + Reference< XRow > xCursorRow( xListCursor, UNO_QUERY_THROW ); while ( xListCursor->next() && ( entryPos++ < SHRT_MAX ) ) // SHRT_MAX is the maximum number of entries { aStr = aValueFormatter.getFormattedValue(); - aStringList.push_back(aStr); + aDisplayList.push_back( aStr ); - if ( pBoundFieldFormatter.get() ) + if ( m_bBoundComponent ) { - aStr = pBoundFieldFormatter->getFormattedValue(); - aValueList.push_back( aStr ); + aBoundValue.fill( nBoundColumn + 1, nBoundColumnType, xCursorRow ); + aValueList.push_back( aBoundValue ); } - if (bUseNULL && (m_nNULLPos == -1) && !aStr.getLength()) - m_nNULLPos = (sal_Int16)aStringList.size() - 1; + if ( bUseNULL && ( m_nNULLPos == -1 ) && !aStr.getLength() ) + m_nNULLPos = sal_Int16( aDisplayList.size() - 1 ); } } break; @@ -828,11 +881,11 @@ namespace frm if (xFieldNames.is()) { StringSequence seqNames = xFieldNames->getElementNames(); - sal_Int32 nFieldsCount = seqNames.getLength(); - const ::rtl::OUString* pustrNames = seqNames.getConstArray(); - - for (sal_Int32 k=0; k<nFieldsCount; ++k, ++pustrNames) - aStringList.push_back(*pustrNames); + ::std::copy( + seqNames.getConstArray(), + seqNames.getConstArray() + seqNames.getLength(), + ::std::insert_iterator< ValueList >( aDisplayList, aDisplayList.end() ) + ); } } break; @@ -857,25 +910,16 @@ namespace frm // NULL eintrag hinzufuegen if (bUseNULL && m_nNULLPos == -1) { - if (m_bBoundComponent) - aValueList.insert(aValueList.begin(), ::rtl::OUString()); + if ( m_bBoundComponent ) + aValueList.insert( aValueList.begin(), ORowSetValue() ); - aStringList.insert(aStringList.begin(), ::rtl::OUString()); + aDisplayList.insert( aDisplayList.begin(), ORowSetValue( ::rtl::OUString() ) ); m_nNULLPos = 0; } - m_aValueSeq.realloc(aValueList.size()); - ::rtl::OUString* pValues = m_aValueSeq.getArray(); - for ( i = 0; i < (sal_Int32)aValueList.size(); ++i, ++pValues) - *pValues = aValueList[i]; - - // String-Sequence fuer ListBox erzeugen - StringSequence aStringSeq(aStringList.size()); - ::rtl::OUString* pStrings = aStringSeq.getArray(); - for ( i = 0; i < (sal_Int32)aStringList.size(); ++i, ++pStrings ) - *pStrings = aStringList[i]; + m_aBoundValues = aValueList; - setFastPropertyValue(PROPERTY_ID_STRINGITEMLIST, makeAny(aStringSeq)); + setFastPropertyValue( PROPERTY_ID_STRINGITEMLIST, makeAny( lcl_convertToStringSequence( aDisplayList ) ) ); } //------------------------------------------------------------------------------ @@ -890,19 +934,14 @@ namespace frm if ( !hasExternalListSource() ) impl_refreshDbEntryList( false ); - - if ( hasField() ) - m_pBoundFieldFormatter.reset( new ::dbtools::FormattedColumnValue( getContext(), m_xCursor, getField() ) ); } //------------------------------------------------------------------------------ void OListBoxModel::onDisconnectedDbColumn() { - m_pBoundFieldFormatter.reset( NULL ); - - if (m_eListSourceType != ListSourceType_VALUELIST) + if ( m_eListSourceType != ListSourceType_VALUELIST ) { - m_aValueSeq = StringSequence(); + ValueList().swap(m_aBoundValues); m_nNULLPos = -1; m_bBoundComponent = sal_False; @@ -914,81 +953,73 @@ namespace frm } //------------------------------------------------------------------------------ - StringSequence OListBoxModel::GetCurValueSeq() const + ValueList OListBoxModel::impl_getValues() const { - StringSequence aCurValues; + if ( !m_aBoundValues.empty() ) + return m_aBoundValues; - // Aus den selektierten Indizes Werte-Sequence aufbauen - DBG_ASSERT(m_xAggregateFastSet.is(), "OListBoxModel::GetCurValueSeq : invalid aggregate !"); - if (!m_xAggregateFastSet.is()) - return aCurValues; - - Any aTmp = m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ); - - Sequence<sal_Int16> aSelectSeq; aTmp >>= aSelectSeq; - const sal_Int16 *pSels = aSelectSeq.getConstArray(); - sal_uInt32 nSelCount = aSelectSeq.getLength(); + Sequence< ::rtl::OUString > aStringItems( getStringItemList() ); + ValueList aValues( aStringItems.getLength() ); + ::std::copy( + aStringItems.getConstArray(), + aStringItems.getConstArray() + aStringItems.getLength(), + aValues.begin() + ); - if (nSelCount) - { - StringSequence aValues( impl_getValues() ); + return aValues; + } + //------------------------------------------------------------------------------ + ORowSetValue OListBoxModel::getFirstSelectedValue() const + { + static const ORowSetValue s_aEmptyVaue; - const ::rtl::OUString *pVals = aValues.getConstArray(); - sal_Int32 nValCnt = aValues.getLength(); + DBG_ASSERT( m_xAggregateFastSet.is(), "OListBoxModel::getFirstSelectedValue: invalid aggregate!" ); + if ( !m_xAggregateFastSet.is() ) + return s_aEmptyVaue; - if (nSelCount > 1) - { - // Einfach- oder Mehrfach-Selektion - sal_Bool bMultiSel = false; - const_cast<OListBoxModel*>(this)->OPropertySetAggregationHelper::getFastPropertyValue(PROPERTY_ID_MULTISELECTION) >>= bMultiSel; - if (bMultiSel) - nSelCount = 1; - } + Sequence< sal_Int16 > aSelectedIndices; + OSL_VERIFY( m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ) >>= aSelectedIndices ); + if ( !aSelectedIndices.getLength() ) + // nothing selected at all + return s_aEmptyVaue; - // ist der Eintrag fuer NULL selektiert ? - // dann leere Selektion liefern - if (m_nNULLPos != -1 && nSelCount == 1 && pSels[0] == m_nNULLPos) - nSelCount = 0; + if ( ( m_nNULLPos != -1 ) && ( aSelectedIndices[0] == m_nNULLPos ) ) + // the dedicated "NULL" entry is selected + return s_aEmptyVaue; - aCurValues.realloc(nSelCount); - ::rtl::OUString *pCurVals = aCurValues.getArray(); + ValueList aValues( impl_getValues() ); - for (sal_uInt16 i = 0; i < nSelCount; i++) - { - if (pSels[i] < nValCnt) - pCurVals[i] = pVals[pSels[i]]; - } + size_t selectedValue = aSelectedIndices[0]; + if ( selectedValue >= aValues.size() ) + { + OSL_ENSURE( false, "OListBoxModel::getFirstSelectedValue: inconsistent selection/valuelist!" ); + return s_aEmptyVaue; } - return aCurValues; + + return aValues[ selectedValue ]; } //------------------------------------------------------------------------------ sal_Bool OListBoxModel::commitControlValueToDbColumn( bool /*_bPostReset*/ ) { // current selektion list - Any aCurrentValue; - StringSequence aCurValueSeq = GetCurValueSeq(); - if ( aCurValueSeq.getLength() ) - aCurrentValue <<= aCurValueSeq.getConstArray()[0]; - - if ( !compare( aCurrentValue, m_aSaveValue ) ) + const ORowSetValue rCurrentValue( getFirstSelectedValue() ); + if ( rCurrentValue != m_aSaveValue ) { - if ( !aCurrentValue.hasValue() ) + if ( rCurrentValue.isNull() ) m_xColumnUpdate->updateNull(); else { try { - ::rtl::OUString sNewValue; - aCurrentValue >>= sNewValue; - m_xColumnUpdate->updateString( sNewValue ); + m_xColumnUpdate->updateObject( rCurrentValue.makeAny() ); } - catch(Exception&) + catch ( const Exception& ) { return sal_False; } } - m_aSaveValue = aCurrentValue; + m_aSaveValue = rCurrentValue; } return sal_True; } @@ -997,37 +1028,41 @@ namespace frm //------------------------------------------------------------------------------ Any OListBoxModel::translateDbColumnToControlValue() { - DBG_ASSERT( m_xAggregateFastSet.is() && m_xAggregateSet.is(), "OListBoxModel::translateDbColumnToControlValue: invalid aggregate !" ); - if ( !m_xAggregateFastSet.is() || !m_xAggregateSet.is() ) - return Any(); - - OSL_ENSURE( m_pBoundFieldFormatter.get(), "OListBoxModel::translateDbColumnToControlValue: illegal call!" ); - if ( !m_pBoundFieldFormatter.get() ) + Reference< XPropertySet > xBoundField( getField() ); + if ( !xBoundField.is() ) + { + OSL_ENSURE( false, "OListBoxModel::translateDbColumnToControlValue: no field? How could that happen?!" ); return Any(); + } - Sequence<sal_Int16> aSelSeq; + Sequence< sal_Int16 > aSelectionIndicies; // Bei NULL-Eintraegen Selektion aufheben! - ::rtl::OUString sValue = m_pBoundFieldFormatter->getFormattedValue(); - OSL_PRECOND( getField() == m_xColumn, "OListBoxModel::translateDbColumnToControlValue: inconsistency!" ); - // m_pBoundFieldFormatter is based on m_xField, and we use m_xColumn to check for wasNull - // => both should better be the same object ... - if ( m_xColumn->wasNull() ) + ORowSetValue aCurrentValue; + aCurrentValue.fill( xBoundField->getPropertyValue( PROPERTY_VALUE ) ); + + if ( aCurrentValue.isNull() ) { - m_aSaveValue.clear(); - if (m_nNULLPos != -1) + if ( m_nNULLPos != -1 ) { - aSelSeq.realloc(1); - aSelSeq.getArray()[0] = m_nNULLPos; + aSelectionIndicies.realloc(1); + aSelectionIndicies[0] = m_nNULLPos; } } else { - m_aSaveValue <<= sValue; - - aSelSeq = findValue( impl_getValues(), sValue, m_bBoundComponent ); + ValueList aValues( impl_getValues() ); + ValueList::const_iterator curValuePos = ::std::find( aValues.begin(), aValues.end(), aCurrentValue ); + if ( curValuePos != aValues.end() ) + { + aSelectionIndicies.realloc( 1 ); + aSelectionIndicies[0] = curValuePos - aValues.begin(); + } } - return makeAny( aSelSeq ); + + m_aSaveValue = aCurrentValue; + + return makeAny( aSelectionIndicies ); } // XReset @@ -1158,7 +1193,7 @@ namespace frm aThisEntryIndexes.getConstArray(), aThisEntryIndexes.getConstArray() + aThisEntryIndexes.getLength(), ::std::insert_iterator< ::std::set< sal_Int16 > >( aSelectionSet, aSelectionSet.begin() ) - ); + ); } // copy the indexes to the sequence @@ -1329,7 +1364,7 @@ namespace frm } //-------------------------------------------------------------------- - void OListBoxModel::stringItemListChanged( ::osl::ResettableMutexGuard& _rInstanceLock ) + void OListBoxModel::stringItemListChanged( ControlModelLock& _rInstanceLock ) { if ( !m_xAggregateSet.is() ) return; diff --git a/forms/source/component/ListBox.hxx b/forms/source/component/ListBox.hxx index 16fe8cd4482b..60bd63b3712d 100644 --- a/forms/source/component/ListBox.hxx +++ b/forms/source/component/ListBox.hxx @@ -46,14 +46,13 @@ #include <com/sun/star/form/XChangeBroadcaster.hpp> /** === end UNO includes === **/ -#include <vcl/timer.hxx> - #include <comphelper/asyncnotification.hxx> - +#include <connectivity/FValue.hxx> #include <cppuhelper/interfacecontainer.hxx> #include <cppuhelper/implbase1.hxx> +#include <vcl/timer.hxx> -#include <memory> +#include <vector> namespace dbtools { @@ -67,21 +66,21 @@ namespace frm //================================================================== //= OListBoxModel //================================================================== +typedef ::std::vector< ::connectivity::ORowSetValue > ValueList; + class OListBoxModel :public OBoundControlModel ,public OEntryListHelper ,public OErrorBroadcaster { - CachedRowSet m_aListRowSet; // the row set to fill the list - ::std::auto_ptr< ::dbtools::FormattedColumnValue > - m_pBoundFieldFormatter; - ::com::sun::star::uno::Any m_aSaveValue; + CachedRowSet m_aListRowSet; // the row set to fill the list + ::connectivity::ORowSetValue m_aSaveValue; // <properties> ::com::sun::star::form::ListSourceType m_eListSourceType; // type der list source ::com::sun::star::uno::Any m_aBoundColumn; - StringSequence m_aListSourceSeq; // - StringSequence m_aValueSeq; // alle Werte, readonly + ValueList m_aListSourceValues; + ValueList m_aBoundValues; ::com::sun::star::uno::Sequence<sal_Int16> m_aDefaultSelectSeq; // DefaultSelected // </properties> @@ -89,8 +88,7 @@ class OListBoxModel :public OBoundControlModel sal_Bool m_bBoundComponent : 1; private: - // Helper functions - StringSequence GetCurValueSeq() const; + ::connectivity::ORowSetValue getFirstSelectedValue() const; virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); @@ -164,7 +162,7 @@ protected: getCurrentFormComponentValue() const; // OEntryListHelper overriables - virtual void stringItemListChanged( ::osl::ResettableMutexGuard& _rInstanceLock ); + virtual void stringItemListChanged( ControlModelLock& _rInstanceLock ); virtual void connectedExternalListSource( ); virtual void disconnectedExternalListSource( ); virtual void refreshInternalEntryList(); @@ -180,8 +178,7 @@ private: */ void impl_refreshDbEntryList( bool _bForce ); - StringSequence - impl_getValues() const { return m_aValueSeq.getLength() ? m_aValueSeq : getStringItemList(); } + ValueList impl_getValues() const; }; //================================================================== diff --git a/forms/source/component/RadioButton.cxx b/forms/source/component/RadioButton.cxx index 78841aa89ecf..cd70d200f376 100644 --- a/forms/source/component/RadioButton.cxx +++ b/forms/source/component/RadioButton.cxx @@ -259,7 +259,7 @@ void ORadioButtonModel::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, cons } } - if (nHandle == PROPERTY_ID_DEFAULTCHECKED) + if (nHandle == PROPERTY_ID_DEFAULT_STATE) { sal_Int16 nValue; rValue >>= nValue; @@ -269,7 +269,7 @@ void ORadioButtonModel::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, cons Any aZero; nValue = 0; aZero <<= nValue; - SetSiblingPropsTo(PROPERTY_DEFAULTCHECKED, aZero); + SetSiblingPropsTo(PROPERTY_DEFAULT_STATE, aZero); } } } @@ -341,7 +341,7 @@ void SAL_CALL ORadioButtonModel::read(const Reference<XObjectInputStream>& _rxIn } setReferenceValue( sReferenceValue ); - setDefaultChecked( (CheckState)nDefaultChecked ); + setDefaultChecked( (ToggleState)nDefaultChecked ); // Nach dem Lesen die Defaultwerte anzeigen if ( getControlSource().getLength() ) diff --git a/forms/source/component/entrylisthelper.cxx b/forms/source/component/entrylisthelper.cxx index 81a9346ae6e7..3d7217cc162c 100644 --- a/forms/source/component/entrylisthelper.cxx +++ b/forms/source/component/entrylisthelper.cxx @@ -31,6 +31,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_forms.hxx" #include "entrylisthelper.hxx" +#include "FormComponent.hxx" + #include <osl/diagnose.h> #include <comphelper/sequence.hxx> #include <comphelper/property.hxx> @@ -50,18 +52,18 @@ namespace frm //= OEntryListHelper //===================================================================== //--------------------------------------------------------------------- - OEntryListHelper::OEntryListHelper( ::osl::Mutex& _rMutex ) - :m_rMutex( _rMutex ) - ,m_aRefreshListeners( _rMutex ) + OEntryListHelper::OEntryListHelper( OControlModel& _rControlModel ) + :m_rControlModel( _rControlModel ) + ,m_aRefreshListeners( _rControlModel.getInstanceMutex() ) { } //--------------------------------------------------------------------- - OEntryListHelper::OEntryListHelper( const OEntryListHelper& _rSource, ::osl::Mutex& _rMutex ) - :m_rMutex( _rMutex ) + OEntryListHelper::OEntryListHelper( const OEntryListHelper& _rSource, OControlModel& _rControlModel ) + :m_rControlModel( _rControlModel ) ,m_xListSource ( _rSource.m_xListSource ) ,m_aStringItems( _rSource.m_aStringItems ) - ,m_aRefreshListeners( _rMutex ) + ,m_aRefreshListeners( _rControlModel.getInstanceMutex() ) { } @@ -73,14 +75,14 @@ namespace frm //--------------------------------------------------------------------- void SAL_CALL OEntryListHelper::setListEntrySource( const Reference< XListEntrySource >& _rxSource ) throw (RuntimeException) { - ::osl::ResettableMutexGuard aGuard( m_rMutex ); + ControlModelLock aLock( m_rControlModel ); // disconnect from the current external list source disconnectExternalListSource(); // and connect to the new one if ( _rxSource.is() ) - connectExternalListSource( _rxSource, aGuard ); + connectExternalListSource( _rxSource, aLock ); } //--------------------------------------------------------------------- @@ -93,7 +95,8 @@ namespace frm //--------------------------------------------------------------------- void SAL_CALL OEntryListHelper::entryChanged( const ListEntryEvent& _rEvent ) throw (RuntimeException) { - ::osl::ResettableMutexGuard aGuard( m_rMutex ); + ControlModelLock aLock( m_rControlModel ); + OSL_ENSURE( _rEvent.Source == m_xListSource, "OEntryListHelper::entryChanged: where did this come from?" ); OSL_ENSURE( ( _rEvent.Position >= 0 ) && ( _rEvent.Position < m_aStringItems.getLength() ), @@ -107,14 +110,15 @@ namespace frm ) { m_aStringItems[ _rEvent.Position ] = _rEvent.Entries[ 0 ]; - stringItemListChanged( aGuard ); + stringItemListChanged( aLock ); } } //--------------------------------------------------------------------- void SAL_CALL OEntryListHelper::entryRangeInserted( const ListEntryEvent& _rEvent ) throw (RuntimeException) { - ::osl::ResettableMutexGuard aGuard( m_rMutex ); + ControlModelLock aLock( m_rControlModel ); + OSL_ENSURE( _rEvent.Source == m_xListSource, "OEntryListHelper::entryRangeInserted: where did this come from?" ); OSL_ENSURE( ( _rEvent.Position > 0 ) && ( _rEvent.Position < m_aStringItems.getLength() ) && ( _rEvent.Entries.getLength() > 0 ), @@ -143,14 +147,15 @@ namespace frm aMovedEntries ); - stringItemListChanged( aGuard ); + stringItemListChanged( aLock ); } } //--------------------------------------------------------------------- void SAL_CALL OEntryListHelper::entryRangeRemoved( const ListEntryEvent& _rEvent ) throw (RuntimeException) { - ::osl::ResettableMutexGuard aGuard( m_rMutex ); + ControlModelLock aLock( m_rControlModel ); + OSL_ENSURE( _rEvent.Source == m_xListSource, "OEntryListHelper::entryRangeRemoved: where did this come from?" ); OSL_ENSURE( ( _rEvent.Position > 0 ) && ( _rEvent.Count > 0 ) && ( _rEvent.Position + _rEvent.Count <= m_aStringItems.getLength() ), @@ -170,21 +175,22 @@ namespace frm // shrink the array m_aStringItems.realloc( m_aStringItems.getLength() - _rEvent.Count ); - stringItemListChanged( aGuard ); + stringItemListChanged( aLock ); } } //--------------------------------------------------------------------- void SAL_CALL OEntryListHelper::allEntriesChanged( const EventObject& _rEvent ) throw (RuntimeException) { - ::osl::ResettableMutexGuard aGuard( m_rMutex ); + ControlModelLock aLock( m_rControlModel ); + OSL_ENSURE( _rEvent.Source == m_xListSource, "OEntryListHelper::allEntriesChanged: where did this come from?" ); Reference< XListEntrySource > xSource( _rEvent.Source, UNO_QUERY ); if ( _rEvent.Source == m_xListSource ) { - impl_lock_refreshList( aGuard ); + impl_lock_refreshList( aLock ); } } @@ -207,8 +213,8 @@ namespace frm void SAL_CALL OEntryListHelper::refresh() throw(RuntimeException) { { - ::osl::ResettableMutexGuard aGuard( m_rMutex ); - impl_lock_refreshList( aGuard ); + ControlModelLock aLock( m_rControlModel ); + impl_lock_refreshList( aLock ); } EventObject aEvt( static_cast< XRefreshable* >( this ) ); @@ -216,7 +222,7 @@ namespace frm } //--------------------------------------------------------------------- - void OEntryListHelper::impl_lock_refreshList( ::osl::ResettableMutexGuard& _rInstanceLock ) + void OEntryListHelper::impl_lock_refreshList( ControlModelLock& _rInstanceLock ) { if ( hasExternalListSource() ) { @@ -272,7 +278,7 @@ namespace frm } //--------------------------------------------------------------------- - void OEntryListHelper::connectExternalListSource( const Reference< XListEntrySource >& _rxSource, ::osl::ResettableMutexGuard& _rInstanceLock ) + void OEntryListHelper::connectExternalListSource( const Reference< XListEntrySource >& _rxSource, ControlModelLock& _rInstanceLock ) { OSL_ENSURE( !hasExternalListSource(), "OEntryListHelper::connectExternalListSource: only to be called if no external source is active!" ); OSL_ENSURE( _rxSource.is(), "OEntryListHelper::connectExternalListSource: invalid list source!" ); @@ -306,7 +312,7 @@ namespace frm } //--------------------------------------------------------------------- - void OEntryListHelper::setNewStringItemList( const ::com::sun::star::uno::Any& _rValue, ::osl::ResettableMutexGuard& _rInstanceLock ) + void OEntryListHelper::setNewStringItemList( const ::com::sun::star::uno::Any& _rValue, ControlModelLock& _rInstanceLock ) { OSL_PRECOND( !hasExternalListSource(), "OEntryListHelper::setNewStringItemList: this should never have survived convertNewListSourceProperty!" ); OSL_VERIFY( _rValue >>= m_aStringItems ); diff --git a/forms/source/component/entrylisthelper.hxx b/forms/source/component/entrylisthelper.hxx index 5b5b0ca46610..3d0f1de784b6 100644 --- a/forms/source/component/entrylisthelper.hxx +++ b/forms/source/component/entrylisthelper.hxx @@ -46,6 +46,9 @@ namespace frm { //......................................................................... + class OControlModel; + class ControlModelLock; + //===================================================================== //= OEntryListHelper //===================================================================== @@ -57,19 +60,19 @@ namespace frm class OEntryListHelper : public OEntryListHelper_BASE { private: - ::osl::Mutex& m_rMutex; + OControlModel& m_rControlModel; ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XListEntrySource > m_xListSource; /// our external list source ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aStringItems; /// "overridden" StringItemList property value - ::cppu::OInterfaceContainerHelper + ::cppu::OInterfaceContainerHelper m_aRefreshListeners; protected: - OEntryListHelper( ::osl::Mutex& _rMutex ); - OEntryListHelper( const OEntryListHelper& _rSource, ::osl::Mutex& _rMutex ); + OEntryListHelper( OControlModel& _rControlModel ); + OEntryListHelper( const OEntryListHelper& _rSource, OControlModel& _rControlModel ); virtual ~OEntryListHelper( ); /// returns the current string item list @@ -117,7 +120,7 @@ namespace frm not to be called when we have an external list source @see hasExternalListSource */ - void setNewStringItemList( const ::com::sun::star::uno::Any& _rValue, ::osl::ResettableMutexGuard& _rInstanceLock ); + void setNewStringItemList( const ::com::sun::star::uno::Any& _rValue, ControlModelLock& _rInstanceLock ); /** announces that the list of entries has changed. @@ -127,7 +130,7 @@ namespace frm @pure @see getStringItemList */ - virtual void stringItemListChanged( ::osl::ResettableMutexGuard& _rInstanceLock ) = 0; + virtual void stringItemListChanged( ControlModelLock& _rInstanceLock ) = 0; /** called whenever a connection to a new external list source has been established */ @@ -171,7 +174,7 @@ namespace frm */ void connectExternalListSource( const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XListEntrySource >& _rxSource, - ::osl::ResettableMutexGuard& _rInstanceLock + ControlModelLock& _rInstanceLock ); /** refreshes our list entries @@ -182,7 +185,7 @@ namespace frm In case we do not have an external list source, refreshInternalEntryList is called. */ - void impl_lock_refreshList( ::osl::ResettableMutexGuard& _rInstanceLock ); + void impl_lock_refreshList( ControlModelLock& _rInstanceLock ); private: OEntryListHelper(); // never implemented diff --git a/forms/source/component/propertybaghelper.cxx b/forms/source/component/propertybaghelper.cxx index 796f683ac1aa..a14aaf6d3ed3 100644 --- a/forms/source/component/propertybaghelper.cxx +++ b/forms/source/component/propertybaghelper.cxx @@ -45,6 +45,9 @@ #include <tools/diagnose_ex.h> #include <comphelper/sequence.hxx> +#include <rtl/logfile.hxx> +#include "rtl/instance.hxx" + #define NEW_HANDLE_BASE 10000 @@ -93,6 +96,7 @@ namespace frm ,m_pPropertyArrayHelper( NULL ) ,m_bDisposed( false ) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "PropertyBagHelper::PropertyBagHelper" ); } //-------------------------------------------------------------------- @@ -104,12 +108,14 @@ namespace frm //-------------------------------------------------------------------- void PropertyBagHelper::dispose() { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "PropertyBagHelper::dispose" ); m_bDisposed = true; } //-------------------------------------------------------------------- void PropertyBagHelper::impl_nts_checkDisposed_throw() const { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "PropertyBagHelper::impl_nts_checkDisposed_throw" ); if ( m_bDisposed ) throw DisposedException(); } @@ -117,12 +123,14 @@ namespace frm //-------------------------------------------------------------------- void PropertyBagHelper::impl_nts_invalidatePropertySetInfo() { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "PropertyBagHelper::impl_nts_invalidatePropertySetInfo" ); delete m_pPropertyArrayHelper, m_pPropertyArrayHelper = NULL; } //-------------------------------------------------------------------- sal_Int32 PropertyBagHelper::impl_findFreeHandle( const ::rtl::OUString& _rPropertyName ) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "PropertyBagHelper::impl_findFreeHandle" ); ::comphelper::OPropertyArrayAggregationHelper& rPropInfo( impl_ts_getArrayHelper() ); // check the preferred handle @@ -162,29 +170,43 @@ namespace frm //-------------------------------------------------------------------- ::comphelper::OPropertyArrayAggregationHelper& PropertyBagHelper::impl_ts_getArrayHelper() const { - ::osl::MutexGuard aGuard( m_rContext.getMutex() ); - if ( !m_pPropertyArrayHelper ) + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "PropertyBagHelper::impl_ts_getArrayHelper" ); + //::osl::MutexGuard aGuard( m_rContext.getMutex() ); + OPropertyArrayAggregationHelper* p = m_pPropertyArrayHelper; + if ( !p ) { - // our own fixed and our aggregate's properties - Sequence< Property > aFixedProps; - Sequence< Property > aAggregateProps; - m_rContext.describeFixedAndAggregateProperties( aFixedProps, aAggregateProps ); + ::osl::MutexGuard aGuard( m_rContext.getMutex() ); + p = m_pPropertyArrayHelper; + if ( !p ) + { + // our own fixed and our aggregate's properties + Sequence< Property > aFixedProps; + Sequence< Property > aAggregateProps; + m_rContext.describeFixedAndAggregateProperties( aFixedProps, aAggregateProps ); - // our dynamic properties - Sequence< Property > aDynamicProps; - m_aDynamicProperties.describeProperties( aDynamicProps ); + // our dynamic properties + Sequence< Property > aDynamicProps; + m_aDynamicProperties.describeProperties( aDynamicProps ); - Sequence< Property > aOwnProps( - ::comphelper::concatSequences( aFixedProps, aDynamicProps ) ); + Sequence< Property > aOwnProps( + ::comphelper::concatSequences( aFixedProps, aDynamicProps ) ); - const_cast< PropertyBagHelper* >( this )->m_pPropertyArrayHelper = new OPropertyArrayAggregationHelper( aOwnProps, aAggregateProps, &lcl_getPropertyInfos(), NEW_HANDLE_BASE ); + p = new OPropertyArrayAggregationHelper( aOwnProps, aAggregateProps, &lcl_getPropertyInfos(), NEW_HANDLE_BASE ); + OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); + const_cast< PropertyBagHelper* >( this )->m_pPropertyArrayHelper = p; + } + } // if ( !p ) + else + { + OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); } - return *m_pPropertyArrayHelper; + return *p; } //-------------------------------------------------------------------- void PropertyBagHelper::addProperty( const ::rtl::OUString& _rName, ::sal_Int16 _nAttributes, const Any& _rInitialValue ) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "PropertyBagHelper::addProperty" ); ::osl::MutexGuard aGuard( m_rContext.getMutex() ); impl_nts_checkDisposed_throw(); @@ -212,6 +234,7 @@ namespace frm //-------------------------------------------------------------------- void PropertyBagHelper::removeProperty( const ::rtl::OUString& _rName ) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "PropertyBagHelper::removeProperty" ); ::osl::MutexGuard aGuard( m_rContext.getMutex() ); impl_nts_checkDisposed_throw(); @@ -260,6 +283,7 @@ namespace frm //-------------------------------------------------------------------- Sequence< PropertyValue > PropertyBagHelper::getPropertyValues() { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "PropertyBagHelper::getPropertyValues" ); ::osl::MutexGuard aGuard( m_rContext.getMutex() ); impl_nts_checkDisposed_throw(); @@ -302,6 +326,7 @@ namespace frm //-------------------------------------------------------------------- void PropertyBagHelper::setPropertyValues( const Sequence< PropertyValue >& _rProps ) { + // RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "forms", "dev@dba.openoffice.org", "PropertyBagHelper::setPropertyValues" ); ::osl::ClearableMutexGuard aGuard( m_rContext.getMutex() ); impl_nts_checkDisposed_throw(); diff --git a/forms/source/component/refvaluecomponent.cxx b/forms/source/component/refvaluecomponent.cxx index 7a9f71475229..cd6fd6eba04e 100644 --- a/forms/source/component/refvaluecomponent.cxx +++ b/forms/source/component/refvaluecomponent.cxx @@ -90,7 +90,7 @@ namespace frm switch ( _nHandle ) { case PROPERTY_ID_REFVALUE: _rValue <<= m_sReferenceValue; break; - case PROPERTY_ID_DEFAULTCHECKED: _rValue <<= (sal_Int16)m_eDefaultChecked; break; + case PROPERTY_ID_DEFAULT_STATE: _rValue <<= (sal_Int16)m_eDefaultChecked; break; case PROPERTY_ID_UNCHECKED_REFVALUE: OSL_ENSURE( m_bSupportSecondRefValue, "OReferenceValueComponent::getFastPropertyValue: not supported!" ); @@ -117,11 +117,11 @@ namespace frm OSL_VERIFY( _rValue >>= m_sNoCheckReferenceValue ); break; - case PROPERTY_ID_DEFAULTCHECKED: + case PROPERTY_ID_DEFAULT_STATE: { sal_Int16 nDefaultChecked( (sal_Int16)STATE_NOCHECK ); OSL_VERIFY( _rValue >>= nDefaultChecked ); - m_eDefaultChecked = (CheckState)nDefaultChecked; + m_eDefaultChecked = (ToggleState)nDefaultChecked; resetNoBroadcast(); } break; @@ -146,7 +146,7 @@ namespace frm bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, m_sNoCheckReferenceValue ); break; - case PROPERTY_ID_DEFAULTCHECKED: + case PROPERTY_ID_DEFAULT_STATE: bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_eDefaultChecked ); break; @@ -168,7 +168,7 @@ namespace frm { BEGIN_DESCRIBE_PROPERTIES( m_bSupportSecondRefValue ? 3 : 2, OBoundControlModel ) DECL_PROP1( REFVALUE, ::rtl::OUString, BOUND ); - DECL_PROP1( DEFAULTCHECKED, sal_Int16, BOUND ); + DECL_PROP1( DEFAULT_STATE, sal_Int16, BOUND ); if ( m_bSupportSecondRefValue ) { DECL_PROP1( UNCHECKED_REFVALUE, ::rtl::OUString, BOUND ); diff --git a/forms/source/component/refvaluecomponent.hxx b/forms/source/component/refvaluecomponent.hxx index 856c53572432..40745b22764d 100644 --- a/forms/source/component/refvaluecomponent.hxx +++ b/forms/source/component/refvaluecomponent.hxx @@ -28,10 +28,11 @@ * ************************************************************************/ -#ifndef EFORMS2_FORMS_SOURCE_COMPONENT_REFVALUECOMPONENT_HXX -#define EFORMS2_FORMS_SOURCE_COMPONENT_REFVALUECOMPONENT_HXX +#ifndef FORMS_SOURCE_COMPONENT_REFVALUECOMPONENT_HXX +#define FORMS_SOURCE_COMPONENT_REFVALUECOMPONENT_HXX #include "FormComponent.hxx" +#include "togglestate.hxx" /** === begin UNO includes === **/ /** === end UNO includes === **/ @@ -41,8 +42,6 @@ namespace frm { //........................................................................ - enum CheckState { STATE_NOCHECK = 0, STATE_CHECK = 1, STATE_DONTKNOW = 2 }; - //==================================================================== //= OReferenceValueComponent //==================================================================== @@ -54,7 +53,7 @@ namespace frm // <properties> ::rtl::OUString m_sReferenceValue; // the reference value to use for data exchange ::rtl::OUString m_sNoCheckReferenceValue; // the reference value to be exchanged when the control is not checked - CheckState m_eDefaultChecked; // the default check state + ToggleState m_eDefaultChecked; // the default check state // </properties> sal_Bool m_bSupportSecondRefValue; // do we support the SecondaryRefValue property? @@ -65,8 +64,8 @@ namespace frm const ::rtl::OUString& getNoCheckReferenceValue() const { return m_sNoCheckReferenceValue; } - CheckState getDefaultChecked() const { return m_eDefaultChecked; } - void setDefaultChecked( CheckState _eChecked ) { m_eDefaultChecked = _eChecked; } + ToggleState getDefaultChecked() const { return m_eDefaultChecked; } + void setDefaultChecked( ToggleState _eChecked ) { m_eDefaultChecked = _eChecked; } protected: OReferenceValueComponent( @@ -109,5 +108,5 @@ namespace frm } // namespace frm //........................................................................ -#endif // EFORMS2_FORMS_SOURCE_COMPONENT_REFVALUECOMPONENT_HXX +#endif // FORMS_SOURCE_COMPONENT_REFVALUECOMPONENT_HXX diff --git a/forms/source/helper/makefile.mk b/forms/source/helper/makefile.mk index 4c2d68fd639e..5739d1fcb6d0 100644 --- a/forms/source/helper/makefile.mk +++ b/forms/source/helper/makefile.mk @@ -1,3 +1,4 @@ + #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -50,7 +51,8 @@ INCPRE+=$(SOLARINCDIR)$/offuh SLOFILES= $(SLO)$/formnavigation.obj \ $(SLO)$/controlfeatureinterception.obj \ $(SLO)$/urltransformer.obj \ - $(SLO)$/windowstateguard.obj + $(SLO)$/windowstateguard.obj \ + $(SLO)$/resettable.obj \ # --- Targets ---------------------------------- diff --git a/forms/source/helper/resettable.cxx b/forms/source/helper/resettable.cxx new file mode 100644 index 000000000000..3c67dfa5e46e --- /dev/null +++ b/forms/source/helper/resettable.cxx @@ -0,0 +1,101 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* 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_forms.hxx" + +#include "resettable.hxx" + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +#include <cppuhelper/weak.hxx> + +//........................................................................ +namespace frm +{ +//........................................................................ + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::form::XResetListener; + using ::com::sun::star::lang::EventObject; + /** === end UNO using === **/ + + //==================================================================== + //= ResetHelper + //==================================================================== + //-------------------------------------------------------------------- + void ResetHelper::addResetListener( const Reference< XResetListener >& _listener ) + { + m_aResetListeners.addInterface( _listener ); + } + + //-------------------------------------------------------------------- + void ResetHelper::removeResetListener( const Reference< XResetListener >& _listener ) + { + m_aResetListeners.removeInterface( _listener ); + } + + //-------------------------------------------------------------------- + bool ResetHelper::approveReset() + { + ::cppu::OInterfaceIteratorHelper aIter( m_aResetListeners ); + EventObject aResetEvent( m_rParent ); + + sal_Bool bContinue = sal_True; + while ( aIter.hasMoreElements() && bContinue ) + bContinue = static_cast< XResetListener* >( aIter.next() )->approveReset( aResetEvent ); + + return bContinue; + } + + //-------------------------------------------------------------------- + void ResetHelper::notifyResetted() + { + EventObject aResetEvent( m_rParent ); + m_aResetListeners.notifyEach( &XResetListener::resetted, aResetEvent ); + } + + //-------------------------------------------------------------------- + void ResetHelper::disposing() + { + EventObject aEvent( m_rParent ); + m_aResetListeners.disposeAndClear( aEvent ); + } + +//........................................................................ +} // namespace frm +//........................................................................ diff --git a/forms/source/inc/FormComponent.hxx b/forms/source/inc/FormComponent.hxx index d396cbd2df6a..05c8ad587902 100644 --- a/forms/source/inc/FormComponent.hxx +++ b/forms/source/inc/FormComponent.hxx @@ -31,57 +31,61 @@ #ifndef _FORMS_FORMCOMPONENT_HXX_ #define _FORMS_FORMCOMPONENT_HXX_ -#include <osl/mutex.hxx> -#include <rtl/ustring.hxx> -#include <cppuhelper/component.hxx> -#include <cppuhelper/implbase1.hxx> -#include <cppuhelper/implbase2.hxx> -#include <cppuhelper/implbase3.hxx> -#include <cppuhelper/implbase4.hxx> -#include <cppuhelper/implbase7.hxx> -#include <com/sun/star/awt/XControl.hpp> -#include <com/sun/star/uno/XAggregation.hpp> -#include <com/sun/star/lang/XEventListener.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/form/XBoundControl.hpp> -#include <com/sun/star/io/XPersistObject.hpp> -#include <com/sun/star/io/XMarkableStream.hpp> -#include <com/sun/star/container/XNamed.hpp> -#include <com/sun/star/container/XChild.hpp> -#include <com/sun/star/form/XFormComponent.hpp> -#include <com/sun/star/form/XBoundComponent.hpp> -#include <com/sun/star/form/XLoadListener.hpp> -#include <com/sun/star/form/XReset.hpp> -#include <com/sun/star/sdbc/XRowSet.hpp> -#include <com/sun/star/sdb/XColumn.hpp> -#include <com/sun/star/sdb/XColumnUpdate.hpp> -#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> -#include <com/sun/star/form/FormComponentType.hpp> -#include <com/sun/star/util/XCloneable.hpp> -#include <com/sun/star/form/binding/XBindableValue.hpp> -#include <com/sun/star/lang/DisposedException.hpp> +#include "cloneable.hxx"
+#include "ids.hxx"
+#include "property.hrc"
+#include "property.hxx"
+#include "propertybaghelper.hxx"
+#include "resettable.hxx" +#include "services.hxx"
+#include "windowstateguard.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#include <com/sun/star/beans/XPropertyContainer.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/form/binding/XBindableValue.hpp>
+#include <com/sun/star/form/FormComponentType.hpp>
+#include <com/sun/star/form/validation/XValidatableFormComponent.hpp>
+#include <com/sun/star/form/validation/XValidityConstraintListener.hpp>
+#include <com/sun/star/form/XBoundComponent.hpp>
+#include <com/sun/star/form/XBoundControl.hpp>
+#include <com/sun/star/form/XFormComponent.hpp>
+#include <com/sun/star/form/XLoadListener.hpp>
+#include <com/sun/star/form/XReset.hpp>
+#include <com/sun/star/io/XMarkableStream.hpp>
+#include <com/sun/star/io/XPersistObject.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/sdb/XColumn.hpp>
+#include <com/sun/star/sdb/XColumnUpdate.hpp>
+#include <com/sun/star/sdb/XRowSetChangeListener.hpp>
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/uno/XAggregation.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
#include <com/sun/star/util/XModifyListener.hpp> -#include <com/sun/star/form/validation/XValidityConstraintListener.hpp> -#include <com/sun/star/form/validation/XValidatableFormComponent.hpp> -#include <com/sun/star/beans/XPropertyContainer.hpp> -#include <com/sun/star/beans/XPropertyAccess.hpp> - -#include <comphelper/propagg.hxx> -#include <comphelper/propertybag.hxx> -#include <comphelper/uno3.hxx> -#include <comphelper/sequence.hxx> -#include <comphelper/componentcontext.hxx> -#include "services.hxx" -#ifndef _FRM_PROPERTY_HRC_ -#include "property.hrc" -#endif -#include "property.hxx" -#include "cloneable.hxx" -#include "ids.hxx" -#include "windowstateguard.hxx" -#include "propertybaghelper.hxx" -#include <comphelper/propmultiplex.hxx> +#include <com/sun/star/form/XLoadable.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/propagg.hxx>
+#include <comphelper/propertybag.hxx>
+#include <comphelper/propmultiplex.hxx>
+#include <comphelper/sequence.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/component.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/implbase7.hxx>
+#include <osl/mutex.hxx>
+#include <rtl/ustring.hxx>
#include <memory> @@ -104,6 +108,64 @@ namespace frm virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException) \ { return ::rtl::OUString::createFromAscii("com.sun.star.comp.forms.") + ::rtl::OUString::createFromAscii(#ImplName); } + class OControlModel; + + //========================================================================= + //= ControlModelLock + //========================================================================= + /** class whose instances lock a OControlModel + + Locking here merely means locking the OControlModel's mutex. + + In addition to the locking facility, the class is also able to fire property + change notifications. This happens when the last ControlModelLock instance on a stack + dies. + */ + class ControlModelLock + { + public: + ControlModelLock( OControlModel& _rModel ) + :m_rModel( _rModel ) + ,m_bLocked( false ) + { + acquire(); + } + + ~ControlModelLock() + { + if ( m_bLocked ) + release(); + } + inline void acquire(); + inline void release(); + + inline OControlModel& getModel() const { return m_rModel; }; + + /** adds a property change notification, which is to be fired when the last lock on the model + (in the current thread) is released. + */ + void addPropertyNotification( + const sal_Int32 _nHandle, + const ::com::sun::star::uno::Any& _rOldValue, + const ::com::sun::star::uno::Any& _rNewValue + ); + + private: + void impl_notifyAll_nothrow(); + + private: + OControlModel& m_rModel; + bool m_bLocked; + ::com::sun::star::uno::Sequence< sal_Int32 > m_aHandles; + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > m_aOldValues; + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > m_aNewValues; + + private: + ControlModelLock(); // never implemented + ControlModelLock( const ControlModelLock& ); // never implemented + ControlModelLock& operator=( const ControlModelLock& ); // never implemented + }; + //========================================================================= //= OControl //= base class for form layer controls @@ -117,7 +179,7 @@ class OControl :public ::cppu::OComponentHelper ,public OControl_BASE { protected: - osl::Mutex m_aMutex; + ::osl::Mutex m_aMutex; OImplementationIdsRef m_aHoldIdHelper; ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > m_xControl; @@ -125,8 +187,6 @@ protected: m_xAggregate; ::comphelper::ComponentContext m_aContext; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xServiceFactory; // legacy only, use m_aContext instead WindowStateGuard m_aWindowStateGuard; public: @@ -301,19 +361,14 @@ class OControlModel :public ::cppu::OComponentHelper protected: ::comphelper::ComponentContext m_aContext; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xServiceFactory; // legacy only, use m_aContext instead - ::osl::Mutex m_aMutex; + ::osl::Mutex m_aMutex; + oslInterlockedCount m_lockCount; InterfaceRef m_xParent; // ParentComponent OImplementationIdsRef m_aHoldIdHelper; PropertyBagHelper m_aPropertyBagHelper; - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& - getORB( ) const { return m_xServiceFactory; } - // legacy only, use getContext instead! - const ::comphelper::ComponentContext& getContext() const { return m_aContext; } @@ -465,6 +520,22 @@ protected: virtual void describeAggregateProperties( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps ) const; + +public: + struct LockAccess { friend class ControlModelLock; private: LockAccess() { } }; + + void lockInstance( LockAccess ); + oslInterlockedCount unlockInstance( LockAccess ); + + void firePropertyChanges( + const ::com::sun::star::uno::Sequence< sal_Int32 >& _rHandles, + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rOldValues, + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rNewValues, + LockAccess + ); + + inline ::osl::Mutex& + getInstanceMutex() { return m_aMutex; } }; //================================================================== @@ -520,7 +591,7 @@ protected: #define IMPLEMENT_DEFAULT_CLONING( classname ) \ ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL classname::createClone( ) throw (::com::sun::star::uno::RuntimeException) \ { \ - classname* pClone = new classname( this, getORB() ); \ + classname* pClone = new classname( this, getContext().getLegacyServiceFactory() ); \ pClone->clonedFrom( this ); \ return pClone; \ } @@ -529,9 +600,10 @@ protected: //= OBoundControlModel //= model of a form layer control which is bound to a data source field //================================================================== -typedef ::cppu::ImplHelper3 < ::com::sun::star::form::XLoadListener +typedef ::cppu::ImplHelper4 < ::com::sun::star::form::XLoadListener , ::com::sun::star::form::XReset , ::com::sun::star::beans::XPropertyChangeListener + , ::com::sun::star::sdb::XRowSetChangeListener > OBoundControlModel_BASE1; // separated into an own base class since derivees can disable the support for this @@ -565,14 +637,20 @@ protected: }; private: + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > + m_xField; + // the form which controls supplies the field we bind to. + ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable > + m_xAmbientForm; + ::rtl::OUString m_sValuePropertyName; sal_Int32 m_nValuePropertyAggregateHandle; sal_Int32 m_nFieldType; ::com::sun::star::uno::Type m_aValuePropertyType; bool m_bValuePropertyMayBeVoid; + ResetHelper m_aResetHelper; ::cppu::OInterfaceContainerHelper m_aUpdateListeners; - ::cppu::OInterfaceContainerHelper m_aResetListeners; ::cppu::OInterfaceContainerHelper m_aFormComponentListeners; ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding > @@ -585,15 +663,13 @@ private: ::rtl::OUString m_aControlSource; // Datenquelle, Name des Feldes ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xLabelControl; // reference to a sibling control (model) which is our label - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - m_xField; sal_Bool m_bInputRequired; // </properties> ::comphelper::OPropertyChangeMultiplexer* m_pAggPropMultiplexer; - sal_Bool m_bLoadListening : 1; // are we currently a load listener at our parent form? + bool m_bFormListening : 1; // are we currently a XLoadListener at our ambient form? sal_Bool m_bLoaded : 1; sal_Bool m_bRequired : 1; const sal_Bool m_bCommitable : 1; // do we support XBoundComponent? @@ -910,10 +986,10 @@ protected: virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - inline const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& getField() const - { - return m_xField; - } + /// sets m_xField to the given new value, without notifying our listeners + void impl_setField_noNotify( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxField + ); inline bool hasField() const { return m_xField.is(); @@ -929,6 +1005,12 @@ protected: ) const; public: + inline const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& getField() const + { + return m_xField; + } + +public: // UNO Anbindung DECLARE_UNO3_AGG_DEFAULTS(OBoundControlModel, OControlModel); virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException); @@ -979,6 +1061,9 @@ public: // XPropertyChangeListener virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw(::com::sun::star::uno::RuntimeException); + // XRowSetChangeListener + virtual void SAL_CALL onRowSetChanged( const ::com::sun::star::lang::EventObject& i_Event ) throw (::com::sun::star::uno::RuntimeException); + // XLoadListener virtual void SAL_CALL loaded( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException); virtual void SAL_CALL unloading( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException); @@ -1030,7 +1115,7 @@ protected: @precond we do have an active external binding in place */ - void transferExternalValueToControl( ::osl::ResettableMutexGuard& _rInstanceLock ); + void transferExternalValueToControl( ControlModelLock& _rInstanceLock ); /** transfers the control value to the external binding @precond @@ -1038,7 +1123,7 @@ protected: @precond we do have an active external binding in place */ - void transferControlValueToExternal( ::osl::ResettableMutexGuard& _rInstanceLock ); + void transferControlValueToExternal( ControlModelLock& _rInstanceLock ); /** calculates the type which is to be used to communicate with the current external binding, and stores it in m_aExternalValueType @@ -1093,46 +1178,41 @@ private: /// initializes listening at the value property void implInitValuePropertyListening( ) const; - /** adds the component as load listener to the parent form + /** adds or removes the component as load listener to/from our form, and (if necessary) as RowSetChange listener at + our parent. - @precond there is a valid (non-NULL) parent form @precond there must no external value binding be in place - @precond We are currently *not* listening at the parent form. */ - void startLoadListening( ); + void doFormListening( const bool _bStart ); - /** removes the component as load listener from the parent form - @precond We currently *are* listening at the parent form. + inline bool isFormListening() const { return m_bFormListening; } + + /** determines the new value of m_xAmbientForm */ - void stopLoadListening( ); + void impl_determineAmbientForm_nothrow(); - inline sal_Bool isLoadListening() const { return m_bLoadListening; } + /** connects to a value supplier which is an database column. - /** connects to a value supplier which is an database column + The column is take from our parent, which must be a database form respectively row set. @precond The control does not have an external value supplier - @precond Our mutex is not locked - @param _rxRowSet - The row set which contains the column which we should connect to @param _bFromReload Determines whether the connection is made after the row set has been loaded (<FALSE/>) or reloaded (<TRUE/>) - @see disconnectDatabaseColumn + @see impl_disconnectDatabaseColumn_noNotify */ - void connectDatabaseColumn( - const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& _rxRowSet, + void impl_connectDatabaseColumn_noNotify( bool _bFromReload ); /** disconnects from a value supplier which is an database column @precond The control does not have an external value supplier - @precond Our mutex is not locked - @see connectDatabaseColumn + @see impl_connectDatabaseColumn_noNotify */ - void disconnectDatabaseColumn( ); + void impl_disconnectDatabaseColumn_noNotify(); /** connects to an external value binding @@ -1147,7 +1227,7 @@ private: */ void connectExternalValueBinding( const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding >& _rxBinding, - ::osl::ResettableMutexGuard& _rInstanceLock + ControlModelLock& _rInstanceLock ); /** disconnects from an external value binding @@ -1196,6 +1276,23 @@ private: ); }; + //========================================================================= + //= inlines + //========================================================================= + inline void ControlModelLock::acquire() + { + m_rModel.lockInstance( OControlModel::LockAccess() ); + m_bLocked = true; + } + inline void ControlModelLock::release() + { + OSL_ENSURE( m_bLocked, "ControlModelLock::release: not locked!" ); + m_bLocked = false; + + if ( 0 == m_rModel.unlockInstance( OControlModel::LockAccess() ) ) + impl_notifyAll_nothrow(); + } + //......................................................................... } //......................................................................... diff --git a/forms/source/inc/InterfaceContainer.hxx b/forms/source/inc/InterfaceContainer.hxx index 9bdbf3bdc402..f9939d17623b 100644 --- a/forms/source/inc/InterfaceContainer.hxx +++ b/forms/source/inc/InterfaceContainer.hxx @@ -53,10 +53,11 @@ #include <com/sun/star/container/XIndexContainer.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/form/XFormComponent.hpp> +#include <com/sun/star/util/XCloneable.hpp> #include <osl/mutex.hxx> #include <cppuhelper/interfacecontainer.hxx> #include <cppuhelper/component.hxx> -#include <cppuhelper/implbase7.hxx> +#include <cppuhelper/implbase8.hxx> using namespace comphelper; @@ -91,13 +92,15 @@ typedef ::std::hash_multimap< ::rtl::OUString, InterfaceRef, ::comphelper::UStri // OInterfaceContainer // implements a container for form components //================================================================== -typedef ::cppu::ImplHelper7< ::com::sun::star::container::XNameContainer, - ::com::sun::star::container::XIndexContainer, - ::com::sun::star::container::XContainer, - ::com::sun::star::container::XEnumerationAccess, - ::com::sun::star::script::XEventAttacherManager, - ::com::sun::star::beans::XPropertyChangeListener, - ::com::sun::star::io::XPersistObject > OInterfaceContainer_BASE; +typedef ::cppu::ImplHelper8 < ::com::sun::star::container::XNameContainer + , ::com::sun::star::container::XIndexContainer + , ::com::sun::star::container::XContainer + , ::com::sun::star::container::XEnumerationAccess + , ::com::sun::star::script::XEventAttacherManager + , ::com::sun::star::beans::XPropertyChangeListener + , ::com::sun::star::io::XPersistObject + , ::com::sun::star::util::XCloneable + > OInterfaceContainer_BASE; class OInterfaceContainer : public OInterfaceContainer_BASE { @@ -108,7 +111,7 @@ protected: OInterfaceMap m_aMap; ::cppu::OInterfaceContainerHelper m_aContainerListeners; - ::com::sun::star::uno::Type m_aElementType; + const ::com::sun::star::uno::Type m_aElementType; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> m_xServiceFactory; @@ -122,6 +125,12 @@ public: ::osl::Mutex& _rMutex, const ::com::sun::star::uno::Type& _rElementType); + OInterfaceContainer( ::osl::Mutex& _rMutex, const OInterfaceContainer& _cloneSource ); + + // late constructor for cloning + void clonedFrom( const OInterfaceContainer& _cloneSource ); + +protected: virtual ~OInterfaceContainer(); public: @@ -221,11 +230,17 @@ protected: ) throw(::com::sun::star::lang::IllegalArgumentException); // called after the object is inserted, but before the "real listeners" are notified - virtual void implInserted( const ElementDescription* /*_pElement*/ ) { } + virtual void implInserted( const ElementDescription* _pElement ); // called after the object is removed, but before the "real listeners" are notified - virtual void implRemoved(const InterfaceRef& /*_rxObject*/) { } - // called after an object was replaced, but before the "real listeners" are notified - virtual void implReplaced( const InterfaceRef& /*_rxReplacedObject*/, const ElementDescription* /*_pElement*/ ) { } + virtual void implRemoved(const InterfaceRef& _rxObject); + + /** called after an object was replaced. The default implementation notifies our listeners, after releasing + the instance lock. + */ + virtual void impl_replacedElement( + const ::com::sun::star::container::ContainerEvent& _rEvent, + ::osl::ClearableMutexGuard& _rInstanceLock + ); void SAL_CALL writeEvents(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream); void SAL_CALL readEvents(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream); @@ -267,6 +282,8 @@ private: efVersionSO6x }; void transformEvents( const EventFormat _eTargetFormat ); + + void impl_createEventAttacher_nothrow(); }; //================================================================== @@ -275,9 +292,9 @@ private: typedef ::cppu::ImplHelper1< ::com::sun::star::form::XFormComponent> OFormComponents_BASE; typedef ::cppu::OComponentHelper FormComponentsBase; // else MSVC kills itself on some statements -class OFormComponents : public FormComponentsBase, - public OInterfaceContainer, - public OFormComponents_BASE +class OFormComponents :public FormComponentsBase + ,public OInterfaceContainer + ,public OFormComponents_BASE { protected: ::osl::Mutex m_aMutex; @@ -285,6 +302,7 @@ protected: public: OFormComponents(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); + OFormComponents( const OFormComponents& _cloneSource ); virtual ~OFormComponents(); DECLARE_UNO3_AGG_DEFAULTS(OFormComponents, FormComponentsBase); diff --git a/forms/source/inc/frm_strings.hxx b/forms/source/inc/frm_strings.hxx index 13fbf9723eeb..1eaee92f8421 100644 --- a/forms/source/inc/frm_strings.hxx +++ b/forms/source/inc/frm_strings.hxx @@ -135,7 +135,7 @@ namespace frm FORMS_CONSTASCII_STRING( PROPERTY_BUTTONTYPE, "ButtonType" ); FORMS_CONSTASCII_STRING( PROPERTY_STRINGITEMLIST, "StringItemList" ); FORMS_CONSTASCII_STRING( PROPERTY_DEFAULT_TEXT, "DefaultText" ); - FORMS_CONSTASCII_STRING( PROPERTY_DEFAULTCHECKED, "DefaultState" ); + FORMS_CONSTASCII_STRING( PROPERTY_DEFAULT_STATE, "DefaultState" ); FORMS_CONSTASCII_STRING( PROPERTY_FORMATKEY, "FormatKey" ); FORMS_CONSTASCII_STRING( PROPERTY_FORMATSSUPPLIER, "FormatsSupplier" ); FORMS_CONSTASCII_STRING( PROPERTY_SUBMIT_ACTION, "SubmitAction" ); diff --git a/forms/source/inc/property.hrc b/forms/source/inc/property.hrc index 065a46eb5b8c..0a3e3739d31a 100644 --- a/forms/source/inc/property.hrc +++ b/forms/source/inc/property.hrc @@ -118,7 +118,7 @@ namespace frm #define PROPERTY_ID_SUBMIT_ENCODING (PROPERTY_ID_START + 74) // FmSubmitEncoding #define PROPERTY_ID_DEFAULT_VALUE (PROPERTY_ID_START + 75) // ::rtl::OUString #define PROPERTY_ID_SUBMIT_TARGET (PROPERTY_ID_START + 76) // ::rtl::OUString -#define PROPERTY_ID_DEFAULTCHECKED (PROPERTY_ID_START + 77) // UINT16 +#define PROPERTY_ID_DEFAULT_STATE (PROPERTY_ID_START + 77) // UINT16 #define PROPERTY_ID_VALUE_SEQ (PROPERTY_ID_START + 78) // StringSeq #define PROPERTY_ID_IMAGE_URL (PROPERTY_ID_START + 79) // ::rtl::OUString // free diff --git a/forms/source/inc/resettable.hxx b/forms/source/inc/resettable.hxx new file mode 100644 index 000000000000..f8815d5e3eb3 --- /dev/null +++ b/forms/source/inc/resettable.hxx @@ -0,0 +1,75 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* 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. +************************************************************************/ +
+#ifndef FORMS_RESETTABLE_HXX +#define FORMS_RESETTABLE_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/form/XResetListener.hpp> +/** === end UNO includes === **/ + +#include <cppuhelper/interfacecontainer.hxx> + +namespace cppu +{ + class OWeakObject; +} + +//........................................................................ +namespace frm +{ +//........................................................................ + + //==================================================================== + //= ResetHelper + //==================================================================== + class ResetHelper + { + public: + ResetHelper( ::cppu::OWeakObject& _parent, ::osl::Mutex& _mutex ) + :m_rParent( _parent ) + ,m_aResetListeners( _mutex ) + { + } + + // XReset equivalents + void addResetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener >& _listener ); + void removeResetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener >& _listener ); + + // calling listeners + bool approveReset(); + void notifyResetted(); + void disposing(); + + private: + ::cppu::OWeakObject& m_rParent; + ::cppu::OInterfaceContainerHelper m_aResetListeners; + }; + +//........................................................................ +} // namespace frm +//........................................................................ + +#endif // FORMS_RESETTABLE_HXX diff --git a/forms/source/inc/togglestate.hxx b/forms/source/inc/togglestate.hxx new file mode 100644 index 000000000000..04755000db19 --- /dev/null +++ b/forms/source/inc/togglestate.hxx @@ -0,0 +1,43 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* 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. +************************************************************************/ +
+#ifndef FORMS_TOGGLESTATE_HXX +#define FORMS_TOGGLESTATE_HXX + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +//........................................................................ +namespace frm +{ +//........................................................................ + + enum ToggleState { STATE_NOCHECK = 0, STATE_CHECK = 1, STATE_DONTKNOW = 2 }; + +//........................................................................ +} // namespace frm +//........................................................................ + +#endif // FORMS_TOGGLESTATE_HXX diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx index 55fec77ffb11..f1b59d77af7e 100644 --- a/forms/source/misc/InterfaceContainer.cxx +++ b/forms/source/misc/InterfaceContainer.cxx @@ -30,34 +30,34 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_forms.hxx" -#include "InterfaceContainer.hxx" -#include <cppuhelper/queryinterface.hxx> -#include <comphelper/eventattachermgr.hxx> -#include <comphelper/types.hxx> -#include <comphelper/enumhelper.hxx> -#include <comphelper/property.hxx> -#include <comphelper/container.hxx> -#include <comphelper/sequence.hxx> - -#ifndef _FRM_PROPERTY_HRC_ -#include "property.hrc" -#endif -#include "services.hxx" -#ifndef _FRM_RESOURCE_HRC_ -#include "frm_resource.hrc" -#endif -#include "frm_resource.hxx" -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/lang/XComponent.hpp> -#include <com/sun/star/io/XMarkableStream.hpp> -#include <com/sun/star/io/WrongFormatException.hpp> -#include <com/sun/star/container/XNamed.hpp> -#include <tools/debug.hxx> -#include <tools/diagnose_ex.h> - -#include <algorithm> -#include <memory> -#include <rtl/logfile.hxx> + +#include "frm_resource.hrc"
+#include "frm_resource.hxx"
+#include "InterfaceContainer.hxx"
+#include "property.hrc"
+#include "services.hxx"
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/io/WrongFormatException.hpp>
+#include <com/sun/star/io/XMarkableStream.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+
+#include <comphelper/container.hxx>
+#include <comphelper/enumhelper.hxx>
+#include <comphelper/eventattachermgr.hxx>
+#include <comphelper/property.hxx>
+#include <comphelper/sequence.hxx>
+#include <comphelper/types.hxx>
+#include <cppuhelper/exc_hlp.hxx>
+#include <cppuhelper/queryinterface.hxx>
+#include <rtl/logfile.hxx>
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+ +#include <algorithm>
+#include <memory>
//......................................................................... namespace frm @@ -71,6 +71,7 @@ using namespace ::com::sun::star::container; using namespace ::com::sun::star::script; using namespace ::com::sun::star::io; using namespace ::com::sun::star::form; +using namespace ::com::sun::star::util; namespace { @@ -102,15 +103,56 @@ OInterfaceContainer::OInterfaceContainer( const Reference<XMultiServiceFactory>& _rxFactory, ::osl::Mutex& _rMutex, const Type& _rElementType) - :m_rMutex(_rMutex) - ,m_aContainerListeners(_rMutex) - ,m_aElementType(_rElementType) - ,m_xServiceFactory(_rxFactory) + :OInterfaceContainer_BASE() + ,m_rMutex(_rMutex) + ,m_aContainerListeners(_rMutex) + ,m_aElementType(_rElementType) + ,m_xServiceFactory(_rxFactory) +{ + impl_createEventAttacher_nothrow(); +} + +//------------------------------------------------------------------------------ +OInterfaceContainer::OInterfaceContainer( ::osl::Mutex& _rMutex, const OInterfaceContainer& _cloneSource ) + :OInterfaceContainer_BASE() + ,m_rMutex( _rMutex ) + ,m_aContainerListeners( _rMutex ) + ,m_aElementType( _cloneSource.m_aElementType ) + ,m_xServiceFactory( _cloneSource.m_xServiceFactory ) +{ + impl_createEventAttacher_nothrow(); +} + +//------------------------------------------------------------------------------ +void OInterfaceContainer::clonedFrom( const OInterfaceContainer& _cloneSource ) +{ + try + { + const Reference< XIndexAccess > xSourceHierarchy( const_cast< OInterfaceContainer* >( &_cloneSource ) ); + const sal_Int32 nCount = xSourceHierarchy->getCount(); + for ( sal_Int32 i=0; i<nCount; ++i ) + { + Reference< XCloneable > xCloneable( xSourceHierarchy->getByIndex( i ), UNO_QUERY_THROW ); + Reference< XInterface > xClone( xCloneable->createClone() ); + insertByIndex( i, makeAny( xClone ) ); + } + } + catch( const Exception& ) + { + throw WrappedTargetException( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Could not clone the given interface hierarchy." ) ), + static_cast< XIndexContainer* >( const_cast< OInterfaceContainer* >( &_cloneSource ) ), + ::cppu::getCaughtException() + ); + } +} + +//------------------------------------------------------------------------------ +void OInterfaceContainer::impl_createEventAttacher_nothrow() { try { - m_xEventAttacher = ::comphelper::createEventAttacherManager(m_xServiceFactory); - OSL_ENSURE( m_xEventAttacher.is(), "OInterfaceContainer::OInterfaceContainer: no event attacher manager!" ); + m_xEventAttacher.set( ::comphelper::createEventAttacherManager( m_xServiceFactory ), UNO_SET_THROW ); } catch( const Exception& ) { @@ -118,7 +160,10 @@ OInterfaceContainer::OInterfaceContainer( } } -OInterfaceContainer::~OInterfaceContainer() {} +//------------------------------------------------------------------------------ +OInterfaceContainer::~OInterfaceContainer() +{ +} //------------------------------------------------------------------------------ void OInterfaceContainer::disposing() @@ -783,6 +828,25 @@ void OInterfaceContainer::removeElementsNoEvents(sal_Int32 nIndex) xChild->setParent(InterfaceRef ()); } +//------------------------------------------------------------------------------ +void OInterfaceContainer::implInserted( const ElementDescription* /*_pElement*/ ) +{ + // not inrerested in +} + +//------------------------------------------------------------------------------ +void OInterfaceContainer::implRemoved( const InterfaceRef& /*_rxObject*/ ) +{ + // not inrerested in +} + +//------------------------------------------------------------------------------ +void OInterfaceContainer::impl_replacedElement( const ContainerEvent& _rEvent, ::osl::ClearableMutexGuard& _rInstanceLock ) +{ + _rInstanceLock.clear(); + m_aContainerListeners.notifyEach( &XContainerListener::elementReplaced, _rEvent ); +} + // XIndexContainer //------------------------------------------------------------------------------ void SAL_CALL OInterfaceContainer::insertByIndex( sal_Int32 _nIndex, const Any& _rElement ) throw(IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException) @@ -856,17 +920,13 @@ void OInterfaceContainer::implReplaceByIndex( const sal_Int32 _nIndex, const Any m_xEventAttacher->attach( _nIndex, aElementMetaData.get()->xInterface, makeAny( aElementMetaData.get()->xPropertySet ) ); } - implReplaced( xOldElement, aElementMetaData.get() ); - - // benachrichtigen - ContainerEvent aEvt; - aEvt.Source = static_cast<XContainer*>(this); - aEvt.Accessor <<= _nIndex; - aEvt.Element = aElementMetaData.get()->aElementTypeInterface; - aEvt.ReplacedElement = xOldElement->queryInterface( m_aElementType ); + ContainerEvent aReplaceEvent; + aReplaceEvent.Source = static_cast< XContainer* >( this ); + aReplaceEvent.Accessor <<= _nIndex; + aReplaceEvent.Element = aElementMetaData.get()->xInterface->queryInterface( m_aElementType ); + aReplaceEvent.ReplacedElement = xOldElement->queryInterface( m_aElementType ); - _rClearBeforeNotify.clear(); - m_aContainerListeners.notifyEach( &XContainerListener::elementReplaced, aEvt ); + impl_replacedElement( aReplaceEvent, _rClearBeforeNotify ); } //------------------------------------------------------------------------------ @@ -1124,8 +1184,17 @@ Sequence<Type> SAL_CALL OFormComponents::getTypes() throw(RuntimeException) //------------------------------------------------------------------------------ OFormComponents::OFormComponents(const Reference<XMultiServiceFactory>& _rxFactory) - :FormComponentsBase(m_aMutex) - ,OInterfaceContainer(_rxFactory, m_aMutex, ::getCppuType(static_cast<Reference<XFormComponent>*>(NULL))) + :FormComponentsBase( m_aMutex ) + ,OInterfaceContainer( _rxFactory, m_aMutex, XFormComponent::static_type() ) + ,OFormComponents_BASE() +{ +} + +//------------------------------------------------------------------------------ +OFormComponents::OFormComponents( const OFormComponents& _cloneSource ) + :FormComponentsBase( m_aMutex ) + ,OInterfaceContainer( m_aMutex, _cloneSource ) + ,OFormComponents_BASE() { } diff --git a/forms/source/misc/property.cxx b/forms/source/misc/property.cxx index a47b7b73b706..564cd822f145 100644 --- a/forms/source/misc/property.cxx +++ b/forms/source/misc/property.cxx @@ -125,7 +125,7 @@ void PropertyInfoService::initialize() ADD_PROP_ASSIGNMENT(BUTTONTYPE); ADD_PROP_ASSIGNMENT(STRINGITEMLIST); ADD_PROP_ASSIGNMENT(DEFAULT_TEXT); - ADD_PROP_ASSIGNMENT(DEFAULTCHECKED); + ADD_PROP_ASSIGNMENT(DEFAULT_STATE); ADD_PROP_ASSIGNMENT(DEFAULT_DATE); ADD_PROP_ASSIGNMENT(DEFAULT_TIME); ADD_PROP_ASSIGNMENT(DEFAULT_VALUE); diff --git a/forms/source/richtext/richtextunowrapper.cxx b/forms/source/richtext/richtextunowrapper.cxx index 13da356d0ad3..f5a9d178d32c 100644 --- a/forms/source/richtext/richtextunowrapper.cxx +++ b/forms/source/richtext/richtextunowrapper.cxx @@ -37,6 +37,7 @@ /** === end UNO includes === **/ #include <svx/unofored.hxx> #include <svx/editview.hxx> +#include <svx/unoipset.hxx> //........................................................................ namespace frm @@ -51,10 +52,10 @@ namespace frm //==================================================================== namespace { - const SfxItemPropertyMap* getTextEnginePropertyMap() + const SvxItemPropertySet* getTextEnginePropertySet() { // Propertymap fuer einen Outliner Text - static const SfxItemPropertyMap aTextEnginePropertyMap[] = + static const SfxItemPropertyMapEntry aTextEnginePropertyMap[] = { SVX_UNOEDIT_CHAR_PROPERTIES, SVX_UNOEDIT_FONT_PROPERTIES, @@ -63,8 +64,8 @@ namespace frm { MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType( static_cast< const Reference< XNameContainer >* >( NULL ) ), 0, 0 }, { NULL, 0, 0, NULL, 0, 0 } }; - - return aTextEnginePropertyMap; + static SvxItemPropertySet aTextEnginePropertySet( aTextEnginePropertyMap ); + return &aTextEnginePropertySet; } } @@ -73,7 +74,7 @@ namespace frm //==================================================================== //-------------------------------------------------------------------- ORichTextUnoWrapper::ORichTextUnoWrapper( EditEngine& _rEngine, IEngineTextChangeListener* _pTextChangeListener ) - :SvxUnoText( getTextEnginePropertyMap() ) + :SvxUnoText( getTextEnginePropertySet() ) { SetEditSource( new RichTextEditSource( _rEngine, _pTextChangeListener ) ); } diff --git a/forms/source/richtext/richtextvclcontrol.cxx b/forms/source/richtext/richtextvclcontrol.cxx index 7c5505d1d87d..f3c56cc6cd88 100644 --- a/forms/source/richtext/richtextvclcontrol.cxx +++ b/forms/source/richtext/richtextvclcontrol.cxx @@ -233,7 +233,7 @@ namespace frm { // Ctrl-Tab is used to step out of the control // -> build a new key event without the Ctrl-key, and let the very base class handle it - KeyCode aNewCode( KEY_TAB, bShift, sal_False, sal_False ); + KeyCode aNewCode( KEY_TAB, bShift, sal_False, sal_False, sal_False ); ::KeyEvent aNewEvent( pKeyEvent->GetCharCode(), aNewCode ); Control::KeyInput( aNewEvent ); return 1; // handled diff --git a/forms/source/xforms/submission/replace.cxx b/forms/source/xforms/submission/replace.cxx index e0504973f7ac..9c54d6e7164a 100644 --- a/forms/source/xforms/submission/replace.cxx +++ b/forms/source/xforms/submission/replace.cxx @@ -30,8 +30,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_forms.hxx" - +#include <memory> #include "submission.hxx" +#include "serialization_app_xml.hxx" #include <rtl/ustring.hxx> #include <rtl/string.hxx> @@ -44,11 +45,14 @@ #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/beans/PropertyValue.hpp> +#include <ucbhelper/content.hxx> using namespace com::sun::star::uno; +using namespace com::sun::star::ucb; using namespace com::sun::star::frame; using namespace com::sun::star::lang; using namespace com::sun::star::beans; +using namespace com::sun::star::task; using namespace com::sun::star::xml::dom; CSubmission::SubmissionResult CSubmission::replace(const ::rtl::OUString& aReplace, const Reference<XDocument>& aDocument, const Reference<XFrame>& aFrame) @@ -116,5 +120,29 @@ CSubmission::SubmissionResult CSubmission::replace(const ::rtl::OUString& aRepla } return CSubmission::UNKNOWN_ERROR; } +::std::auto_ptr< CSerialization > CSubmission::createSerialization(const Reference< XInteractionHandler >& _xHandler,Reference<XCommandEnvironment>& _rOutEnv) +{ + // PUT always uses application/xml + ::std::auto_ptr< CSerialization > apSerialization(new CSerializationAppXML()); + apSerialization->setSource(m_aFragment); + apSerialization->serialize(); + + // create a commandEnvironment and use the default interaction handler + CCommandEnvironmentHelper *pHelper = new CCommandEnvironmentHelper; + if( _xHandler.is() ) + pHelper->m_aInteractionHandler = _xHandler; + else + pHelper->m_aInteractionHandler = CSS::uno::Reference< XInteractionHandler >(m_aFactory->createInstance( + ::rtl::OUString::createFromAscii("com.sun.star.task.InteractionHandler")), UNO_QUERY); + OSL_ENSURE(pHelper->m_aInteractionHandler.is(), "failed to create IntreractionHandler"); + + CProgressHandlerHelper *pProgressHelper = new CProgressHandlerHelper; + pHelper->m_aProgressHandler = Reference< XProgressHandler >(pProgressHelper); + + // UCB has ownership of environment... + _rOutEnv = pHelper; + return apSerialization; +} + diff --git a/forms/source/xforms/submission/submission.hxx b/forms/source/xforms/submission/submission.hxx index a435d7c7fc15..c146282903c4 100644 --- a/forms/source/xforms/submission/submission.hxx +++ b/forms/source/xforms/submission/submission.hxx @@ -35,12 +35,14 @@ #include <rtl/ustring.h> #include <osl/conditn.hxx> #include <osl/mutex.hxx> +#include <unotools/processfactory.hxx> #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Exception.hpp> #include <com/sun/star/uno/RuntimeException.hpp> #include <com/sun/star/xml/xpath/XXPathObject.hpp> #include <com/sun/star/xml/dom/XDocumentFragment.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/ucb/XCommandEnvironment.hpp> #include <com/sun/star/ucb/XProgressHandler.hpp> @@ -66,10 +68,12 @@ class CCommandEnvironmentHelper : public cppu::WeakImplHelper1< CSS::ucb::XComma friend class CSubmissionPut; friend class CSubmissionPost; friend class CSubmissionGet; + friend class CSubmission; protected: - CSS::uno::Reference< CSS::task::XInteractionHandler > m_aInteractionHandler; - CSS::uno::Reference< CSS::ucb::XProgressHandler > m_aProgressHandler; + CSS::uno::Reference< CSS::task::XInteractionHandler > m_aInteractionHandler; + CSS::uno::Reference< CSS::ucb::XProgressHandler > m_aProgressHandler; + public: virtual CSS::uno::Reference< CSS::task::XInteractionHandler > SAL_CALL getInteractionHandler() throw (CSS::uno::RuntimeException) { @@ -118,11 +122,15 @@ class CSubmission protected: INetURLObject m_aURLObj; - CSS::uno::Reference< CSS::xml::xpath::XXPathObject > m_aXPathObject; + CSS::uno::Reference< CSS::xml::xpath::XXPathObject > m_aXPathObject; CSS::uno::Reference< CSS::xml::dom::XDocumentFragment > m_aFragment; - CSS::uno::Reference< CSS::io::XInputStream > m_aResultStream; + CSS::uno::Reference< CSS::io::XInputStream > m_aResultStream; + CSS::uno::Reference< CSS::lang::XMultiServiceFactory > m_aFactory; rtl::OUString m_aEncoding; + ::std::auto_ptr< CSerialization > createSerialization(const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler + ,com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment>& _rOutEnv); + public: enum SubmissionResult { SUCCESS, @@ -136,6 +144,7 @@ public: CSubmission(const rtl::OUString& aURL, const CSS::uno::Reference< CSS::xml::dom::XDocumentFragment >& aFragment) : m_aURLObj(aURL) , m_aFragment(aFragment) + , m_aFactory(::utl::getProcessServiceFactory()) {} virtual ~CSubmission() {} diff --git a/forms/source/xforms/submission/submission_get.cxx b/forms/source/xforms/submission/submission_get.cxx index 9ca195be946f..c310be9fc82f 100644 --- a/forms/source/xforms/submission/submission_get.cxx +++ b/forms/source/xforms/submission/submission_get.cxx @@ -55,7 +55,6 @@ using namespace std; CSubmissionGet::CSubmissionGet(const rtl::OUString& aURL, const CSS::uno::Reference< CSS::xml::dom::XDocumentFragment >& aFragment) : CSubmission(aURL, aFragment) - , m_aFactory(utl::getProcessServiceFactory()) { } diff --git a/forms/source/xforms/submission/submission_post.cxx b/forms/source/xforms/submission/submission_post.cxx index 53047c7036e9..8142fec3df05 100644 --- a/forms/source/xforms/submission/submission_post.cxx +++ b/forms/source/xforms/submission/submission_post.cxx @@ -55,29 +55,14 @@ using namespace std; CSubmissionPost::CSubmissionPost(const rtl::OUString& aURL, const CSS::uno::Reference< CSS::xml::dom::XDocumentFragment >& aFragment) : CSubmission(aURL, aFragment) - , m_aFactory(utl::getProcessServiceFactory()) { } CSubmission::SubmissionResult CSubmissionPost::submit(const CSS::uno::Reference< CSS::task::XInteractionHandler >& aInteractionHandler) { // PUT always uses application/xml - auto_ptr< CSerialization > apSerialization(new CSerializationAppXML()); - apSerialization->setSource(m_aFragment); - apSerialization->serialize(); - - // create a commandEnvironment and use the default interaction handler - CCommandEnvironmentHelper *pHelper = new CCommandEnvironmentHelper; - if( aInteractionHandler.is() ) - pHelper->m_aInteractionHandler = aInteractionHandler; - else - pHelper->m_aInteractionHandler = CSS::uno::Reference< XInteractionHandler >(m_aFactory->createInstance( - OUString::createFromAscii("com.sun.star.task.InteractionHandler")), UNO_QUERY); - OSL_ENSURE(pHelper->m_aInteractionHandler.is(), "failed to create IntreractionHandler"); - CProgressHandlerHelper *pProgressHelper = new CProgressHandlerHelper; - pHelper->m_aProgressHandler = CSS::uno::Reference< XProgressHandler >(pProgressHelper); - // UCB has ownership of environment... - CSS::uno::Reference< XCommandEnvironment > aEnvironment(pHelper); + CSS::uno::Reference< XCommandEnvironment > aEnvironment; + auto_ptr< CSerialization > apSerialization(createSerialization(aInteractionHandler,aEnvironment)); try { ucbhelper::Content aContent(m_aURLObj.GetMainURL(INetURLObject::NO_DECODE), aEnvironment); diff --git a/forms/source/xforms/submission/submission_post.hxx b/forms/source/xforms/submission/submission_post.hxx index d812c0bec858..a3c109033664 100644 --- a/forms/source/xforms/submission/submission_post.hxx +++ b/forms/source/xforms/submission/submission_post.hxx @@ -31,14 +31,10 @@ #ifndef __SUBMISSION_POST_HXX #define __SUBMISSION_POST_HXX -#include <com/sun/star/lang/XMultiServiceFactory.hpp> - #include "submission.hxx" class CSubmissionPost : public CSubmission { -private: - CSS::uno::Reference< CSS::lang::XMultiServiceFactory > m_aFactory; public: CSubmissionPost(const rtl::OUString& aURL, const CSS::uno::Reference< CSS::xml::dom::XDocumentFragment >& aFragment); virtual SubmissionResult submit(const CSS::uno::Reference< CSS::task::XInteractionHandler >& aInteractionHandler); diff --git a/forms/source/xforms/submission/submission_put.cxx b/forms/source/xforms/submission/submission_put.cxx index 50d80880b07a..10bc0e2b0896 100644 --- a/forms/source/xforms/submission/submission_put.cxx +++ b/forms/source/xforms/submission/submission_put.cxx @@ -53,31 +53,13 @@ using namespace std; CSubmissionPut::CSubmissionPut(const rtl::OUString& aURL, const CSS::uno::Reference< CSS::xml::dom::XDocumentFragment >& aFragment) : CSubmission(aURL, aFragment) - , m_aFactory(utl::getProcessServiceFactory()) { } CSubmission::SubmissionResult CSubmissionPut::submit(const CSS::uno::Reference< CSS::task::XInteractionHandler >& aInteractionHandler) { - // PUT always uses application/xml - auto_ptr< CSerialization > apSerialization(new CSerializationAppXML()); - apSerialization->setSource(m_aFragment); - apSerialization->serialize(); - - // create a commandEnvironment and use the default interaction handler - CCommandEnvironmentHelper *pHelper = new CCommandEnvironmentHelper; - if( aInteractionHandler.is() ) - pHelper->m_aInteractionHandler = aInteractionHandler; - else - pHelper->m_aInteractionHandler = CSS::uno::Reference< XInteractionHandler >(m_aFactory->createInstance( - OUString::createFromAscii("com.sun.star.task.InteractionHandler")), UNO_QUERY); - OSL_ENSURE(pHelper->m_aInteractionHandler.is(), "failed to create IntreractionHandler"); - - CProgressHandlerHelper *pProgressHelper = new CProgressHandlerHelper; - pHelper->m_aProgressHandler = CSS::uno::Reference< XProgressHandler >(pProgressHelper); - - // UCB has ownership of environment... - CSS::uno::Reference< XCommandEnvironment > aEnvironment(pHelper); + CSS::uno::Reference< XCommandEnvironment > aEnvironment; + auto_ptr< CSerialization > apSerialization(createSerialization(aInteractionHandler,aEnvironment)); try { ucbhelper::Content aContent(m_aURLObj.GetMainURL(INetURLObject::NO_DECODE), aEnvironment); diff --git a/forms/source/xforms/submission/submission_put.hxx b/forms/source/xforms/submission/submission_put.hxx index da95f926ebaf..3bf3d2fd92a1 100644 --- a/forms/source/xforms/submission/submission_put.hxx +++ b/forms/source/xforms/submission/submission_put.hxx @@ -38,8 +38,6 @@ class CSubmissionPut : public CSubmission { -private: - CSS::uno::Reference< CSS::lang::XMultiServiceFactory > m_aFactory; public: CSubmissionPut(const rtl::OUString& aURL, const CSS::uno::Reference< CSS::xml::dom::XDocumentFragment >& aFragment); virtual SubmissionResult submit(const CSS::uno::Reference< CSS::task::XInteractionHandler >& aInteractionHandler); diff --git a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hprophelp.cxx b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hprophelp.cxx deleted file mode 100644 index 4e5f01f0a14c..000000000000 --- a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hprophelp.cxx +++ /dev/null @@ -1,315 +0,0 @@ -/************************************************************************* - * - * 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: hprophelp.cxx,v $ - * $Revision: 1.8 $ - * - * 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_lingucomponent.hxx" - - -#include <linguistic/misc.hxx> - -#include "hprophelp.hxx" -#include <linguistic/lngprops.hxx> -#include <tools/debug.hxx> - -#include <com/sun/star/linguistic2/LinguServiceEvent.hpp> -#include <com/sun/star/linguistic2/LinguServiceEventFlags.hpp> -#include <com/sun/star/linguistic2/XLinguServiceEventListener.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <osl/mutex.hxx> - - -//using namespace utl; -using namespace osl; -using namespace rtl; -using namespace com::sun::star; -using namespace com::sun::star::beans; -using namespace com::sun::star::lang; -using namespace com::sun::star::uno; -using namespace com::sun::star::linguistic2; -using namespace linguistic; - - -#define A2OU(x) ::rtl::OUString::createFromAscii( x ) - -/////////////////////////////////////////////////////////////////////////// - - -PropertyChgHelper::PropertyChgHelper( - const Reference< XInterface > & rxSource, - Reference< XPropertySet > &rxPropSet, - const char *pPropNames[], USHORT nPropCount ) : - aPropNames( nPropCount), - xMyEvtObj (rxSource), - aLngSvcEvtListeners (GetLinguMutex()), - xPropSet(rxPropSet) -{ - OUString *pName = aPropNames.getArray(); - for (INT32 i = 0; i < nPropCount; ++i) - { - pName[i] = A2OU( pPropNames[i] ); - } -} - - -/*PropertyChgHelper::PropertyChgHelper( const PropertyChgHelper &rHelper ) : - aLngSvcEvtListeners (GetLinguMutex()) -{ - xPropSet = rHelper.xPropSet; - aPropNames = rHelper.aPropNames; - AddAsPropListener(); - - xMyEvtObj = rHelper.xMyEvtObj; -} */ - - -PropertyChgHelper::~PropertyChgHelper() -{ -} - - -void PropertyChgHelper::AddAsPropListener() -{ - if (xPropSet.is()) - { - INT32 nLen = aPropNames.getLength(); - const OUString *pPropName = aPropNames.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) - { - if (pPropName[i].getLength()) - xPropSet->addPropertyChangeListener( pPropName[i], this ); - } - } -} - -void PropertyChgHelper::RemoveAsPropListener() -{ - if (xPropSet.is()) - { - INT32 nLen = aPropNames.getLength(); - const OUString *pPropName = aPropNames.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) - { - if (pPropName[i].getLength()) - xPropSet->removePropertyChangeListener( pPropName[i], this ); - } - } -} - - -void PropertyChgHelper::LaunchEvent( const LinguServiceEvent &rEvt ) -{ - cppu::OInterfaceIteratorHelper aIt( aLngSvcEvtListeners ); - while (aIt.hasMoreElements()) - { - Reference< XLinguServiceEventListener > xRef( aIt.next(), UNO_QUERY ); - if (xRef.is()) - xRef->processLinguServiceEvent( rEvt ); - } -} - - -void SAL_CALL PropertyChgHelper::disposing( const EventObject& rSource ) - throw(RuntimeException) -{ - MutexGuard aGuard( GetLinguMutex() ); - if (rSource.Source == xPropSet) - { - RemoveAsPropListener(); - xPropSet = NULL; - aPropNames.realloc( 0 ); - } -} - - -sal_Bool SAL_CALL - PropertyChgHelper::addLinguServiceEventListener( - const Reference< XLinguServiceEventListener >& rxListener ) - throw(RuntimeException) -{ - MutexGuard aGuard( GetLinguMutex() ); - - BOOL bRes = FALSE; - if (rxListener.is()) - { - INT32 nCount = aLngSvcEvtListeners.getLength(); - bRes = aLngSvcEvtListeners.addInterface( rxListener ) != nCount; - } - return bRes; -} - - -sal_Bool SAL_CALL - PropertyChgHelper::removeLinguServiceEventListener( - const Reference< XLinguServiceEventListener >& rxListener ) - throw(RuntimeException) -{ - MutexGuard aGuard( GetLinguMutex() ); - - BOOL bRes = FALSE; - if (rxListener.is()) - { - INT32 nCount = aLngSvcEvtListeners.getLength(); - bRes = aLngSvcEvtListeners.removeInterface( rxListener ) != nCount; - } - return bRes; -} - - -/////////////////////////////////////////////////////////////////////////// - -static const char *aHP[] = -{ - UPN_HYPH_MIN_LEADING, - UPN_HYPH_MIN_TRAILING, - UPN_HYPH_MIN_WORD_LENGTH -}; - - -PropertyHelper_Hyphen::PropertyHelper_Hyphen( - const Reference< XInterface > & rxSource, - Reference< XPropertySet > &rxPropSet ) : - PropertyChgHelper ( rxSource, rxPropSet, aHP, sizeof(aHP) / sizeof(aHP[0]) ) -{ - SetDefault(); - INT32 nLen = GetPropNames().getLength(); - if (rxPropSet.is() && nLen) - { - const OUString *pPropName = GetPropNames().getConstArray(); - for (INT32 i = 0; i < nLen; ++i) - { - INT16 *pnVal = NULL; - INT16 *pnResVal = NULL; - - if (A2OU( UPN_HYPH_MIN_LEADING ) == pPropName[i]) - { - pnVal = &nHyphMinLeading; - pnResVal = &nResHyphMinLeading; - } - else if (A2OU( UPN_HYPH_MIN_TRAILING ) == pPropName[i]) - { - pnVal = &nHyphMinTrailing; - pnResVal = &nResHyphMinTrailing; - } - else if (A2OU( UPN_HYPH_MIN_WORD_LENGTH ) == pPropName[i]) - { - pnVal = &nHyphMinWordLength; - pnResVal = &nResHyphMinWordLength; - } - - if (pnVal && pnResVal) - { - GetPropSet()->getPropertyValue( pPropName[i] ) >>= *pnVal; - *pnResVal = *pnVal; - } - } - } - -} - - -PropertyHelper_Hyphen::~PropertyHelper_Hyphen() -{ -} - - -void PropertyHelper_Hyphen::SetDefault() -{ - nResHyphMinLeading = nHyphMinLeading = 2; - nResHyphMinTrailing = nHyphMinTrailing = 2; - nResHyphMinWordLength = nHyphMinWordLength = 0; -} - - -void SAL_CALL - PropertyHelper_Hyphen::propertyChange( const PropertyChangeEvent& rEvt ) - throw(RuntimeException) -{ - MutexGuard aGuard( GetLinguMutex() ); - - if (GetPropSet().is() && rEvt.Source == GetPropSet()) - { - INT16 nLngSvcFlags = LinguServiceEventFlags::HYPHENATE_AGAIN; - - INT16 *pnVal = NULL; - switch (rEvt.PropertyHandle) - { - case UPH_HYPH_MIN_LEADING : pnVal = &nHyphMinLeading; break; - case UPH_HYPH_MIN_TRAILING : pnVal = &nHyphMinTrailing; break; - case UPH_HYPH_MIN_WORD_LENGTH : pnVal = &nHyphMinWordLength; break; - default: - DBG_ERROR( "unknown property" ); - } - if (pnVal) - rEvt.NewValue >>= *pnVal; - - if (pnVal) - { - if (nLngSvcFlags) - { - LinguServiceEvent aEvt( GetEvtObj(), nLngSvcFlags ); - LaunchEvent( aEvt ); - } - } - } -} - - - -void PropertyHelper_Hyphen::SetTmpPropVals( const PropertyValues &rPropVals ) -{ - - nResHyphMinLeading = nHyphMinLeading; - nResHyphMinTrailing = nHyphMinTrailing; - nResHyphMinWordLength = nHyphMinWordLength; - - INT32 nLen = rPropVals.getLength(); - - if (nLen) - { - const PropertyValue *pVal = rPropVals.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) - { - INT16 *pnResVal = NULL; - switch (pVal[i].Handle) - { - case UPH_HYPH_MIN_LEADING : pnResVal = &nResHyphMinLeading; break; - case UPH_HYPH_MIN_TRAILING : pnResVal = &nResHyphMinTrailing; break; - case UPH_HYPH_MIN_WORD_LENGTH : pnResVal = &nResHyphMinWordLength; break; - default: - DBG_ERROR( "unknown property" ); - } - if (pnResVal) - pVal[i].Value >>= *pnResVal; - } - } -} - -/////////////////////////////////////////////////////////////////////////// - diff --git a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hprophelp.hxx b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hprophelp.hxx deleted file mode 100644 index 86ed4510be4f..000000000000 --- a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hprophelp.hxx +++ /dev/null @@ -1,169 +0,0 @@ -/************************************************************************* - * - * 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: hprophelp.hxx,v $ - * $Revision: 1.8 $ - * - * 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. - * - ************************************************************************/ - - -#ifndef _LINGU2_PROPHELP_HXX_ -#define _LINGU2_PROPHELP_HXX_ - -#include <tools/solar.h> - -#include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type -#include <cppuhelper/implbase2.hxx> // helper for implementations -#include <cppuhelper/interfacecontainer.h> -#include <com/sun/star/beans/XPropertyChangeListener.hpp> -#include <com/sun/star/beans/PropertyValues.hpp> - -#include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp> - -namespace com { namespace sun { namespace star { namespace beans { - class XPropertySet; -}}}} - -namespace com { namespace sun { namespace star { namespace linguistic2 { - struct LinguServiceEvent; -}}}} - - -using namespace ::rtl; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::linguistic2; - -/////////////////////////////////////////////////////////////////////////// -// PropertyChgHelper -// virtual base class for all XPropertyChangeListener members of the -// various lingu services. -// Only propertyChange needs to be implemented. - -class PropertyChgHelper : - public cppu::WeakImplHelper2 - < - XPropertyChangeListener, - XLinguServiceEventBroadcaster - > -{ - Sequence< OUString > aPropNames; - Reference< XInterface > xMyEvtObj; - ::cppu::OInterfaceContainerHelper aLngSvcEvtListeners; - Reference< XPropertySet > xPropSet; - - // disallow use of copy-constructor and assignment-operator - PropertyChgHelper( const PropertyChgHelper & ); - PropertyChgHelper & operator = ( const PropertyChgHelper & ); - -public: - PropertyChgHelper( - const Reference< XInterface > &rxSource, - Reference< XPropertySet > &rxPropSet, - const char *pPropNames[], USHORT nPropCount ); - virtual ~PropertyChgHelper(); - - // XEventListener - virtual void SAL_CALL - disposing( const EventObject& rSource ) - throw(RuntimeException); - - // XPropertyChangeListener - virtual void SAL_CALL - propertyChange( const PropertyChangeEvent& rEvt ) - throw(RuntimeException) = 0; - - // XLinguServiceEventBroadcaster - virtual sal_Bool SAL_CALL - addLinguServiceEventListener( - const Reference< XLinguServiceEventListener >& rxListener ) - throw(RuntimeException); - virtual sal_Bool SAL_CALL - removeLinguServiceEventListener( - const Reference< XLinguServiceEventListener >& rxListener ) - throw(RuntimeException); - - // non UNO functions - void AddAsPropListener(); - void RemoveAsPropListener(); - void LaunchEvent( const LinguServiceEvent& rEvt ); - - const Sequence< OUString > & - GetPropNames() const { return aPropNames; } - const Reference< XPropertySet > & - GetPropSet() const { return xPropSet; } - const Reference< XInterface > & - GetEvtObj() const { return xMyEvtObj; } - -}; - - -/////////////////////////////////////////////////////////////////////////// - -class PropertyHelper_Hyphen : - public PropertyChgHelper -{ - // default values - INT16 nHyphMinLeading; - INT16 nHyphMinTrailing; - INT16 nHyphMinWordLength; - - // return values, will be set to default value or current temporary value - INT16 nResHyphMinLeading; - INT16 nResHyphMinTrailing; - INT16 nResHyphMinWordLength; - - // disallow use of copy-constructor and assignment-operator - PropertyHelper_Hyphen( const PropertyHelper_Hyphen & ); - PropertyHelper_Hyphen & operator = ( const PropertyHelper_Hyphen & ); - -protected: - // PropertyChgHelper - virtual void SetDefault(); - -public: - PropertyHelper_Hyphen( - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface > &rxSource, - ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > &rxPropSet); - virtual ~PropertyHelper_Hyphen(); - - virtual void SetTmpPropVals( const com::sun::star::beans::PropertyValues &rPropVals ); - - // XPropertyChangeListener - virtual void SAL_CALL - propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvt ) - throw(::com::sun::star::uno::RuntimeException); - - INT16 GetMinLeading() const { return nResHyphMinLeading; } - INT16 GetMinTrailing() const { return nResHyphMinTrailing; } - INT16 GetMinWordLength() const { return nResHyphMinWordLength; } -}; - -/////////////////////////////////////////////////////////////////////////// - -#endif diff --git a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.hxx b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.hxx index e7c412914a55..68a991a6260e 100644 --- a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.hxx +++ b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.hxx @@ -48,10 +48,12 @@ #include <unotools/charclass.hxx> -#include <lingutil.hxx> #include <linguistic/misc.hxx> -#include "hprophelp.hxx" +#include <linguistic/lngprophelp.hxx> + +#include <lingutil.hxx> #include <stdio.h> + using namespace ::rtl; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; @@ -90,15 +92,15 @@ class Hyphenator : ::cppu::OInterfaceContainerHelper aEvtListeners; Reference< XPropertyChangeListener > xPropHelper; Reference< XMultiServiceFactory > rSMgr; - PropertyHelper_Hyphen * pPropHelper; + linguistic::PropertyHelper_Hyphen * pPropHelper; BOOL bDisposing; // disallow copy-constructor and assignment-operator for now Hyphenator(const Hyphenator &); Hyphenator & operator = (const Hyphenator &); - PropertyHelper_Hyphen & GetPropHelper_Impl(); - PropertyHelper_Hyphen & GetPropHelper() + linguistic::PropertyHelper_Hyphen & GetPropHelper_Impl(); + linguistic::PropertyHelper_Hyphen & GetPropHelper() { return pPropHelper ? *pPropHelper : GetPropHelper_Impl(); } diff --git a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/makefile.mk b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/makefile.mk index c3f9e49a714d..208bb56c668c 100644 --- a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/makefile.mk +++ b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/makefile.mk @@ -57,11 +57,9 @@ HUNSPELL_CFLAGS += -I$(SOLARINCDIR)$/hunspell CFLAGS += -I..$/..$/..$/lingutil $(HUNSPELL_CFLAGS) EXCEPTIONSFILES= \ - $(SLO)$/hprophelp.obj\ $(SLO)$/hyphenimp.obj SLOFILES= \ - $(SLO)$/hprophelp.obj\ $(SLO)$/hreg.obj\ $(SLO)$/hyphenimp.obj @@ -71,14 +69,10 @@ SHL1TARGET= $(REALNAME)$(DLLPOSTFIX) SHL1STDLIBS= \ $(CPPULIB) \ $(CPPUHELPERLIB) \ - $(VOSLIB) \ $(I18NISOLANGLIB) \ $(TOOLSLIB) \ - $(SVTOOLLIB) \ $(SVLLIB) \ - $(VCLLIB) \ $(SALLIB) \ - $(UCBHELPERLIB) \ $(UNOTOOLSLIB) \ $(LNGLIB) \ $(HNJLIB) \ @@ -86,7 +80,7 @@ SHL1STDLIBS= \ $(HUNSPELLLIB) # build DLL -SHL1LIBS= $(SLB)$/$(TARGET).lib +SHL1LIBS= $(SLB)$/$(TARGET).lib $(SLB)$/libulingu.lib SHL1IMPLIB= i$(REALNAME) SHL1DEPN= $(SHL1LIBS) SHL1DEF= $(MISC)$/$(SHL1TARGET).def diff --git a/lingucomponent/source/hyphenator/altlinuxhyph/hyphtabs/hyph_en.dic b/lingucomponent/source/hyphenator/altlinuxhyph/hyphtabs/hyph_en.dic deleted file mode 100644 index c2c5f8e2f7af..000000000000 --- a/lingucomponent/source/hyphenator/altlinuxhyph/hyphtabs/hyph_en.dic +++ /dev/null @@ -1,11388 +0,0 @@ -ISO8859-1 -.ab4i -.1ab -.ab3ol -.abo2 -.ace4 -.ace2t3 -.a2ch4 -.ac5t2iva -.a2ct -.ac2t1iv -.ad4d1in -.ad1d4 -.ad3di -.ad3e -.a2d3o -.4a2e5d -.aer3i -.aer1 -.a2f3f -.a2f3t -.ag4a -.4a2g5n2 -.a2ir3 -.2ai2 -.al5im -.4al1k -.al3le -.all2 -.a1m5a2r -.2a2m -.ama5te -.am1at -.am2i -.am3pe -.am2p -.am3ph -.a2n1 -.an1a3b -.an2a -.an2a3s -.a4nd2 -.an5da -.an4el -.a4n4en -.an4gl2 -.a4ng -.an4on. -.an1o -.a4n3s -.an2t3a -.an3t2i3 -.4ant4ic -.an4t5o -.a2n2y5 -.a3ph5or -.2ap -.a1pho -.ap4i -.ar5ab -.a2r -.ar5ap -.ar4c2i2 -.ar1c2 -.ar5d -.ar4e -.ar1i4 -.ar4ise -.ar4isi -.ar5sen -.a2r2s2 -.ar2se -.ar4t5icl2 -.art2 -.ar1t4ic -.as1 -.as4q -.as5s1ib -.a4ss2 -.at5a2r -.2a2ta -.ateli4 -.ate2l -.at5omi4se -.a2to -.at2om -.atom1i -.at5om1iz -.2a2t3r2 -.a2t3t4 -.au3b -.2au2 -.au3g4u -.aur4e5 -.au4r -.aus5 -.authen5 -.au3th -.authe2 -.2av4 -.av5era -.aver1 -.bap5ti2s1m4 -.b2a4p1 -.ba2pt2 -.bap2t1is -.barri5c4 -.ba2r -.b2a4r1r4 -.bar3ri -.bas4i -.1bas -.ba5sic -.be3d2i -.b2e -.2b2ed -.be3lo -.1bel -.be5r4a -.ber1 -.be5s1m4 -.be1s2 -.bi4er1 -.b4ie2 -.blaz5o -.2bl2 -.bl2a -.b4l2az2 -.bo3lo -.bo2 -.bo1s5o2m -.bou4n4d -.bo4u2 -.b2oun1 -.bov4 -.3bra5ch -.br4 -.br2e2 -.burn5i -.bu4r -.bur2n2 -.ca3de -.ca4gin -.ca1g2i -.cam5i -.c2a2m -.ca1m3o -.ca2n1 -.can5t2a -.ca5p2itu -.1c2ap -.cap1i -.car4i -.1ca2r -.cas5u1al -.3cas1u3 -.cas2ua2 -.ca4ti -.c1at -.cen5so -.1cen2 -.ce4n2s -.cen5ten1a -.3cent -.cen1te -.cen4t5ri -.cen1tr2 -.cer4i -.cer1 -.2ch4 -.cit4a -.1c2i2 -.cle1m5e4 -.cl2 -.c2le2 -.clima5to -.cli1m -.co5i4t -.1c2o2 -.c2oi -.co3pa -.cop5ro -.co1pr2 -.c4o3r1u -.co3si -.co5ter1 -.c2ot -.coty3le5 -.5coty -.cri5t2i1c2i2 -.cr2 -.crit1ic -.cust2om5 -.1cus -.c4ust2 -.cus1to4 -.3d2av5 -.dea5c2o2 -.dea2 -.de5lec -.d2ele -.del5eg -.de3li -.de3l2i5r -.1d4e1m -.de5nit -.den1i -.de3n1o -.der2 -.de3ra -.de5re4s -.d4er2e -.1de3ri -.de5sc2r2ib -.5de2sc2 -.descr2 -.de5ser1v2 -.deser1 -.de5signe -.des4i -.des2i4g -.desi2gn2 -.de5s2ir -.de5s1is2 -.de5sp2oi -.des1p -.des2po -.determ5i -.1de1t -.deter2 -.de3ve -.de4w -.di4al. -.1d2i1a2 -.dia3s -.di4at -.din4a -.2d1in -.di2o5c -.3d2i1o2 -.1do2 -.do4e -.domest5 -.d2om -.dom2e -.do2me2s -.du4al. -.1du -.d2ua2 -.du1al -.3d4u4c -.d4y2s3 -.2d2y -.eas4t5 -.ea2 -.ech1in5 -.ech3i -.e2ch -.e1c2o3 -.e2c3t -.e1d5em -.2ed -.ede2 -.ed4it. -.ed1it -.ed4iti -.eg4 -.ei3d4 -.e2i5r -.e2l3ev3 -.2ele -.el2i -.elu5s4 -.e1lu -.e2m3b -.em5in -.em1p4 -.em5p4y -.en1 -.en5c -.en4d2ed -.2e4nd -.ende2 -.e4n3s -.ent2 -.en5ta -.eo1s5 -.epi1 -.epi3d -.er2a -.er1 -.er5em5 -.2er2e -.er4i4 -.er4o2 -.eros4 -.er2ot3 -.er4ri -.e4r1r4 -.es1 -.esc1al5 -.e2sc2 -.es1ca -.es3p -.es3t2 -.eter2n5 -.eter2 -.eth3e2 -.e2th1 -.eu1 -.eu4r4 -.eval3 -.evol5ut -.e1vo -.evo2l -.ew4 -.ex1 -.ex3a -.eye3 -.fal4le -.1f2a -.fall2 -.far4i -.5fa2r -.fec5un2da -.3fec -.fecun1 -.fecu4nd -.f2e4n4d -.feo2ff5 -.feof2 -.fi2 -.fi5l2i1a2 -.1fi2l -.fil5tr2 -.fi1n5e4ss -.2fin -.fin2e -.fine4s -.f1i4n3g -.fi5n4it -.f2in1i -.fi2s4c5 -.3f2o3c -.1fo -.fran5ch -.1fr2 -.fra2n -.fu5g4a -.3fu -.g2a4m -.ga1m5e2t -.gam2e -.gen4et -.3gen -.g4ene -.ge5neti -.gen5i1a2 -.gen1i -.ge3ro -.ger1 -.glor5i3o2 -.2gl2 -.3glo -.glor1i -.gnost4 -.2gn2 -.g2no -.gno4s -.go3no -.3gos3 -.h1ab2 -.ha2 -.ha5bili -.hab1il -.hama5 -.h2a4m -.han4de2 -.ha2n -.ha4nd -.hast5i -.hast2 -.h4e4i -.he2 -.hem5a -.hi2 -.hi3b -.ho2l -.ho5rol -.hov3 -.hy3lo -.h2y -.hy2l -.ico3s -.2i2c2o2 -.idi2 -.i2d -.2ig3 -.i2g1n2 -.il4i -.i2m5b -.in1 -.2i4n3d -.in3e2 -.2in2i -.2in3o -.in3t -.inve2st5i -.in3v2 -.inve2 -.invest2 -.i4r3r4 -.2ir -.i2s4c2 -.is4li -.i2s1l4 -.is4o -.i1s2o5m -.ka5ro -.ka2r -.ki4e2 -.kin3e -.k1in -.lab4o2 -.l2a -.l1ab -.la4m2e -.l2a2m -.lam5enta -.la3men -.lan5i -.la2n -.lash4e2 -.l4as -.las2h -.le4m -.len5t2i -.le2p -.le1p5r2 -.les5son -.3le4s4s -.les2so -.le5va2n -.2lev -.l3eva -.libra2r5 -.lib1r4 -.lig3a -.1l2ig -.l2i3o2 -.li4o4n1s2 -.l2i4p -.loc3a -.1l2oc -.lo4g2i1a2 -.1l2o1g -.lo3g2i -.lo2p -.loph3 -.lous5i -.lo4u2 -.lov5er1 -.lub3 -.ly1o3 -.2ly -.mac5u -.mal5ad5 -.mal2a -.ma5l1in -.mar5ti -.1ma2r -.mart2 -.m4a2th5 -.me5lo3d2i1o2 -.m2e -.melo4di -.ment4 -.1men -.men5ta -.me5r2i2d -.mer1 -.me5r3in -.met4er2 -.1me2t -.met1e -.mi4e2 -.mi3gr2 -.m2ig -.min5ue -.m2in2u -.mir2k4 -.m2ir -.mis1 -.mi5to -.mi2t -.mo3b2i -.1mo -.mo5le2c4 -.mon3a4 -.m4on -.mor5ti -.m2ort2 -.mu3n2i -.mun1 -.mu3si -.mus2i5c2o2 -.myth3 -.2my -.3myt -.n2a5k2 -.n1a -.nar1i4 -.na2r -.nast4 -.n2as -.nas5ti -.ne2c3t -.ni4c -.n1i -.ni5tro -.n2itr2 -.n2o4c -.no2m3o -.n2om -.nos3t2 -.no5t1ic -.n2ot -.nuc2le5 -.n2u -.5n4uc -.nuc3l2 -.o2b2ed5 -.ob2e -.o1b3e4l -.o2b3l2 -.od4 -.o2e4d5 -.oe5so -.o2f5t -.2oi4 -.ol4d -.om2e2 -.2om -.om5el -.on4ce -.on1c -.o2n4e -.op2i -.op2t5a -.1o2p1t2 -.or1 -.or4at4 -.or1a -.ora5tor1i -.orat1or5 -.ora2to -.or5che2 -.or4ch -.or1c2 -.or3d -.2or2e4 -.or3eo -.or4i -.orn1er4 -.or2n2 -.or2o -.os1 -.osi4 -.4oth5 -.2ot -.out1 -.o4u2 -.ov4 -.pal5i -.para5di4s1 -.1pa2r -.par2ad -.par5af -.par1a5t -.p2a5ta -.pa4t2io2 -.pe2c3t4 -.pecu3 -.3ped3e2 -.2p2ed -.p2e4nd4 -.pen5de2 -.pe2p3t2 -.per3i5n -.p4eri -.per1 -.per3se5c -.pe2r1s2 -.per2se -.pe5titi -.3pet -.pe2ti -.ph2 -.phe5n2o2m -.phe4 -.phen1o -.phon4i -.1pho -.ph2o4n -.p2i2e2 -.pi3l3a -.p2il -.plast4 -.p2l2 -.1pl2a -.pl4as -.plic4 -.plica4 -.plos4 -.po3l2a -.1po -.po5lite -.pol2it -.po2p -.p4op5l2 -.po5si1t2io2 -.3p4os -.pos1it -.pos5si -.po4s1s2 -.pro5bat -.1pr2 -.pr4oba -.pu4r4r4 -.pu4r -.put4te -.pu2t1t4 -.ra5cem -.ran5g2i -.ra2n -.ra4ng -.re3c2a -.r2e -.r2ef5er2e -.re2fe -.re1f -.refer1 -.re5ga2r -.re1i4 -.re5lin -.re1m -.re5o -.res5c2i2 -.re2sc2 -.re5sen -.re5s2po -.re5stat -.rest2 -.r2e5s4t2or2e -.rest1or -.re5st4r2 -.re3t2a -.re5u -.re3w -.rib5a -.2r2ib -.rin4 -.rit2 -.rol4l2a -.roll2 -.r4os3a -.sa2 -.sac5r2 -.sal4i -.sa2l -.sa5l1in -.salt5er1 -.s4al4t -.sal1te -.sanc5 -.sa2n -.s4ap5a -.s3ap -.sa3vo -.s2av -.sci3e2 -.sc2 -.s1c2i2 -.sea3s4 -.se2a2 -.se2ct4 -.sec5to -.se3gr2 -.sen3t -.se1q -.ser4ie2 -.ser1 -.s2es1 -.sev5era -.3sev -.sever1 -.s2h2 -.si5g2no -.s2i4g -.si2gn2 -.s1is3 -.st4 -.sta2t4o -.stra5to -.str2 -.str4in2g5i -.stri4ng -.su5d4a -.sulph5a2 -.1s2ul -.sulph2 -.sul3t -.tact4i -.ta2ct -.tac5t2ic -.t2a4m -.ta1ma2r5 -.tar5o -.ta2r -.te2ct4 -.tel5a -.te2l -.tell5e -.1tell2 -.te4m -.te5ra5t -.ter1 -.ter4p -.th4 -.tho4 -.thol4 -.ti2 -.til4 -.t2i5n1i -.t1in -.t3i2t4is -.t1or1 -.tran4c -.tr2 -.tra2n -.tri5bal -.t2r2ib -.tri3d -.trin4a -.t4ri5sti -.trist2 -.tro4ph -.tr2op -.tro1ph5o -.tro4v -.tula2r5 -.tu1l2a -.tur1b4 -.tu4r -.tur1i4 -.tu5te -.1tut -.tu3t2o -.4ul4l2 -.ulti5mat -.ultim4a -.ul1tim -.un5ce -.un1 -.un5ch -.u4n3d2 -.under5 -.unde2 -.un3e -.u4n3g -.u1ni3c -.un2i -.un2i3o2 -.u4n3k4 -.u4n5s4 -.un3t4 -.un5u4 -.2up1 -.up3l2 -.ur1a4 -.u4r -.ur5e2th1 -.ur1e2t -.ur2e -.ur4o -.va5l2ed -.1v2ale -.ve2 -.vec5 -.ve5lo -.2vel -.vent5il -.vent2i -.v5er4ie2 -.ver1 -.ver3n2 -.vic5to -.vic2 -.5vi2ct2 -.vi2s -.vis3i -.vi5so -.v2o1c -.1vo -.vo5lut -.vo2l -.wine5s -.wi2 -.win2e -.xy3l -.za5r -.z1a1 -a4a -1ab -2ab. -2aba -ab5ar2e -aba2r -ab4ay4 -2a2b1b2 -ab5ber1 -abb2e -2ab2e4 -ab3erd -aber1 -a5b3e4r1r4 -a3bet -ab1ic -a3b4ie2 -2abin -4a1b2i2o2 -abi5on -ab3it1a -ab4itu -ab3l2a -a2bl2 -abli4 -4abolic -abo2 -abol3i -ab3om -ab3ota -ab2ot -3about -abo4u2 -ab1r4 -2abs. -a4b1s2 -ab1ul -abu4lo -ab3use -ab3usi -2a2by -ac2a -ac5a2bl2 -ac1ab -ac3al -5ac1anth2 -aca2n -ac5ard -a1ca2r -a5c1at -ach5al -a2ch -acha2 -a5ch2in1i -ach1in -ach5i2s1m4 -achro4 -a3c2hr -ach5u4r4 -2a1c2i2 -a4cic -aci4e2r1s2 -aci3er1 -acie2 -ac2i3f4 -4acit -ack5a -ack1 -ac3li -acl2 -4a4co. -a1c2o2 -aco3d -ac5on1r -acon1 -4acos -4aco4u2 -ac1r2 -ac3r2y2 -act5ate -a2ct -ac2ta -act5ile -ac2to -act5o2r2y -act1or -ac2t5r2 -ac5uat -ac2ua2 -a5d2ai2 -a3d2a3v -4adee -ad5en1i -ad4ha2 -a4d1h -ad3ica -a5d2i1f -4adil4 -adi4op -a3d2i1o2 -ad2i4p -adis4i -adi4s1 -a3diti -3adju -ad1j -5admi2t -a2d1m -a2do -4adoe -4ad2oi -ad3ol -a3d4os -ad1ow -ad1r2 -a3dr2a2m4 -4a2du -ad3u1l2a -ad3um -4a2d2y -ae5a2 -ae4cit -ae1c2i2 -ae1c2o3 -4a2ed -aed5i4s1 -ae5g -ae3on -ae5p -aero2d2y5 -aer1 -aer2od -ae4s -ae5si -aes3t2 -aet4a -ae2th4 -aet4or. -aet1or -aev3a -4af. -4afe -af5ta -a2ft -a4fu -ag4ar1i -aga2r -4ageri -ager1 -a5ghe2 -a2gh -a5g2i1a2 -a1g2i -agi4as -4ag2ino -4a2gl2 -agli4 -4a2g1n2 -ag3on1i -agor4a -ag5ot -a2gr2 -ag3ri -a3gru5 -2ah -a1h2a2 -aha2r2 -aha5r1a -a1he2 -a2h4n2 -a5h2oo -2ai2 -4ai. -a2i3a2 -a1ic -aid4a -ai2d -aid5er1 -a2ig2 -ai5gu -ai2l3er1 -ail3o -aim5er1 -aim2e -ain5de2r3s2 -a2i4nd -ainde2 -ainder1 -a4i5nea2 -a3ing. -ai4ng -a2in3i -a2in5o -aint5er1 -ain1te -air5a -a2ir -air5p -ai2r3s2 -ais1i -a5i2s1m4 -2a1j -a4ju -2ak -akel4 -ak5u -al5a2bl2 -al2a -al1ab -ala2ct4 -al4ac -a1l4ae -al5ais -al2ai2 -ala3ma -al2a2m -al5ance -ala2n -al3at -a5l2av -al2c3at -al1c2 -al3ch -ald5ri -aldr2 -2ale -a3lec -aleg4 -ale5ma -al5end4e2 -al2e4nd -a1leo -a2let -al3ib1r4 -ali4c2i2 -al5i4c5s4 -al1i2d -al3i1f -5a1l2ig -al1in -a5l2in1i -al2in5o -al5ipe -al2ip -al5ip2ot -ali3po -4alis. -al1is -4al2i1u2 -4alk -alk5ie2 -al4l1ab -all2 -al1l2a -al4lag -alli5a2n -al1li -all2i1a2 -al1l2ig4 -al4lis2h -all1is -a5loe -al3o1gr2 -a1l2o1g -a3l2om -a3l2oo -al1or -al4orim -alor1i -alos4 -a4lo4u2 -al3ous -a5low -al5pen -al3ph2 -al5tati -al3tie2 -alu3b -al5u4ed -a4lue -al3ues -a5lumn2i1a2 -alu4m1n2 -alumn1i -al1va -al5ver1 -alv5u -2a2ly4 -a5lyn1 -2a2m -a5mad -ama4g -ama4n5d -a1ma2n -a5marin4e -a1ma2r -amar1i -a3mas. -am1at -a5m4at1i2c -am5a2tu -am4bin -a2m1b -amb2i -3ambu -am5elo -am2e -a3men -am2e4n4d -am3era -amer1 -am5erl -am1i -am1i2c -am5ica -am2i1c5r2 -3ami2d -a3mili -am2il -am5i2ly -amin2i4f -am2in1i -am5in1iz -am4inos4 -am2ino -a5m2is. -a4mium. -a3m2i1u2 -ami3um -a3m4on -a1mo -amor5a -am2ort3 -am5ose -am2p -am5p4er3i -amper1 -amph2i5g -amp3li -amp2l2 -ampo5l -am3po -am3ul -amyl5 -a2my -a2n -an2a -a5nadi4 -an3ae -an3age -an2a5k2 -an3ali -an3ar1c2 -ana2r -a5nast2 -an2as -an4con1 -an1c2o2 -an3d4at -a4nd -an2da -and5au2 -and5eer1 -ande2 -an5de4l -an5d2i1f -and5ist2 -andi4s1 -an5dit -an4don1i -an1do -an4ea2 -an5eer1 -an3ell2 -anel5li -an3eu -a2n3ga2n -a4ng -ang2a -angov4 -an1go -an4gu4r -an1gu -4an1h2 -an3ic -an1i -an2i3f -an5i3fo -4an2i2g -an5ion -an2io2 -anis5te2 -anist2 -4anity -4an2i1u2 -an5no -an1n4 -4an2ny2 -an1o -an2oe -an3o1ma -an2om -anor3 -an2os -an5ot -a4n2s -an3s2c2 -an4s2c2o2 -ans3il -an2si -an4su4r -an3su -an2t2a -ant5a2bl2 -an2t1ab -an3t1al -an5t2a2m -an2te -1anth2 -an4thi -3an1t2h2r -4ant1ic -ant2i -an4tie2 -an4t3i4ng -ant1in -an2t4iv -an4to2n4e -an1t2o -an1t4r2 -an4tus -an1tu -an5tym -an2ty -an3ul -an2u -an3um. -an5u4m1s -a3nu4r -a5nut -a2n2y2 -an5y1a2 -a5ny1i -2ao -aol3i -5aow -2ap -4ap. -4apa -a1pac -ap3al -ap5aro -a1pa2r -ape5li -a5peu -aph5em -aphe4 -aph3i -aph5ol -a1pho -a3phy2l3 -aph2y -ap1i -ap5icu -ap3in -ap4in4e -a5p2ir -a3pla2n -ap2l2 -a1pl2a -ap5li -apo5str2 -a1po -a3p4os -apost2 -ap4o3th -ap2ot -a2pr2 -ap5ron -4a2ps2 -apt5at -a2pt2 -apu5la2r -apu1l2a -a5p4un1 -a4q -a5q2ui2 -aqu4 -a2r -4arabi -ar1ab -ar2a5bo2 -aract4i -ara2ct -ara2g -ar3age -ar4a2g2e4d -ar5a1g2i -ar3ago -a3r2a1j -ar3all2 -ar2a3m -ara4n4g -ara2n -aran5te -aran2t -ar5apa -ar2ap -ar1at -a3r2au2 -ar2a3v -ar3ba -ar1b -arb5et -ar2b2e -ar4b2i2d -arb2i -ar4bl2 -arb3li -ar4bul -ar5chet1 -ar1c2 -ar2ch -arche2 -ar1ch5o -ar5din1a -ar2d2in -ar4do2ne -ar1do -ar3en -ar2e -ar2e4n5d -ar5e2t2t4 -ar3e1v5 -ar5gh -ar1g2 -ar3gu -ar3h2 -ar1i -ar5i2ff -ar2i1f -ar4ill2 -a5r4i5net -arin4e -ar5in1i -a5rishi -aris2h -arm3er1 -arm2e -ar5mi2t -ar3nal -ar2n2 -arn1a -ar3nis -arn1i -ar3od -ar5o2i4d3 -a4r2oi -aro4mas -ar2om -aro1ma -aro4n -a5roti -ar2ot -a5ro4uc -aro4u2 -a4r3o4x -arp5e2r1s2 -arpe2 -arper1 -ar4pu -2a4r1r4 -ar2rh2 -a2r2s2 -ar2s5a2l -ar3so -art5at -art2 -ar2th -arth4e2 -ar1t2h3r -ar5t1iz -2aru -ar3um -ar5un4 -a3ry1o2 -a2r2y -a5ry2t -ar5z -as1a -as4af -asa2n2 -2asc2 -as5con1 -as2c2o2 -as5c2ot -as2cr2 -as2e -as3e2ct -4a2s2ed -ase2p4 -ash5ay -as2h -asha2 -ash5i4l -as5i2ly -a2s3in -a5s2io4 -a3s1it -a4s5iv -ask5er1 -as2k2 -aske2 -aski4 -as4l2a -a2sl4 -as4lo -2aso -as5o2ch -as2oc -a4s4o2n2ed -as4o2ne -as5or -as3ph2 -a4ss2 -assa5g2i -as1sa -assa4g -ass5i2bl2 -as4s1ib -as4sil -as3s2it5 -2asta -ast2 -as4tat -as4t2i3a2 -as3t1is -as4tit -4asto2 -as3tra -astr2 -as4tri -as1u -as4un1 -as5u4r -2a2ta -4atabi -a2t1ab -a5tal1is -at2a2m4 -at2a3p -atar3a -ata2r -ata3s -ata3t4 -at3e2au3 -atea2 -at3e2ch -at5eer1 -a5tel. -ate2l -at2e5le -at5enat -aten1a -at3ent -4ater1 -at3era -at5er1n3is -ater2n2 -atern1i -at5ern3iz -4ate4ss -a2t2es -at5et -4a2th -ath3a4 -a3then -athe2 -ath5er3in -at4her1 -ath5ero -ath5ete -athet1 -ath3i -ath3od -a5th2o4n -a1t2h5r -4a3t2i2a2 -at1i2c -at5icis -at2i1c2i2 -ati5cit -at5ic1iz -a2t2i1f2 -a4t1i4l -a4tim -a2t3in -4atin1a -at5i4ng -4at4is. -a2t1is -at1it -atit3u -atitud5i -4a3t2i1u2 -at4ivi -a2t1iv -a5tiv1iz -a2to -5at5od -4a1t2o1g -2atol -4aton -a3t2oo -a4to2ps2 -a5t4oria2n -at1or -ator1i -ator2i1a2 -a4to2r2y -atos4 -a5t2oz -2a2tr2 -at3ra -a4tr2e -5at5re4s4s -at1ri -a3t2r2ic5u -at3ron -at5ro4u2 -at4tag -a2t1t4 -atta4 -2a2tu -at1ul -atu4m -at3ur1a -atu4r -at3ur1g2 -4a2ty -2au2 -4au. -au1b5i -4a4uc -au5cer1 -au1c3o2 -au4d5er1 -aud4e -audic4 -aul3i -aul4t -aul5t4ed -aul1te -ault5er1 -ault5i -au3ma -aun2 -aun5ch4ie2 -aun2ch -au4n3d -aun4dr2e -aundr2 -au5reo -au4r -aur2e -aur4o -au5ror -4aus. -aus5er1 -aus5p -au4s4t4ed -a4ust2 -auste2 -aut3a2r -aut3er1 -au3th -2av -a2v4ab -ava4g -av3a4ge -ava5l2a -av5alr4 -av5ant -ava2n -av5a2r -avas3 -av3e4nd -av3er2n2 -aver1 -av3ig -av4i1ol4 -a3v2i1o2 -av1is -aw5er. -awer1 -aw5e2r1s2 -aw1i2 -aw5n2ie2 -awn1i -aw5y2 -a4x -ax2i2d -ax1i -4ay -ay5l2a -ay3m -ayn4 -a4y2s2 -ay5si -ay5sta -ays1t2 -ayth4 -2az2 -az3a2r -az1a1 -aze4 -az5ee -azy1g4 -azz4l -azz2 -2ba. -ba5b2ir4 -b1ab -3back1 -baen4 -bag4a -5b2ah -b2a4i2 -bal3a -balm5i -balm2 -ba5lon -bal5u -bam4a -b2a2m -ban4a -ba2n -ba5na2n -b4ane -5ba4ng -b4aniti -ban1i -b4a4n2s -b2a4p1 -5bar1b -ba2r -bar4d -bardi4 -bar4n2 -ba5r2om -bar3o4n -5ba2r2s2 -1bas -bas4te2 -bast2 -b4a4th4 -3bat1i2c -ba5t2io2 -b4at5on -ba2to -battle5 -ba2t1t4 -bat2tl -2b1b2 -b4b2a2ta -b3bli -b2bl2 -b4bo2n4e -bbo2 -b3bon -b1c2 -bcord4 -b1c2o2 -2b1d -bdeac5 -bdea2 -bde4b -b1di4v2 -b2e -4be. -3bea2 -4beas -be3c2a -3becu -2b2ed -be3da -bed5el -bede2 -bed2i -be4do -be5dra -bedr2 -be4du -5bee -3be1f -be3go -be5gr2 -be3gu -1bel -be3l2a -2b2ele -be3l1it -bel4t -be3m -b2e4n4d -ben2d5a -bend5er1 -bende2 -b4e1ne -be5n2i2g -ben1i -b4e5n2u -4beo -be3q -2b2er2e -ber1 -berg2a5m -ber1g2 -berl4 -5be4r1r4 -be2r5s2 -b5er2t1in -bert2 -be1s2 -2b4es. -be3sl4 -be3tr2 -be3w -2b1f -b1f2a4 -4b1h -b4ha2 -2bi. -1b2i1a2 -bi4b1 -bi1cen5 -b4ice -3b2i2d -bid5i -b4ie2 -bi4e2r1s2 -bi1er1 -b2i1f4 -bi4fid. -bifi4d -bi5ga -b2ig -bigu3 -b1il -b2ile -5biles -3b2ill2 -4bim -bi1me2t5 -bim2e -5bin1a -5b2i4n4d -bind3e2 -bin5et -b2in5i4 -1b2i2o2 -b4i1o3l -bi2o5m -bi3o4u2 -b2ip4 -b2i5q -b2ir4 -bi3r2e4 -bi5rus -b2is -5bi2s1m4 -bis4o -bi5s2ul5 -3bit2u1a2 -4bity -bi5ve -b1j -4b5k4 -2bl2 -5bl4ac -bl2a -blag4 -b3la2n -5blast2 -bl4as -bl2a5tu -blem5at -3b2ler1 -5blesp -4b3l2ik2 -blim3a -bl2i3o2 -bl2i2q -b3l1is -4b2ly -2b1m -bment4 -bm2e -b1men -bmi4 -4b1n -bo2 -4bo. -3b2oa2 -bo5a2m -5bob -bod5i -bo5h2 -2bo2i4d -b2oi -4boke -bol4e -4bo2l2ed -bol3i -bol4t -3bon -bon4c -bo2n4e -bon4ie2 -bon1i -bon3i4f -bon4sp -bo4n1s2 -1b2oo -b3orat -bor1a -bor3d -bor5ee -b2or2e -bor5et -3bor1i -bor5ic -bor5i3o2 -bor4n2 -bot3a2n -b2ot -5boti -boun5t2i -bo4u2 -b2oun1 -3bou4r -bous4 -bow2 -bow3s4 -4boxy -bo4x -5b2oy -br4 -3bra2ch -4bral -br2a2m4 -b2ra2n -bra4n4d -4b4re. -br2e -b4reas -brea4 -4b2res -brev5et -bre1v -b2ri2d -5brie1f -brie2 -bri4ng5 -bri4os -br2i3o2 -b5rist2 -b4r2oa2 -bro4ma -br2om -bros4 -brum4 -4bry. -b2r2y -4b1s2 -b3sc2 -bscon4 -bs2c2o2 -bsen4 -bserv5a2n -bser1 -bser1v2 -b5si -b2sin4 -bso2 -bsol3e -bs2ol -bso3lu -b4stac -bst2 -bstu1pe5 -bs1tu -bst2up -2b1t -b5t1let -b2tl -4bu. -5bub -buf5fer1 -buf2 -bu2ff -buf1fe -b4ul2i -b4ulos -bu1lo -bun2 -bu4n4a4 -b5u5nat -bunt4 -bur3e -bu4r -bur4ri -bu4r1r4 -busi4e2 -bu4ss2 -bus5si -3b4ust2 -bu5ta2r -b3ute -b5ut1in -but2i -3bu3t2io2 -bu2t4iv -b5ut5o -b1v -4b3w -2by -4by. -3by1i -b4y2s4 -5byt -2ca. -c2ab5in -c1ab -c4ace -ca1c2o3 -cad4r2 -5caf -ca3go -5c2ai2 -5c2ak -c1al -c4al2a -ca5la1ma2n -cala3ma -cal2a2m -cal5a2r -3cal1c2 -ca5le1f -c2ale -cal2l5in -call2 -cal1li -cal4m2 -c2a3ly4 -ca3ma -c2a2m -cam4i -ca5na2r -ca2n -can2a -c2an4e -c4an1o -ca3n2oe -can5ta2r -can2t2a -can5t4ed -can2te -c4an4t1ic -cant2i -can4t4r2 -5c2ao -1c2ap -ca5p2il -cap1i -ca2pt4 -cap3ti -cap3u -1ca2r -ca3ra5c -car5am2e -car2a3m -ca3ree -car2e -ca3r4i3c -car1i -car3i1f -car5m -car3n1i -car2n2 -car3ol -car5o4n -car5oo4 -ca3ro4u2 -car4v2 -cas2e5 -cashi4 -cas2h -3ca4s3s2 -cas5t2ig -cast2 -3cas1u3 -c1at -c4at. -c2a2tc2 -c4at2om -ca2to -c2a3t2r2 -c4a4t1s -c2a2t4u -3c2au2 -caulk4i -cav3i4l -c2av -3c4ay -c1c4 -ccen1t5r2 -c1cen2 -c3cent -cces4sa -c5ce4ss -c3ch -cci3d4 -c1c2i2 -cc2ip4 -cc2le3 -ccl2 -4ce. -4c4e1ab -cea2 -cea2n3 -3ceas -ce4c2i2 -2c2ed -5ceda -ce3da2r -3cede2 -3cedi -4ce1f -ce5g -3ce2iv -cel3ai2 -cel2a -cel5ib5 -5cell2 -cel5lin -cel1li -celo4 -ce5l2om -4ce2ly -2cem -ce4me2t -ce1m2e4 -3cemi -ce4mo -1cen2 -5cenc -cen5c2i2 -cen5d2ed -c2e4nd -cende2 -cend5en -cend5er1 -cen3i -2cen1n4 -3cent -cent4a -cen5t4ed -cen1te -cen5ter. -center1 -cen5te2r1s2 -cen5t2es -1cep -cept3a -ce2pt2 -cep5t4ic -3cera -cer1 -cer4b2i -cer1b -3c2erd -ce3rem -c2er2e -5cer2n2 -5ce4ss -cest5o -cest2 -ces5t4r2 -ce2t -cew4 -2ch -4ch. -4ch1ab -cha2 -3chae -3ch2ai2 -cham5per1 -ch2a4m -cham2p -chan5g2i -cha4n2g -cha2n -ch4a3pa -ch2ap -chec4 -che2 -4ch2ed -3chee -3chem -che3o2l -ch1er1 -ch4eri -5cher3in -ch4erl -4ches -3chete -chet1 -ch5eu2 -che5va -che4v4 -3chew -ch5ex -5c2hi. -3ch2i1a2 -3ch2i2c2o2 -ch1ic -ch3i2ly -chi4l -ch4in. -ch1in -ch3in1n4 -3ch2io2 -5ch2i2p -ch2izz4 -ch1iz -ch5k -5chlor -c4hl -4c2h1m -1cho -ch2o3a2 -5ch2oc -4ch2oi -ch5o2i4d -3chor -4cho2r4ed -ch2or2e -chor5ol -4choso -3ch2ot -4choti -ch5ous -ch2o4u2 -chow5 -3c2hr -chu4r4 -3chut -5chy1d4 -ch2y -3chy2l -3chy2m -1c2i2 -4ci. -4ciac -c2i1a2 -ci2a4m -ci3ca -4ci4d1s2 -ci2d -4cie. -cie2 -ci3er1 -ci3es2t2 -c2i5et -c2i3f -cifi4 -4c2ig -ci3ga -c3iga2r5 -3cil -cil5lin -cill2 -cil1li -2cim -cim3a -ci3m2e -5ci1men -4cin3ab -cin1a -4c2i4nd -c4ine5a2 -cine5mat -ci5ne4ss -cine4s -4cint -c4i3ol -c2io2 -ci5om -ci4po -c2ip -cisi4 -c2it3r2 -ck1 -cka2r5 -cka5t -c4ke -ck5i1f -ck4sc2 -c4k1s -cl2 -cla5r2i1f -cl2a -cla2r -clar1i -3cl4as -c2le2 -2c4le. -c5lec -clemat4 -c2lev3 -cli1m -c3li4ng -cl2i2q -c1lo4q -c4l4o1tr2 -cl2ot -c4lue4 -cl2yp5 -c2ly -5cl4y2s -cn2 -c3n1i -1c2o2 -4co. -3c2oa2 -c4o5ba -3c2oc -co3c2i2 -co5cu -co3dic -co3d2i1f -4co2d2y -3coe -co5et -co3gr2 -c2o1g -4c3o2i4d -c2oi -co3inc -4col. -col3a -co3l2o1g -co1lo -5col1o4u2 -co5ly -co5mas -c2om -co1ma -co4m2e -co3mo4 -com1p4 -con1 -con4ati4 -con1a -con4ch -con1c -con3d5er1 -co4nd -conde2 -con4ey -co2ne -con4ie2 -con1i -co4n3s2 -c2on3t -conta5d -3c2oo -coo2p4 -co3or -cop4e -co3ph -c4o5p2l2 -co3po -c1o2p4t2 -2cor1a -cor5d2ed -cord5er1 -4co2r4ed -c2or2e -co3rel -3cor2n2 -4coro -co5rol -5c2ort2 -3cos. -c4ost3a -cost2 -cost5er1 -coste2 -co5ta -c2ot -3c4o3tr2 -5coty -co4us5t2 -co4u2 -cov1 -co3va -cow5a -c2oz4 -co5z1i -c1q -cr2 -5craf -craft5i -cra2ft -c4ra2n -5cran1i -cr4a5n2i1u2 -cras3t2 -cras2 -cra4te -c2r2e -4crea2n -crea4 -cre3at -cre4p3 -5creti -cre4t2o -cret5or -cri3l -cron4 -crost4 -4cro4u2 -5c4rus -c2r2y2 -crym3 -cry1o3 -4c5s4 -csim5 -2ct -c2ta -c3tac -ctac5u -c5ta5g -ct1a2n -ct5ant -c5tar2i1a2 -cta2r -ctar1i -c3ta2to -c1te -c4tea2 -c2t5ee -c4tent -cter4i1a2 -c1teri -cter1 -c2t5es -ct5et -ct2ic -c5tic2i1a2 -ct2i1c2i2 -c4ti4c5s4 -ctifi4e2 -c1t2i1f2 -c3tim -ct4in. -ct1in -ct4in1a -ct5i4ng -c3t2in1i -c5t2in5o -c5t2io2 -c3t2is -c3tit -c4titu -c4tity -ct5ive -c2t1iv -ct4iv1i2t -ct5o1lo -c1t2om -c3ton -c5toris -ct1or -ctor1i -c5tor1iz -c1tr2 -c2tr2e -ct2r2o5t -c1tu -c2tum -c1ty -cub3at -cuba4 -c4uf2 -cu5ity -c2ui2 -cu4l5ab -cu1l2a -c2ul2i -cul2l5er1 -c4ull2 -cul2l5in -cul1li -1c2ult -cu4mi -5cu4n3a4 -cun1 -cun4e -5cun2i -5cuol -cu5pa -c2up -cu3pi -c3up2l2 -1cu4r -cur4er1 -cur2e -cur5ial -cur1i -cur2i1a2 -4cur4o -1cus -cus5a -c3u2t1iv -cut2i -c3utr2 -5cuu4 -cu5v2 -2cy. -cy4b2i -c4y1b -1cyc -cyl3 -cy4m -cy5no -cyn1 -c4y2s4 -cys5to -cys1t2 -cy4t -cz2 -4da. -d4ab1r4 -d1ab -1d2ac -da2ch4 -d5ache2 -3da2ct -d1ag -d4a4g2i -d4ale -d4al1g2 -dal5ler1 -dall2 -dam5a -d2a2m -3dam2e -d3am1i -da5mu -3da4ng -da2n -d1an4t -d3ap -d3ard -da2r -5darm -3d4as2 -d2ast5a -dast2 -d1at -da2t1iv4 -d2a2t4u -dau2gh3 -d2au2 -daun5te -daun2 -3d2av -d3b -d3c4 -d1d4 -d4d4er2e -dder1 -d3di -d3d2ler1 -d2dl4 -d3dli -d3dy1i -d2d2y -2de. -de1a2c3t -dea2 -de5aw -de4b2i -de1b -deb5it -3dec -de5cant -dec2a -deca2n -de4cil -de1c2i2 -de1cr2 -4de2ct -ded3i -d2ed -def2or5e -de1f -de1fo -de4fy. -de3g -de4gu -de3io2 -5d4e3is -de3lat -del2a -de1li4e2 -del5ler1 -dell2 -del5li -de5lo -1d4em -4de4mie2 -4dem4is -d4em4o4n -de1mo -de4mo4n1s2 -de3mor -de4mos -4de2my -de1n2a -d2e4n4d -4d4ene -d3en1h2 -den2i4e2 -den1i -dens5a -de4n2s -dens5er1 -den5tit -dent2i -de3od -deo3l -deon2 -de3ont5 -de1p -depen4 -deposi4 -de1po -de3p4os -de2p4u -d3eq -derac4 -der1 -de3r2ai2 -d4er2e -4d4e2r4ed -de5reg -3der3er1 -1deri -der3k4 -3derm -der4mi -der5min -5derne -der2n2 -3dero4 -der5os -de2r3s2 -5d2eru -4d4es. -de3sa -5de2sc2 -des4ca -de5sc1al -de3sec -des4i -de3s4i2d -des5ig1n1a -des2i4g -desi2gn2 -des1p -des5p4o2n -des2po -de3sq -d3e4st. -dest2 -de2s3ti -1de1t -de3t2es -de5th1 -de2ti -dev3i4l -de3vis -de3vi2t -de4v2oi -de1vo -devol5u -devo2l -3dex -2d5f -dfol4 -d1fo -d2g -dg4a -d1gel4 -d4gen -d3gr2 -4d1h -dh2ot4 -d4hu -4di. -1d2i1a2 -di2ad -3dia2r -di5at5om -di3at -dia2to -4d1ib -d1ic. -dic5a2m -d4i4ce -d4i3ch -d5icl2 -dic5ol -d2i2c2o2 -1di2ct -dic5tat -dic2ta -dic4te -5dicul -d2icu -d5i1cu4r -1di2d -di4e2r1s2 -die2 -di1er1 -3di3ev -d4i3fo -d2i1f -dig3al -d2ig -di3g2a2m -dil4 -5dill2 -dilo4 -d4i3lu -di5mer1 -dim2e -di1me2t4 -di1m1i -2d1in -din4e -d4in5g2i -di4ng -d4i5nos -d2ino -3d2i1o2 -di2o4c -di4ol2a -d4i1ol -di2p5t2 -d2ip -3dir2e -d2ir -di3r1i -4d5iro -di4s1 -d4i2s3c2 -d4is3en3 -3d2is2i1a2 -3d2i4s1s -d4it4as -dit1a -d4iter1 -dithe4 -d2ith -d3ito -dit1or3 -2dity -1d2i1u2 -1di1v2 -di4val -d2iva -di5vin2e -di2v1in -dix4i -d2ix -d1j -2dl4 -d1l2a -5dle1f -5dlest2 -3dlew -dlin4 -d1lo -d5lu -2d1m -4d1n2 -1do -4do. -d4ob -do4c3u -d2oc -do2g4a -d2o1g -do4j -d4ol. -dol3en -do5l4ine -dol5it -do4lon -do1lo -d4o4ls -5dom. -d2om -do1ma2n4 -do1ma -domin5 -dom1i -dom5ino -dom5i2t -do5mo -don4at -don1a -4do2ny2 -3d2oo -d2or -4dor. -d2or4m -d2ort4 -d4os -do5sim -dossi4 -do4ss -dot1a -d2ot -dot4t1in -do2t1t4 -dot3ti -2dous -do4u2 -d4own -3do4x -d1p -dr2 -d5rail -dr2ai2 -d3ral -3dr2a2m -dra2n4 -d4ras2 -drast4 -3drel -dr2e -dres4 -dres2s5o -dre4ss -dri4e2 -d4r2i1f -dr2i4g3 -d4r2om -dro1pho4 -dr2op -dru4n2k3 -drun1 -4d1s2 -d5sl4 -d2s3m4 -ds4mi -d4sw2 -dt4 -dt5ho -1du -2du. -du1at -d2ua2 -3d4uc -du4ch5 -duci5a2n -du1c2i2 -duc2i1a2 -du4c2o2 -du5eli -du5ell2 -du5en -du5e2t2t4 -due4t -du5in -d2ui2 -dul3c2 -d3ule -d4ul4l2 -dum4b2e -du2m1b -du4n4a4 -dun1 -d5un4c -d2u2p -du3p2l2 -5dur1o -du4r -d5use -dust5er1 -d4ust2 -duste2 -du3u4 -d1v -dver2 -dvert3 -dvoc5at -d1vo -dv2oc -dvoc2a -2d1w -dwell3 -2d2y -dy4ad. -dy1a2 -d1y5a2r -5dy4e -5dyk -dyl2 -dyll3 -5dymi -3dyn1 -dys3p -d4y2s -d3zo -ea2 -4e1ab -e1a2ct -eac4te -ea5cu -e5ad1d4 -ead3er1 -ead1i -ead3li -ea2dl4 -ea4g -e2ak1 -eal3a -ea2l3er1 -e2ale -ea3l2o1g -eam4bl2 -e2a2m -ea2m1b -eam3er1 -eam2e -ean5i -ea2n -e2ap2 -eap5er1 -e3a4p1p2 -ear3a -ea2r -ear3er1 -ear2e -ear4li -e5a4r2r4 -ear4te -eart2 -earth5i -ear2th -eas5er1 -eas2e -ea4son1i -e2aso -e1a4s1s2 -eassem4 -eas4t2 -east5i -eat5en1i -e4at3er1 -eat5ie2 -e3a2t2i1f2 -eat1it4 -eat4it3u -e3at1ri -e2a2tr2 -e4a2tu -e2au3 -eav5i -e2av -eavi4e2 -eav5o4u2 -ea1vo -eaz5i -e2az2 -e1b -eba2r4 -e2b2b2 -eb2e4 -e4bel. -e1bel -e4be4ls -e2ben -eb5et -eb2i -e5b1il -e4bin -e4b2is -e4bl2 -e4bos -ebo2 -ebo1t3o -eb2ot -e2br4 -eb1ra -e2b2t -e4b4uc -ebus5i -ec2a -ec3ade -ecad5en -ec2al5e -ec1al -e5c2a2m -e4ca1po -e1c2ap -ec3at -ec5a2th -e1ce -ecen2t5o -e1cen2 -e3cent -ech3i -e2ch -e4cib -e1c2i2 -ec2i4f -ecip5i -ec2ip -e1cl2 -ec3l2ip -econ4s2c2 -e1c2o2 -econ1 -eco4n3s2 -econstit5 -econ3s2t2 -e2c3or1a -e4c5oro -ec3rat -ecr2 -e4c5rea2n -ec2r2e -ecrea4 -e4crem -ec1ro -ect5ati -e2ct -ec2ta -ec4ter1 -ec1te -ect2i4c -ec4tit -ec4t5us -ec1tu -ec1ul -e5c2ul2i -2ed -e5da4n2s -eda2n -e2d1at -ede2 -2e4d2ed -e5de1h2 -e4d2ele -edes3t2 -ede3te -e1de1t -edeter5 -e3dev -e5dew -ed4g -edi4a4ls -e1d2i1a2 -ed5i4c1al -ed5i4c5s4 -ediges4 -ed2ig -edi1ge -ed5i1gr2 -ed3im2e -ed1it -e1di2v2 -ediv5i2d -ed3li -e2dl4 -ed2or4 -e1do -e4do4x -ed1ro -edr2 -edu5cer1 -e1du -e3d4uc -e2dul -ed3u1lo -e4d5u4r -ee4ce -eed3er1 -e2ed -eede2 -ee4do -ee2f -ee5g -ee1i -ee2l1i -ee2m -eem5er1 -ee1m2e4 -eem3i -eep1 -ee4pa -eer4in4e -eer1 -eer3in -eesi4 -ee3to -e1f -efac2t5o -e1f2a -efa2ct2 -efal4 -ef5er3ee -efer1 -ef2er2e -ef5ini4te -e2fin -ef2in1i -e4fite -ef4l2 -efor5est2 -e1fo -ef2or2e -2e3fu -e4fug -efut5a -e1gel3 -eg2i5a2 -e1g2i -e4gib -e3gl2a -e2gl2 -eg3le -eg4mi -e2g1m4 -eg5n1ab -e2gn2 -eg1n1a -e5g4on -e2gr2 -e5gu4r -e1h2 -e5ho -e2h5s -eh2y2 -ehyd5r2 -ehy1d4 -ei2d4 -5ei1do -4e2i1f -e2ig2 -e5ignit -ei2gn2 -eig1n1i -e4in. -e3inc -e2ine -e1i4ng -e2in5i -e4ins. -ei4n1s2 -e2i4p4 -eir3o -e2ir -4eis -eis3i -eit5er1 -e2ith4 -e2iv -eiv3er1 -e2iz -e1j -ejudic4 -eju1di -ek3en -ek5is4 -ek4l2 -e4l4ac -el2a -e5lad -el5age -el2a2m4 -el5anc -ela2n -elast3 -el4as -e4la2t2es -ela4te -el5at3ive -ela2t1iv -elch5er1 -el1c2 -elch4e2 -el2ch -eld3er1 -2ele -elea5g -elea2 -4e4l2ed -el5en1i -el3en3o -ele3o -ele5ph1 -e2l1er1 -e1les -e5le4s4s -e4leste2 -elest2 -el3et3o -e1let -el3ev3a -e2lev -ele3vi -el5ex -e4l3ica4 -e1lie2 -eli4e2r1s2 -eli1er1 -e3lim -el3i4ng -eli3on -el2io2 -e4l1i4s -el2i2t4t4 -el1it -e3l4iv -el4l1ab -ell2 -el1l2a -ell5iz -el1li -e3l2oa2 -e3l2oc -elo5c2a -eloc3u -elo4di -e2l2o1g -elom5ate -el2om -elo1ma -elo3mat -el5op. -el5o2ps2 -elp5in -el3so -e4ls -el5tie2 -e1lu -elu4m -elus4 -elv4 -e5ly1i -e2ly -3elyt -e2m3ago4 -em3an3a -e1ma2n -e1ma2r4 -emarc5a -emar1c2 -em5at1iz -em2at5ol -ema2to -em5b2i -e2m1b -e1m2e4 -e4mee -e4mel -e3me2m -e4m3era -emer1 -em5ero -emet4e -e1me2t -em4icis -em1ic -emi1c2i2 -e4mie2 -e2m2ig -emig5ra -emi2gr2 -em3in1a -em5i4ng -e3m2i3o2 -em3i2s1m4 -e4mit1a -emi2t -e4m2i1u2 -em4mae -e2m1m2 -4emnit -e4m1n2 -emn1i -emo3b2i -e1mo -emo2d4u -emod1 -e2m2o1g -e4m2oi -em3o1lo -em5o1m -4em4on -e3mon1i -emon5ol -emo4no -e2mor -em5oris -emor1i -em3o4r1r4 -e4mot1ic -em2ot -e5m2oz -em1pa5r -em1p -em3pa -empara5 -em5pes -4emp4li. -emp2l2 -em4pr2e -em1pr2 -em3um -e5mut -en3a2c -en1a -e4nal -en3a1m3o -e1n2a2m -en4an1n4 -ena2n -e2n3a2r -en3as. -en2as -ena5tur2e -en2a2tu -enatu4r -3en1cep -en4cile -en1c2i2 -en3cil -en2c1t4 -2e4nd -en4d5al -en2da -en4de2dl4 -ende2 -en1d2ed -end5rit -endr2 -4ene -e2n2e5d -en3ee -e5nelle -enell2 -e5ne2p -e2n1er1 -e5nereo -en2er2e -ener5v2 -en5esi -e3ne4ss -en1et -en4e2t2t4 -e2n3eu -e3n4ew -en3g2i -e4ng -en3ic -en1i -en5i1er1 -en2ie2 -en3i1g3r2 -en2i2g -en5in -enit5u -e4n3k -en1o -en3oi -en2o2m -en3oty -en2ot -enov3 -e4n2s -ens5a2l -en3sp -en4s4u2m -en3su -en4sus -ent3a2r -en4te2r1s2 -en1te -enter1 -en5t2i2a2 -ent2i -en4ti3fy -en1t2i1f2 -en2t2o -en4tri -en1tr2 -ent5rin -ent5up -en1tu -en4tus -4en2u -en3u1a2 -en3uf2 -en3u4r -en5ut -5enwa -en5w -eo3b -e4o2ch -e2oc -e4oda -eof2 -eo2l -eol5ar. -eol2a -eola2r -eol5at -eolo3g2i4 -eo1lo -eo1l2o1g -e5olu -e2o3m -eon4a -e3ont -e1o2p4t2 -e1or1 -eor4de -e2or3e -eor5o -eo1s2 -eo4t2o -e2ot -e1pa -ep4al -ep5ar1c2 -e1pa2r -epa4t -epend5en -ep2e4nd -epende2 -ep5ert2 -eper1 -e4pete -e3pet -epe5ti1t2io2 -epe2ti -e4p5ex -eph1 -eph4i -e2p2ig -e5pl2a -ep2l2 -ep3lic -epol3a -e1po -epol3i -epol2it5 -ep3re1h2 -e1pr2 -epr2e -ep3res5e -e4p5ri4m -e4p5rob5 -ept3or -e2pt2 -e1p4u -e3pu4r5 -e4puta -equin4 -equ4 -eq2ui2 -equ2i5no -er1 -era4cie2 -er2a1c2i2 -era4do -er2ad -era4g -era4l -er3aph -er2ap -er3ap1i -er3a2p4y -4era4ti. -4era4tim -er5a2tu -er3bat -er1b -er2ba -er3b2e -er2b5os -erbo2 -2er1c2 -er3ch -er3cl2 -2erd -er2d5a2r -er4di4e2 -2er2e -er3eal -erea4 -4e2r4ed -er3e2gr2 -er5el. -er5ell2 -er5e4ls -e4re1m2e4 -er3en -5er2e4nd -er4en4e2 -ere5o2l -e3re1q -er3er1 -ere4s -er5ese -er3esi -er5este2 -erest2 -er5e2sti -eres5t4r2 -eret4 -er3et. -er3e4t1s -er3e2t2t4 -ere4v -er3ex -ergi3v -er1g2 -er1g2i -er3gl2 -er3ia. -er2i1a2 -er4ia2n -eri4ci2d -eri1c2i2 -5er5ick1 -er2i2d -er3ie2 -er3i2ff -er2i1f -er4i1me2t -erim2e -er3in -eri4n1a -eri4on -er2i3o2 -er3io4u2 -er4i2s4c2 -er4i5sta -erist2 -4eri2t -e3r2i4v -er5iz -4er1j -er2k4 -er3m2e -er4m2oi -er1mo -5ernacl2 -er2n2 -er3na2c -ern1a -er5nal1is -er1n3er1 -er1n3is -ern1i -ern3it -4e4ro. -er3o2i4d3 -e4r2oi -er4o5is -ero5st2 -erpent5in -erpe2 -er3pent -erpent2i -erre5l2a -e4r1r4 -erre2l -err2e -er4rep -er5s2ine -e2r1s2 -er2sin -er5t4ed -ert2 -er4ter1 -ert5er. -ert5e2r1s2 -er4th2i -er2t5iz -2eru -eru4b -er2u5d -eru4n2d5 -erun1 -er4vi4l -er1v2 -5erw2au2 -er1w -eryth3 -e2r2y -ery2t -2er2z -4es. -es5a4m -es5a2n -e2sc2 -es5ca2n -es1ca -es5che2 -es2ch2 -esci5e2 -es1c2i2 -escut5 -e2s1cu -e3se2a2 -e3se2ct -e5see -e5seg5 -ese4l -es5enc -e3sh4a2 -es2h -e1shi -e5shu4 -esi4a2n -es2i1a2 -es5ic. -e5s2ick1 -es5id3en -es4i2d -esi4de -esi5d2i1u2 -es5ies -esie2 -es3im -e2s3in -e5sion -e1s2io4 -e4s1it -es4it. -es4i4t1s -e3sk1in -es2k2 -e3s4mi -e2s1m4 -e2s4od -es3ol3a -es2ol -es3ol3u -es3on1a -es2o3p -e1sor -es3per3 -es5pir1a -esp2ir -es5pit -es4p2l2 -es3plen5 -esple2 -es5p2ot -es2po -e5s2pr2 -es4s3a2n -e4ss -es1sa -essa2r5 -ess5ee -es4sil -es2so -es2t1a4b2 -est2 -est3a2n -e5sta2r -es5t2au2 -e2sti -est5ifi -es1t2i1f2 -est5igati -est2ig -estig1at -e3st2oc -es5t2oo -est4r2 -es4tud4 -es1tu -e1su -e2s3ul -es4u4r5 -et2a -et3al. -et5all1is -etall2 -etal1li -et3al5o4 -eta5m2e -et2a2m -et2a3p -et3ar1i -eta2r -et5a2r2y -et4as -et3ate -et3ati -et5ay -et3eer1 -etel1l5i -ete2l -e1tell2 -etend5er1 -et2e4nd -etende2 -et5en1i -eter2 -et3er3a -et5er3i1a2 -e1teri -e3tex4 -e2th1 -ethy2l3 -eth2y -2e1t2i2a2 -e3t2ic1u -et1ic -e3t4i4g2i -et2ig -e5tim -et3in -eti4n1a -e3t2ir -et5i2t3iv -e3t2i4u2 -et5o1lo -e5tomet1e -et2om -etom2e -eto1me2t -e2ton -et3on1a -etor3i -et1or -etra5g -etr2 -4e4tral -etr2a5m -et4ra2n -et5re4s4s -etr2e -et1ri -et4r2i1a2 -etrib5a -et2r2ib -e4trim -et1ro -e2t2t4 -et3ter1 -etud4 -et3ud4e -e4tum -et4we -et1w -e2t5z2 -eu3d2i3o5 -eue4 -euk5 -4eum -e3ur1g2 -eu4r -eur5i -eus4 -eu5ten -eu3ter1 -eut3i -ev4abi -e2v3ab -e1v2al5e -ev2a2p3 -ev3ast2 -ev3at -ev5eli -e2vel -eve4n -ev5erat -ever1 -ev5er3en -e4v4er2e4 -ever4er1 -e4veri -e4ves -e1v2i1a2 -e4vi1ab -e2vic2 -evic1tu4 -e5vi2ct2 -evi2d3 -ev5ig -ev4ile -evi4l -ev5is2h -evi2s5in -evis5o -e4v2i1u2 -ev2oc3 -e1vo -evol5e -evo2l -evol5ute -evu4 -e1wa -e4wag -e5w4ay -ew1er1 -e3wh2 -ew5ie2 -ewi2 -ew1in -ew5is2h -e3wit -e1wr -ex5i4c -ex1i -ex4on. -ex1o -exo4n -1ex3p -4ey. -ey4as -ey1a2 -eyl4 -e4y3s2 -ez5er. -ezer1 -ez5e2r1s2 -ez5ie2 -ez1i -1f2a -2fa. -fab4i -f1ab -fa3ce2t -fa2ct2 -fa2c3u -2f3ag -fal2l5in -fall2 -fal1li -5falo -fa5lon -fals5ifie2 -fa4ls -fals2i1f4 -4fan3a -fa2n -fan5tas1iz -fan2t2a -fantas3i -fant3i -5fa2r -far3i -5faw -4f5b -2f5d -2fe. -3feas -fea2 -fe4a3tu -fe2b5r4 -fe1b -3fec -2f2ed1 -5fei -fe1li -fem3i -femin5 -fend5er1 -f2e4nd -fende2 -f5en1i -4f4e2r4ed -fer1 -f2er2e -fer3ee -3fero -fe5r2oc -fer5om -3fe4r1r4 -fer3v2 -2f4es. -fes2s3o -fe4ss -fest3a -fest2 -fe2st5i -fe4t -fet4al -fet2a -fet4in -fet4o -3feu -fe5veri -fever1 -2ff -f1fe -ffec4te -f3fec -ffe2ct -f5fe4t -f1fi -f5f2i1a2 -f3fic -f5fie2 -f1fi2l3 -f2f3is -ff4le -ffl2 -ff3lin4 -f3f2oc3 -f1fo -ffon1i4 -ffo2n -ff2or3e -f3fr2 -ffran2ch5 -ffra2n -4f5h -fi5ance -f2i1a2 -fia2n -f4ib5u -4fic. -4fi4c1al -3fi1c2i2 -4fi4c5s4 -fi5del -fi2d -fid3en -fiel4 -fie2 -fi2er4c2 -fi1er1 -figh2t5 -f2ig -fi2gh -1fi2l -2fin -fin2a -fi3na4l -f2i4nd3 -fin2e -f1i4ng -5finin -f2in1i -fin4n1i -f2in1n4 -fir2m1 -f2ir -f3it1a -f5it3ee -fl2 -3fl2a -fle2s -f3lica -flin4 -3flo -flo5ric -flor1i -3flu -flu1m4i -1fo -4fo. -3f2oc -fo2e -foet3i4 -fo1et -fo1l4i -fo4li2e2 -fomen4t4 -f2om -fom2e -fo1men -fo2n -fon4de2 -fo4nd -3f2oo -fo5r2a2m4 -for1a -for5ay -for5b -for4di -fore3t -f2or2e -5f2orm -for4m3a -fortu5n4a4 -f2ort2 -for1tu -for3tun1 -fo3v -1fr2 -frag5a -fran2t4 -fra2n -fra2r4 -frat2ch4 -fra2tc2 -fre4s -fr2e -fros4t5i -frost2 -fr4uc4 -2f3s -fs4p -2ft -f1t4ed -f4ter. -fter1 -f2t5es -ft2i4et -ftie2 -ft4ine -ft1in -3fu -4fu. -f4u4c -fuel5li -fuell2 -fug4a -fu4min -fu1mi -fu4n2g -fun1 -4fu2r4ed -fu4r -fur2e -fur3n2 -fu3sil5 -fus5o -fu5til -fut2i -4ga. -ga4cie2 -g2a1c2i2 -gadi4 -ga4d4os -ga2do -3gag -3g2ai2 -3g2ale -ga5len -gal2i4a2 -gal5ler1 -gall2 -3galo -gam4bl2 -g2a2m -ga2m1b -gan5at -ga2n -gan2a -4ga2n2ed -gang5er1 -ga4ng -g5ant. -gan4t4r2 -g5an4t1s -g5ar1c2 -ga2r -g4ar2e -gar3ee -gariz4a1 -gar1i -gar1iz -ga5r2ot -gar5p -5g2a4r1r4 -1ga4s -gas5i -g2as3o -gas2ol5 -gas2s5in -ga4ss2 -gast3r2 -gast2 -g1at -g4at. -ga2t5iv -g4a2to. -ga2to -g4atos4 -g4a2t1t4 -g2a2t5u -gaud5 -g2au2 -ga5z1a1 -g2az2 -g1b -g5d4 -2ge. -5geal -gea2 -3gea2n -2g2e4d -3gedi -5ge4d1n2 -4ge1f -1gel -4g2ele -ge4li -gel4in -gel5li -gell2 -ge4lu -2ge2ly -gem3i -5ge1mo -3gen -gen4du -g2e4nd -gen5it -gen1i -gen3o -gen5t2i -ge4o -geo3lo -geo2l -4g2er2e -ger1 -3germ4 -2g4es. -5ge4ss -gest5at -gest2 -3get -get3a -2g1f -2g1g -gg4a -g2ge -g5ge2dl4 -g2g2e4d -g3ger1 -g5ger3er1 -g4g2er2e -gg2i4a5 -g1g2i -g3gli -g2gl2 -g3glu3 -g5g2ly -ggr2av3 -g1gr2 -g4g4ro -2gh -g5h2ai2 -gha2 -gh5en1i -ghe2 -g3ho -g4hos -gh2t -1g2i -4gi. -gi4all2 -g2i1a2 -gi4at -3gib -g2i5c2o2 -g2i4g -gi5ga2n -1g4in5g2i -gi4ng -3g2io2 -gi4or -gi4ot -5g2ip -gi5pa -g4i4s -5gis. -gi2t1 -5gitu -giv5en. -2gl2 -g3la2r -gl2a -5glass. -gl4as -gla4ss2 -glec4 -3g2ler1 -g4leto -g1let -g4letr2 -g4ley -gli5on -gl2io2 -g5l1is4 -3glo -4g5lod -gl2om3 -4glop -3glu -glu5te -glu5t2i -3gl2yp2 -g2ly -2g1m4 -2gn2 -g1n1a -g4n1ab -g5nate -5gn4a2th -g5nati4 -gna5tu4r -gn2a2tu -gn5e2dl4 -g2n2ed -gn5ee -gn3er1 -g1n1i -g4n2i1a2 -g2n3in -gn4in. -g4n2i2o2 -g2no -5gnor1i -gno4s -2go. -5g2oa2 -3g2oc -5god -3goe -go4et -go4ge -g2o1g -4go3gr2a2m -go1gr2 -g5o2i4d -g2oi -g4o3is -go2m2e -g2om -5gon1n4 -go5n2om -3g2oo -goph4 -4gor. -5gor1g2 -4go2r1s2 -g4o2r2y -3gos -gos4t2 -2go4u2 -gour4i -gou4r -g1ous -gov1 -g3p -1gr2 -gr1ab4 -3gr2a2m -4gram2e -gr2a2p -g4r2e -gril4 -gri2m3a -g4ro -gr2o4g -g5ron -gr2op4 -3gru -gru3en -gr2u5i2 -gru2m4b -2g1s -gs4c2 -gs4t2 -g4sti -gth5en1i -gthe2 -g5to -g4u2a2 -gu5ab -5gua2n -3guar2d -gua2r -g5uat -2gue -5gueu -5guit4 -g2ui2 -gui5t1a -gu2ma -gu4mi -3gun1 -g4uras5 -gu4r -gur1a -g4u2r4ed -gur2e -gur4n2 -gur4u -4gu2r2y -gust5a -g4ust2 -2g1w -2gy -g4y2b -5gym -3gyn1 -gyn5o -g5z2 -ha2 -4ha. -h4ac -hadi4e2 -had4in4e -ha2d1in -hae3o -ha2g2e4d5 -ha3g2i3o2 -ha1g2i -hag5u -ha5ic -h2ai2 -hais4 -hak4ine -h2ak -hak1in -hal5ant -hal2a -hala2n -h2a4m -ha1m5a2n -han4cro -ha2n -han1cr2 -ha4n2g -h1an1i4 -h5an1iz -han4t -han2t3a -ha4pe -h2ap -hap3l2 -har1a -ha2r -har5b -har4d -har5die2 -har2ge4 -har1g2 -ha5ri2s1m4 -har1i -har3o -har4t4ed -hart2 -har4ti -has4te2 -hast2 -ha2t5o -haugh2t5 -h2au2 -hau2gh -ha2vel4 -h2av -hav5ersi -haver1 -have2r1s2 -ha1v5o -h1b -h1c -h1d -hdeac5 -hdea2 -h1du4 -he2 -4he. -h2ea2 -1head -3hea2r -hear2ch4 -hear1c2 -heas4t5 -heav5en -he2av -he2c3t4 -he5del -h2ed -hede2 -he3do -heek4 -h4ei -h4e3is -he5lat -hel2a -h5elin -he3l2io2 -he5l2i1u2 -hel4li -hell2 -h3el3o -hem1a -he3men -he1m2e4 -hemis4 -he5m4op -he1mo -hem4p -hende5 -h2e4nd -he3or1 -hep1 -h1er. -her1 -her4as2 -her2b -her2b3a -herb3i -here3a4 -h2er2e -here3o -h5er3e2t2t4 -heret4 -h5erh2 -her5ial -her2i1a2 -h5erin4e -her3in -h1erl -her5om -h4eron -h1e2r1s2 -h5erwa -her1w -hes3t4r2 -hest2 -het1 -h4et3a -het3i -het4t4ed -he2t2t4 -heu2 -h4eum3 -heumat5 -heu1ma -he4v4 -hev5i -hex5o -h1f -h5h -2hi. -hi4a2r -h2i1a2 -h1ic -hi3c4a2n -h4i4cin -hi1c2i2 -h4icl2 -h5ie. -hie2 -h1i1er1 -h4i4e2r1s2 -h1ies -h3ifi4 -h2i1f -h3i3fy -hig4o -h2ig -hi5ka -h2ik2 -hi4l -hi5ma4 -hi5mer1 -him2e -himos4 -hi2mo -h1in -h2i4n4d -h2in2e -hi5n2ie2 -h2in1i -h5in1iz -hi5nop -h2ino -h2i4n1s2 -hio5lo -h2io2 -h4i1ol -h4i1or -h2i2p -hip3l2 -h4ir -hi4r4r4 -hir3r5i -hit4a -h2iv5a -4hl -h3l2a -h1le -h3let -h1l2i -hl2i4a2 -2h1m -h4man3ic4 -h1ma2n -hman1i -h5mica -hm1ic -2h1n2 -hno1cen5 -hn2oc -hn4o3ce2 -4ho. -ho3a2n -h2oa2 -ho4c2o2 -h2oc -ho3don -ho2do -ho5du -ho5ep5 -hol3a2r -hol2a -hold1 -hol4is. -hol1is4 -ho5l4y2s -ho2ly -ho4mag -h2om -ho1ma -hom5in -hom1i -h2o4n -hon5em -ho2ne -ho5neu -hon3ey -hon2g3i -ho4ng -ho5n2io2 -hon1i -hon1o -1hood -h2oo -hoo5r -h4ope -ho2p5r2 -h4op4te -h1o2p1t2 -hor5et -h2or2e -h4or2n2 -horn5i -ho5r2o1g -hort5h -h2ort2 -hosi4 -ho4ton -h2ot -ho1t2o -h2o4u2 -3h2ouse3 -4h1p -2hr -hras5eo -hras2 -hr2as2e -hr2e4 -hre5ma -hr5er1 -hres4 -hri4 -hril2l5in -hrill2 -hril1li -hrim4 -h5rit -h3r2od -hrom4i -hr2om -h2r2y4 -h3rym3 -2h1s -hsi4 -h4s2k2 -ht5ag -ht5ee -ht3en. -ht5e2n1er1 -h4t4ene -ht3en1i -ht3e4n2s -ht5e2o -h2t5es -ht4f2oo -h2t3f -ht1fo -h1th -ht4ine -ht1in -hu4g -hu4mat -hu1ma -hu5mer1 -hum2e -hu4min -hu1mi -hun4c -hun1 -hu4n2k4 -hun4t -hur3i -hu4r -hu3s2i1a2 -huz4 -h1w -h4wart2 -hwa2r -h2y -hy2l -hyl5en -hyle2 -hy2m -hyn4 -hy3o2 -hyol5i -hy1pe -h2yp -hy3ph -hyr4 -hys3te2 -h4y2s -hys1t2 -hy4t -2i1a2 -ia4bl2 -i1ab -iab5ol1is4 -iabo2 -iabol3i -iab5ol1iz -i2a2ch -ia1c3o2 -i2ac2r2 -ia5cri -ia5d4em -i5ae -iaf4 -i2ag4 -i4a3g1n2 -i5a4g5o -ia3gr2 -i3ah -i5ai2 -iale2ct4 -i2ale -ia3lec -i3al1it -ial5li -iall2 -4ial1n4 -i2a3lo -i2a5ly4 -i5a2m1b -i2a2m -ia3m2e -ian2ch5 -ia2n -i3ant -i5ape -i2ap -ia3ph -i2ard -ia2r -4iarit -iar1i -i3at -ia5the2 -i4a2th -i5at2om -ia2to -i2a2t4u -iat3ur4a -iatu4r -i3au2 -i2av4 -ib3era -ib2e -iber1 -ib1i -i1b2i2o4 -ibios4 -ib5li -i2bl2 -4ibo2 -i4bon -ibor4 -i4bose -i5bo4u2 -ib1ri -ibr4 -4ibu -ib3uta -ic3ac -ic5a2do -i4c1al -ic1a2n -2i1ca2r -iccu4 -ic1c4 -4ice -i5ceo -4i2ch -ich4i -ich5i4ng -ich1in -ich5ol -i1cho -4icin -i1c2i2 -i5c2io2 -2ick1 -ic4lo -icl2 -2i2c2o2 -i3c2o3c -ic5ol3a -icon3o -icon1 -i5cop -icoty3le5 -i5coty -ic2ot -2i1cr2 -i4cri -i4cru -i4c2r2y2 -ic4te2dl4 -i2ct -ic1te -ict4ed -ic4ter1 -ict5ic -2icu -icu4lu -ic3um -i5cun4 -i5cut -2i1cy -i2d -id1a -i5d4ay -i1d4e4m -id3enc -id3era -ider1 -i3derm5 -i3d2icu -id3i1f -i5d2ig -i5dil4 -i3dim -id4ine4s -i2d1in -idin4e -idios4 -i3d2i1o2 -id2ir4 -id1i4s4 -id4ist2 -2i4d1it -i1di4v2 -id3li -i2dl4 -id3ol -i1do -idol3a -4idom1i -id2om -id3ow -4idr2 -id5ri -id3ul -i1du -ie2 -4iec -2ieg2 -ie3ga -ie5i -i5ell2 -4iem -2i1en -i2e4n2d -i1er1 -i3ere4s -i2er2e -i2eri -ier3i4n -4ier2n2 -ier2o -i4ert2 -i3e2sc2 -ies3e4l -i1es2t2 -i3e4st. -2i1et -i4et. -ie2t3ie2 -4ieu -i5eut3i -iev3a -iev3er1 -ie1v3o -2i1f -i2fe -if4f2a -i2ff -iff5ler1 -iff4le -iffl2 -i4f3ic. -i4fic3ac -i4f5i4c5s4 -ifi4d -i2fi4n -4i2fl2 -i3fo -i3f2oc5 -if5tee -i2ft -i3fy -2ig -i3gad -ig3a4nd -iga2n -3iga2r -i1ge -i3ger1 -ight5er. -i2gh -igh2t -ighter1 -ight5e2r1s2 -4i1g2i -ign5iz -i2gn2 -ig1n1i -ign2o5m -ig2no -i3gon -ig1or -ig3ot -i5gret -i1gr2 -ig4r2e -i4g5ro -i5gu5it4 -ig2ui2 -ig1u4r -2i1h -ih2y4 -2ii -i5in -i1ja4 -4iju -2ik2 -ik5a2n -ike4b -i2l3a -ila4g -ila5te2l -ila4te -i5l4ater1 -il4a4x -il5dr2 -il4du -i3len -ilesi4 -il3f -il3ia. -il2i1a2 -il3ia2r -ili4arl -i3li1c2i2 -i5l2i1en -ilie2 -ili4er1 -il4i4fe -il2i1f -il4ific -il1in -il5i2ne. -il4ine -4ili3o4u2 -il2io2 -il5i4p1p2 -il2ip -il5i1q -il4ite -il1it -ilit5u -il4mo -ilm2 -i5lon -il3o4u2 -ilth4 -il2tr2 -4ilu -il5ul -i5lum -il5ur2e -ilu4r -il3v -4ilym2 -i2ly -ima4c -im2ag -im3a4ge -im1al -i2m5a2m -i5m2as -i4mat4ed -i4ma2t3in -im2a2t5u -im1i -i3m2ie2 -im4ine -im5ino -im5me2s -i2m1m2 -imm2e -i2mo -i5m2o1g -i3m4on -im5oo -i3mos. -impar5a -im1p -im3pa -im1pa2r -impar2ad5 -im5p2ie2 -im2pi -imp2o2t5 -im3po -im5pr2 -im3pu4 -im1ul -im5um -in3ab -in1a -4inace -ina2c -in4a2do -in5a2gl2 -in3a2ir -in2ai2 -ina4l -4inal1it -i1n5a2m -in3a2n -in3ap -in4a2r2s2 -ina2r -i3nas. -in2as -4in2a2ta -inat1or5 -ina2to -in3au2 -in4aw -2inc -inc4t2u1a2 -in2c1t -inc1tu -2i4nd -in5da2r -in2da -inde5p -inde2 -inde4s5 -in1de3t -indeterm5 -indeter2 -in5dro -indr2 -4inea2 -4i2n2ed -in5ee -in5eg3a -4in5eo -ine4s -in3esi -ine5te -4ineu -inev5 -infilt5 -in3f -in1fi2l -infol4 -in1fo4 -4in3fu -4ing2a -i4ng -in5gal -4inge -ing5ha2 -in2gh4 -4in2g2i -4ingle -in2gl2 -4ingli -4in1go -4in1gu -in2g3um -2in1i -in5ia. -in2i1a2 -4inic -in4i1c2i2 -in3ion -in2io2 -in4itud -4i4n2k -ink4ine -ink1in -4i4n1l2 -2in1n4 -2ino -4i4no. -in3oi -i5nole -4inos -i3n4os. -in5ose -in3osi -4in1q -i4n1s2 -in4s2ch5 -ins2c2 -inse2 -inse2ct5 -in5sec -insec5u -in3si -5ins2k2 -insolv5 -ins2ol -in4tee -in1te -int5e4ss -in2t2es -in3til -int2i -int5res -in1tr2 -intr2e -intu5m -in1tu -2in2u -in5ul -in5um -in3un1 -in3u4r -invol5u -in3v2 -in1vo -invo2l -2io2 -io3a2ct4 -i2oa2 -i1od -iod3i4 -io2d5o -ioe4 -io3gr2 -i2o1g -4i1ol -io3ma -i2om -i4oman1i -io1ma2n -io3mo -i5ope -io3ph -i5o1po -io2p4s2 -i1or -ior2a4m4 -ior1a -4i2or2e -4iorit -ior1i -5ior1iz -4iorl -ior4n2 -io3sc2 -i3ose -i3osi -i4oso -i4o5sta -iost2 -i3ot -iot4a -i4o5th -iot5ic -i4o5tr2 -i4oty -i4our. -io4u2 -iou4r -i4ou2r2s2 -i5o4x -2ip -ip3al -ip2ap4 -ipar3o -i1pa2r -ipart5ite -ipart2 -ip1at -i3p2e4nd -i1ph2e4 -iphen3 -i5pheri -ipher1 -iphi4 -i4phu -ip3i2d -i5p2il -ip3in -ip4in4e -ip2ir4 -ip5is -ip1i4t -ip4iti -ip3lin -ip2l2 -ip3lo -i3po -i4p2o1g -i4poli -i4p2om -ip4o2n3 -i4pow -ip2p2l2 -i4p1p2 -ip3pli -ip4r2e -i1pr2 -ip5tor1i -i2pt2 -ipt1or -ip1ul -i5put -i2p4y4 -2iq -i3q2ua2 -iqu4 -2ir -ir1a -ir4abi -ir1ab -ira4c -ir4ae. -ir4ag -ir4al1in -ir4al1li -irall2 -i5r2a3so -iras2 -irassi4 -ira4ss2 -ir4ay4 -ird3i -ire3a4 -ir2e -ir3ec -ir5ee -irel4 -ire5li -ires4 -ir5e4ss -ir1i -ir2i4d -ir4im -ir4is. -5ir1iz -irl5i4ng -ir5o2ch -ir2oc -ir5ol -ir3om -ir4q -i2r2s2 -ir5ta -irt2 -ir5tee -irwo4m2e -ir1w -ir1wo -ir3w2om -i4sa -is5ad -is3age -isa4g -is1a2l -is3a4m -is1a2n -is3a2r -is5av -4i4s3b -i2s3c2 -is5chi -is2ch2 -isci5c -is1c2i2 -4i1sec -ise5cr2 -is3ell2 -4is3en -is2er1 -is5er2e -i2s3et -4iseu -is3ha2r -is2h -isha2 -ish5ee -ishe2 -4ish3io2 -ish3op -is5hor -2is2i1a2 -is5ic -is3ie2 -4isim -is3inc -i2sin -4is1is2 -is4ke2 -is2k2 -i2s1l4 -islun4 -2isma -i2s1m4 -is1on -is5on1er1 -is4o2ne -is2o5p -is1p -i3s2ph2 -5is1pr2 -2i4s1s -iss5ad -is1sa -is4sa2l -is5sa2n -is4s4iv -is1s4o -4ista -ist2 -is4tal -ist5enc -iste2 -ist5ent -is5ter3er1 -i4s2t2er2e4 -ister1 -4is1th -is4t3ic -4i4s2tl -i4s1to -4is4t2om -is1tr2 -3is2t4r2y -4is4ty -i5s2ul -is3u4r -2is2y -it1a -i2t5ab -ita4c -4i1t2ai2 -it3a2m -it4an2a -ita2n -it4as -it3at -i3te2ct -it3ee -it3enc -it3ent -it3era -iter1 -2ith -itha5l -itha4 -ith5i -i5thol -i1t2h3r -ith2y5 -2i1t2i2a2 -it2i4c2o2 -it1ic -it5ic1u -it1ie2 -it3ig -4i1tim -it4in. -it1in -i4t4i4n1s2 -4itio. -i1t2io2 -4itio2ne -i5t2i4q -4i5tit -i2t3iv -it4li -i2tl -it5lo -4i2to. -it5ol -2iton -it1o4u2 -2itr2 -it5re4s4s -itr2e -i4tric -2i2t1t4 -it4tit -it3ti -itu4a4ls -it2u1a2 -itu1al -it5ua2r -4itue -it1ul -it1u4r -it3us -2i1u2 -i3um -iur5e -iu4r -2iva -iv5anc -iva2n -iv1at -i4v2ed -iv5el. -i2vel -iv5el3i4ng -iv5e4ls -i4ver. -iver1 -iv3eri -i4vers. -ive2r1s2 -iver5sa2l -ives4 -iv3et -i4vie2 -iv3i1f -i5vil1it -ivi4l -ivil3i -5ivi4st. -i2v5ist2 -5ivi2s4t3s -iv1i2t -i2vo -iv2oc3 -i5v2or2e -2i1w -2ix -ix3o -i5ye -1iz -4iz2ah -iz1a1 -iz3i2 -2izo -iz5oi -2izz2 -1ja -2ja. -3jac -ja2c5o2 -jac3u -jag5u -jal4 -ja5lo -ja5pa2n -j2ap -j4apa -jel5l2a -jell2 -jeo2 -jeop3 -4jes -jeu4 -jew3 -2ji -3j2ig -jil4 -jill5 -5jis. -3jo2 -4jo. -jo1c5o2 -j2oc -joc5u -jol4e -4jr -4js -ju1di -j2ui4 -ju5l -ju3n2i -jun1 -ju2s1cu4 -j2usc2 -jut3a -ju1v2 -k4abi -k1ab -k2a5bu -ka2ch4 -k3a4g -kais5 -k2ai2 -ka4l -ka5lim -kal4is -k4a2n -k2a3o -k2ap4 -kar4i -ka2r -1kas. -kau4r4 -k2au2 -k2av4 -k1b4 -k1c -kc2om4 -k1c2o2 -k5d2 -k1do4 -kdol5 -4k2ed -ke5da -k5ede2 -3kee -ke4g -k2e4n4d -ken1o4 -ke2p5t2 -ker5a -ker1 -k4er2e -k5erel -k4er4j -ker5o -kes4i -ket5a -key4wo -key3w -k1f -kfu4r4 -k3fu -k3ho -5k2i1h -ki2l -kilo3 -k1in -k2in. -3k2i4nd -kinema4 -kin5et -k3i4ng -k2in4i -k2i4n1s2 -kir3m -k2ir -ki4r4r4 -kis4 -3kis. -k1is2h -ki2t5c2 -k2i4w -kk4 -k5ker1 -k2l2 -k3l2a -k5lea2 -k3ler1 -k3let -k3li -k3lo -k1m -kn2 -k2no -1kn4ow -k2o5a2 -kol4 -ko5m1i -k2om -ko5pe -k1p -k5ro4 -k3ru -4k1s -k3sl4 -ks2mi -k2s1m4 -ks4t2 -k1t -ku4r5 -k5v -k1w -3kyl -l2a -4la. -5la4a -lab5a2r -l1ab -l2aba -la1bel4 -l2ab2e4 -5lab1r4 -l4ac -la2c2a -la5ceo -la5cer1 -la4ch -la2c2o2 -5la5col -lac5on1 -la3cu -la4de -l5a2d1m -l4ae -l4af -la3ger1 -la4g4i4s -la1g2i -la2g3r2 -5l2ah4 -la4ic. -l2ai2 -la1ic -l4al -4l2ale -5laman3dr2 -l2a2m -lama4n5d -la1ma2n -la5mel1li -lam2e -lamell2 -lam4ie2 -lam1i -la1m1o -l5amu -lan3at -la2n -lan2a -la4n2d -3land. -land3i -3lan4d1s2 -lan4er1 -lan3et -lan5tine -lant2i -lant1in -lan4t4r2 -l2a4p -lap1i4 -lar5a2n -la2r -lar5de -4la2r4ed -lar2e -l4as -lat5al -l2a2ta -la4te -5latil1is -la4t1i4l -5latil1iz -5lat2in1i -la2t3in -lat5us -l2a2tu -l4au2 -5lau4r -lav5at -l2av -l4aw -4l2az2 -l3b -lb2e4 -l4bit -l4by -l1c2 -l2c1at -lce4 -l1cen4 -l4c2er2e -lcer1 -lch4e2 -l2ch -l3da2r -l3d2ed -l3de1h2 -l5dera -lder1 -ld3est2 -l5dew -ldi2 -l3die2 -ld4in4e -l2d1in -l5di5ne4s -ld3is2h -ldi4s1 -ld5li -l2dl4 -l3do -4le. -3leagu -lea2 -lea4g -le5a1t2io2 -leav5er1 -le2av -l3eb5ra -le1b -le2br4 -le3c2a -le5cha2 -le2ch -lect5ica -lect2i4c -le2ct -2l2ed -le5dr2 -leg1a -l3ega2n -3le2g1g -le4gin -le1g2i -leg3o -le3gra -le2gr2 -lek4 -4l4e4l2ed -l2ele -lel5o -le1lu5 -lem5enc -le1m2e4 -le1men -lem3is -l5em1iz -5le2m1m2 -l3e4m1n2 -le2mo -l4em5on -l5en2da -l2e4nd -len5da2r -lend4e2 -len4do -l4e1ne -le5n2ie2 -len1i -len3o -4len1t2io2 -lent2i -l4en5u -le3on -leo4s2 -le5q -2ler1 -le5rec -l2er2e -5l4er2i1a2 -l4eric -le5r2ig -ler3om -leros4 -ler3ot -4l4es. -le3s2c2o2 -le2sc2 -3le4s4s -1let -le5tra -letr2 -le5tr2e -5le5tu5 -leu4r5 -2lev -l3eva -5leve -lev5it2a -levi2t -le4wi2 -l5ex1a -1ley -lf5i2d -l2fo -lf3o2n -l1g2 -l4gal -l4gem -lg2i4a2 -l1g2i -l4gi2d -l4g2oi -l3h -4li. -li4an1i -l2i1a2 -lia2n -lias4 -lib1r4 -l1ic. -5l4i2ch -li4cie2 -li1c2i2 -5li5c2io2 -l3ic3on1 -l2i2c2o2 -lict4o -li2ct -l2i4cu -l3id1a -li2d -l4ida2r -5lid3i1f -3l4ieu -lie2 -l4i2fe -l2i1f -l4i3fo -lift5er1 -li2ft -1l2ig -li5ger1 -li1ge -light5i -li2gh -ligh2t -5l2i1h -3l2ik2 -1l4il -lil4i -li2m2b -limet4e -lim2e -li1me2t -lim4p -l4i2na. -lin1a -l4in2as -l2i4n4d -l4ine -5l4in3ea2 -lin4er. -lin1er1 -lin4e2r1s2 -lin4ger1 -l4inge -li4ng -l4in2g3i -5lingt -3l4in1gu -3l4in1q -lint5i -3li2o1g -l2io2 -l4i4ol -li2o3m -li3ot4 -li3o4u2 -5liph -l2ip -li2pt5 -l2i1q -3l2ir -l1is -l4is2k2 -5lisse -l2i4s1s -l1it -l2it. -l3it5a -5liter1 -3l2ith -5l2i1t2i2a2 -3l2itr2 -lit4u -l4iv -l5iv1at -l2iva -liv3er1 -liv5i2d -lkal5o -lka4l -lk5at -lk3er. -lker1 -lk3e2r1s2 -ll2 -l1l2a -ll2a4ba -ll1ab -lla2ct4 -ll4ac -l5l4as -l4l4aw -l5le1b -l1lec -l1leg -l3lei -l1lel -lle5m -l1len -l3lep -l3leu -l3lev -ll3f -l1li -lli5a2m -ll2i1a2 -lli4a2n -llib4e -llic4 -l4licl2 -ll2i5c2o2 -l5lie2 -llig1at4 -l1l2ig -l2lin -l5lin. -l3lin1a -l3l4ine -l5l2io2 -ll4i5v -ll3m2 -l1lo -lloc3a -l1l2oc -lloc5u -l1lo2q -l4lov -llow5er1 -ll3p -l4l3s -ll5t -l1lu -llun4 -l5ly1a2 -l2ly -l3ly1c -l3ly1g -l3ly1h -l3ly1i -l5lym2 -lm2 -l1ma -l1m2e -l4mer1 -lm3i4ng -l5m2i3p -l2m3od1 -l1mo -l1n4 -l3ne -lneo4 -2lo. -5load -l2oa2 -5l4ob3a -1l2oc -loc3al -loc2a -loc5ul -lo4cus. -lo1cus -2lo1cy -l3od1i4s2 -3lo3dr2 -1l2o1g -lo5ga2n -lo2ga -4loi. -l2oi -lo5m1i -l2om -lo2m4m2 -lon4al -lon1a -lo2n4e -l5onel -lo5ney -long5in -lo4ng -lon2g2i -3l4o1n2i1a2 -lon1i -lon2i4e2 -l3onis -l3on1iz -loom5er1 -l2oo -lo2o4m -loom2e -lop4e -5lo5pen -l3o2p1m -1lo1q -l4o2r4ed -l2or2e -lor5i3at -lor1i -lor2i1a2 -lor4i2fe -lor3i1f -lo5rof -loros4 -l4os. -lo1so -lo4ss4 -los5sie2 -lot5at -l2ot -loth4ie2 -l4oth -lo5tu -5lo2up -lo4u2 -lp1at -lp3er1 -lph2 -l5phe4 -l3ph1i4n -l2pho -l3p2ie2 -l3pit -lr4 -l3ri -l3ro -l5ru -4ls -l5s2a4m -ls5a2n -lsi4f2i1a2 -ls2i1f4 -lsi4m -ls4is2 -l5s2k2 -ls4p -l1s2t2 -lt4an3e -lta2n -l4ta4ng -lt5ant -l5ta2r -l1te -l4tei4 -lter2n3 -lter1 -lth3i -lt2i4c2i2 -lt1ic -ltim4a -l1tim -lt1in4 -lti3t -l3t4iv -lt4or -l1tr2 -ltram2ont5 -ltr2a2m -ltra3m4on -ltra1mo -l1tu -l4tus -4lu. -l2u1a2 -lu4ch4 -l4uc -lu2c5o2 -luc5ra -lucr2 -lu4cu -4lue -lu1en -lu5er1 -l2u1i2 -lu4it -lum4bri -lu2m1b -lumbr4 -lu4mo -5lum2p -lu2m5u -lunch5eo -lun1 -lun2ch -lunche2 -5lune -l3unta -lu3or1i -5l2up -3lur3o -lu4r -lus2k5 -lu4ss4 -lut5a2n -4lut5a2r -5lution1iz -lut2i -lu3t2io2 -lution1i -lu5t2oc -lut2o -lut5r2 -lu1v2 -lv5ate -l5vet4 -l4vi -l4vor -l1vo -l3w -lx4 -2ly -4ly. -ly1c -ly4ca -lyc4l2 -ly2c5os -ly1c2o2 -lym2 -lymph5 -lym1p -l2yp2 -ly4pa -lypt5o -ly2pt2 -3lyr -lys5er1 -l4y2s -3ly3w -3lyz -lz4 -4ma. -m4ac2a -mac3ad -ma5ch2in2e -ma2ch -mach1in -5mach2y -ma4cis -m2a1c2i2 -ma2ct4 -4mad. -4mada -4ma4d1s2 -ma4ge -5m4a2g1n2 -2mago4 -2m2ah -ma5ho -3m2a4i2 -4m4ai. -mai2d3 -5m2ak -mal3a4p -mal2a -mal5ar1i -mala2r -5m2ale2 -ma2l5ed -mal3e1f -m3al1g2 -m3al1is -m4al4is. -mal3le -mall2 -mal4li -2m2a2m -mament4 -ma3men -mam2e -m5ament. -1ma2n -3m4an. -man3a -man5da2r -ma4nd -man2da -man3dr2 -man3ic4 -man1i -man4ica -ma5n2il -m4a4n2s -man3te2l5 -man2te -2m2ap -m3aph -1ma2r -5mara2n -mar5ol -ma5ro4n -ma3r2oo4 -mar5ri -m2a4r1r4 -mar4shi -ma2r2s2 -mars2h -mar3v2 -ma3son -m2aso -massi4 -ma4ss2 -mass5i4ng -mas2s1in -3mas1t2 -ma4s4t4ed -maste2 -mast4ic -mas4t1in -m4at. -m4aten -m4a3ter1 -mater5n4 -m4at1it -mat4iti -m4atiz1a1 -mat1iz -m4a3t2o1g -ma2to -mat5om -ma3top -m4a4t1s -3m4a2t1t4 -ma5tur2e -m2a2tu -matu4r -m2av4 -2m1b -mba2t4t4 -m2b4d -m5bec -mb2e -m5ber3er1 -m2b2er2e -mber1 -m4be2r2y -m4be1s2 -mb2i -m2bic -m5b1il5 -m4b3i4ng -m4b2is -mb5ist2 -mbival5 -mb2iva -m5b2ler1 -m2bl2 -m3bli -mbru4 -mbr4 -mbu3l -mbu4r4 -m1c -m5d -m2e -2me. -mea5g -mea2 -me5a4nd -mea2n -me4ba -me1b -me4b2i -2m2ed -4med. -3me1d2i1a2 -med5ic1at -4medie2 -m5ed5ies -3med1it -me4do -m5e2d2y -me2g -5meg2a1 -meg1a5t -4m2ele -mel5ee -mel5ler1 -mell2 -mel3on -mel4t -melt5er1 -mel1te -me2m -4m5e1m2e4 -1men -3men. -2men1a -men4ag -mend5er1 -m2e4nd -mende2 -men1d5o -m4e1ne -ment5or -men2t2o -5men4t1s -5me2o1g -me4p -m5era2n -mer1 -4m2er2e -mer4i1a2 -2me2s -mes5en -me5s2i4a2 -mes5q -3me2sti4 -mest2 -1me2t -meta3t -met2a -met1e -4met4ed -meth4i -me2th1 -met1i4c -met5i1c2i2 -met3o -met3ri -metr2 -m1f -4m3h -4mi. -m1ic -m4i4cin -mi1c2i2 -m2i3c2o2 -3micro -m2i1cr2 -m4i2ct -mi3cul -m2icu -mi4cus -m4idi -mi2d -mi2d4in -mid5on -mi1do -mi5fi -m2i1f -mig5a -m2ig -migh5ti -mi2gh -migh2t -mi2gr2 -4mij -mi5ka -m2ik2 -m2il -m3i2l3a -mil4ad -4m5ilie2 -mil5ies -3mill2 -mi5lo -mil4t -3m2im -mim5i -5m2i4n4d -mind5er1 -minde2 -min4er. -min1er1 -min4e2r1s2 -m4ing5li -mi4ng -min2gl2 -min5ie2 -m2in1i -m4init -min3ol -m2ino -1m4int -minth5o -minth2 -m2i3o2 -m2i3p -mir1ab4 -m2ir -mir1a -mi5r2acu -mira4c -m2is. -m4i2s3c2 -mi4se -4misem -mis3ha2 -mis2h -5missi -m2i4s1s -m3i4st. -mist2 -mis4t1in -m3i2s4t3s -mi2t -m5ita2n -mit1a -4mity -3m2i1u2 -5m2ix -4m1l -mlo5cut2i -m1l2oc -mlun4 -2m1m2 -mma4n4d -m1ma2n -mmand5er1 -mmande2 -m3medi -mm2e -m2m2ed -mmel5li -mmell2 -mmet4e -m1me2t -mm2ig3 -mm2in3u -mmis3 -mmob3 -m1mo -m5m2oc -mmor3 -mmut3a -4m1n2 -mn2i1f4 -mn1i -m4nin -mn2i5o2 -mnis4 -mno5l -1mo -4mo. -2m2oc -mod1 -mod5ifie2 -mod2i1f -mogast4 -m2o1g -mo2ga -mo3ga4s -mo4go -mo2g5ri -mo1gr2 -m5o2ir -m2oi -mok4i -mol3a -4molog. -mo1lo -mo1l2o1g -4molo2g1s -4molo2gu -mo3ly -m2o1m -mo4mis -mom1i -m4on -mon1a4 -4m4o2n2ed -mo2ne -mo4n1g -mo4no -mono1lo4 -monolo3g5i -mono1l2o1g -m4op -mophil5i -mo5phi4l -m1o2p4t2 -m3or1ab -mor1a -m3orat4 -mor4a2to -m5ord -mo5rel -m2or2e -3mor2i1a2 -mor1i -m5or1iz -mor5on -3morp -3mor2se -mo2r1s2 -mor5tal -m2ort2 -m4o3sp -5most2 -m4o3sta -2m1ous -mo4u2 -m1p -m3pa -m4panc -mpa2n -m4pant -mp4a2th3 -mpel5li -mpell2 -m5per3er1 -m4p2er2e -mper1 -mp4er3i -mpet5it -m3pet -mpe2ti -mphal5o -mpha2 -m4phe4 -m4p4h2l -m2pi -mp5i2d -m5p2ig -mp3i2ly -mp2il -mp1in -m3p2ir -mp3is -m3po -mpol5it -mp2o2t -mpov5 -mp3to -m2pt2 -mp5tr2 -m3pu -m5q -m3r -m4r2y -4m1s -m5sel5f -m5si -ms2ol4 -mtu4 -muc4k4e -m4uc -muck1 -mu2ff4 -muf2 -mul1t2 -m5unc -mun1 -mu5n2io2 -mun2i -mun3is -mus5c2o2 -m2usc2 -mu4se -mus5ke2 -mus2k2 -mu3til -mut2i -m1v -m3w -2my -5my3c -my4d4 -my3e -3my1i -5mys1t4 -m4y2s -3myt -n1a -2na. -na2c -na2ch4 -na5cious. -n2a1c2i2 -nac2io2 -nacio4u2 -na5ciou2sl4 -nac4te -na2ct -nac5t2iva -nac2t1iv -na5cular1i -nacu1l2a -nacula2r -na4d4a -nadi4 -nad4op -na2do -n2ae. -naf1fi2l4 -na2ff -naf1fi -nag4a -n4a3gen -5n4a5geri -nager1 -na4g2i -n5ago -5n4a3gr2 -5n2ah -5nail -n2ai2 -na5iv -n2ak2 -4na2l2ed -n2ale -n5al1g2 -n4al2i1a2 -n2a3ly4 -1n2a2m -3nam2e -na4m4n2 -na5n2as -na2n -n1an2a -nann2ot4 -nan5no -nan1n4 -nan4t2a -nan5t4ed -nan2te -nan4t2o -n2a5o -4n4ard -na2r -nar5tisti -nart2 -nar2t1is -nartis2t2 -n2as -nas5i -nas5p -na4s3s2 -nas5te2 -nast2 -nat5al -n2a2ta -na5ta3t4 -n4atee -na3the2 -n4a2th -nat4h4l -nati4 -n4a4ti. -nat5i2c -n4a2to. -na2to -na3t2om -na4tos4 -n2a2t4r2 -na5tur1i -n2a2tu -natu4r -naugh5ti -n2au2 -nau2gh -naugh2t -naus3 -3naut -naut3i -n2a2v -na5vel -n3b4 -nbarric5 -nba2r -nb2a4r1r4 -nbar3ri -nbe2au4 -nb2e -n3bea2 -nbe4n -nb4e1ne4 -nbet4 -nbit4 -n1c2a -n4cal. -nc1al -ncarn5at -n1ca2r -ncar2n2 -ncarn1a -ncel4i -ncen4t5ri -n1cen2 -n3cent -ncen1tr2 -n4cept. -n1cep -nce2pt2 -n3cer1 -nc2er4e -n4c4es. -n5ce2t -n5cey -n3cha2 -n2ch -nch4ie2 -n3cho -nch5o1lo -n3chu -n4cic -n1c2i2 -ncid5en -nci2d -n4c2i3f -ncip5ie2 -nc2ip -n1c2l2 -n4cles -nc2le2 -n3c2oc4 -n1c2o2 -nco5pat -nco1pa -n1cr2 -n2c1t -nc4t1in -nct4ivi -nc2t1iv -nct2o -n1cu -ncu4lo -n4cun1 -n4curvi -n1cu4r -ncur1v2 -nc4us4t2 -n1cus -4nd -n2da -n3d2a4c -n3dal -n4d4ale -n3d2a2m -nd3anc -nda2n -nde2 -n3dea2 -nde3c2i2 -n3dec -n1d2ed -nde4l -ndeleg4 -nd2ele -nd3enc -ndepr2e4 -nde1p -nde1pr2 -n3derl -nder1 -nde4s -ndes5cr2 -n5de2sc2 -n5dez -nd4hi -n4d1h -n1dic -nd2ic5u -ndid5a -n1di2d -n3die2 -nd5i2ly -ndil4 -nd4in4e -n2d1in -nd3ise -ndi4s1 -nd5is4i -nd5ism. -ndi2s1m4 -n2d5ity -nd3ler1 -n2dl4 -nd1li -n5d2oc -n1do -nd2or4 -n2do4u2 -nd5ou4r -ndrag5 -ndr2 -n3dr2a2m4 -n5dron -ndu4b -n1du -nduc2t5iv -n3d4uc -ndu2ct -n4dun1 -nd2we -n2d1w -n3dy1i -n2d2y -2ne. -ne3alo -nea2 -n3ea2r -ne2b3u -ne1b -5neck1 -ne4cl2 -ne2c2o2 -n5ec1t2om -ne2ct -2n2ed -3nedi -ne4du4 -neg3a -ne3go -5negu -n4eis4 -2n2ele -ne5l2i1a2 -ne1l2i4g -n4e2ly -ne2mo -4n1en -n3e4nd -neo3l -neon4 -ne2p -n1er1 -4n4e2r4ed -n2er2e -5neri4ng -ner3in -ner5o -ne4r4r5 -ner2v2 -ner2v5in -2n4es. -n1e2sc2 -ne3s2i1a2 -1ne4ss -n1est2 -nes3t4r2 -net3a -net3ic -ne4t2o1g -net1r2 -neuma5to -n4eum -neu1ma -neut5r2 -nev5er1 -n4ew -news3 -n4eys. -ne4y3s2 -n3f -n1fo4 -nform5er1 -n5f2orm -nform2e -nfor1tu5 -nf2ort2 -nfra2n3 -n1fr2 -4ng -ng2a -n4gae -n5gee -n3geri -nger1 -n5gero -n2gh4 -n2g2i -n5gic -ngi2o4g -n3g2io2 -n5glem -n2gl2 -n3glie2 -n5gl2io2 -n2g1n2 -n1go -n4g2r2y -n1gr2 -n1gu -n2gum -n1h2 -nh1ab3 -nha2 -nho4 -nh2y2 -nhy1d5 -n1i -4ni. -3niac -n2i1a2 -ni3ba -n4ic1ab -ni4cen2 -n4ice -4nicl2 -nic2t5a -ni2ct -ni4cul4 -n2icu -ni4d2i1o2 -ni2d -n2ie2 -ni4e2r1s2 -ni1er1 -ni2f4f -n2i1f -ni2ft4 -nif5ti -n2i2g -night5i -ni2gh -nigh2t -n3i2g1m4 -3ni2gn2 -nik5e -n2ik2 -n2il -ni2l4a -n3im1 -n4im2e -5ni1me2t -n4ine4s -nin4j -5n2in1n4 -n4in2u -5n4i1ol -n2io2 -ni1o4u2 -3nipu -n2ip -5n2iq -n4is. -n4is2k2 -ni2s4l4 -nis4o -n5i4s1s -nis5ter. -nist2 -niste2 -nister1 -nis5te2r1s2 -nit2ch4 -ni2tc2 -ni4te -ni3tho -n2ith -n4itos -ni5tra -n2itr2 -nit5res -nitr2e -ni3tri -nit4u4r -n2iv -n2iv4a -ni3vo -niv2oc4 -niz5en -n1iz -n1j -nj2a2m2 -n1ja -njur5i -nju4r -4n2k -nk5a2r -n5ker5o -nker1 -n3key -nk5i1f -nk5i2l -4n1l2 -nla4n2d5 -nl2a -nla2n -n3le -n1let4 -n3m -nm4a3ter4 -nmor5ti -n1mo -nm2ort2 -n1n4 -nne4 -nnel5li -nnell2 -nnerv5a -nn1er1 -nner2v2 -n3n1i -nni3ki -nn2ik2 -nnov3 -n5ny1i -n2ny2 -4no. -n5ob2i -no5b1il -no2b4l2 -no5blem -nobser4 -no4b1s2 -n5ocu1l2a -n2oc -no4di -n4o2d2y -noe4c -no4f2a -nois5i -n2oi -n4ois -n5ol. -no3l2a -nol4i -no2m3al -n2om -no1ma -1nom1i -no2mo -4no2ne -3n2oni4c -non1i -5nood -n2oo -nop5i -nora4t -nor1a -nor5di -nor4i1a2 -nor1i -nor4is -nor3ma -n2orm -n4oro -n2or4t2 -n4os. -nos4o -n4o3sp -not1a -n2ot -3note -n1o4u2 -n4oug4 -3n2oun1 -2nous -nou5v2 -nova4l -nove2 -no2v3el -no4v2el5e -n4ow -now5er1 -now3l -n3p4 -np2il4 -n1pl2a4 -np2l2 -npoin4 -n1po -np2oi -npo5l2a -n3p4os4 -npri4 -n1pr2 -n1q -n4que1f -nqu4 -n1r -nre4i4 -nr2e -nre3m -nres5t4r2 -nrest2 -4n1s -ns2c2 -n2s2c2o2 -ns3c2ot -n4s1cu -n5sec -nsec4te -nse2ct -n2s2es -n5seu -n3s2h2 -n2si -n4s3ib -n4sic -n5s2ick1 -n3s4i2d -n3sie2 -ns5ifi -ns2i1f4 -ns3i4ng -n2sin -n3s2io4 -n3s2is2 -ns1i2t -n4s3iv -nsolu4 -ns2ol -n5son -n4s2or2e -n4s3o2r2y -n3sp2ir -n3s2t2 -nsta4 -nstil4 -n3su -nsur4e -nsu4r -n3swa -nsw2 -ntab4u -n2t1ab -nt3age -nt1al -n4t3anc -nta2n -nt5a4nd -ntan5eo -nt4ane -n4t3ant -nt4ar2i1u2 -nta2r -ntar1i -n5tas1is2 -ntas3i -nt3as4t2 -nt1at -nt5a2th -nt3ati -nt5a2t1iv -n5t2au2 -n1te -n4tec -n4tee. -n4tees -n3te2l -ntend5en -nt2e4nd -ntende2 -n4te2o -n4ter. -nter1 -n3teri -n5ter2n2 -ntern5al -ntern1a -nter5nat -nth2 -n1the2 -nt4her5 -nth5in2e -nth1in -nt2i -n2t4ib -n4t3ic. -nt1ic -n5ticis -nt2i1c2i2 -n5tic1iz -n4ti4c5s4 -nt2ic4u4 -n3ti2d4 -n1tie2 -n4tify. -n1t2i1f2 -nti3fy -n3t2ig -nt5ilati -nti2l3a -n5t4ill2 -nt3i4ng -nt1in -nt5ing. -n1t2i3p -n4ti1pa2r -n4tis. -n2t1is -nt3i2s1m4 -nt3is2t2 -n5ti1t2io2 -nt3iz -n2tj -n1t2o -n3t2om -nton1i4 -n5top -n1tr2 -ntr2a3d -nt3ral -n4tran2t -ntra2n -n3trat -nt5re4s4s -ntr2e -n2t3ril -ntrol5ler1 -ntrolle2 -ntroll2 -n5trym -n2t4r2y -n1tu -n3t2u1a2 -ntub5 -ntup5li -nt2up -ntup2l2 -n5tu4r -n2ty -n2u -n2u1a2 -5n4uc -3nud -nud5i -nu3en -nug4a -n2u3i2 -nu4is -5nuk -n4u1lo -n3ult -nul1tim5 -nu1m2e -5numenta -numen4t -nu1men -5numer1 -5nu1mi -3nunc -nun1 -nu3tat -n5u2t1iv -nut2i -nu4t2o -nu1tr2 -n3v2 -nve2 -n2vel3 -nv4e1n4e -nven5o -nver2s5a2n -nver1 -nve2r1s2 -nvi4t -nvoc5at -n1vo -nv2oc -nvoc2a -n5w -nwin4 -nwi2 -n3w2om4 -n1wo -n2x4 -2ny2 -5nyc -nym5i2t -nyth4 -n1z2 -nzy4 -2oa2 -o5ace -o3a2ct -oad5er1 -oad5i -o3ag -oak5er1 -o2ak -o3ales -o2ale -oal4i -oal5in -o5al1it -oan4t -oa2n -oap5i -o2ap -oar5er1 -oa2r -oar2e -oar4se -oa2r2s2 -oast5er1 -oast2 -oaste2 -o2a2t5a -oat5ee -o4at5er1 -4oba -o1be4l -ob2e -ob2i -ob3i4ng -2o1b2i3o2 -ob3it -o3bl2a -o2bl2 -ob1li -4obo2 -ob3oc -o5bol -o5b2ot -o3bra -obr4 -obr2om4 -o2b5t -ob3ul -o3bus -2oc -oc2a -o4c1ab -o3cad -oc5ag -o5cal1li -oc1al -ocall2 -o4c5a2t1iv -oc1at -oc5a2to -4o3ce2 -o4cea2 -ocen5o -o1cen2 -ocess4i -o5ce4ss -och4e2 -o2ch -och5in -o3ch2o4n -o1cho -ochro4n -o3c2hr -o5chu -oci3ab -o1c2i2 -oc2i1a2 -oci4al -o1cl2 -o2c2le2 -o1cr2 -oc2r2e3 -o2ct2 -oc2te -oc1to -ocu4lu -ocum4 -oc5uo -ocu4ss4 -o1cus -ocus5si -oc3ut5r2 -o1cy -o5cy4t -ocyt5o -od3al. -o3de4c -o5de3g -ode4ga -o5d2e4n4d -o3dent -odes4 -od3ica -o4d1ie2 -od3iga -od2ig -od4il4 -od1i4s2 -o3d2is5i1a2 -od5it -5od1iz -od3li -o2dl4 -o2do -od5o1lo -o2d5ous -odo4u2 -o3dro -odr2 -od5ru -o2du -odu5cer1 -o3d4uc -o4duct. -odu2ct -o4duc4t1s -od3ul -o5dyt -o2d2y -oe3a2 -oe4b2i -oe1b -oe5cu -o2e4d -o5ee -oe5ic -o3elec -o2ele -oel1li4 -oell2 -oelo4 -oe3o4p -oep5 -o5eq -o3er1 -oes3t2 -o1et -o4et. -oet3i -oet4r2 -3oeu -o3ev -o3ex -o3flu4 -ofl2 -4o1fo -o4ful -o3fu -ofun4 -2o1g -o2ga -o3g2a2m -og5a2r5 -o3ga4s -o3gen1 -o5gey -o3g2i -o4g2io2 -og2n1a -o2gn2 -ogon1i4 -o4g2ot -o2gri -o1gr2 -o4g4ro -og4s2h -o2g1s -o2gu -o5gyr -o2gy -o1h2 -o3ha2 -oh1ab3 -o3he2 -oher4er1 -oher1 -oh2er2e -o3ho4 -oh2y4 -2oi -oi4c -o3ic. -o4i5ch -o2i4d -4oide -o2ig4 -oi5ki5 -o2ik2 -oi2l3er1 -oil5i -oin3de2 -o2i4nd -o3i4ng -oin4t5er1 -oin1te -oin4tr2 -o2i4o2 -4ois -o3i2s1m4 -oi4t -oit4al -oit1a -o2ith4 -o1j -ok4ine -ok1in -ok3l2 -ok5u -ol4a4c -ol2a -o4lack1 -o5lali -ol4al -ol4a2n -ola4n5d -ol5ast2 -ol4as -ol4at5er1 -ola4te -ol5ch -ol1c2 -ole2c4 -ol5e1c2i2 -ol5efi -ole1f -o3leo -ole4on -o3lep -o2l1er1 -o3lest2 -o3leu -o1l2i1a2 -ol3ica -o3l4ice -ol5ic1iz -oli1c2i2 -ol5ick1 -ol3i4c5s4 -ol5id. -oli2d -oli2e2 -o3li1er1 -ol5i4es. -o5l2i1f -ol4i4f3e -oli5go -o1l2ig -o5lin1a -ol3i4ng -oli5os -ol2io2 -ol5ip4 -ol1is4 -ol2it -olle2 -oll2 -ollim3 -ol1li -ol4lop4e -ol1lo -ol4ly1i -ol2ly -ol3mi -olm2 -o1lo -4o1l2oc -ol3o2i4d -ol2oi -o4lon1a -ol5on5el -olo2n4e -ol1or -o3los -ol1o4u2 -4ol1ub -o3lu1mi -o5lun1te -olun1 -ol3us. -oly3ph -o2ly -ol2yp2 -4olyt -2om -o1ma -o4m1ab -o2mac -o2mal -o4mane -o1ma2n -o3mas1t4 -o3mat -om4b2e -o2m1b -o2m2e4d -om2e -ome4g -o5meg5a1 -ome3li -o2m3en1a -o1men -omen4t -o3meri -omer1 -om1i -o3m2i1a2 -om1i2c -om2i1c5r2 -om4ie. -omie2 -om2il4 -om4i2ny2 -om2i4s1s4 -om2i2t -omm2e4 -o2m1m2 -om2n1a -o4m1n2 -omn1i3 -o4m2oi -o1mo -omoli3 -o2m4o4n -om5o2ny2 -o4mos. -omo2t5iv -om2ot -o2mo4u2 -om5p2il -om1p -om2pi -ompt5er1 -om2pt2 -ona4d -on1a -on3ai2 -o5nas. -on2as -onast5i -onast2 -on5a2t1iv -onati4 -4on2au2 -on1c -onc1at3 -on1c2a -on4cho -on2ch -5ond5a2r -o4nd -on2da -ond5ent -onde2 -on3der1 -on3dr2 -on5d2y -o2ne -4onea2 -onec4r2 -4o2n2ed -on1ee -on5ell2 -o3neo -o1n3e4ss -on1et -ong3at -o4ng -ong2a -on4gu -4on1h2 -4o1n2i1a2 -on1i -on5ia2r -2oni4c -onic5a -oni4c1al4 -on4i2d -on3ies -on2ie2 -on3i1f -o5n2i2g -o1n2io2 -on4k4s -o4n2k -4onnes -on1n4 -onne4 -on5o4di -on5oi -o1no4m1i -on2om -4o5nom1i2c -ono3s -o5not1a -on2ot -o4n1s2 -2ont -ont5a2ne. -ont4ane -onta2n -on4ter1 -on1te -onti5fi -ont2i -on1t2i1f2 -onton5 -on1t2o -on1t4r2 -on4tr2e -on5u4r -on2u -o5nus -onvo5lu -on3v2 -on1vo -onvo2l -on2z2 -2oo -oof3er1 -o2o1i -ook3er1 -ook3i -oo4le -ool5i2e2 -o2o4m -oon3i -oo2p -oop4ie2 -oop1i -o3o2p1t2 -oo4se -oost5er1 -oost2 -ooste2 -o2o2t -oot3er1 -ooz5er1 -o2oz -o1pa -o4p1ab -o5pali -opa5ra -o1pa2r -op4a2th5 -o5pec -ope4n2s4 -op1er1 -3opera -4opera4g -o1pha2 -o4phe4 -oph4ie2 -o5phi4l -op5hol -o1pho -o1ph2y -ophy5l2a -o3phy2l -op1i -op3ies -op2ie2 -op5i4ng -o3p2it -4op2l2 -oplast4 -o1pl2a -opl4as -o4p2oi -o1po -opol3i -op4o2n4 -o2p5o2ny2 -op5or1i -op2oun4 -opo4u2 -o2p5ov -op2p2l2 -o4p1p2 -op5pli -oprac4 -o1pr2 -op3ra2n -opr2e4 -opro4l -op5r2op -op5so -o2ps2 -1o2p1t2 -op2ta -op1u -o5qui3al -oqu4 -oq2ui2 -oqu2i1a2 -or1a -or5a2do -or2ad -ora4g -o5r2ai2 -or5al -4ora4ls -or2a2m4 -oran3e -ora2n -orat1or5 -ora2to -or2b3in -or1b -orb2i -or4ch -or1c2 -orch3i -or4du -2or2e -or5ead -orea4 -ore5a2r -ore5c2a -ore3f -ore3g -or3ei4 -oreo5l -or3e2sc2 -ore3s2h -or3e4ss -orest5at -orest2 -or5este2 -or5e2t2t4 -ore4v -5orex -or4fr2 -or1f -or5gn2 -or1g2 -or1i -4o4ri. -or3ia. -or2i1a2 -4oria2n -ori4c2i2 -ori5ci2d -or2i1en4 -orie2 -or3i1f -5or2ig -ori5ga -or4i4no -4orio. -or2i3o2 -or5ion -4orios -ork5a -or2k -2orm -orm1i -or3n4a -or2n2 -5or1nis -orn1i -or3nit -or3o2ne -o5r2oo4 -or5ose -or5oso -or1o4u2 -orre2l3 -o4r1r4 -orr2e -orres3 -or4sc2 -o2r1s2 -or4sey -or2se -or4sti -orst2 -2ort2 -ort3a2n -ort3at -ort3er1 -or5t4es. -or2t2es -or3th2i -or4t2h2r -or4tit -or2t3iz -or4t1or -or1t4o -or5tra -ortr2 -ort3r2e -4or1u -or4un1 -or2y5p -o2r2y -o3s2a5i2 -os3a2l -osa2r5 -o1sc2 -os4ca -os4ce -o2s2ch2 -o4s1c2i2 -osclero5s4 -oscl2 -osc2le2 -osc2ler1 -o3sec -osec3u -ose5g -os5enc -o3se4n2s4 -os5eo -oser4 -o2set -os5eu -o3s2i1a2 -osi4al -osi4a2n -os5i4de -os4i2d -o3si1er1 -osie2 -os5i1f4 -o2s1in -o4s1is2 -o5ske2 -os2k2 -o5son -o3soph -os2o2p -os3o1po -4osp -o3spec -os1pi -os4sa -o4ss -oss5a2r -os4s2it -4osta -ost2 -ost5age -os4ta2r -os5tee -oste2 -os5ten -osten5t -ost5ica -ost1ic -os3til -o5stom2e -ost2om -ost3or -4osu -os1u4r -2ot -ot3a4g -o5tal1it -ot3a2m -ot4an3ic -ota2n -otan1i -o3t2ap -ot4a1t2io2 -o5t2a5v -o3t4a4x -o4t4ed -oter4m -oter1 -ot5est3a -o2t2es -otes4t2 -4oth -othal2a2m5 -otha4 -othal2a -oth5er3in -ot4her1 -othe2 -o5therm -otherm5a -o5thor -o5t2i2a2 -o5t4ill2 -5ot5in1iz -ot1in -ot2in1i -o2t4iv -o3t2iva -o5tivi -o1t2o -o5to2n4e -o4tor2n2 -ot1or -o4to4u2 -4o1tr2 -otur1i4 -otu4r -oty3le2 -o4u2 -5o2u3a2 -oub2 -ou5br4 -ou5c2a -o4uc -ou5c2o2 -oud5i -4oue -ou3e4t -oug4 -ou5ga -ought5i -ou2gh -ough2t -ou5g2i -oul4t -oult5i -ou3m -2oun1 -ou4n2d -oun2d5a -ound5e4l -ounde2 -oun5gin -ou4ng -oun2g2i -oun3tr2 -oup5li -o2up -oup2l2 -our3er1 -ou4r -our2e -ou5sa2n -2ouse -5ous2i1a2 -ou4ss4 -out5is2h -out2i -ou2t1is -ou4v5a -ouv2 -o1v2a3le -o5va2r -4ovati -ov5el3i4ng -o2vel -o4ver. -over1 -o5ver3b -ove2r3s2 -ov4ete -ovid5en -ovi2d -o1vis -ovis5o -o2v5os -o1vo -ow3ag -ow3a2n -o5w4ay -owd4i -ow2d3l4 -ow1el -owel5li -owell2 -ow5ha2 -owh2 -owh2ith4 -ow1i2 -ow5in -owi5n2e -ows4 -ow5s2h -ow5sl4 -ow5y2 -o4x -ox3i -oxic5ol -oxi4c -ox2i2c2o2 -ox5o -2oy -oy5a2 -o4y2s4 -2oz -o1zo -oz2o5i -o3zy1g -4pa. -pac4te -pa2ct -pa5do4u2 -pa2do -pad4r2 -pae4s4 -pa3ga2n -4pag1at -pag4ati -pain2 -p2ai2 -4pairm -pa2ir -pa5la2n -pal2a -pal3in -pa3lo -p4a4ls -pan5a2c -pa2n -pan2a -pan1e -pan3i -p4a4pa -p2ap -pa3pe -pap3u -pa3p4y -1pa2r -para5s2 -par3l -pa3r2oc -pa3rol -par5o4n -1p4as -pass5ive -pa4ss2 -pas4s1iv -pas1t2 -pas4t1in -p4a3ter1 -pa2t3i4n -p5a2to -pat4ric -p2a2tr2 -pat1ri -pa5tric2i1a2 -patri1c2i2 -5p2au2 -paul5e -pa2u3p -pa5vi4l -p2av -5paw -pawk4 -paw5ki -2p1b -p1c4 -p5d2 -2pe. -pear4l5i -pea2 -pea2r -pe4c2o2 -pec4tu -pe2ct -2p2ed -5ped3a -3pede2 -3pedi -ped3i4s1 -3pe4d1s2 -pe2du -p4ee -pe2f -4p2ele -pe5le3o -pel5v4 -pen4at -pen1a -5p4enc -pend5er1 -p2e4nd -pende2 -pen5dr2 -pen4ic -pen1i -3p4en1n4 -pens5ati -pe4n2s -pens2a1t -p4en5u -pe5on -5p2er1c2 -per1 -per3cent5 -per1cen2 -4p2er2e -perem5i -p4eri -5p4er3n2 -p3eron -per4os. -per5t1in -pert2 -per2t5is -per3v2 -p4e2r2y -2pes -pe4s4s3 -pes5til -pe2sti -pest2 -3pet -pet5all2 -pet2a -pet3en -pe2ti -pet3r2 -pe4wa -4pex -p1f -p5g -2ph. -4phae -pha2 -pha5g2e4d5 -ph5al. -ph2a2n -phant5i -phan4t -phe4 -ph5esi -ph3et1 -3phib -4ph1ic -1phi4l -ph1i4n -ph1is -ph2i5th -p4h2l -1pho -4pho2bl2 -4ph4o2n2ed -ph2o4n -pho2ne -3phor -ph5or1iz -phor1i -ph4os3p -ph3o4u2 -3phra -p2hr -4p2h1s -1phu -ph2u5i2 -2phy. -ph2y -3phy2l -4pi. -3pia2r -p2i1a2 -4pica -p5i4c1al -p2i3c2o2 -p2i4cr2 -pi2ct4 -p2ie2 -p4i1es2t2 -pi5eti -p2i1et -p5ifie2 -p2i1f -pi2g3n2 -p2ig -p2il -3pile -pil2l5in -pill2 -pil1li -5pilo -pi3l2ot -pim2 -pin4e -pin5et -3p4inge -pi4ng -p4in1n4 -5p4i4n1s2 -3p2i1o2 -pip4a -p2ip -pi4pe -5p2iq -pir5a4c -p2ir -pir1a -pir4t2 -p4is. -p4i2s3c2 -p2i4s2s -pis1s5a -pis5til -pist2 -pis4tr2 -p2itu -2p3k2 -p2l2 -1pl2a -pla5n1o -pla2n -plant5er1 -plan2te -plas5t2i1c2i2 -pl4as -plast2 -plast1ic -pla5t4o -4p4le. -4pled. -p2l2ed -3pleg -3plen -2ples -4pli2s1m4 -pl1is -4plist2 -plu2m -plum4b2e -plu2m1b -plumb5er1 -p4ly -2p1m -2pn -pnos4 -1po -4po. -po3c2a -p2oc -3pod -4pof -2p5o2i4d -p2oi -pois5i -p4ois -po5lem1ic -po4ly1 -pol4y3s -po1ma2n5 -p2om -po1ma -pom4e -p4o2n -pon4a2c -pon1a -pon4ce -pon1c -pon4i4e2 -pon1i -3pon3i1f -pon5ta -p2ont -2po2ny2 -po4pa -po5ple -p4op2l2 -4pora2to -por1a -por3ea4 -p2or2e -4po2r4ed -por3i4f -por1i -por3p -3p2ort2 -por5tie2 -3p4os -po4s1s2 -po1te -p2ot -poul1t5e -po4u2 -poul4t -pound5er1 -p2oun1 -pou4n2d -pounde2 -pout5er1 -p5ox3i -po4x -5p2oy -4p1p2 -p1pa2r3 -ppar1at5 -p4p4ene -p3pet3 -pph4 -ppi4c -p4p2l2ed -pp2l2 -p5p2ler1 -p5p1let -ppres2s5o -p1pr2 -ppr2e -ppre4ss -ppr4ob5a -1pr2 -prac1 -pr2a5d -pra2r4 -4p4re. -pr2e -pre1b3 -p2r4e1d -pr2ef5er2e -pre2fe -pre1f -prefer1 -prel5a4te -pre1l2a -3prem -pre5mat -pren3 -pres3a -pre5scin -pre2sc2 -pres1c2i2 -p3rese -5pressi -pre4ss -5pri1c2i2 -pri4es -prie2 -4pri4m -pring5er1 -pr4inge -pri4ng -pr4in2g5i -4pr2i3o2 -p5r4i1ol -pri4os -pri2s5in -pr2i4v2 -4pr2iva -4p4ro. -pr4o3bo2 -p3roc3a -pr2oc -pro4ch -pro1l -pron4a -pro4ph5e4 -pr2op -pro3pyl5 -pro2p4y -pro3r2 -pros4i -pros5tr2 -prost2 -pr4o3th -pr2ot -4p2r2y -2ps2 -p3sac -ps4al5t -psa2l -p3s2h -p1si -p5sin. -p2sin -p1s2o3m -p1st2 -psul3i -p1s2ul -3psy1c -ps2y -2pt2 -p2t3ab -p4tad -p4ta2n -p2ta2r -pt5ar1c2 -p1t4ed -p5ten1a -pt5en1n4 -5pte2r2y -pter1 -p5tet -pt4ic -p5tie2 -p3til -p2t3in -pt4ine -p3tise -p2t1is -p5tisi -p5t2om -p4tr2 -p1tu -pub1 -pu5b2e -p4uc4 -pu4ch4 -pudi4c -pu5er1 -puff5er1 -puf2 -pu2ff -puf1fe -pu4la2r -pu1l2a -pu5lar. -pu5l1is -pul2i -p4u4m -pu1m4o -p4un1 -pu4n4a4 -3punc -pun5g2i -pu4ng -pun3i -pun2t -pu3pi -p2up -pur5b -pu4r -pur3c2 -p4us -push4ie2 -pus2h -pu3tat -p5u5t1is -put2i -pu3tr2 -4p1w -2p4y -py3e -3py1g -3pyl -pyr3e -py5t -4qf -qu4 -5qu2ak -q2ua2 -4qua2r -qua5t2io2 -2que. -3quer3a -quer1 -4qu2er2e -4qu4es. -1que4t -5quin1a -q2ui2 -5qu2ir -3quito -4quitu -4ra. -r2a3ba -r1ab -5r2ab2e4 -3r2a3bin -r2abo2 -ra3bol -rac4a -r2acu -rac5u1l2a -ra5cu1lo -r2ad -ra4de -rad4in4e -ra2d1in -ra2g5o4u2 -ra3gr2 -3raill2 -r2ai2 -ra5ist2 -4ral2i1a2 -r2a3ly4 -r5a4m1n2 -r2a2m -ra3mu -r4andi -ra2n -ra4nd -ran5dis2h -randi4s1 -ran4du -ra5nee -ran4gen -ra4ng -ra3n2i1a2 -ran1i -ra3n2oi -ran1o -ran2t -ran5t4ed -ran2te -5ran3te2l -rant5in -rant2i -ran1t5o -rapol5 -r2ap -ra1po -rap5to -ra2pt2 -4rar1c2 -ra2r -rar2e2 -rar3e1f -rar5ia. -rar1i -rar2i1a2 -ras2 -r2as3c2 -r2as2e -r4as2k2 -r2a3so -ras1s5a -ra4ss2 -ras2s5in -r4as5te2 -rast2 -ra5t2a3p -r2a2ta -ra5ta3t4 -rat5eu -rath4e2 -r4a2th -ra2t3i1f2 -rat4in. -ra2t3in -ra5t2oc -ra2to -5r2a5tol -4r4at2om -ra4tos4 -ra5t2u1i2 -r2a2tu -rat5u4m -rat3u4r -rav5ai2 -r2av -rav5eli -ra2vel -rav3i2t -rawn4 -ra3z2ie2 -r2az2 -raz1i -r1b -r2ba -r4bag -rb3ali -rb1a2n -rba2r3 -r2b2e -rbe5c -r3bel -rbel5o -rb3ent -r4be1s2 -rb2i -rbic4 -rb2ic5u -r2bin -r5bine -rbit1 -r2bos -rbo2 -r4bum -rbu5t4 -r1c2 -rcant5 -rca2n -rca4s -r4c2ele -rce2n5er1 -r1cen2 -rc4ene -rcen5ten1a -r3cent -rcen1te -r2ces -r3ch2a3i2 -r2ch -rcha2 -rch3al -rch5ar4d -rcha2r -rch5ate -r3cheo -rche2 -r4ch1er1 -rch4i1er1 -rchie2 -r4ch1in -rch3is -r3chit -r3cil4 -r1c2i2 -rci5n2o1g -rc2ino -rcis2 -rciz4i2 -rc1iz -r2cl2 -r4c2le2 -r5clo -rco1lo4 -r1c2o2 -rcrit5 -rcr2 -rcriti4 -r2ct4 -rc5ti -r5d2a2m -r4d1a2n4 -rd4an. -r2da2r -r5de4l -r3de4n2s -r4des -rd5e4ss -rd5ia2n -r1d2i1a2 -r4die2 -r5d2ig -r2d2in -rd3i4ng -r3d2i3o2 -rd1i4s2 -rd5ler1 -r2dl4 -rd3li -r4dol -r1do -r2d5ous -rdo4u2 -r2e -4re. -rea4 -r4ea. -reac2t5iv -re1a2ct -re3af -re3a4g -re5alt -re5a2m1b -re2a2m -re3an5i -rea2n -re5ant -re5asc2 -re2as3o -r5e2au3 -3re2av -r5ebrate -re1b -re2br4 -reb1ra -re4b5uc -re3c1al -rec2a -rec4ce -rec1c4 -re3ce -reced5en -re2c2ed -re3cede2 -re3cha2 -re2ch -reci5si4 -re1c2i2 -r4e1c2r2 -rec4t3r2 -re2ct -re3cu -2r4ed -re1de2 -re3di4s1 -re4dol -re1do -re1dr2 -reed5i -re2ed -ree3m -3reer1 -re2fe -re1f -re3fin -re5gali -re5gra -re2gr2 -r2e3g4r2e -reg3ri -re3g4ro -reg3ul -rei4 -r4e3i1f -re1in -r4e3is -reit3 -reit4i -re1l2a -r2e1le -4r4e4l2ed -re3l2i1a2 -rel3ic -re5l2ig -rel2i4q -rel3li -rell2 -r5em. -rem5ac -rema4n4d -re1ma2n -rem5a2to -r3em1p -rem5ul -ren1a4 -ren5at -r4endi -r2e4nd -r4ene2 -ren4es -r4en1i -ren3ic5 -ren4it -ren4ter1 -ren1te -re5num -r4en2u -re3oc -3re2o1g -re5ol2a -reo2l -re3oli -3reo1s2 -re1pe -re4per1 -re5ph1 -rep5i2d -re3pin -re3ple -rep2l2 -r2e4pr2e -re1pr2 -re1q -rer4a -rer1 -r2er2e4 -re5rea4 -r2e3r2u -2r4es. -re3scr2 -re2sc2 -re3se4l -re3sem -re3ser1 -res5ist2 -res1is2 -re5s1it -re3spe -r3esq -re5stal -rest2 -rest5er1 -reste2 -re5s1tu -3reta2r -ret2a -re3ten -re4t4er3 -re5term -re1t2o -re5ton -re3tra -retr2 -r2e3tr2e -re5t1ri -re3tu -re3un1 -reu4r4 -re1v -re2v3el -revi4t -r1f -rf4l2 -rfu4m -r3fu -r1g2 -r4gag -rgal4 -r2ge -r5gee -r4g4ene -r3gen -r3ge4o -r3ger1 -rg5li -r2gl2 -rgu5f2 -rh2 -r5hel4 -rhe2 -rhe5o2l -rhos4 -3r2h2y -4ri. -ri3a2m -r2i1a2 -ri5ap -2r2ib -r4i3bo2 -ric2a5t4u -ric1at -2r4ice -rich5om -r4i2ch -ri1cho -rick4en -r2ick1 -ric4ke -r4icl2 -ri5cli -ri3col -r2i2c2o2 -ri5cor -ri4cra -r2i1cr2 -2r2icu -rid4al -ri2d -rid1a -rid4e -ri5el -rie2 -ri3er1 -ri2es -rift5er1 -r2i1f -ri2ft -rif5tie2 -5rifug4a -ri3fu -ri5g2a2m -r2ig -rig5ant -riga2n -ri5l4a -r4ile -rill5er. -rill2 -ril2ler1 -rill5in2g1s -ril1li -ril2lin -rilli4ng -4rim. -ri2ma -rim2a4g -ri1m5a2n4 -rim3at -r4i2m1b -ri1men4 -rim2e -4ri2m1m2 -4ri4m1s -rin4e -r4inet -ring5ie2 -r4in2g2i -ri4ng -rink5er1 -r4i4n2k -r4ino -ri4n4s2 -rin3s5i -rin4t5er1 -rin1te -r2i3o2 -ri2o4g -5rio2ne -ri4op -ri5or -ri5p2a -r2ip -ri5p2ie2 -rip5lica -rip2l2 -r2i5r -ri2s4c2 -r4is4is2 -r2is1p -ris4pa -ris4pe -ris5ter1 -rist2 -riste2 -4risti -r2i3ton -r5it5r2 -r2i4v -riv4al -r2iva -ri5vall2 -riv5eli -ri2vel -riv3en -riv3i4l -5r2i5zo -r1iz -r1j -r2k -r5kas -rk5ati -r5kell2 -rk5en1i -rk1er1 -r3ket -r3key -r3ki1er1 -rkie2 -r5ki1es2t2 -r5k2in. -rk1in -r5k2i4n1s2 -rks4m2e -r4k1s -rk2s1m4 -r1l2a -rlat3 -r1le -r3l4ic -r3l4ine -r5li4n1s2 -r4l1it -r1lo -r3mac -rma5ce -r5mad -r2mal -r4manc -r1ma2n -r4man1o -r4mar1i -r1ma2r -r4ma2r2y -rm4as -r4m3ati -rma5t2oc -rma2to -r5m2a5tol -rme2a2 -rm2e -r2m1ic -rm4ica -r5m2i2d -rm4ie2 -r5m2ig -rm2il5 -rmin4e -rm3i4ng -r4ming. -r4mi4te. -rmi2t -r3m2oc -r1mo -rmol4 -r1mu -rmu3l2i -r2n2 -rn3ab -rn1a -r3na2c -r5nad -rn5a2r -rn3ate -rn5a2t3in -rnati4 -rn5e2dl4 -r2n2ed -r3nel -r3ne4ss -rn5est2 -r3net -r3ney -r5n2i1a2 -rn1i -rn5ib -r3nic -rn3in -rn4ine -r1nis -rn3ist2 -rn2i5v -rn3iz -rn5n4 -r3n2oc -r5n2o1g -rnt4 -r5n4uc4 -rn2u -r5nut -4ro. -ro4b2e -rob3le -ro2bl2 -ro5br4 -5roc1c4 -r2oc -ro3cu -r2od -ro3do -ro3dy4n1 -ro2d2y -ro1fe -ro3gn2 -r2o1g -4r2oi -ro3i4c -ro2i4d3 -ro3l2a -r4o2l2ed -rol5ite -rol2it -ro3ly -romant4 -r2om -ro1ma -ro1ma2n -ro5mel -rom2e -ro3m2i2t -rom1i -romole2c5 -ro1mo -rom4p -ro3mu -ron4a2c -ron1a -4ronal -ro5nate -ron5ch -ron1c -ron4do -ro4nd -ron2g5i -ro4ng -r5onm2e -ron3m -ro1no -ron4ton5 -r2ont -ron1t2o -r2oo4 -1ro2o4m -5ro2o2t -r2op -4rop. -ro3pel -rop4in4e -rop1i -r4o1pr2 -r5opte -r1o2p1t2 -ror5d -4r2or2e -r4osa -ro3s2i4a2 -ro5s2ol -4ro4ss -ro5stat -r4osta -rost2 -ros4ti -ros5tit -ro3tat -r2ot -ro1te -ro4ter1 -ro3tu -5r4oue -ro4u2 -roul3 -round5er1 -r2oun1 -rou4n2d -rounde2 -rou5sel -r2ouse -4rou4ss4 -r4out -r4ow -row3er1 -4ro4x -rpas2s5in -r1p4as -rpa4ss2 -rp3at -rpe2 -r3pent -rp5er. -rper1 -r2ph -rph5e4 -r3phol -r1pho -rp3i4ng -rp5is -rpol3a -r1po -r2p5o4u2 -rpr2e4 -r1pr2 -rpre4t5er3 -r3pu -r1q -4r1r4 -rr2a4h -rran5g2i -rra2n -rra4ng -rr2ap4 -rre2l -rr2e -r4reo4 -rrhe3 -rrh2 -r3ri -rric4 -r2r2icu4 -rri4fy. -rr2i1f -rri3fy -rr4in5ge -rri4ng -rri4os -rr2i3o2 -rrob3 -rr2o1g5 -rr2o4t -r5ru -r2r2y5 -r3ry1i -r3rym -2r1s2 -r4sa4g -r2sa2l -r5sal1is -r5sal1iz -r2sa2n -r4sa2r -r2se -r3se2a2 -r3sec -rsel4 -rsell5 -rs3er. -rser1 -2r1s3e2r1s2 -r3set -r3sha2 -rs2h -r3shi -r4shie2 -r5s2i2a2 -r4s3ib -r5sie2 -r4sil -rs3i4ng -r2sin -r3s2io4 -r4s1it -r4s3iv -rs5li -r2sl4 -rst1or4 -rst2 -rstrat4 -rstr2 -r3su -r4sus -rswea2r4 -rsw2 -rswea2 -rt2 -r2t3ab -rta4g -rt3age -r3ta2r -r4tar2e -r2t3c2 -r1t4ed -r4te2dl4 -r3te2l4 -r5t2e4nd -rt3en1i -r5ter3er1 -r2t2er2e4 -rter1 -r5tet -r5teu -r4th4ene -rthe2 -rth2i -rth5ing. -rth1in -rthi4ng -rth3ri4 -r1t2h2r -r1t4ic -r4ticl2 -r5t2i1et -rtie2 -r5ti2l3a -r5t4ill2 -rtil5le -rt5i2ly -r2t1in -r3tin1a -rt3i4ng -r3titi -rti5tu -r2t3iv -r2t1iz -rt5let -r2tl -rt3li -r1t4o -rto5l -rt5ri2d -rtr2 -rt5s2i -r4t1s -r1tu -r4tus -rtwis4 -rt1w -rt2wi2 -r2u3a2 -r4ub2e -rub3r4 -ru4ce -r4uc -r2ud -rue4l -r4uf2 -ru3in -r2ui2 -ruis5i -ru2l -r4um2e -r4u1mi -ru4m2or2e -ru1mo -run4c2l2 -run1 -run1cu4 -runcul5 -ru4n2d4 -run2e -ru5net -ru4n4g -run4t -r2u2p -rup5lic -rup2l2 -ru3pu -rur4i -ru4r -rus4p -rust5at -r4ust2 -rust5ee -ruste2 -rus5t4ic -rus4t5u -ru3tal -ru3t2i -r1v2 -r4vanc -rva2n -r2ve -rvel4i -r2vel -r3ven -rv4e1n4e -rv5er. -rver1 -rv5ers. -rve2r1s2 -r3vest2 -r3vet -r3vey -rvi4t -r1w -2r2y -ry5er1 -5ry2g1m4 -ry1g -ry4go -ry2m4b -3ryn1go -ryn1 -ry4ng4 -4ryn4gol -ryp5a -r2yp -ry2t -ryth4i -r2z -2sa. -2s1ab -s3a2bl2 -5sack1 -sac4q -s3a2ct -sac4te -sad5i -sa2d5o -5sae -sa4g -3s2ai2 -sain4t -5s2ak -sa2l -sa5l4ac -sal2a -3s2ale -sa3lie2 -s4al4t -sa3lu -s2a4m -sa5min -sam1i -sa1m5o -sam2p4 -san3a -sa2n -san4d2ed -sa4nd -sande2 -s4an4e -san5ga2r -sa4ng -sang2a -san5i3f -san1i -2sant -sant5ri -san1t4r2 -s3ap -sa2p3r2 -sa2r5s2 -sa2r -3sas. -sa4s3s2 -sassem4 -s2a1t -sa2te -s5a2t1iv -s5a4to2r2y -sa2to -sat1or -s2a2t1u -1s2au2 -sau5c2i2 -s4a4uc -sau4r5 -savi2 -s2av -sa3vo4u2 -sa1vo -4s3b -s4bei -sb2e -sbe4s2 -s2by3 -sc2 -s1ca -sca5len -sc1al -sc2ale -s1c2a2p -scar4c2 -s1ca2r -sc2av3 -s1ce -s4c2ed -4scei -4s4ces -s2ch2 -sci2d5 -s1c2i2 -s2c2o2 -scof4 -s4c2oi -3s4cop4e -5scopic -scop1i -5scripti -scr2 -scr2ip -scri2pt2 -2s1cu -4sc4u4ra. -s1cu4r -scur1a -4scuras5 -2s1d2 -2se. -se2a2 -s4e2a2m -seas4 -sea3w -sec4a -sec5a2n -se2c2o2 -secon4 -2s2ed -se4da -sed4it -3se2ed -3sei -se2i3g2 -5sel2a -4s2ele -se3lec -selen5 -5self -2s4e1m2e4 -sem2i -semi5d -se1m4o -se4n5g -3se4n2s -sen5sati -sens2a1t -sen5sor1i -sent5ee -sen1te -5sen4t3m -seo5l2o1g -seo2l -seo1lo -se2p -se1p3a -sep4si -se2ps2 -3se2pt2 -sep3ti -ser4a2n -ser1 -se5r4en4e2 -s2er2e -ser3en -ser4t4o -sert2 -4ser1vo -ser1v2 -s2es -4s4es. -se5s2h -s5esta -sest2 -1set -5s4eum -3sev -sev3e4n -se1wo4 -3sex -sex1o2 -3sey -2s1f -sfac2t5o -s1f2a -sfa2ct2 -sfi4 -sf2or5e -s1fo -sfra2n5 -s1fr2 -2s1g4 -s2h -4sh1ab -sha2 -sh4abi -sh1er1 -she2 -sh5et1 -shil5li -shi4l -shill2 -sh5i1ne4ss -sh1in -sh2in2e -shine4s -sh3io2 -5sh2i2p -s3h2o4n -4shu4 -sh4y2s4 -sh2y -si4all2 -s2i1a2 -siast5 -4s1ib -s3ic1at -3sic1c4 -2s5icl2 -s2i4cu -si5cul -s4i2d -4sid. -si4de -side5l -sid3en -si1d5eri -sider1 -4si4d1s2 -5sid5u4a2 -si1du -si4e2r1s2 -sie2 -si1er1 -s2i1f4 -si2f5f -s2i4g -1sili -sim4p4ly -sim1p -simp2l2 -2sin -s2ine -sin5et -5sing5er1 -s4inge -si4ng -s2in3i -5s4i4n2k -si5nol -s2ino -si3nus -s2in2u -1s2io4 -4sio. -si5o5s -3s2ip -si4pr2 -s1is2 -4sis2h -4si2s1m4 -s4ist3a -sist2 -si4s1t3o -s1it -si4te -sit5om -4s1iv -5s2iva -s1j -s2k2 -4sk. -s5ka2r -ske2 -s3ket -s5key -s3ki1er1 -skie2 -s5ki1es2t2 -sk5i2ly -ski2l -sk5ine4s -sk1in -4s4k1s -s3ky3l -2sl4 -slan2g5i -sl2a -sla2n -sla4ng -s1lat -3sl4au2 -slav5eri -sl2av -slaver1 -s2le -s5lea2 -s3let -s5ley -s3l1it -s1l2o3c -slov5 -s5l4uc -2s1m4 -s3ma2n -smas4 -s3men -sm2e -sm2i3g -3sm2ith -smi2t -smo4d1 -s1mo -smu5ta1t2io2 -s1n2 -s2n1a -2so. -2s3od -so2d3o -so2d2y4 -3soe -4s3o2i4d -s2oi -s2ol -sol3a -so5l4a2n -so2l4er1 -so3lic -3solve -solv5er1 -1s2o2m -soma5to -so1ma -so3mat -3so2me. -som2e -so5met1e -so1me2t -so3mo -s2on1a -son5at -s4o2ne -son5or -s2o2p -4sor3ie2 -sor1i -5sor2i3o2 -sor4it -s5or1iz -sor3o -s3o2r2y -sos4 -4sose -s4o5th -s2ot -3so4u2 -sov5e -so3vi -spas1t4 -s1p4as -spens5a -spe4n2s -4speo -3sperm -sper1 -s5pero -spers5a -spe2r1s2 -sph2 -s3pha2 -3spher1 -sphe4 -spic5ul -sp2icu -s2pi2d -sp5id. -s5pi1er1 -sp2ie2 -spil4l2 -sp2il -s2pin -sp3i4ng -sp2i5n1i -spital5 -spit1a -s1p2l2 -sple2 -s4p4ly -s2po -5sp2om -spon5g2i -sp4o2n -spo4ng -3spo4n1s2 -3spoon -sp2oo -spr2u5d -s1pr2 -s4p4y -s1r -sr2e2 -sreg5 -sre1p5u -sre4s -4ss -s1sa -s5s2a4m2 -s1sel -s5se4n5g -s3sent -ssent5er1 -ssen1te -ss3er. -sser1 -s5seri -ss3e2r1s2 -s5seu -s3sev3 -s3s2i1a2 -s1sic -s1s2i1f4 -s2s1in -ss4in. -s4s2ine -ss4is. -ss1is2 -s3s2it -ss4ivi -s4s1iv -ss5li -s2sl4 -s2s3m4 -s4s1n2 -s1so -ssol3u -ss2ol -ss4ol1u4b -s4s2or2e -ssor5ial -ssor1i -ssor2i1a2 -ss5po -s1su -ss3w2 -st2 -4st. -s2t1ab2 -sta3bi -4s1t2ak -s4t2ale -stan2t5iv -sta2n -stant2i -s3tas. -5stat1i2c -s2t3c2 -ste2 -ste5a2r -stea2 -ste5at -s4te1b -s4tec -4s1t4ed -s4te2dl4 -s4te4d1n2 -4s2t2er2e4 -ster1 -ster4i1a2 -s1teri -s4tern. -ster2n2 -s3tero -st5es4t2 -s2t2es -s1th -s4tha4 -s4thu -s3t2i3a2 -3st2ick1 -st1ic -s3t2ic1u -stil5ler1 -st4ill2 -s4ti2ly -st3i4ng -st1in -5s4t2ir -s5t1iz -4s2tl -st3ler1 -st3li -s4toe -3ston -sto2n4e3 -ston4ie2 -ston1i -s5torat -st1or -stor1a -st4or5ia2n -stor1i -stor2i1a2 -s4tose -s2to4u2 -s4tr4ay -str2 -str2e4 -strep3 -3st4r4uc -str2u5d -2s4t3s -s1tu -s4tud -stu4m -stur4e -stu4r -4st1w -s4ty -1styl -4su. -su5a2n -s2ua2 -su4b1 -su2b1t2 -su2ct4 -s4uc -sud4a -su3e4t -su2f3f -suf2 -sug3 -3s2ui2 -su2i5c -su5i4ng -1s2ul -s4u2m -su1m3i -su4n4a4 -sun1 -su5pe -s2up -su3pin -supra3 -su2pr2 -sur4as5 -su4r -sur1a -sur3c2 -s4ur1g2 -sur3p2l2 -su5su -su5z -2s3v -svers5a -sver1 -sve2r1s2 -sves4 -sve2st5i -svest2 -sw2 -5swee -swel4l5i -swell2 -4sw4e2r4ed -swer1 -sw2er2e -2s1wo -s2y -4sy. -sy4b2i -s4y1b -sy1c -sy4ce -sy4c2hr -sy2ch -sy4d4 -1syl -3syn1 -syn5e -sy5pho -s2yp -sy2ph -syr5i -2ta. -2t1ab -ta5blem -ta2bl2 -3tabli4 -t2abo2 -ta3bol -ta4bo4u2 -t4a3ce -ta5ch2om -ta2ch -ta1cho -ta3ch2y -ta4ci2d -t2a1c2i2 -t5ade -tad4i -5t2ad1j -ta5d2or -ta2do -tad2r2 -tae5n -taf4 -tage5o -ta5g2o1g -3ta2gr2 -3t2ah -1t2ai2 -3tail -2ta2ir -t4ais -1t2ak -tal2c2 -tal5ent -t2ale -ta5lep -t4al2i1a2 -t4al1in -tal4l3a -tall2 -5tal1lu -t2alo4 -t2a3ly4 -tam5ar1i -t2a2m -ta1ma2r -5ta3me2t -tam2e -tamor2ph5 -ta1mo -ta3morp -tan5at -ta2n -tan2a -tand5er1 -ta4nd -tande2 -t4ane -5tanel -tan5ie2 -tan1i -t5an1iz -ta2nt5a2n -tan2t2a -t4a4pa -t2ap -1tard -ta2r -tar5ia. -tar1i -tar2i1a2 -tark5i -tar2k -tar3n2 -3t2a4r1r4 -tas3i -t3a2s1m4 -5ta4ss2 -tas4t2 -t2a3sta -tast5i4c -t4ateu -3ta2t1is -t4a2to. -ta2to -tat4o4u2 -t2a2t4r2 -ta1t3ut -t2a2tu -tau3t2o -t2au2 -t5awa -tawn4 -t4a4x -4t3b -2tc2 -t1ca -tcas4 -tch5e2t2t4 -t2ch -tche2 -tchet1 -tch5u -4t1d4 -4te. -te5cha2 -te2ch -5tec2h1n2 -te3cr2 -t4ed -te5d2a -4ted1d4 -4te1do -4tee1i -te2g -5tegic -te1g2i -t3ego -te2g1r2 -teg3u -tei4 -te2l -4t4e4l2ed -t2ele -tel5iz -1tell2 -4te3lo -3te4ls -tem3a -4te1m2e4 -t4e5m4on -te1mo -ten4ag -ten1a -4te2n3a2r -4t4ene -t5en3m -5tenn1a -ten1n4 -4ten1o -te5n2o1g -tent4a -te2o -teo5l -2tep -te3pe -tep5i -tera4c -ter1 -t4era4g -t4era2to -3ter3b -5t2erd -2t2er2e4 -ter3e1b -ter5ec -5terel -te3reo -3tere4s4 -1teri -ter3i1a2 -ter5i2d -ter5i1f -t4er3in -ter5iorit -ter2i3o2 -teri5or -terior1i -t4er3i2t -ter5k4 -5tern3it -ter2n2 -tern1i -ter5no -3te4r1r4 -2t2es -4t4es. -tesi4 -t3esq -t3ess. -te4ss -t5ess2es -tes4t2 -test3a -5teste2 -test5er1 -test5in -te2sti -test5or -tes5tu -teti4 -tet1r2 -tet1r5o -tew3a2r -te1wa -3tex -2t3f -t3g -2th. -tha4 -th5al. -thal3m2 -4t4he. -the2 -4th2ea2 -th5eas -4th2ed -1th4ei -3theo -theo3l -t4her1 -5ther2ap -th5er1c2 -t5h2erd -4th4e2r4ed -th2er2e -th3er2n2 -th3e2r2y -4t2hi. -t5hill2 -thi4l -3th4i4n2k -th1in -5th4io2 -th4is. -th5lo -t4hl -2t2h1m2 -th4mi -th3oli -4t5h2oo -4th1o2p1t2 -4thores -th2or2e -3th2ot -5thoug4 -th2o4u2 -1t2h2r -2t2h1s -5thu4r -5thy2m -th2y -3thyr4 -th4y2s4 -4ti. -1t2i2a2 -ti3ab -2t3ib -5t4i5bu -t1ic -t3ic. -tic5as -t2i1c2i2 -tici5a2r -tic2i1a2 -3t4i3cin -t4icity -ti3col -t2i2c2o2 -t2ic1u -4ticule -t3id. -ti2d -t4id1a -3tidi -ti3die2 -t5i4d1s2 -3t2i2en -tie2 -1t2i1f2 -ti3fe -4ti2ff -4ti4f3ic. -3t4i1g2i -t2ig -ti3g2i5o2 -4ti2g1m4 -5tigu -ti4ka -t2ik2 -ti4let -5til1in -t4ill2 -til4l5ag -til1l2a -t4ilt -1tim -tim1a -5ti1me2t4 -tim2e -t1in -5ti5nad -tin1a -4t4i2n2ed -tin3et -ti4ng5i4ng -t4in2g2i -ti4ng -3t2in1n4 -4ti4n1s2 -t4int -tin4te -tin5t4ed -tint5er1 -tin3ue -t2in2u -1t2io2 -ti3oc -tiol3a -t4i1ol -ti5o3mo -ti2om -4tionem -tio2ne -1t2ip -ti5plex -tip2l2 -ti3pli -t2i4q -ti5q2ua2 -tiqu4 -t3iris -t2ir -tir1i -2t1is -3tis1a2n -ti4sa -ti2s4c2 -tish5i -tis2h -3t2i4s1s -tis2t2 -5t4iste2 -t4is1tr2 -ti5t4a2n -tit1a -tith4e2 -t2ith -tit5il -t3i2t1is -3ti2tl -ti3tra -t2itr2 -3t2i1u2 -2t1iv -tiv5all2 -t2iva -t3ive -tiv3is -2tl -t1l2a -tlant4 -tla2n -5tle1b -5tle5dr2 -t2l2ed -3tle1f -3tlem -5tlen -5tletr2 -t1let -5tlew -t1li -tlin4 -4t3m -t1me2t2 -tm2e -tm2o4t5 -t1mo -2t3n2 -t4n2er2e -tn1er1 -2to. -toas4 -t2oa2 -to1b -4toc1c4 -t2oc -to3de5c -tod4i -to5do -3toe -1t2o1g -2t3o2i4d -t2oi -5tok -4to2l2ed -tol4l2 -tolu5 -to5ly -to2m3ac -t2om -to1ma -to1ma4n -tom2at5ol -to3mat -toma2to -to2m4b -to4m2o1g -to1mo -tom5os -to2n4e -t4on5ea2 -3ton1n4 -to4n3s2 -top4e -to5p2i1a2 -top1i -to4p4os -to1po -t1or -to5r2ad -tor1a -4t2or2e -tor5er1 -tori4as -tor1i -tor2i1a2 -to4r5oi -tor5p -tor4q -3tos. -t4o3s4p -tos4t2 -to5str2 -to5tal1is -t2ot -to5tal1iz -to3tem -tot5u -tou4f2 -to4u2 -5tou4r -t3ous -4tov -to3wa2r -t3p -tr2 -tra4c2o2 -4trad1d4 -tr2ad -4tra5ist2 -tr2ai2 -tra5q -trar2ch4 -t4rar1c2 -tra2r -tra5ven -tr2av -tra5ve2r1s2 -traver1 -trav5est2 -3tr4ay -4t4re. -tr2e -4t2r4ed -tre4mo -tren4 -tr4end5i -tr2e4nd -tre5pr2 -tre4s4s -4trew -t5r4icl2 -3t2r2icu -t2rie2 -tri5fli -tr2i1f -tr4i2fl2 -t5rifu5g4a -tri3fu -2tril -tri3li -tri3m2e -t2rit -4tr2ix -t4r2od -tro5f -5troo2p -tr2oo4 -tro4pha2 -tr2op -tr4o3sp -t2r2ot -t5ro1t2o -tro1v -3tr2oy -t4r4uc -tr2u3i2 -2t4r2y -tr4y2s4 -4t1s -t2sc2 -ts4h -ts2i -t4sil -tst4ay4 -tst2 -2t1t4 -tta4 -t3t1ab -t5ta2n -t5tas -t3t4ed -t4t2er2e4 -tter1 -t5ter3er1 -t5tes4t2 -t2t2es -t3ti -tti3tu -ttitud4 -ttitu5di -t3t2ler1 -t2tl -t3t1li -t5t2oi -t5t1or -t3tos -t4t5s -t4tu1pe -tt2up -t2ty -4tu. -t2u1a2 -tu4al5li -tu1al -tuall2 -tuar3i4 -tua2r -tu4bin -tu1b2i -tu5bu -tu5den -tud4e -tud5ie2 -tu5en -4tuf2 -t2u1i2 -tu4is -2tum. -3tu1mi -4tu4m1s -3tun1 -tu4n4a4 -tu4ne -tun5it -tun2i -tup5let -t2up -tup2l2 -tup5lic -tu5rac -tu4r -tur1a -t4ura2n -tur2b3a -tur1b -tur4d -turf5i -tur2f -5turit -tur1i -tur4n2 -5tur5o -1tut -4tu2t4iv -tut2i -t1w -t3wa4 -t2wi2 -twi5li -t3wit -t3wo -twon4 -4ty. -ty4a2 -5ty2ch -ty4let -tyle2 -tyl5i -ty5mi -1t2yp -3type -1tyr1 -2tz2 -t5z2i1a2 -tz1i -t5z2ie2 -2ua2 -u2a3c2i2 -u2ag -u2a5h -u1al -ua5lu -uan4o -ua2n -uan2t5is -uant2i -uant5it -uar3a -ua2r -uar2d -uar3i -uari4n -uar5te2r1s2 -uart2 -uarter1 -uar4t5i -ua5ter2n2 -u4ater1 -uba4 -ub5b2ly -u2b1b2 -ub2bl2 -u1b2i -u4b2icu -ub3lin -u2bl2 -ub5lo -ub3ra -ubr4 -4uc -u1c2a -uc1cen5 -uc1c4 -u4c2e4nd -u1cen2 -u4ch -u5c2hr -uc3l2 -u4c2om -u1c2o2 -uc2o5t -uc2tr2 -u2ct -uc3ub -uc5ul -u5cum -u5d2ac -ud1al -ud4e -ud5e1p -u4der1 -udev4 -ud4g -ud4i4cin -udi1c2i2 -ud3i2ed -udie2 -u5dinis -u2d1in -ud2in1i -u3d2i3o2 -u5di1t2io2 -u2do -u5d2oi -ud5on -u5d2or -ue1b4 -u4ed -uen4o -uen4ter1 -uen1te -uer3a -uer1 -ue4s4s -uest5rat -uest4r2 -uest2 -ues5tri -ue4t -uf2 -3u1f2a -u3fl2 -u4fo -u2ft4 -uga4c -ug5l2i1f -u2gl2 -ug2n1i -u2gn2 -u4go -ug3ul -ug3ur1a -ugu4r -uhem3 -uhe2 -2ui2 -ui3al -u2i1a2 -u2ic -ui3cent5 -u4ice -ui1cen2 -ui1d5o -ui2d -ui2l4a -uild5er1 -ui3lib -uil4t -uin1c5u -u2inc -ui4n4s2 -uint4 -uin4ta -ui5pr2 -u2ip -uis3er1 -uis4t2 -uisti4 -uit5er1 -ui5val5 -u2iva -ui3vo -u2iz -4ul. -u1l2a -u4l1ab -4ul4ac -ul5ard -ula2r -u5lat -ul4bo2 -ul3b -ul3ca -ul1c2 -ul4ch -5ulch4e2 -5ulchr2e4 -ul3c2hr -4ulea2 -u5lee -u1len4 -4ulen1c2i2 -u5lent -u1let4 -u2l4ev -ul2f2a -ul2i -ul4i1a2 -u3l4ine -ul3i4ng -ul5is2h -ul1is -u5liti -ul1it -u5lity -4ull2 -ul4lat -ul1l2a -ul4l5ib -ul1li -ul4l1is -ul4l1it -ul3m2 -u1lo -u5l2om -ulph3i -ulph2 -ul2ph3o -ulp5i4ng -ul4po -2u4ls -ul3s2i1f4 -u1lu -ul1v4 -u1ma -u2m3a2m -u1ma2r4 -u5mas -um4bar. -u2m1b -umba2r -um2b2i -umen4t -um2e -u1men -u1mi -u4m1ic -u2m5i1f -umi4fy -umi5l2i1a2 -um2il -umin4a2r -umin1a -u4m4i2n2ed -u4m3i4ng -u4mor1a -u1mo -u4mos -um2p -um4pa -ump3er1 -ump5li -ump2l2 -um2pt4 -ump5te -u1mu -umu4lo -un1 -u4n3a4 -un5ab -unabu4 -un4ae -un4as. -un2as -un2ce -un4dal -u4nd -un2da -un3d2ed -unde2 -un1de4t -undeter5m -undeter2 -un1di4c -un4die2 -un3do -un4dus -un1du -u3n2er1 -unho5li -un1h2 -unho4 -un2i -u1nic -un4ie2 -un3in -un4ine -un2i5p -uni3s4o -un3ist2 -un2i1v -un3iz -unk5eri -u4n2k -unker1 -un5ket -un3kn2 -2un1n4 -un4nag -unn1a -un5o -un5r -u4n3s4 -un5s2h2 -un2t2i -until4 -un2u4 -un3us -uo3de -uo3dent4 -u5oros -u3os -uo5t4a1t2io2 -u2ot -u1o4u2 -2up -u1pat -u1pe -u5p4ee -uper3 -u1ph -u5pi2d -up3i4ng -u4po -u5pol -u2pr2 -upr2e4 -u5que4t -uqu4 -u4r -ur1a -4u4ra. -ur2a4c2i2 -4urae -ura2g -4urant2i -uran2t -ura2n -uras5 -urb5i4ng -ur1b -urb2i -ur2bin -ur2c2 -urc3a -ur5den. -ur5den1i -ur5die2 -ur4du -ur3ea4 -ur2e -ur5ee -ur1er1 -ur3e2r1s2 -ur1e2t -ur3e2t2t4 -ur2f -ur3f2a -ur1i -u5r2i5cu -ur4ie. -urie2 -ur5ifie2 -ur2i1f -uril4 -ur4ili -ur5ion -ur2i3o2 -uri4os. -ur2l5er1 -ur1le -ur5lie2 -url5i4ng -ur1m4 -urn3al -ur2n2 -urn1a -urn3er1 -ur4n5s -ur1o -ur2o4d -ur5o4m -ur5ot -uroti4 -ur3pen5t -urpe2 -ur2ph4 -u2r2s2 -ur2s5a2l -urs5er1 -ur2se -ur3s2h -urs3or -ur5ta -urt2 -ur1te -ur5t2es -urth2 -ur3the2 -urti4 -ur1u -ur4va -ur1v2 -u3sad -us3a4g -us3a2l -us4ap -us3a1t -2usc2 -us4ca2n -us1ca -ush5a2 -us2h -us5ia2n -us2i1a2 -usil5 -u4s1in -usk5er1 -us2k2 -uske2 -us1p -us4pa -uss4e -u4ss -4ust2 -us3tac -us5ta2n -ust4ic -us5t2i1c2i2 -ust5ig -ust3il -us1to4 -us1tr2 -us4tr2e4 -usur4e -usu4r -us5ur1i -u3t4ane -uta2n -utch4e2 -u2tc2 -ut2ch -ut5en1i -u5te2o -u4t2er2e4 -uter1 -ut2i -u3tie2 -ut3i4ng -ut1in -u5t2in1i -u3t2io2 -ut5i2s1m4 -u2t1is -ut3is2t2 -5u5t1iz -ut3le -u2tl -ut1li4 -ut2o -u4to5s -u4t1ra -utr2 -u4t1s2 -ut5s1m4 -ut4to2n4e -u2t1t4 -u3tu -u4tul -uu4 -uv2 -u4va -uve2 -uven3 -uv5eri -uver1 -u5v1in -ux2o -uy4a2 -uy5er1 -4va. -2v3ab -5vac -va1c2a -va5ceo -vacu1 -v4ad -3vag3a -va4ge -4va2g2e4d -vager4 -va2g5r2 -v1al. -1v2ale -vali2 -va5lie2 -val4ise -val1is -5valu -5val4v -vam4i -v2a2m -va5mo -5van1n4 -va2n -van2t2a4 -4van2tl -var4is -va2r -var1i -4vas2e -vas5el5 -v5a4so -v2ast3a -vast2 -v4at. -5vatee -v4at4in1a -va2t3in -4v2a2tu -2ve. -ve2ct4 -ve3g -3vei -2vel -vel3at -vel2a -4v2ele -v3e2l1er1 -ve5l4ine -v1ell2 -v4el1l2a -vel5ler1 -vel3li -vel5op1i -ve4n4al -ven1a -ven4do -v2e4nd -v4e1ne -ve5n2i1a2 -ven1i -ven2t5o -ven4tr2 -4v4en2u -v5en5ue -5ve3o -5ver1b -ver1 -verde5v -v2erd -4v4er2e4 -ver5ea4 -ver3ei4 -v5er3ie2 -ver3m4 -ver4ne -ver2n2 -5ver2se -ve2r1s2 -4v4es. -4vi. -5vi3al1it -v2i1a2 -vi4a2tr2 -vi3at -vi1b4 -vic2 -vi4ca -vi5car1i -v2i1ca2r -vice3r1 -v4ice -5vi2ct2 -5v2icu -5vider1 -vi2d -vi2gn3 -v2ig -vi4l -vil3i -3vil2i4a2 -v5ilise -vil1is -v5ilize -vil1iz -vil5lin -vill2 -vil1li -vim4 -5vim2e -2v1in -vin4a2c -vin1a -3vin1c2i2 -v2inc -vin2e -5vinit -v2in1i -v5in1iz -vint4 -vin5ta -3v2i1o2 -v4i1ol3 -vi5om -5v2i3p -vir2e4 -v2ir -vi5r2i4d -vir1i -vir3u -5visecti -v4i1sec -vise2ct -5vi1s2io4 -v3i2s1m4 -2v5ist2 -vi2t -vit2a -vi3tal -vi5te2l -v5it1ie2 -v2it1r2 -vi3tu -v3ity -viv5al -v2iva -viv5or -vi2vo -v2i5zo -v1iz -1vo -2vo. -vo2l -vo5li1t2io2 -vol2it -vol4u1b2i -v4ol1ub -volv4 -4von -vo5rac -vor1a -3vor1c2 -4v2or2e -3voro -vo3ta2r -v2ot -2vow -vr4 -v5ra4 -v5ri -v5ro -vr2ot4 -4vs -v3ur2e -vu4r -2vv2 -v5ver1 -v5vi -4vy -4w1ab -wag3o -wais4 -w2ai2 -w3al. -wal2l5er1 -wall2 -w3a4ls -wan5gli -wa2n -wa4ng -wan2gl2 -wank5er1 -wa4n2k -war5d2ed -wa2r -ward5er1 -ward5r2 -war4f -war4te -wart2 -war5th2i -war2th -wa4ss4 -was4t2 -wa1te -wav4in2e -w2av -wa2v1in -w1b4 -w4bon -wbo2 -w5c -w5die2 -w3dr2 -we4b -w4ed -3we2ed -5wei -weight5i -we2ig2 -wei2gh -weigh2t -we2ir4 -wel3i -wel1iz4 -wel4iz3i2 -wel4li -well2 -went4 -wes4 -west3 -w5e4st. -w5f -wh2 -w5hi2d -wi2 -wid4e -wi2d -wi5er1 -wie2 -wil2l5in -will2 -wil1li -wim2p -win2e -wing5er1 -w4inge -wi4ng -win4tr2 -3w4ise -with5eri -w2ith -wit4her1 -withe2 -w3l2a -w2l1er1 -wl1i -wl4ie2 -w1m -1wo -wol4 -wol5ver1 -3w2om -w2on2t -word5i -wot2ch4 -w2ot -wo2tc2 -w2oun4 -wo4u2 -wp5in -wra4 -ws5i4ng -w2sin -w5ster1 -wst2 -wste2 -wt4 -w5te -w3to -wy2 -wz4 -x1a -x4a2ch -x4ade -x2ag -x3a2g1g -xa5me2t -x2a2m -xam2e -x3am1i -xa4n5d -xa2n -xan1o4 -x2as -xas5p -x3c4 -xc2av3 -xcor5 -x1c2o2 -xe4 -x1ec -xec3r2 -xe5cu3t2io2 -xecut2i -xecut5o -x2e2d -x5e2dl4 -x5e4d1n2 -x5eg -x1em -x3en -xen4op -xen1o -x3er1 -xer4g2 -xer3o -x1h -xhort4a -xh2ort2 -x1i -x3ia. -x2i1a2 -x4ias -xi4c -x5i1ge -x2ig -xim3a -x4im2e -xi1me2t4 -x3io2 -x2i4p -x4it. -x4i4t1s -x1o -x4ode -x5om -xo4mat -xo1ma -xo4n -x4os -xotr2op4 -x2ot -x4o1tr2 -x3p -xpel4 -xp4o5n2 -x1po -xp2oun4 -xpo4u2 -x1s2 -x1t2 -x4t4ed -xtens5o -xte4n2s -x1ter3i -xter1 -xter4m3 -xter2n3 -x4th -xti4 -xtr2a5d -xtr2 -xtr2a3v -xtr2e4 -xu4o -x1u4r -xur4b -x5us -x5w -xx4 -x4y2s4 -xy3t -y1a2 -y5ac -1y2a2r -3yard -yas4i -4y1b -yb2i -yc2a5m -y5chede2 -y2ch -y4ch2ed -yche2 -ych5is -y3cho -y4chose -yc1l2 -ycl2a2m4 -ycl2a -y4coli -y1c2o2 -y4coll2 -yc2om4 -y2cos -y1d4 -yda4 -yder4 -ydro5s -ydr2 -y4dro4u2 -y3ee -yel5o -y3en -y1er1 -y3e4st. -yest2 -yes5te2 -y5e2t2t4 -y5f -y1g -y1g2i2 -yg2i5a2 -y3gl2 -yg2o4i -y1h -y1i -y3in -yle2 -ylin5de2 -yl2i4n4d -yllab5i -yll2 -yl1l2a -yll1ab -yl3os -yl5o4u2 -y1m2e4 -y3men -y5me2t -y5m2i1a2 -ym5in -ym2ot4 -y1mo -ym4pha2 -ym1p -yn1 -yn5ago4 -yn1a -yna4nd5 -yna2n -yn5ap4 -yn5ast2 -yn2as -yn4c2i2 -y4nd4 -yn2e -yn3er1 -y4ng4 -yn4gol -yn1go -yni4c -yn1i -y2n4y2 -y1o2 -yo3d -yo4g4i4s -y2o1g -yo3g2i -y2oun4 -yo4u2 -you4ng5 -2yp -yp5al -yper3 -y5p2er2e -y4p4eri -y4pero -y4pet -y2ph -yph4e4 -yph3i -y4p1i -y2p1n -y1po1 -y4po4x -y2pr2 -yp5ri -yp4si -y2ps2 -yp5sy5f -yps2y -ypt3a -y2pt2 -y5pu -y3rag -yr3at -yr3ic -y5r2ig -yr3is -yr3i4t -yr5o1lo -y4r4r4 -y2r4s2 -yr5u -4y2s -ys5a4g -ys5a1t -y3s2c2 -y3s2h -ys1ic -y2s3in -y1s2i4o4 -yso5 -ys4so -y4ss -ys1t2 -ys4to -y3u -yv4 -y3w -yz5er1 -yzy4 -z1a1 -2za. -za4bi -z1ab -z2a2i2 -z4as -za4te -zd4 -ze1b4 -z2e4d -zen4a -z5e4ng -zer5a -zer1 -z3et4 -z1i -zib5 -5zic4 -z2ie2 -zi5m -zin4c3i2 -z2inc -z3i4ng -z4in2g5i -z4is -3zlem -z3ler1 -z3li -4zo. -5z2oa2 -zo3a2n -3z2oo2 -zo3ol -zo3on -zo5o2p -zo5oti -zo2o2t -zo5p -z2ot2 -z5s -5zum -4zy. -zz2 -z3za2r -zz1a1 -z5z4as -z3z2ie2 -zz1i -zzo3 -z5z2ot2 diff --git a/lingucomponent/source/hyphenator/altlinuxhyph/hyphtabs/substrings.pl b/lingucomponent/source/hyphenator/altlinuxhyph/hyphtabs/substrings.pl deleted file mode 100755 index 78e31f5da75c..000000000000 --- a/lingucomponent/source/hyphenator/altlinuxhyph/hyphtabs/substrings.pl +++ /dev/null @@ -1,165 +0,0 @@ -#!/usr/bin/perl -# convert TeX (Patgen) hyphenation patterns to Libhnj format -# (A utility for finding substring embeddings in patterns) -# usage: substrings.pl inputfile outputfile [encoding] - -if (!defined $ARGV[1]) { - print "" . -"substrings.pl - convert TeX (Patgen) hyphenation patterns to Libhnj format\n" . -"(A utility for finding substring embeddings in patterns)\n" . -"usage: substrings.pl inputfile outputfile [encoding]\n"; - exit 1; -} -$fn = $ARGV[0]; -if (!-e $fn) { $fn = "hyphen.us"; } -open HYPH, $fn; -open OUT, ">$ARGV[1]"; -$encoding = $ARGV[2]; -if (defined $encoding) { print OUT "$encoding\n"; } - -while (<HYPH>) -{ - $pat =~ s/%.*$//g; - if (/^\%/) { - #comment, ignore - } elsif (/^(.+)\/([^,]+),([0-9]+),([0-9]+)$/) { - $origpat = $1; - $pat = $1; - $repl = $2; - $beg = $3; - $len = $4; - $pat =~ s/\d//g; - if ($origpat eq $pat) { - print "error - missing hyphenation point: $_"; - exit 1; - } - push @patlist, $pat; - $pattab{$pat} = $origpat; - $repltab{$pat} = $repl; - $replbeg{$pat} = $beg - 1; - $repllen{$pat} = $len; - } elsif (/^(.+)\/(.+)$/) { - $origpat = $1; - $pat = $1; - $repl = $2; - $pat =~ s/\d//g; - if ($origpat eq $pat) { - print "error - missing hyphenation point: $_"; - exit 1; - } - push @patlist, $pat; - $pattab{$pat} = $origpat; - $repltab{$pat} = $repl; - $replbeg{$pat} = 0; - $repllen{$pat} = enclen($pat); - } elsif (/^(.+)$/) { - $origpat = $1; - $pat = $1; - $pat =~ s/\d//g; - push @patlist, $pat; - $pattab{$pat} = $origpat; - } -} - -foreach $pat (@patlist) { - $patsize = length $pat; - for $i (0..$patsize - 1) { - for $j (1..$patsize - $i) { - $subpat = substr ($pat, $i, $j); - if (defined $pattab{$subpat}) { - print "$pattab{$subpat} is embedded in $pattab{$pat}\n"; - $newpat = substr $pat, 0, $i + $j; - if (!defined $newpattab{$newpat}) { - $newpattab{$newpat} = - substr ($pat, 0, $i).$pattab{$subpat}; - $ss = substr $pat, 0, $i; - print "$ss+$pattab{$subpat}\n"; - push @newpatlist, $newpat; - if (defined $repltab{$subpat}) { - $begcorr = (($pat =~ /^[.]/) && !($subpat =~ /^[.]/)) ? 1 : 0; - $newrepltab{$newpat} = $repltab{$subpat}; - $newreplbeg{$newpat} = $replbeg{$subpat} + enclen($ss) - $begcorr; - $newrepllen{$newpat} = $repllen{$subpat}; - } - } else { - $tmp = $newpattab{$newpat}; - $newpattab{$newpat} = - combine ($newpattab{$newpat}, $pattab{$subpat}); - print "$tmp + $pattab{$subpat} -> $newpattab{$newpat}\n"; - } - } - } - } -} - -foreach $pat (@newpatlist) { - if (defined $newrepltab{$pat}) { - print OUT $newpattab{$pat}."/".$newrepltab{$pat}.",".($newreplbeg{$pat}+1).",".$newrepllen{$pat}."\n"; - } else { - print OUT $newpattab{$pat}."\n"; - } -} - -#convert 'n1im' to 0n1i0m0 expresed as a list -sub expand { - my ($pat) = @_; - my $last = '.'; - my @exp = (); - - foreach $c (split (//, $pat)) { - if ($last =~ /[\D]/ && $c =~ /[\D]/) { - push @exp, 0; - } - push @exp, $c; - $last = $c; - } - if ($last =~ /[\D]/) { - push @exp, 0; - } - return @exp; -} - -# Combine two patterns, i.e. .ad4der + a2d becomes .a2d4der -# The second pattern needs to be a substring of the first (modulo digits) -sub combine { - my @exp = expand shift; - my @subexp = expand shift; - my $pat1, $pat2; - my $i; - - $pat1 = join ('', map { $_ =~ /\d/ ? () : $_ } @exp); - $pat2 = join ('', map { $_ =~ /\d/ ? () : $_ } @subexp); - - $begcorr = ($pat1 =~ /^[.]/) ? 1 : 0; - - for $i (0..length ($pat1) - length ($pat2)) { - if (substr ($pat1, $i, length $pat2) eq $subpat) { - for ($j = 0; $j < @subexp; $j += 2) { - if ($subexp[$j] > $exp[2 * $i + $j]) { - $exp[2 * $i + $j] = $subexp[$j]; - if (defined $newrepltab{$pat2} && !defined $newrepltab{$pat1}) { - $ss = substr ($pat1, 0, $i); - $newrepltab{$pat1} = $newrepltab{$pat2}; - $newreplbeg{$pat1} = $newreplbeg{$pat2} + enclen($ss) - $begcorr; - $newrepllen{$pat1} = $newrepllen{$pat2}; - } - } - } - print ("$pat1 includes $pat2 at pos $i\n"); - } - } - return join ('', map { $_ eq '0' ? () : $_ } @exp); -} - -# 8 bit or UTF-8 character length (calculating right start position for discretionary hyphenation) -sub enclen { - my $nonchar = 0; - my $len = length($_[0]); - if ($encoding eq "UTF-8") { - # length of an UTF-8 string equals to the count of the characters not started with '10' bits - for ($i = 0; $i < $len; $i++) { - if ((ord(substr($_[0], $i, 1)) >> 6) == 2) { $nonchar++; } - } - } - return $len - $nonchar; -} diff --git a/lingucomponent/source/languageguessing/altstrfunc.cxx b/lingucomponent/source/languageguessing/altstrfunc.cxx index 0a5850343406..7b9739b206e6 100644 --- a/lingucomponent/source/languageguessing/altstrfunc.cxx +++ b/lingucomponent/source/languageguessing/altstrfunc.cxx @@ -34,14 +34,6 @@ #include <sal/types.h> -std::string upperCase(const std::string &s) { - std::string upper(s); - for(size_t i = 0; i < s.length(); i++) - upper[i] = sal::static_int_cast< char >( toupper(upper[i]) ); - return upper; -} - - int start(const std::string &s1, const std::string &s2){ size_t i; int ret = 0; diff --git a/lingucomponent/source/languageguessing/altstrfunc.hxx b/lingucomponent/source/languageguessing/altstrfunc.hxx index a918cb73c2fd..1bd883b32fcc 100644 --- a/lingucomponent/source/languageguessing/altstrfunc.hxx +++ b/lingucomponent/source/languageguessing/altstrfunc.hxx @@ -38,7 +38,6 @@ inline bool isSeparator(const char c){ return c == GUESS_SEPARATOR_OPEN || c == GUESS_SEPARATOR_SEP || c == GUESS_SEPARATOR_CLOSE || c == '\0'; } -std::string upperCase(const std::string &s); int start(const std::string &s1, const std::string &s2); #endif diff --git a/lingucomponent/source/languageguessing/guess.cxx b/lingucomponent/source/languageguessing/guess.cxx index dc45e49edc79..68db6c521aab 100644 --- a/lingucomponent/source/languageguessing/guess.cxx +++ b/lingucomponent/source/languageguessing/guess.cxx @@ -102,13 +102,7 @@ Guess::Guess(char * guess_str) if(lang!=""){//if not we use the default value language_str=lang; } - - if(/*country!=""*/1){ - country_str=country; - } - else{//if we don't have an availlable country, we use the language as a country - country_str=upperCase(language_str); - } + country_str=country; if(enc!=""){//if not we use the default value encoding_str=enc; diff --git a/lingucomponent/source/languageguessing/guesslang.cxx b/lingucomponent/source/languageguessing/guesslang.cxx index eef917d182fe..bd2c29430f76 100644 --- a/lingucomponent/source/languageguessing/guesslang.cxx +++ b/lingucomponent/source/languageguessing/guesslang.cxx @@ -96,15 +96,18 @@ class LangGuess_Impl : XLanguageGuessing, XServiceInfo > { - SimpleGuesser guesser; + SimpleGuesser m_aGuesser; + bool m_bInitialized; css::uno::Reference< css::uno::XComponentContext > m_xContext; - LangGuess_Impl(const LangGuess_Impl &); // not defined - void operator =(const LangGuess_Impl &); // not defined + LangGuess_Impl( const LangGuess_Impl & ); // not defined + LangGuess_Impl & operator =( const LangGuess_Impl & ); // not defined + virtual ~LangGuess_Impl() {} + void EnsureInitialized(); public: - explicit LangGuess_Impl(css::uno::Reference< css::uno::XComponentContext > const & context); + explicit LangGuess_Impl(css::uno::Reference< css::uno::XComponentContext > const & rxContext); // XServiceInfo implementation virtual OUString SAL_CALL getImplementationName( ) throw(RuntimeException); @@ -129,50 +132,64 @@ public: //************************************************************************* -LangGuess_Impl::LangGuess_Impl(css::uno::Reference< css::uno::XComponentContext > const & context) : - m_xContext(context) +LangGuess_Impl::LangGuess_Impl(css::uno::Reference< css::uno::XComponentContext > const & rxContext) : + m_bInitialized( false ), + m_xContext( rxContext ) { - // set default fingerprint path to where those get installed - String aPhysPath; - String aURL( SvtPathOptions().GetFingerprintPath() ); - utl::LocalFileHelper::ConvertURLToPhysicalName( aURL, aPhysPath ); +} + +//************************************************************************* + +void LangGuess_Impl::EnsureInitialized() +{ + if (!m_bInitialized) + { + // set this to true at the very start to prevent loops because of + // implicitly called functions below + m_bInitialized = true; + + // set default fingerprint path to where those get installed + String aPhysPath; + String aURL( SvtPathOptions().GetFingerprintPath() ); + utl::LocalFileHelper::ConvertURLToPhysicalName( aURL, aPhysPath ); #ifdef WNT - aPhysPath += '\\'; + aPhysPath += '\\'; #else - aPhysPath += '/'; + aPhysPath += '/'; #endif - SetFingerPrintsDB( aPhysPath ); - - // - // disable currently not functional languages... - // - struct LangCountry - { - const char *pLang; - const char *pCountry; - }; - LangCountry aDisable[] = - { - {"gv", ""}, {"sco", ""}, // no lang-id available yet... -// {"hy", ""}, {"drt", ""}, // 0 bytes fingerprints... - {"zh", "CN"}, {"zh", "TW"}, {"ja", ""}, {"ko", ""}, // not yet correct functional... - {"ka", ""}, {"hi", ""}, {"mr", ""}, {"ne", ""}, - {"sa", ""}, {"ta", ""}, {"th", ""}, - {"qu", ""}, {"yi", ""} - }; - sal_Int32 nNum = sizeof(aDisable) / sizeof(aDisable[0]); - Sequence< Locale > aDisableSeq( nNum ); - Locale *pDisableSeq = aDisableSeq.getArray(); - for (sal_Int32 i = 0; i < nNum; ++i) - { - Locale aLocale; - aLocale.Language = OUString::createFromAscii( aDisable[i].pLang ); - aLocale.Country = OUString::createFromAscii( aDisable[i].pCountry ); - pDisableSeq[i] = aLocale; + SetFingerPrintsDB( aPhysPath ); + + // + // disable currently not functional languages... + // + struct LangCountry + { + const char *pLang; + const char *pCountry; + }; + LangCountry aDisable[] = + { + {"gv", ""}, {"sco", ""}, // no lang-id available yet... +// {"hy", ""}, {"drt", ""}, // 0 bytes fingerprints... + {"zh", "CN"}, {"zh", "TW"}, {"ja", ""}, {"ko", ""}, // not yet correct functional... + {"ka", ""}, {"hi", ""}, {"mr", ""}, {"ne", ""}, + {"sa", ""}, {"ta", ""}, {"th", ""}, + {"qu", ""}, {"yi", ""} + }; + sal_Int32 nNum = sizeof(aDisable) / sizeof(aDisable[0]); + Sequence< Locale > aDisableSeq( nNum ); + Locale *pDisableSeq = aDisableSeq.getArray(); + for (sal_Int32 i = 0; i < nNum; ++i) + { + Locale aLocale; + aLocale.Language = OUString::createFromAscii( aDisable[i].pLang ); + aLocale.Country = OUString::createFromAscii( aDisable[i].pCountry ); + pDisableSeq[i] = aLocale; + } + disableLanguages( aDisableSeq ); + DBG_ASSERT( nNum == getDisabledLanguages().getLength(), "size mismatch" ); } - disableLanguages( aDisableSeq ); - DBG_ASSERT( nNum == getDisabledLanguages().getLength(), "size mismatch" ); } //************************************************************************* @@ -187,7 +204,7 @@ Sequence< com::sun::star::lang::Locale > SAL_CALL LangGuess_Impl::guessLanguages Sequence< com::sun::star::lang::Locale > aRes; OString o = OUStringToOString( rText, RTL_TEXTENCODING_UTF8 ); - vector<Guess> gs = guesser.GuessLanguage(o.pData->buffer); + vector<Guess> gs = m_aGuesser.GuessLanguage(o.pData->buffer); aRes.realloc(gs.size()); @@ -210,6 +227,7 @@ Sequence< com::sun::star::lang::Locale > SAL_CALL LangGuess_Impl::guessLanguages } */ //************************************************************************* + Locale SAL_CALL LangGuess_Impl::guessPrimaryLanguage( const ::rtl::OUString& rText, ::sal_Int32 nStartPos, @@ -218,11 +236,13 @@ Locale SAL_CALL LangGuess_Impl::guessPrimaryLanguage( { osl::MutexGuard aGuard( GetLangGuessMutex() ); + EnsureInitialized(); + lang::Locale aRes; if (nStartPos >=0 && nLen >= 0 && nStartPos + nLen <= rText.getLength()) { OString o( OUStringToOString( rText.copy(nStartPos, nLen), RTL_TEXTENCODING_UTF8 ) ); - Guess g = guesser.GuessPrimaryLanguage((char*)o.getStr()); + Guess g = m_aGuesser.GuessPrimaryLanguage((char*)o.getStr()); aRes.Language = OUString::createFromAscii(g.GetLanguage().c_str()); aRes.Country = OUString::createFromAscii(g.GetCountry().c_str()); } @@ -247,7 +267,7 @@ void LangGuess_Impl::SetFingerPrintsDB( //cout << "Conf file : " << conf_file_path.getStr() << " directory : " << path.getStr() << endl; - guesser.SetDBPath((const char*)conf_file_path.getStr(), (const char*)path.getStr()); + m_aGuesser.SetDBPath((const char*)conf_file_path.getStr(), (const char*)path.getStr()); } //************************************************************************* @@ -256,8 +276,10 @@ uno::Sequence< Locale > SAL_CALL LangGuess_Impl::getAvailableLanguages( ) { osl::MutexGuard aGuard( GetLangGuessMutex() ); + EnsureInitialized(); + Sequence< com::sun::star::lang::Locale > aRes; - vector<Guess> gs = guesser.GetAllManagedLanguages(); + vector<Guess> gs = m_aGuesser.GetAllManagedLanguages(); aRes.realloc(gs.size()); com::sun::star::lang::Locale *pRes = aRes.getArray(); @@ -278,8 +300,10 @@ uno::Sequence< Locale > SAL_CALL LangGuess_Impl::getEnabledLanguages( ) { osl::MutexGuard aGuard( GetLangGuessMutex() ); + EnsureInitialized(); + Sequence< com::sun::star::lang::Locale > aRes; - vector<Guess> gs = guesser.GetAvailableLanguages(); + vector<Guess> gs = m_aGuesser.GetAvailableLanguages(); aRes.realloc(gs.size()); com::sun::star::lang::Locale *pRes = aRes.getArray(); @@ -300,8 +324,10 @@ uno::Sequence< Locale > SAL_CALL LangGuess_Impl::getDisabledLanguages( ) { osl::MutexGuard aGuard( GetLangGuessMutex() ); + EnsureInitialized(); + Sequence< com::sun::star::lang::Locale > aRes; - vector<Guess> gs = guesser.GetUnavailableLanguages(); + vector<Guess> gs = m_aGuesser.GetUnavailableLanguages(); aRes.realloc(gs.size()); com::sun::star::lang::Locale *pRes = aRes.getArray(); @@ -323,6 +349,8 @@ void SAL_CALL LangGuess_Impl::disableLanguages( { osl::MutexGuard aGuard( GetLangGuessMutex() ); + EnsureInitialized(); + sal_Int32 nLanguages = rLanguages.getLength(); const Locale *pLanguages = rLanguages.getConstArray(); @@ -336,7 +364,7 @@ void SAL_CALL LangGuess_Impl::disableLanguages( language += l.getStr(); language += "-"; language += c.getStr(); - guesser.DisableLanguage(language); + m_aGuesser.DisableLanguage(language); } } @@ -347,6 +375,8 @@ void SAL_CALL LangGuess_Impl::enableLanguages( { osl::MutexGuard aGuard( GetLangGuessMutex() ); + EnsureInitialized(); + sal_Int32 nLanguages = rLanguages.getLength(); const Locale *pLanguages = rLanguages.getConstArray(); @@ -360,7 +390,7 @@ void SAL_CALL LangGuess_Impl::enableLanguages( language += l.getStr(); language += "-"; language += c.getStr(); - guesser.EnableLanguage(language); + m_aGuesser.EnableLanguage(language); } } diff --git a/lingucomponent/source/languageguessing/makefile.mk b/lingucomponent/source/languageguessing/makefile.mk index 653e7935a3ce..7650df0c0bce 100644 --- a/lingucomponent/source/languageguessing/makefile.mk +++ b/lingucomponent/source/languageguessing/makefile.mk @@ -63,7 +63,6 @@ SHL1STDLIBS= \ $(LIBTEXTCATLIB) \ $(SALLIB) \ $(SVLLIB) \ - $(SVTOOLLIB) \ $(TOOLSLIB) \ $(UNOTOOLSLIB) diff --git a/lingucomponent/source/lingutil/lingutil.cxx b/lingucomponent/source/lingutil/lingutil.cxx index f6d24a2d059a..d32af21f7e7a 100644 --- a/lingucomponent/source/lingutil/lingutil.cxx +++ b/lingucomponent/source/lingutil/lingutil.cxx @@ -188,7 +188,7 @@ std::vector< SvtLinguConfigDictionaryEntry > GetOldStyleDics( const char *pDicTy if (!sLang.getLength()) continue; rtl::OUString sRegion; - if (nIndex != -1); + if (nIndex != -1) sRegion = sChunk.copy( nIndex, sChunk.getLength() - nIndex ); // Thus we first get the language of the dictionary diff --git a/lingucomponent/source/lingutil/makefile.mk b/lingucomponent/source/lingutil/makefile.mk index 55747a9da549..92021d949144 100644 --- a/lingucomponent/source/lingutil/makefile.mk +++ b/lingucomponent/source/lingutil/makefile.mk @@ -55,7 +55,7 @@ CXXFLAGS += $(HUNSPELL_CFLAGS) CFLAGSCXX += $(HUNSPELL_CFLAGS) CFLAGSCC += $(HUNSPELL_CFLAGS) -SLOFILES=$(SLO)$/lingutil.obj +SLOFILES = $(SLO)$/lingutil.obj LIB1TARGET= $(SLB)$/lib$(TARGET).lib LIB1ARCHIV= $(LB)/lib$(TARGET).a diff --git a/lingucomponent/source/spellcheck/hunspell/phonet.cxx b/lingucomponent/source/spellcheck/hunspell/phonet.cxx deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/lingucomponent/source/spellcheck/hunspell/phonet.cxx +++ /dev/null diff --git a/lingucomponent/source/spellcheck/hunspell/phonet.hxx b/lingucomponent/source/spellcheck/hunspell/phonet.hxx deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/lingucomponent/source/spellcheck/hunspell/phonet.hxx +++ /dev/null diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx index ad21c90c2699..5da36c38f3f6 100644 --- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx +++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx @@ -52,9 +52,10 @@ #include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp> #include <tools/table.hxx> -#include <lingutil.hxx> #include <linguistic/misc.hxx> -#include "sprophelp.hxx" +#include <linguistic/lngprophelp.hxx> + +#include <lingutil.hxx> using namespace ::rtl; using namespace ::com::sun::star::uno; @@ -88,15 +89,15 @@ class MacSpellChecker : ::cppu::OInterfaceContainerHelper aEvtListeners; Reference< XPropertyChangeListener > xPropHelper; - PropertyHelper_Spell * pPropHelper; + linguistic::PropertyHelper_Spell * pPropHelper; BOOL bDisposing; // disallow copy-constructor and assignment-operator for now MacSpellChecker(const MacSpellChecker &); MacSpellChecker & operator = (const MacSpellChecker &); - PropertyHelper_Spell & GetPropHelper_Impl(); - PropertyHelper_Spell & GetPropHelper() + linguistic::PropertyHelper_Spell & GetPropHelper_Impl(); + linguistic::PropertyHelper_Spell & GetPropHelper() { return pPropHelper ? *pPropHelper : GetPropHelper_Impl(); } diff --git a/lingucomponent/source/spellcheck/macosxspell/makefile.mk b/lingucomponent/source/spellcheck/macosxspell/makefile.mk index f1ddf5be84f2..c414c671dfcc 100644 --- a/lingucomponent/source/spellcheck/macosxspell/makefile.mk +++ b/lingucomponent/source/spellcheck/macosxspell/makefile.mk @@ -56,12 +56,10 @@ CFLAGSCXX += -I..$/..$/lingutil CFLAGSCXX += -x objective-c++ -fobjc-exceptions EXCEPTIONSFILES= \ - $(SLO)$/sprophelp.obj\ $(SLO)$/macspellimp.obj SLOFILES= \ - $(SLO)$/sprophelp.obj\ $(SLO)$/macreg.obj\ $(SLO)$/macspellimp.obj diff --git a/lingucomponent/source/spellcheck/macosxspell/sprophelp.cxx b/lingucomponent/source/spellcheck/macosxspell/sprophelp.cxx deleted file mode 100644 index 2bc62f72c9a0..000000000000 --- a/lingucomponent/source/spellcheck/macosxspell/sprophelp.cxx +++ /dev/null @@ -1,375 +0,0 @@ -/************************************************************************* - * - * 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: sprophelp.cxx,v $ - * $Revision: 1.3 $ - * - * 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_lingucomponent.hxx" - -#include <linguistic/misc.hxx> - -#include "sprophelp.hxx" -#include <linguistic/lngprops.hxx> -#include <tools/debug.hxx> - -#include <com/sun/star/linguistic2/LinguServiceEvent.hpp> -#include <com/sun/star/linguistic2/LinguServiceEventFlags.hpp> -#include <com/sun/star/linguistic2/XLinguServiceEventListener.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <osl/mutex.hxx> - -//using namespace utl; -using namespace osl; -using namespace rtl; -using namespace com::sun::star; -using namespace com::sun::star::beans; -using namespace com::sun::star::lang; -using namespace com::sun::star::uno; -using namespace com::sun::star::linguistic2; -using namespace linguistic; - - -#define A2OU(x) ::rtl::OUString::createFromAscii( x ) - -/////////////////////////////////////////////////////////////////////////// - - -PropertyChgHelper::PropertyChgHelper( - const Reference< XInterface > & rxSource, - Reference< XPropertySet > &rxPropSet, - const char *pPropNames[], USHORT nPropCount ) : - aPropNames (nPropCount), - xMyEvtObj (rxSource), - aLngSvcEvtListeners (GetLinguMutex()), - xPropSet (rxPropSet) -{ - OUString *pName = aPropNames.getArray(); - for (INT32 i = 0; i < nPropCount; ++i) - { - pName[i] = A2OU( pPropNames[i] ); - } -} - - -/*PropertyChgHelper::PropertyChgHelper( const PropertyChgHelper &rHelper ) : - aLngSvcEvtListeners (GetLinguMutex()) -{ - xPropSet = rHelper.xPropSet; - aPropNames = rHelper.aPropNames; - AddAsPropListener(); - - xMyEvtObj = rHelper.xMyEvtObj; -} */ - - -PropertyChgHelper::~PropertyChgHelper() -{ -} - - -void PropertyChgHelper::AddAsPropListener() -{ - if (xPropSet.is()) - { - INT32 nLen = aPropNames.getLength(); - const OUString *pPropName = aPropNames.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) - { - if (pPropName[i].getLength()) - xPropSet->addPropertyChangeListener( pPropName[i], this ); - } - } -} - -void PropertyChgHelper::RemoveAsPropListener() -{ - if (xPropSet.is()) - { - INT32 nLen = aPropNames.getLength(); - const OUString *pPropName = aPropNames.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) - { - if (pPropName[i].getLength()) - xPropSet->removePropertyChangeListener( pPropName[i], this ); - } - } -} - - -void PropertyChgHelper::LaunchEvent( const LinguServiceEvent &rEvt ) -{ - cppu::OInterfaceIteratorHelper aIt( aLngSvcEvtListeners ); - while (aIt.hasMoreElements()) - { - Reference< XLinguServiceEventListener > xRef( aIt.next(), UNO_QUERY ); - if (xRef.is()) - xRef->processLinguServiceEvent( rEvt ); - } -} - - -void SAL_CALL PropertyChgHelper::disposing( const EventObject& rSource ) - throw(RuntimeException) -{ - MutexGuard aGuard( GetLinguMutex() ); - if (rSource.Source == xPropSet) - { - RemoveAsPropListener(); - xPropSet = NULL; - aPropNames.realloc( 0 ); - } -} - - -sal_Bool SAL_CALL - PropertyChgHelper::addLinguServiceEventListener( - const Reference< XLinguServiceEventListener >& rxListener ) - throw(RuntimeException) -{ - MutexGuard aGuard( GetLinguMutex() ); - - BOOL bRes = FALSE; - if (rxListener.is()) - { - INT32 nCount = aLngSvcEvtListeners.getLength(); - bRes = aLngSvcEvtListeners.addInterface( rxListener ) != nCount; - } - return bRes; -} - - -sal_Bool SAL_CALL - PropertyChgHelper::removeLinguServiceEventListener( - const Reference< XLinguServiceEventListener >& rxListener ) - throw(RuntimeException) -{ - MutexGuard aGuard( GetLinguMutex() ); - - BOOL bRes = FALSE; - if (rxListener.is()) - { - INT32 nCount = aLngSvcEvtListeners.getLength(); - bRes = aLngSvcEvtListeners.removeInterface( rxListener ) != nCount; - } - return bRes; -} - -/////////////////////////////////////////////////////////////////////////// - -static const char *aSP[] = -{ - UPN_IS_GERMAN_PRE_REFORM, - UPN_IS_IGNORE_CONTROL_CHARACTERS, - UPN_IS_USE_DICTIONARY_LIST, - UPN_IS_SPELL_UPPER_CASE, - UPN_IS_SPELL_WITH_DIGITS, - UPN_IS_SPELL_CAPITALIZATION -}; - - -PropertyHelper_Spell::PropertyHelper_Spell( - const Reference< XInterface > & rxSource, - Reference< XPropertySet > &rxPropSet ) : - PropertyChgHelper ( rxSource, rxPropSet, aSP, sizeof(aSP) / sizeof(aSP[0]) ) -{ - SetDefault(); - INT32 nLen = GetPropNames().getLength(); - if (rxPropSet.is() && nLen) - { - const OUString *pPropName = GetPropNames().getConstArray(); - for (INT32 i = 0; i < nLen; ++i) - { - BOOL *pbVal = NULL, - *pbResVal = NULL; - - if (A2OU( UPN_IS_GERMAN_PRE_REFORM ) == pPropName[i]) - { - pbVal = &bIsGermanPreReform; - pbResVal = &bResIsGermanPreReform; - } - else if (A2OU( UPN_IS_IGNORE_CONTROL_CHARACTERS ) == pPropName[i]) - { - pbVal = &bIsIgnoreControlCharacters; - pbResVal = &bResIsIgnoreControlCharacters; - } - else if (A2OU( UPN_IS_USE_DICTIONARY_LIST ) == pPropName[i]) - { - pbVal = &bIsUseDictionaryList; - pbResVal = &bResIsUseDictionaryList; - } - else if (A2OU( UPN_IS_SPELL_UPPER_CASE ) == pPropName[i]) - { - pbVal = &bIsSpellUpperCase; - pbResVal = &bResIsSpellUpperCase; - } - else if (A2OU( UPN_IS_SPELL_WITH_DIGITS ) == pPropName[i]) - { - pbVal = &bIsSpellWithDigits; - pbResVal = &bResIsSpellWithDigits; - } - else if (A2OU( UPN_IS_SPELL_CAPITALIZATION ) == pPropName[i]) - { - pbVal = &bIsSpellCapitalization; - pbResVal = &bResIsSpellCapitalization; - } - - if (pbVal && pbResVal) - { - rxPropSet->getPropertyValue( pPropName[i] ) >>= *pbVal; - *pbResVal = *pbVal; - } - } - } -} - - -PropertyHelper_Spell::~PropertyHelper_Spell() -{ -} - - -void PropertyHelper_Spell::SetDefault() -{ - bResIsGermanPreReform = bIsGermanPreReform = FALSE; - bResIsIgnoreControlCharacters = bIsIgnoreControlCharacters = TRUE; - bResIsUseDictionaryList = bIsUseDictionaryList = TRUE; - bResIsSpellUpperCase = bIsSpellUpperCase = FALSE; - bResIsSpellWithDigits = bIsSpellWithDigits = FALSE; - bResIsSpellCapitalization = bIsSpellCapitalization = TRUE; -} - - -void SAL_CALL - PropertyHelper_Spell::propertyChange( const PropertyChangeEvent& rEvt ) - throw(RuntimeException) -{ - MutexGuard aGuard( GetLinguMutex() ); - - if (GetPropSet().is() && rEvt.Source == GetPropSet()) - { - INT16 nLngSvcFlags = 0; - BOOL bSCWA = FALSE, // SPELL_CORRECT_WORDS_AGAIN ? - bSWWA = FALSE; // SPELL_WRONG_WORDS_AGAIN ? - - BOOL *pbVal = NULL; - switch (rEvt.PropertyHandle) - { - case UPH_IS_IGNORE_CONTROL_CHARACTERS : - { - pbVal = &bIsIgnoreControlCharacters; - break; - } - case UPH_IS_GERMAN_PRE_REFORM : - { - pbVal = &bIsGermanPreReform; - bSCWA = bSWWA = TRUE; - break; - } - case UPH_IS_USE_DICTIONARY_LIST : - { - pbVal = &bIsUseDictionaryList; - bSCWA = bSWWA = TRUE; - break; - } - case UPH_IS_SPELL_UPPER_CASE : - { - pbVal = &bIsSpellUpperCase; - bSCWA = FALSE == *pbVal; // FALSE->TRUE change? - bSWWA = !bSCWA; // TRUE->FALSE change? - break; - } - case UPH_IS_SPELL_WITH_DIGITS : - { - pbVal = &bIsSpellWithDigits; - bSCWA = FALSE == *pbVal; // FALSE->TRUE change? - bSWWA = !bSCWA; // TRUE->FALSE change? - break; - } - case UPH_IS_SPELL_CAPITALIZATION : - { - pbVal = &bIsSpellCapitalization; - bSCWA = FALSE == *pbVal; // FALSE->TRUE change? - bSWWA = !bSCWA; // TRUE->FALSE change? - break; - } - default: - DBG_ERROR( "unknown property" ); - } - if (pbVal) - rEvt.NewValue >>= *pbVal; - - if (bSCWA) - nLngSvcFlags |= LinguServiceEventFlags::SPELL_CORRECT_WORDS_AGAIN; - if (bSWWA) - nLngSvcFlags |= LinguServiceEventFlags::SPELL_WRONG_WORDS_AGAIN; - if (nLngSvcFlags) - { - LinguServiceEvent aEvt( GetEvtObj(), nLngSvcFlags ); - LaunchEvent( aEvt ); - } - } -} - - -void PropertyHelper_Spell::SetTmpPropVals( const PropertyValues &rPropVals ) -{ - // set return value to default value unless there is an - // explicitly supplied temporary value - bResIsGermanPreReform = bIsGermanPreReform; - bResIsIgnoreControlCharacters = bIsIgnoreControlCharacters; - bResIsUseDictionaryList = bIsUseDictionaryList; - bResIsSpellUpperCase = bIsSpellUpperCase; - bResIsSpellWithDigits = bIsSpellWithDigits; - bResIsSpellCapitalization = bIsSpellCapitalization; - // - INT32 nLen = rPropVals.getLength(); - if (nLen) - { - const PropertyValue *pVal = rPropVals.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) - { - BOOL *pbResVal = NULL; - switch (pVal[i].Handle) - { - case UPH_IS_GERMAN_PRE_REFORM : pbResVal = &bResIsGermanPreReform; break; - case UPH_IS_IGNORE_CONTROL_CHARACTERS : pbResVal = &bResIsIgnoreControlCharacters; break; - case UPH_IS_USE_DICTIONARY_LIST : pbResVal = &bResIsUseDictionaryList; break; - case UPH_IS_SPELL_UPPER_CASE : pbResVal = &bResIsSpellUpperCase; break; - case UPH_IS_SPELL_WITH_DIGITS : pbResVal = &bResIsSpellWithDigits; break; - case UPH_IS_SPELL_CAPITALIZATION : pbResVal = &bResIsSpellCapitalization; break; - default: - DBG_ERROR( "unknown property" ); - } - if (pbResVal) - pVal[i].Value >>= *pbResVal; - } - } -} - -/////////////////////////////////////////////////////////////////////////// - diff --git a/lingucomponent/source/spellcheck/macosxspell/sprophelp.hxx b/lingucomponent/source/spellcheck/macosxspell/sprophelp.hxx deleted file mode 100644 index 2a61c8e52c49..000000000000 --- a/lingucomponent/source/spellcheck/macosxspell/sprophelp.hxx +++ /dev/null @@ -1,175 +0,0 @@ -/************************************************************************* - * - * 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: sprophelp.hxx,v $ - * $Revision: 1.3 $ - * - * 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. - * - ************************************************************************/ - -#ifndef _LINGU2_PROPHELP_HXX_ -#define _LINGU2_PROPHELP_HXX_ - -#include <tools/solar.h> - -#include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type -#include <cppuhelper/implbase2.hxx> // helper for implementations -#include <cppuhelper/interfacecontainer.h> -#include <com/sun/star/beans/XPropertyChangeListener.hpp> -#include <com/sun/star/beans/PropertyValues.hpp> - -#include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp> - -namespace com { namespace sun { namespace star { namespace beans { - class XPropertySet; -}}}} - -namespace com { namespace sun { namespace star { namespace linguistic2 { - struct LinguServiceEvent; -}}}} - - -using namespace ::rtl; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::linguistic2; - -/////////////////////////////////////////////////////////////////////////// -// PropertyChgHelper -// virtual base class for all XPropertyChangeListener members of the -// various lingu services. -// Only propertyChange needs to be implemented. - -class PropertyChgHelper : - public cppu::WeakImplHelper2 - < - XPropertyChangeListener, - XLinguServiceEventBroadcaster - > -{ - Sequence< OUString > aPropNames; - Reference< XInterface > xMyEvtObj; - ::cppu::OInterfaceContainerHelper aLngSvcEvtListeners; - Reference< XPropertySet > xPropSet; - - // disallow use of copy-constructor and assignment-operator - PropertyChgHelper( const PropertyChgHelper & ); - PropertyChgHelper & operator = ( const PropertyChgHelper & ); - -public: - PropertyChgHelper( - const Reference< XInterface > &rxSource, - Reference< XPropertySet > &rxPropSet, - const char *pPropNames[], USHORT nPropCount ); - virtual ~PropertyChgHelper(); - - // XEventListener - virtual void SAL_CALL - disposing( const EventObject& rSource ) - throw(RuntimeException); - - // XPropertyChangeListener - virtual void SAL_CALL - propertyChange( const PropertyChangeEvent& rEvt ) - throw(RuntimeException) = 0; - - // XLinguServiceEventBroadcaster - virtual sal_Bool SAL_CALL - addLinguServiceEventListener( - const Reference< XLinguServiceEventListener >& rxListener ) - throw(RuntimeException); - virtual sal_Bool SAL_CALL - removeLinguServiceEventListener( - const Reference< XLinguServiceEventListener >& rxListener ) - throw(RuntimeException); - - // non UNO functions - void AddAsPropListener(); - void RemoveAsPropListener(); - void LaunchEvent( const LinguServiceEvent& rEvt ); - - const Sequence< OUString > & - GetPropNames() const { return aPropNames; } - const Reference< XPropertySet > & - GetPropSet() const { return xPropSet; } - const Reference< XInterface > & - GetEvtObj() const { return xMyEvtObj; } -}; - - -/////////////////////////////////////////////////////////////////////////// - - -class PropertyHelper_Spell : - public PropertyChgHelper -{ - // default values - BOOL bIsGermanPreReform; - BOOL bIsIgnoreControlCharacters; - BOOL bIsUseDictionaryList; - BOOL bIsSpellUpperCase; - BOOL bIsSpellWithDigits; - BOOL bIsSpellCapitalization; - - // return values, will be set to default value or current temporary value - BOOL bResIsGermanPreReform; - BOOL bResIsIgnoreControlCharacters; - BOOL bResIsUseDictionaryList; - BOOL bResIsSpellUpperCase; - BOOL bResIsSpellWithDigits; - BOOL bResIsSpellCapitalization; - - - // disallow use of copy-constructor and assignment-operator - PropertyHelper_Spell( const PropertyHelper_Spell & ); - PropertyHelper_Spell & operator = ( const PropertyHelper_Spell & ); - - void SetDefault(); - -public: - PropertyHelper_Spell( - const Reference< XInterface > &rxSource, - Reference< XPropertySet > &rxPropSet ); - virtual ~PropertyHelper_Spell(); - - // XPropertyChangeListener - virtual void SAL_CALL - propertyChange( const PropertyChangeEvent& rEvt ) - throw(RuntimeException); - - void SetTmpPropVals( const PropertyValues &rPropVals ); - - BOOL IsGermanPreReform() const { return bResIsGermanPreReform; } - BOOL IsIgnoreControlCharacters() const { return bResIsIgnoreControlCharacters; } - BOOL IsUseDictionaryList() const { return bResIsUseDictionaryList; } - BOOL IsSpellUpperCase() const { return bResIsSpellUpperCase; } - BOOL IsSpellWithDigits() const { return bResIsSpellWithDigits; } - BOOL IsSpellCapitalization() const { return bResIsSpellCapitalization; } -}; - -/////////////////////////////////////////////////////////////////////////// - -#endif - diff --git a/lingucomponent/source/spellcheck/spell/makefile.mk b/lingucomponent/source/spellcheck/spell/makefile.mk index c203e22f4afa..623ade9f3f3c 100644 --- a/lingucomponent/source/spellcheck/spell/makefile.mk +++ b/lingucomponent/source/spellcheck/spell/makefile.mk @@ -51,11 +51,9 @@ CFLAGSCXX += -I$(PRJ)$/source$/lingutil $(HUNSPELL_CFLAGS) CFLAGSCC += -I$(PRJ)$/source$/lingutil $(HUNSPELL_CFLAGS) EXCEPTIONSFILES= \ - $(SLO)$/sprophelp.obj\ $(SLO)$/sspellimp.obj SLOFILES= \ - $(SLO)$/sprophelp.obj\ $(SLO)$/sreg.obj\ $(SLO)$/sspellimp.obj @@ -66,21 +64,16 @@ SHL1STDLIBS= \ $(CPPULIB) \ $(CPPUHELPERLIB) \ $(I18NISOLANGLIB) \ - $(VOSLIB) \ $(TOOLSLIB) \ - $(SVTOOLLIB) \ $(SVLLIB) \ - $(VCLLIB) \ $(SALLIB) \ - $(UCBHELPERLIB) \ - $(UNOTOOLSLIB) \ $(LNGLIB) \ $(ULINGULIB) \ $(ICUUCLIB) \ $(HUNSPELLLIB) # build DLL -SHL1LIBS= $(SLB)$/$(TARGET).lib +SHL1LIBS= $(SLB)$/$(TARGET).lib $(SLB)$/libulingu.lib SHL1IMPLIB= i$(TARGET) SHL1DEPN= $(SHL1LIBS) SHL1DEF= $(MISC)$/$(SHL1TARGET).def diff --git a/lingucomponent/source/spellcheck/spell/sprophelp.cxx b/lingucomponent/source/spellcheck/spell/sprophelp.cxx deleted file mode 100644 index fc227598b731..000000000000 --- a/lingucomponent/source/spellcheck/spell/sprophelp.cxx +++ /dev/null @@ -1,375 +0,0 @@ -/************************************************************************* - * - * 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: sprophelp.cxx,v $ - * $Revision: 1.7 $ - * - * 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_lingucomponent.hxx" - -#include <linguistic/misc.hxx> - -#include "sprophelp.hxx" -#include <linguistic/lngprops.hxx> -#include <tools/debug.hxx> - -#include <com/sun/star/linguistic2/LinguServiceEvent.hpp> -#include <com/sun/star/linguistic2/LinguServiceEventFlags.hpp> -#include <com/sun/star/linguistic2/XLinguServiceEventListener.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <osl/mutex.hxx> - -//using namespace utl; -using namespace osl; -using namespace rtl; -using namespace com::sun::star; -using namespace com::sun::star::beans; -using namespace com::sun::star::lang; -using namespace com::sun::star::uno; -using namespace com::sun::star::linguistic2; -using namespace linguistic; - - -#define A2OU(x) ::rtl::OUString::createFromAscii( x ) - -/////////////////////////////////////////////////////////////////////////// - - -PropertyChgHelper::PropertyChgHelper( - const Reference< XInterface > & rxSource, - Reference< XPropertySet > &rxPropSet, - const char *pPropNames[], USHORT nPropCount ) : - aPropNames (nPropCount), - xMyEvtObj (rxSource), - aLngSvcEvtListeners (GetLinguMutex()), - xPropSet (rxPropSet) -{ - OUString *pName = aPropNames.getArray(); - for (INT32 i = 0; i < nPropCount; ++i) - { - pName[i] = A2OU( pPropNames[i] ); - } -} - - -/*PropertyChgHelper::PropertyChgHelper( const PropertyChgHelper &rHelper ) : - aLngSvcEvtListeners (GetLinguMutex()) -{ - xPropSet = rHelper.xPropSet; - aPropNames = rHelper.aPropNames; - AddAsPropListener(); - - xMyEvtObj = rHelper.xMyEvtObj; -} */ - - -PropertyChgHelper::~PropertyChgHelper() -{ -} - - -void PropertyChgHelper::AddAsPropListener() -{ - if (xPropSet.is()) - { - INT32 nLen = aPropNames.getLength(); - const OUString *pPropName = aPropNames.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) - { - if (pPropName[i].getLength()) - xPropSet->addPropertyChangeListener( pPropName[i], this ); - } - } -} - -void PropertyChgHelper::RemoveAsPropListener() -{ - if (xPropSet.is()) - { - INT32 nLen = aPropNames.getLength(); - const OUString *pPropName = aPropNames.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) - { - if (pPropName[i].getLength()) - xPropSet->removePropertyChangeListener( pPropName[i], this ); - } - } -} - - -void PropertyChgHelper::LaunchEvent( const LinguServiceEvent &rEvt ) -{ - cppu::OInterfaceIteratorHelper aIt( aLngSvcEvtListeners ); - while (aIt.hasMoreElements()) - { - Reference< XLinguServiceEventListener > xRef( aIt.next(), UNO_QUERY ); - if (xRef.is()) - xRef->processLinguServiceEvent( rEvt ); - } -} - - -void SAL_CALL PropertyChgHelper::disposing( const EventObject& rSource ) - throw(RuntimeException) -{ - MutexGuard aGuard( GetLinguMutex() ); - if (rSource.Source == xPropSet) - { - RemoveAsPropListener(); - xPropSet = NULL; - aPropNames.realloc( 0 ); - } -} - - -sal_Bool SAL_CALL - PropertyChgHelper::addLinguServiceEventListener( - const Reference< XLinguServiceEventListener >& rxListener ) - throw(RuntimeException) -{ - MutexGuard aGuard( GetLinguMutex() ); - - BOOL bRes = FALSE; - if (rxListener.is()) - { - INT32 nCount = aLngSvcEvtListeners.getLength(); - bRes = aLngSvcEvtListeners.addInterface( rxListener ) != nCount; - } - return bRes; -} - - -sal_Bool SAL_CALL - PropertyChgHelper::removeLinguServiceEventListener( - const Reference< XLinguServiceEventListener >& rxListener ) - throw(RuntimeException) -{ - MutexGuard aGuard( GetLinguMutex() ); - - BOOL bRes = FALSE; - if (rxListener.is()) - { - INT32 nCount = aLngSvcEvtListeners.getLength(); - bRes = aLngSvcEvtListeners.removeInterface( rxListener ) != nCount; - } - return bRes; -} - -/////////////////////////////////////////////////////////////////////////// - -static const char *aSP[] = -{ - UPN_IS_GERMAN_PRE_REFORM, - UPN_IS_IGNORE_CONTROL_CHARACTERS, - UPN_IS_USE_DICTIONARY_LIST, - UPN_IS_SPELL_UPPER_CASE, - UPN_IS_SPELL_WITH_DIGITS, - UPN_IS_SPELL_CAPITALIZATION -}; - - -PropertyHelper_Spell::PropertyHelper_Spell( - const Reference< XInterface > & rxSource, - Reference< XPropertySet > &rxPropSet ) : - PropertyChgHelper ( rxSource, rxPropSet, aSP, sizeof(aSP) / sizeof(aSP[0]) ) -{ - SetDefault(); - INT32 nLen = GetPropNames().getLength(); - if (rxPropSet.is() && nLen) - { - const OUString *pPropName = GetPropNames().getConstArray(); - for (INT32 i = 0; i < nLen; ++i) - { - BOOL *pbVal = NULL, - *pbResVal = NULL; - - if (A2OU( UPN_IS_GERMAN_PRE_REFORM ) == pPropName[i]) - { - pbVal = &bIsGermanPreReform; - pbResVal = &bResIsGermanPreReform; - } - else if (A2OU( UPN_IS_IGNORE_CONTROL_CHARACTERS ) == pPropName[i]) - { - pbVal = &bIsIgnoreControlCharacters; - pbResVal = &bResIsIgnoreControlCharacters; - } - else if (A2OU( UPN_IS_USE_DICTIONARY_LIST ) == pPropName[i]) - { - pbVal = &bIsUseDictionaryList; - pbResVal = &bResIsUseDictionaryList; - } - else if (A2OU( UPN_IS_SPELL_UPPER_CASE ) == pPropName[i]) - { - pbVal = &bIsSpellUpperCase; - pbResVal = &bResIsSpellUpperCase; - } - else if (A2OU( UPN_IS_SPELL_WITH_DIGITS ) == pPropName[i]) - { - pbVal = &bIsSpellWithDigits; - pbResVal = &bResIsSpellWithDigits; - } - else if (A2OU( UPN_IS_SPELL_CAPITALIZATION ) == pPropName[i]) - { - pbVal = &bIsSpellCapitalization; - pbResVal = &bResIsSpellCapitalization; - } - - if (pbVal && pbResVal) - { - rxPropSet->getPropertyValue( pPropName[i] ) >>= *pbVal; - *pbResVal = *pbVal; - } - } - } -} - - -PropertyHelper_Spell::~PropertyHelper_Spell() -{ -} - - -void PropertyHelper_Spell::SetDefault() -{ - bResIsGermanPreReform = bIsGermanPreReform = FALSE; - bResIsIgnoreControlCharacters = bIsIgnoreControlCharacters = TRUE; - bResIsUseDictionaryList = bIsUseDictionaryList = TRUE; - bResIsSpellUpperCase = bIsSpellUpperCase = FALSE; - bResIsSpellWithDigits = bIsSpellWithDigits = FALSE; - bResIsSpellCapitalization = bIsSpellCapitalization = TRUE; -} - - -void SAL_CALL - PropertyHelper_Spell::propertyChange( const PropertyChangeEvent& rEvt ) - throw(RuntimeException) -{ - MutexGuard aGuard( GetLinguMutex() ); - - if (GetPropSet().is() && rEvt.Source == GetPropSet()) - { - INT16 nLngSvcFlags = 0; - BOOL bSCWA = FALSE, // SPELL_CORRECT_WORDS_AGAIN ? - bSWWA = FALSE; // SPELL_WRONG_WORDS_AGAIN ? - - BOOL *pbVal = NULL; - switch (rEvt.PropertyHandle) - { - case UPH_IS_IGNORE_CONTROL_CHARACTERS : - { - pbVal = &bIsIgnoreControlCharacters; - break; - } - case UPH_IS_GERMAN_PRE_REFORM : - { - pbVal = &bIsGermanPreReform; - bSCWA = bSWWA = TRUE; - break; - } - case UPH_IS_USE_DICTIONARY_LIST : - { - pbVal = &bIsUseDictionaryList; - bSCWA = bSWWA = TRUE; - break; - } - case UPH_IS_SPELL_UPPER_CASE : - { - pbVal = &bIsSpellUpperCase; - bSCWA = FALSE == *pbVal; // FALSE->TRUE change? - bSWWA = !bSCWA; // TRUE->FALSE change? - break; - } - case UPH_IS_SPELL_WITH_DIGITS : - { - pbVal = &bIsSpellWithDigits; - bSCWA = FALSE == *pbVal; // FALSE->TRUE change? - bSWWA = !bSCWA; // TRUE->FALSE change? - break; - } - case UPH_IS_SPELL_CAPITALIZATION : - { - pbVal = &bIsSpellCapitalization; - bSCWA = FALSE == *pbVal; // FALSE->TRUE change? - bSWWA = !bSCWA; // TRUE->FALSE change? - break; - } - default: - DBG_ERROR( "unknown property" ); - } - if (pbVal) - rEvt.NewValue >>= *pbVal; - - if (bSCWA) - nLngSvcFlags |= LinguServiceEventFlags::SPELL_CORRECT_WORDS_AGAIN; - if (bSWWA) - nLngSvcFlags |= LinguServiceEventFlags::SPELL_WRONG_WORDS_AGAIN; - if (nLngSvcFlags) - { - LinguServiceEvent aEvt( GetEvtObj(), nLngSvcFlags ); - LaunchEvent( aEvt ); - } - } -} - - -void PropertyHelper_Spell::SetTmpPropVals( const PropertyValues &rPropVals ) -{ - // set return value to default value unless there is an - // explicitly supplied temporary value - bResIsGermanPreReform = bIsGermanPreReform; - bResIsIgnoreControlCharacters = bIsIgnoreControlCharacters; - bResIsUseDictionaryList = bIsUseDictionaryList; - bResIsSpellUpperCase = bIsSpellUpperCase; - bResIsSpellWithDigits = bIsSpellWithDigits; - bResIsSpellCapitalization = bIsSpellCapitalization; - // - INT32 nLen = rPropVals.getLength(); - if (nLen) - { - const PropertyValue *pVal = rPropVals.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) - { - BOOL *pbResVal = NULL; - switch (pVal[i].Handle) - { - case UPH_IS_GERMAN_PRE_REFORM : pbResVal = &bResIsGermanPreReform; break; - case UPH_IS_IGNORE_CONTROL_CHARACTERS : pbResVal = &bResIsIgnoreControlCharacters; break; - case UPH_IS_USE_DICTIONARY_LIST : pbResVal = &bResIsUseDictionaryList; break; - case UPH_IS_SPELL_UPPER_CASE : pbResVal = &bResIsSpellUpperCase; break; - case UPH_IS_SPELL_WITH_DIGITS : pbResVal = &bResIsSpellWithDigits; break; - case UPH_IS_SPELL_CAPITALIZATION : pbResVal = &bResIsSpellCapitalization; break; - default: - DBG_ERROR( "unknown property" ); - } - if (pbResVal) - pVal[i].Value >>= *pbResVal; - } - } -} - -/////////////////////////////////////////////////////////////////////////// - diff --git a/lingucomponent/source/spellcheck/spell/sprophelp.hxx b/lingucomponent/source/spellcheck/spell/sprophelp.hxx deleted file mode 100644 index a6ccb05dffb9..000000000000 --- a/lingucomponent/source/spellcheck/spell/sprophelp.hxx +++ /dev/null @@ -1,175 +0,0 @@ -/************************************************************************* - * - * 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: sprophelp.hxx,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. - * - ************************************************************************/ - -#ifndef _LINGU2_PROPHELP_HXX_ -#define _LINGU2_PROPHELP_HXX_ - -#include <tools/solar.h> - -#include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type -#include <cppuhelper/implbase2.hxx> // helper for implementations -#include <cppuhelper/interfacecontainer.h> -#include <com/sun/star/beans/XPropertyChangeListener.hpp> -#include <com/sun/star/beans/PropertyValues.hpp> - -#include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp> - -namespace com { namespace sun { namespace star { namespace beans { - class XPropertySet; -}}}} - -namespace com { namespace sun { namespace star { namespace linguistic2 { - struct LinguServiceEvent; -}}}} - - -using namespace ::rtl; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::linguistic2; - -/////////////////////////////////////////////////////////////////////////// -// PropertyChgHelper -// virtual base class for all XPropertyChangeListener members of the -// various lingu services. -// Only propertyChange needs to be implemented. - -class PropertyChgHelper : - public cppu::WeakImplHelper2 - < - XPropertyChangeListener, - XLinguServiceEventBroadcaster - > -{ - Sequence< OUString > aPropNames; - Reference< XInterface > xMyEvtObj; - ::cppu::OInterfaceContainerHelper aLngSvcEvtListeners; - Reference< XPropertySet > xPropSet; - - // disallow use of copy-constructor and assignment-operator - PropertyChgHelper( const PropertyChgHelper & ); - PropertyChgHelper & operator = ( const PropertyChgHelper & ); - -public: - PropertyChgHelper( - const Reference< XInterface > &rxSource, - Reference< XPropertySet > &rxPropSet, - const char *pPropNames[], USHORT nPropCount ); - virtual ~PropertyChgHelper(); - - // XEventListener - virtual void SAL_CALL - disposing( const EventObject& rSource ) - throw(RuntimeException); - - // XPropertyChangeListener - virtual void SAL_CALL - propertyChange( const PropertyChangeEvent& rEvt ) - throw(RuntimeException) = 0; - - // XLinguServiceEventBroadcaster - virtual sal_Bool SAL_CALL - addLinguServiceEventListener( - const Reference< XLinguServiceEventListener >& rxListener ) - throw(RuntimeException); - virtual sal_Bool SAL_CALL - removeLinguServiceEventListener( - const Reference< XLinguServiceEventListener >& rxListener ) - throw(RuntimeException); - - // non UNO functions - void AddAsPropListener(); - void RemoveAsPropListener(); - void LaunchEvent( const LinguServiceEvent& rEvt ); - - const Sequence< OUString > & - GetPropNames() const { return aPropNames; } - const Reference< XPropertySet > & - GetPropSet() const { return xPropSet; } - const Reference< XInterface > & - GetEvtObj() const { return xMyEvtObj; } -}; - - -/////////////////////////////////////////////////////////////////////////// - - -class PropertyHelper_Spell : - public PropertyChgHelper -{ - // default values - BOOL bIsGermanPreReform; - BOOL bIsIgnoreControlCharacters; - BOOL bIsUseDictionaryList; - BOOL bIsSpellUpperCase; - BOOL bIsSpellWithDigits; - BOOL bIsSpellCapitalization; - - // return values, will be set to default value or current temporary value - BOOL bResIsGermanPreReform; - BOOL bResIsIgnoreControlCharacters; - BOOL bResIsUseDictionaryList; - BOOL bResIsSpellUpperCase; - BOOL bResIsSpellWithDigits; - BOOL bResIsSpellCapitalization; - - - // disallow use of copy-constructor and assignment-operator - PropertyHelper_Spell( const PropertyHelper_Spell & ); - PropertyHelper_Spell & operator = ( const PropertyHelper_Spell & ); - - void SetDefault(); - -public: - PropertyHelper_Spell( - const Reference< XInterface > &rxSource, - Reference< XPropertySet > &rxPropSet ); - virtual ~PropertyHelper_Spell(); - - // XPropertyChangeListener - virtual void SAL_CALL - propertyChange( const PropertyChangeEvent& rEvt ) - throw(RuntimeException); - - void SetTmpPropVals( const PropertyValues &rPropVals ); - - BOOL IsGermanPreReform() const { return bResIsGermanPreReform; } - BOOL IsIgnoreControlCharacters() const { return bResIsIgnoreControlCharacters; } - BOOL IsUseDictionaryList() const { return bResIsUseDictionaryList; } - BOOL IsSpellUpperCase() const { return bResIsSpellUpperCase; } - BOOL IsSpellWithDigits() const { return bResIsSpellWithDigits; } - BOOL IsSpellCapitalization() const { return bResIsSpellCapitalization; } -}; - -/////////////////////////////////////////////////////////////////////////// - -#endif - diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.hxx b/lingucomponent/source/spellcheck/spell/sspellimp.hxx index d227061cad7c..b8807b99b443 100644 --- a/lingucomponent/source/spellcheck/spell/sspellimp.hxx +++ b/lingucomponent/source/spellcheck/spell/sspellimp.hxx @@ -45,9 +45,10 @@ #include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp> #include <tools/table.hxx> -#include <lingutil.hxx> #include <linguistic/misc.hxx> -#include "sprophelp.hxx" +#include <linguistic/lngprophelp.hxx> + +#include <lingutil.hxx> using namespace ::rtl; using namespace ::com::sun::star::uno; @@ -79,15 +80,15 @@ class SpellChecker : ::cppu::OInterfaceContainerHelper aEvtListeners; Reference< XPropertyChangeListener > xPropHelper; - PropertyHelper_Spell * pPropHelper; + linguistic::PropertyHelper_Spell * pPropHelper; BOOL bDisposing; // disallow copy-constructor and assignment-operator for now SpellChecker(const SpellChecker &); SpellChecker & operator = (const SpellChecker &); - PropertyHelper_Spell & GetPropHelper_Impl(); - PropertyHelper_Spell & GetPropHelper() + linguistic::PropertyHelper_Spell & GetPropHelper_Impl(); + linguistic::PropertyHelper_Spell & GetPropHelper() { return pPropHelper ? *pPropHelper : GetPropHelper_Impl(); } diff --git a/lingucomponent/source/thesaurus/libnth/makefile.mk b/lingucomponent/source/thesaurus/libnth/makefile.mk index 80c7e761d788..acc45476c093 100644 --- a/lingucomponent/source/thesaurus/libnth/makefile.mk +++ b/lingucomponent/source/thesaurus/libnth/makefile.mk @@ -69,12 +69,11 @@ CFLAGSCXX += -I$(PRJ)$/source$/lingutil $(HUNSPELL_CFLAGS) CFLAGSCC += -I$(PRJ)$/source$/lingutil $(HUNSPELL_CFLAGS) EXCEPTIONSFILES= \ - $(SLO)$/ntprophelp.obj\ - $(SLO)$/nthesimp.obj + $(SLO)$/nthesimp.obj \ + $(SLO)$/nthesdta.obj SLOFILES= \ $(SLO)$/nthesdta.obj\ - $(SLO)$/ntprophelp.obj\ $(SLO)$/ntreg.obj\ $(SLO)$/nthesimp.obj @@ -84,14 +83,10 @@ SHL1TARGET= $(TARGET)$(DLLPOSTFIX) SHL1STDLIBS= \ $(CPPULIB) \ $(CPPUHELPERLIB) \ - $(VOSLIB) \ $(TOOLSLIB) \ $(I18NISOLANGLIB) \ - $(SVTOOLLIB) \ $(SVLLIB) \ - $(VCLLIB) \ $(SALLIB) \ - $(UCBHELPERLIB) \ $(UNOTOOLSLIB) \ $(LNGLIB) \ $(ULINGULIB) \ @@ -99,7 +94,7 @@ SHL1STDLIBS= \ $(HUNSPELLLIB) # build DLL -SHL1LIBS= $(SLB)$/$(TARGET).lib +SHL1LIBS= $(SLB)$/$(TARGET).lib $(SLB)$/libulingu.lib SHL1IMPLIB= i$(TARGET) SHL1DEPN= $(SHL1LIBS) SHL1DEF= $(MISC)$/$(SHL1TARGET).def diff --git a/lingucomponent/source/thesaurus/libnth/nthesimp.hxx b/lingucomponent/source/thesaurus/libnth/nthesimp.hxx index f75cc29b9755..2235ebe87a2e 100644 --- a/lingucomponent/source/thesaurus/libnth/nthesimp.hxx +++ b/lingucomponent/source/thesaurus/libnth/nthesimp.hxx @@ -55,7 +55,7 @@ #include <lingutil.hxx> #include <linguistic/misc.hxx> -#include "ntprophelp.hxx" +#include <linguistic/lngprophelp.hxx> #include <osl/file.hxx> #include "mythes.hxx" @@ -89,7 +89,7 @@ class Thesaurus : ::cppu::OInterfaceContainerHelper aEvtListeners; Reference< XPropertyChangeListener > xPropHelper; - PropertyHelper_Thes * pPropHelper; + linguistic::PropertyHelper_Thes * pPropHelper; BOOL bDisposing; CharClass ** aCharSetInfo; MyThes ** aThes; @@ -107,8 +107,8 @@ class Thesaurus : Thesaurus(const Thesaurus &); Thesaurus & operator = (const Thesaurus &); - PropertyHelper_Thes & GetPropHelper_Impl(); - PropertyHelper_Thes & GetPropHelper() + linguistic::PropertyHelper_Thes & GetPropHelper_Impl(); + linguistic::PropertyHelper_Thes & GetPropHelper() { return pPropHelper ? *pPropHelper : GetPropHelper_Impl(); } diff --git a/lingucomponent/source/thesaurus/libnth/ntprophelp.cxx b/lingucomponent/source/thesaurus/libnth/ntprophelp.cxx deleted file mode 100644 index b3280d807e12..000000000000 --- a/lingucomponent/source/thesaurus/libnth/ntprophelp.cxx +++ /dev/null @@ -1,326 +0,0 @@ -/************************************************************************* - * - * 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: ntprophelp.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_lingucomponent.hxx" - -#include <linguistic/misc.hxx> - -#include "ntprophelp.hxx" -#include <linguistic/lngprops.hxx> -#include <tools/debug.hxx> - -#include <com/sun/star/linguistic2/LinguServiceEvent.hpp> -#include <com/sun/star/linguistic2/LinguServiceEventFlags.hpp> -#include <com/sun/star/linguistic2/XLinguServiceEventListener.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <osl/mutex.hxx> - -//using namespace utl; -using namespace osl; -using namespace rtl; -using namespace com::sun::star; -using namespace com::sun::star::beans; -using namespace com::sun::star::lang; -using namespace com::sun::star::uno; -using namespace com::sun::star::linguistic2; -using namespace linguistic; - - -#define A2OU(x) ::rtl::OUString::createFromAscii( x ) - -/////////////////////////////////////////////////////////////////////////// - - -PropertyChgHelper::PropertyChgHelper( - const Reference< XInterface > & rxSource, - Reference< XPropertySet > &rxPropSet, - const char *pPropNames[], USHORT nPropCount ) : - aPropNames (nPropCount), - xMyEvtObj (rxSource), - aLngSvcEvtListeners (GetLinguMutex()), - xPropSet (rxPropSet) -{ - OUString *pName = aPropNames.getArray(); - for (INT32 i = 0; i < nPropCount; ++i) - { - pName[i] = A2OU( pPropNames[i] ); - } -} - - -/*PropertyChgHelper::PropertyChgHelper( const PropertyChgHelper &rHelper ) : - aLngSvcEvtListeners (GetLinguMutex()) -{ - xPropSet = rHelper.xPropSet; - aPropNames = rHelper.aPropNames; - AddAsPropListener(); - - xMyEvtObj = rHelper.xMyEvtObj; -} */ - - -PropertyChgHelper::~PropertyChgHelper() -{ -} - - -void PropertyChgHelper::AddAsPropListener() -{ - if (xPropSet.is()) - { - INT32 nLen = aPropNames.getLength(); - const OUString *pPropName = aPropNames.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) - { - if (pPropName[i].getLength()) - xPropSet->addPropertyChangeListener( pPropName[i], this ); - } - } -} - -void PropertyChgHelper::RemoveAsPropListener() -{ - if (xPropSet.is()) - { - INT32 nLen = aPropNames.getLength(); - const OUString *pPropName = aPropNames.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) - { - if (pPropName[i].getLength()) - xPropSet->removePropertyChangeListener( pPropName[i], this ); - } - } -} - - -void PropertyChgHelper::LaunchEvent( const LinguServiceEvent &rEvt ) -{ - cppu::OInterfaceIteratorHelper aIt( aLngSvcEvtListeners ); - while (aIt.hasMoreElements()) - { - Reference< XLinguServiceEventListener > xRef( aIt.next(), UNO_QUERY ); - if (xRef.is()) - xRef->processLinguServiceEvent( rEvt ); - } -} - - -void SAL_CALL PropertyChgHelper::disposing( const EventObject& rSource ) - throw(RuntimeException) -{ - MutexGuard aGuard( GetLinguMutex() ); - if (rSource.Source == xPropSet) - { - RemoveAsPropListener(); - xPropSet = NULL; - aPropNames.realloc( 0 ); - } -} - - -sal_Bool SAL_CALL - PropertyChgHelper::addLinguServiceEventListener( - const Reference< XLinguServiceEventListener >& rxListener ) - throw(RuntimeException) -{ - MutexGuard aGuard( GetLinguMutex() ); - - BOOL bRes = FALSE; - if (rxListener.is()) - { - INT32 nCount = aLngSvcEvtListeners.getLength(); - bRes = aLngSvcEvtListeners.addInterface( rxListener ) != nCount; - } - return bRes; -} - - -sal_Bool SAL_CALL - PropertyChgHelper::removeLinguServiceEventListener( - const Reference< XLinguServiceEventListener >& rxListener ) - throw(RuntimeException) -{ - MutexGuard aGuard( GetLinguMutex() ); - - BOOL bRes = FALSE; - if (rxListener.is()) - { - INT32 nCount = aLngSvcEvtListeners.getLength(); - bRes = aLngSvcEvtListeners.removeInterface( rxListener ) != nCount; - } - return bRes; -} - -/////////////////////////////////////////////////////////////////////////// - -static const char *aSP[] = -{ - UPN_IS_GERMAN_PRE_REFORM, - UPN_IS_IGNORE_CONTROL_CHARACTERS, - UPN_IS_USE_DICTIONARY_LIST, -}; - - -PropertyHelper_Thes::PropertyHelper_Thes( - const Reference< XInterface > & rxSource, - Reference< XPropertySet > &rxPropSet ) : - PropertyChgHelper ( rxSource, rxPropSet, aSP, sizeof(aSP) / sizeof(aSP[0]) ) -{ - SetDefault(); - INT32 nLen = GetPropNames().getLength(); - if (rxPropSet.is() && nLen) - { - const OUString *pPropName = GetPropNames().getConstArray(); - for (INT32 i = 0; i < nLen; ++i) - { - BOOL *pbVal = NULL, - *pbResVal = NULL; - - if (A2OU( UPN_IS_GERMAN_PRE_REFORM ) == pPropName[i]) - { - pbVal = &bIsGermanPreReform; - pbResVal = &bResIsGermanPreReform; - } - else if (A2OU( UPN_IS_IGNORE_CONTROL_CHARACTERS ) == pPropName[i]) - { - pbVal = &bIsIgnoreControlCharacters; - pbResVal = &bResIsIgnoreControlCharacters; - } - else if (A2OU( UPN_IS_USE_DICTIONARY_LIST ) == pPropName[i]) - { - pbVal = &bIsUseDictionaryList; - pbResVal = &bResIsUseDictionaryList; - } - if (pbVal && pbResVal) - { - rxPropSet->getPropertyValue( pPropName[i] ) >>= *pbVal; - *pbResVal = *pbVal; - } - } - } -} - - -PropertyHelper_Thes::~PropertyHelper_Thes() -{ -} - - -void PropertyHelper_Thes::SetDefault() -{ - bResIsGermanPreReform = bIsGermanPreReform = FALSE; - bResIsIgnoreControlCharacters = bIsIgnoreControlCharacters = TRUE; - bResIsUseDictionaryList = bIsUseDictionaryList = TRUE; -} - - -void SAL_CALL - PropertyHelper_Thes::propertyChange( const PropertyChangeEvent& rEvt ) - throw(RuntimeException) -{ - MutexGuard aGuard( GetLinguMutex() ); - - if (GetPropSet().is() && rEvt.Source == GetPropSet()) - { - INT16 nLngSvcFlags = 0; - BOOL bSCWA = FALSE, // SPELL_CORRECT_WORDS_AGAIN ? - bSWWA = FALSE; // SPELL_WRONG_WORDS_AGAIN ? - - BOOL *pbVal = NULL; - switch (rEvt.PropertyHandle) - { - case UPH_IS_IGNORE_CONTROL_CHARACTERS : - { - pbVal = &bIsIgnoreControlCharacters; - break; - } - case UPH_IS_GERMAN_PRE_REFORM : - { - pbVal = &bIsGermanPreReform; - bSCWA = bSWWA = TRUE; - break; - } - case UPH_IS_USE_DICTIONARY_LIST : - { - pbVal = &bIsUseDictionaryList; - bSCWA = bSWWA = TRUE; - break; - } - default: - DBG_ERROR( "unknown property" ); - } - if (pbVal) - rEvt.NewValue >>= *pbVal; - - if (bSCWA) - nLngSvcFlags |= LinguServiceEventFlags::SPELL_CORRECT_WORDS_AGAIN; - if (bSWWA) - nLngSvcFlags |= LinguServiceEventFlags::SPELL_WRONG_WORDS_AGAIN; - if (nLngSvcFlags) - { - LinguServiceEvent aEvt( GetEvtObj(), nLngSvcFlags ); - LaunchEvent( aEvt ); - } - } -} - - -void PropertyHelper_Thes::SetTmpPropVals( const PropertyValues &rPropVals ) -{ - // set return value to default value unless there is an - // explicitly supplied temporary value - bResIsGermanPreReform = bIsGermanPreReform; - bResIsIgnoreControlCharacters = bIsIgnoreControlCharacters; - bResIsUseDictionaryList = bIsUseDictionaryList; - - // - INT32 nLen = rPropVals.getLength(); - if (nLen) - { - const PropertyValue *pVal = rPropVals.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) - { - BOOL *pbResVal = NULL; - switch (pVal[i].Handle) - { - case UPH_IS_GERMAN_PRE_REFORM : pbResVal = &bResIsGermanPreReform; break; - case UPH_IS_IGNORE_CONTROL_CHARACTERS : pbResVal = &bResIsIgnoreControlCharacters; break; - case UPH_IS_USE_DICTIONARY_LIST : pbResVal = &bResIsUseDictionaryList; break; - default: - DBG_ERROR( "unknown property" ); - } - if (pbResVal) - pVal[i].Value >>= *pbResVal; - } - } -} - -/////////////////////////////////////////////////////////////////////////// diff --git a/lingucomponent/source/thesaurus/libnth/ntprophelp.hxx b/lingucomponent/source/thesaurus/libnth/ntprophelp.hxx deleted file mode 100644 index 67bc8d93ff24..000000000000 --- a/lingucomponent/source/thesaurus/libnth/ntprophelp.hxx +++ /dev/null @@ -1,166 +0,0 @@ -/************************************************************************* - * - * 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: ntprophelp.hxx,v $ - * $Revision: 1.5 $ - * - * 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. - * - ************************************************************************/ - -#ifndef _LINGU2_PROPHELP_HXX_ -#define _LINGU2_PROPHELP_HXX_ - -#include <tools/solar.h> - -#include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type -#include <cppuhelper/implbase2.hxx> // helper for implementations -#include <cppuhelper/interfacecontainer.h> -#include <com/sun/star/beans/XPropertyChangeListener.hpp> -#include <com/sun/star/beans/PropertyValues.hpp> - -#include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp> - -namespace com { namespace sun { namespace star { namespace beans { - class XPropertySet; -}}}} - -namespace com { namespace sun { namespace star { namespace linguistic2 { - struct LinguServiceEvent; -}}}} - - -using namespace ::rtl; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::linguistic2; - -/////////////////////////////////////////////////////////////////////////// -// PropertyChgHelper -// virtual base class for all XPropertyChangeListener members of the -// various lingu services. -// Only propertyChange needs to be implemented. - -class PropertyChgHelper : - public cppu::WeakImplHelper2 - < - XPropertyChangeListener, - XLinguServiceEventBroadcaster - > -{ - Sequence< OUString > aPropNames; - Reference< XInterface > xMyEvtObj; - ::cppu::OInterfaceContainerHelper aLngSvcEvtListeners; - Reference< XPropertySet > xPropSet; - - // disallow use of copy-constructor and assignment-operator - PropertyChgHelper( const PropertyChgHelper & ); - PropertyChgHelper & operator = ( const PropertyChgHelper & ); - -public: - PropertyChgHelper( - const Reference< XInterface > &rxSource, - Reference< XPropertySet > &rxPropSet, - const char *pPropNames[], USHORT nPropCount ); - virtual ~PropertyChgHelper(); - - // XEventListener - virtual void SAL_CALL - disposing( const EventObject& rSource ) - throw(RuntimeException); - - // XPropertyChangeListener - virtual void SAL_CALL - propertyChange( const PropertyChangeEvent& rEvt ) - throw(RuntimeException) = 0; - - // XLinguServiceEventBroadcaster - virtual sal_Bool SAL_CALL - addLinguServiceEventListener( - const Reference< XLinguServiceEventListener >& rxListener ) - throw(RuntimeException); - virtual sal_Bool SAL_CALL - removeLinguServiceEventListener( - const Reference< XLinguServiceEventListener >& rxListener ) - throw(RuntimeException); - - // non UNO functions - void AddAsPropListener(); - void RemoveAsPropListener(); - void LaunchEvent( const LinguServiceEvent& rEvt ); - - const Sequence< OUString > & - GetPropNames() const { return aPropNames; } - const Reference< XPropertySet > & - GetPropSet() const { return xPropSet; } - const Reference< XInterface > & - GetEvtObj() const { return xMyEvtObj; } - -}; - - -/////////////////////////////////////////////////////////////////////////// - - -class PropertyHelper_Thes : - public PropertyChgHelper -{ - // default values - BOOL bIsGermanPreReform; - BOOL bIsIgnoreControlCharacters; - BOOL bIsUseDictionaryList; - - // return values, will be set to default value or current temporary value - BOOL bResIsGermanPreReform; - BOOL bResIsIgnoreControlCharacters; - BOOL bResIsUseDictionaryList; - - // disallow use of copy-constructor and assignment-operator - PropertyHelper_Thes( const PropertyHelper_Thes & ); - PropertyHelper_Thes & operator = ( const PropertyHelper_Thes & ); - - void SetDefault(); - -public: - PropertyHelper_Thes( - const Reference< XInterface > &rxSource, - Reference< XPropertySet > &rxPropSet ); - virtual ~PropertyHelper_Thes(); - - // XPropertyChangeListener - virtual void SAL_CALL - propertyChange( const PropertyChangeEvent& rEvt ) - throw(RuntimeException); - - void SetTmpPropVals( const PropertyValues &rPropVals ); - - BOOL IsGermanPreReform() const { return bResIsGermanPreReform; } - BOOL IsIgnoreControlCharacters() const { return bResIsIgnoreControlCharacters; } - BOOL IsUseDictionaryList() const { return bResIsUseDictionaryList; } -}; - -/////////////////////////////////////////////////////////////////////////// - -#endif - diff --git a/package/inc/ZipFile.hxx b/package/inc/ZipFile.hxx index 4eef944a935b..287b899f7ab0 100644 --- a/package/inc/ZipFile.hxx +++ b/package/inc/ZipFile.hxx @@ -131,7 +131,7 @@ public: sal_Bool bDecrypt) throw(::com::sun::star::io::IOException, ::com::sun::star::packages::zip::ZipException, ::com::sun::star::uno::RuntimeException); - static void StaticGetCipher ( const vos::ORef < EncryptionData > & xEncryptionData, rtlCipher &rCipher ); + static sal_Bool StaticGetCipher ( const vos::ORef < EncryptionData > & xEncryptionData, rtlCipher &rCipher, sal_Bool bDecode ); static void StaticFillHeader ( const vos::ORef < EncryptionData > & rData, sal_Int32 nSize, diff --git a/package/qa/storages/StorageUnitTest.java b/package/qa/storages/StorageUnitTest.java index 7e8caa314e96..2ebfb2967e1d 100644 --- a/package/qa/storages/StorageUnitTest.java +++ b/package/qa/storages/StorageUnitTest.java @@ -84,6 +84,7 @@ public class StorageUnitTest extends ComplexTestCase "ExecuteTest15", "ExecuteTest16", "ExecuteTest17", + "ExecuteTest18", "ExecuteRegressionTest_114358", "ExecuteRegressionTest_i29169", "ExecuteRegressionTest_i30400", @@ -97,7 +98,8 @@ public class StorageUnitTest extends ComplexTestCase "ExecuteRegressionTest_i59886", "ExecuteRegressionTest_i61909", "ExecuteRegressionTest_i84234", - "ExecuteRegressionTest_125919"}; + "ExecuteRegressionTest_125919" + }; } public String getTestObjectName() @@ -234,6 +236,11 @@ public class StorageUnitTest extends ComplexTestCase assure( "Test17 failed!", aTest.test() ); } + public void ExecuteTest18() + { + StorageTest aTest = new Test18( m_xMSF, m_xStorageFactory, log ); + assure( "Test18 failed!", aTest.test() ); + } public void ExecuteRegressionTest_114358() { diff --git a/package/qa/storages/Test01.java b/package/qa/storages/Test01.java index e1a78fd85763..a793a2fd5809 100644 --- a/package/qa/storages/Test01.java +++ b/package/qa/storages/Test01.java @@ -58,6 +58,18 @@ public class Test01 implements StorageTest { return false; } + byte pBigBytes[] = new byte[33000]; + for ( int nInd = 0; nInd < 33000; nInd++ ) + pBigBytes[nInd] = (byte)( nInd % 128 ); + + // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes + if ( !m_aTestHelper.WriteBytesToSubstream( xTempSubStorage, "BigSubStream1", "MediaType1", true, pBigBytes ) ) + return false; + + // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes + if ( !m_aTestHelper.WriteBytesToSubstream( xTempSubStorage, "BigSubStream2", "MediaType2", false, pBigBytes ) ) + return false; + byte pBytes1[] = { 1, 1, 1, 1, 1 }; // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes @@ -136,6 +148,12 @@ public class Test01 implements StorageTest { if ( !m_aTestHelper.checkStorageProperties( xResultSubStorage, "MediaType4", false, ElementModes.READ ) ) return false; + if ( !m_aTestHelper.checkStream( xResultSubStorage, "BigSubStream1", "MediaType1", true, pBigBytes ) ) + return false; + + if ( !m_aTestHelper.checkStream( xResultSubStorage, "BigSubStream2", "MediaType2", false, pBigBytes ) ) + return false; + if ( !m_aTestHelper.checkStream( xResultSubStorage, "SubStream1", "MediaType1", true, pBytes1 ) ) return false; diff --git a/package/qa/storages/Test02.java b/package/qa/storages/Test02.java index 729cdd27fa11..668efbe6a509 100644 --- a/package/qa/storages/Test02.java +++ b/package/qa/storages/Test02.java @@ -60,6 +60,14 @@ public class Test02 implements StorageTest { return false; } + byte pBigBytes[] = new byte[33000]; + for ( int nInd = 0; nInd < 33000; nInd++ ) + pBigBytes[nInd] = (byte)( nInd % 128 ); + + // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes + if ( !m_aTestHelper.WriteBytesToSubstream( xTempSubStorage, "BigSubStream1", "MediaType1", true, pBigBytes ) ) + return false; + byte pBytes1[] = { 1, 1, 1, 1, 1 }; // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes @@ -136,6 +144,9 @@ public class Test02 implements StorageTest { if ( !m_aTestHelper.checkStorageProperties( xResultSubStorage, "MediaType3", false, ElementModes.READ ) ) return false; + if ( !m_aTestHelper.checkStream( xResultSubStorage, "BigSubStream1", "MediaType1", true, pBigBytes ) ) + return false; + if ( !m_aTestHelper.checkStream( xResultSubStorage, "SubStream1", "MediaType1", true, pBytes1 ) ) return false; diff --git a/package/qa/storages/Test03.java b/package/qa/storages/Test03.java index 80259500778b..353cd4df8d14 100644 --- a/package/qa/storages/Test03.java +++ b/package/qa/storages/Test03.java @@ -52,6 +52,18 @@ public class Test03 implements StorageTest { return false; } + byte pBigBytes[] = new byte[33000]; + for ( int nInd = 0; nInd < 33000; nInd++ ) + pBigBytes[nInd] = (byte)( nInd % 128 ); + + // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes + if ( !m_aTestHelper.WriteBytesToSubstream( xTempStorage, "BigSubStream1", "MediaType1", true, pBigBytes ) ) + return false; + + // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes + if ( !m_aTestHelper.WriteBytesToSubstream( xTempSubStorage, "BigSubStream2", "MediaType2", false, pBigBytes ) ) + return false; + byte pBytes1[] = { 1, 1, 1, 1, 1 }; // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes @@ -140,15 +152,24 @@ public class Test03 implements StorageTest { // check that root storage contents are represented correctly String sRootCont[] = xRootNameAccess.getElementNames(); - if ( sRootCont.length != 2 ) + if ( sRootCont.length != 3 ) { m_aTestHelper.Error( "Root storage contains wrong amount of children!" ); return false; } - if ( !( sRootCont[0].equals( "SubStorage1" ) && sRootCont[1].equals( "SubStream1" ) - || sRootCont[0].equals( "SubStream1" ) && sRootCont[1].equals( "SubStorage1" ) ) - || !( xRootNameAccess.hasByName( "SubStream1" ) && xRootNameAccess.hasByName( "SubStorage1" ) ) ) + int nFlag = 0; + for ( int nInd = 0; nInd < sRootCont.length; nInd++ ) + { + if ( sRootCont[nInd].equals( "SubStorage1" ) ) + nFlag |= 1; + else if ( sRootCont[nInd].equals( "SubStream1" ) ) + nFlag |= 2; + else if ( sRootCont[nInd].equals( "BigSubStream1" ) ) + nFlag |= 4; + } + + if ( nFlag != 7 || !( xRootNameAccess.hasByName( "BigSubStream1" ) && xRootNameAccess.hasByName( "SubStream1" ) && xRootNameAccess.hasByName( "SubStorage1" ) ) ) { m_aTestHelper.Error( "Root storage contains wrong list of children!" ); return false; @@ -169,9 +190,9 @@ public class Test03 implements StorageTest { return false; } - if ( !xChildAccess.hasByName( "SubStream2" ) + if ( !( xChildAccess.hasByName( "SubStream2" ) && xChildAccess.hasByName( "BigSubStream2" ) ) || !xResultSubStorage.isStreamElement( "SubStream2" ) - || xResultSubStorage.isStorageElement( "SubStream2" ) ) + || !xResultSubStorage.isStreamElement( "BigSubStream2" ) ) { m_aTestHelper.Error( "'SubStream2' can not be detected as child stream element of 'SubStorage1'!" ); return false; diff --git a/package/qa/storages/Test04.java b/package/qa/storages/Test04.java index 6c6dedee1817..81f770f8ff9a 100644 --- a/package/qa/storages/Test04.java +++ b/package/qa/storages/Test04.java @@ -63,6 +63,14 @@ public class Test04 implements StorageTest { return false; } + byte pBigBytes[] = new byte[33000]; + for ( int nInd = 0; nInd < 33000; nInd++ ) + pBigBytes[nInd] = (byte)( nInd % 128 ); + + // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes + if ( !m_aTestHelper.WriteBytesToSubstream( xTempSubStorage1, "BigSubStream1", "MediaType1", true, pBigBytes ) ) + return false; + byte pBytes1[] = { 1, 1, 1, 1, 1 }; // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes @@ -79,6 +87,10 @@ public class Test04 implements StorageTest { return false; } + // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes + if ( !m_aTestHelper.WriteBytesToSubstream( xTempSubStorage2, "BigSubStream2", "MediaType2", false, pBigBytes ) ) + return false; + byte pBytes2[] = { 2, 2, 2, 2, 2 }; // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes @@ -158,6 +170,15 @@ public class Test04 implements StorageTest { if ( !m_aTestHelper.moveElementTo( xTempSubStorage1, "SubStream1", xTempFileStorage ) ) return false; + if ( !m_aTestHelper.copyElementTo( xTempSubStorage1, "BigSubStream1", xTempFileStorage ) ) + return false; + + if ( !m_aTestHelper.renameElement( xTempFileStorage, "BigSubStream1", "BigSubStream1_copy" ) ) + return false; + + if ( !m_aTestHelper.moveElementTo( xTempSubStorage1, "BigSubStream1", xTempFileStorage ) ) + return false; + if ( !m_aTestHelper.commitStorage( xTempFileStorage ) ) return false; @@ -212,15 +233,27 @@ public class Test04 implements StorageTest { if ( !m_aTestHelper.checkStream( xResStorage, "SubStream1", "MediaType1", true, pBytes1 ) ) return false; + if ( !m_aTestHelper.checkStream( xResStorage, "BigSubStream1", "MediaType1", true, pBigBytes ) ) + return false; + if ( !m_aTestHelper.checkStream( xResStorage, "SubStream1_copy", "MediaType1", true, pBytes1 ) ) return false; + if ( !m_aTestHelper.checkStream( xResStorage, "BigSubStream1_copy", "MediaType1", true, pBigBytes ) ) + return false; + if ( !m_aTestHelper.checkStream( xResSubStorage1, "SubStream1", "MediaType1", true, pBytes1 ) ) return false; + if ( !m_aTestHelper.checkStream( xResSubStorage1, "BigSubStream1", "MediaType1", true, pBigBytes ) ) + return false; + if ( !m_aTestHelper.checkStream( xResSubStorage2, "SubStream2", "MediaType2", false, pBytes2 ) ) return false; + if ( !m_aTestHelper.checkStream( xResSubStorage2, "BigSubStream2", "MediaType2", false, pBigBytes ) ) + return false; + // the storage must be disposed before removing if ( !m_aTestHelper.disposeStorage( xResSubStorage2 ) ) return false; diff --git a/package/qa/storages/Test05.java b/package/qa/storages/Test05.java index bea3d3cccbd0..adf943c6ef12 100644 --- a/package/qa/storages/Test05.java +++ b/package/qa/storages/Test05.java @@ -72,6 +72,17 @@ public class Test05 implements StorageTest { return false; } + byte pBigBytes[] = new byte[33000]; + for ( int nInd = 0; nInd < 33000; nInd++ ) + pBigBytes[nInd] = (byte)( nInd % 128 ); + + // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes + if ( !m_aTestHelper.WriteBytesToSubstream( xSubSubStorage, "BigSubStream1", "MediaType1", true, pBigBytes ) ) + return false; + + // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes + if ( !m_aTestHelper.WriteBytesToSubstream( xSubSubStorage, "BigSubStream2", "MediaType2", false, pBigBytes ) ) + return false; byte pBytes1[] = { 1, 1, 1, 1, 1 }; @@ -126,27 +137,40 @@ public class Test05 implements StorageTest { XStream xSubStream1 = m_aTestHelper.OpenStream( xSubSubStorage, "SubStream1", ElementModes.WRITE | ElementModes.NOCREATE ); + XStream xBigSubStream1 = m_aTestHelper.OpenStream( xSubSubStorage, + "BigSubStream1", + ElementModes.WRITE | ElementModes.NOCREATE ); XStream xSubStream2 = m_aTestHelper.OpenStream( xSubSubStorage, "SubStream2", ElementModes.READ | ElementModes.NOCREATE ); - if ( xSubStream1 == null || xSubStream2 == null ) + XStream xBigSubStream2 = m_aTestHelper.OpenStream( xSubSubStorage, + "BigSubStream2", + ElementModes.READ | ElementModes.NOCREATE ); + + if ( xSubStream1 == null || xBigSubStream1 == null || xSubStream2 == null || xBigSubStream2 == null ) return false; // it should be possible to have more then one copy of stream for reading XStream xSubStream2clone = m_aTestHelper.OpenStream( xSubSubStorage, "SubStream2", ElementModes.READ | ElementModes.NOCREATE ); - if ( xSubStream2 == null ) + XStream xBigSubStream2clone = m_aTestHelper.OpenStream( xSubSubStorage, + "BigSubStream2", + ElementModes.READ | ElementModes.NOCREATE ); + if ( xSubStream2clone == null || xBigSubStream2clone == null ) return false; - // so now the first stream can not be open neither for reading nor for writing + // so now the first streams can not be open neither for reading nor for writing if ( !m_aTestHelper.cantOpenStream( xSubSubStorage, "SubStream1", ElementModes.WRITE ) - || !m_aTestHelper.cantOpenStream( xSubSubStorage, "SubStream1", ElementModes.READ ) ) + || !m_aTestHelper.cantOpenStream( xSubSubStorage, "SubStream1", ElementModes.READ ) + || !m_aTestHelper.cantOpenStream( xSubSubStorage, "BigSubStream1", ElementModes.WRITE ) + || !m_aTestHelper.cantOpenStream( xSubSubStorage, "BigSubStream1", ElementModes.READ ) ) return false; - // the second stream can not be open for writing - if ( !m_aTestHelper.cantOpenStream( xSubSubStorage, "SubStream2", ElementModes.WRITE ) ) + // the second streams can not be open for writing + if ( !m_aTestHelper.cantOpenStream( xSubSubStorage, "SubStream2", ElementModes.WRITE ) + || !m_aTestHelper.cantOpenStream( xSubSubStorage, "BigSubStream2", ElementModes.WRITE ) ) return false; @@ -249,9 +273,15 @@ public class Test05 implements StorageTest { if ( !m_aTestHelper.checkStream( xResSubSubStorage, "SubStream1", "MediaType1", true, pBytes1 ) ) return false; + if ( !m_aTestHelper.checkStream( xResSubSubStorage, "BigSubStream1", "MediaType1", true, pBigBytes ) ) + return false; + if ( !m_aTestHelper.checkStream( xResSubSubStorage, "SubStream2", "MediaType2", false, pBytes2 ) ) return false; + if ( !m_aTestHelper.checkStream( xResSubSubStorage, "BigSubStream2", "MediaType2", false, pBigBytes ) ) + return false; + // dispose used storages to free resources if ( !m_aTestHelper.disposeStorage( xResultStorage ) ) return false; diff --git a/package/qa/storages/Test07.java b/package/qa/storages/Test07.java index 31907a92bb01..970c6f13ec09 100644 --- a/package/qa/storages/Test07.java +++ b/package/qa/storages/Test07.java @@ -48,10 +48,18 @@ public class Test07 implements StorageTest { return false; } + byte pBigBytes[] = new byte[33000]; + for ( int nInd = 0; nInd < 33000; nInd++ ) + pBigBytes[nInd] = (byte)( nInd % 128 ); + byte pBytes1[] = { 1, 1, 1, 1, 1 }; String sPass1 = "12345"; // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes + if ( !m_aTestHelper.WriteBytesToEncrSubstream( xTempStorage, "BigSubStream1", "MediaType1", true, pBigBytes, sPass1 ) ) + return false; + + // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes if ( !m_aTestHelper.WriteBytesToEncrSubstream( xTempStorage, "SubStream1", "MediaType1", true, pBytes1, sPass1 ) ) return false; @@ -59,6 +67,10 @@ public class Test07 implements StorageTest { String sPass2 = "54321"; // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes + if ( !m_aTestHelper.WriteBytesToEncrSubstream( xTempStorage, "BigSubStream2", "MediaType2", false, pBigBytes, sPass2 ) ) + return false; + + // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes if ( !m_aTestHelper.WriteBytesToEncrSubstream( xTempStorage, "SubStream2", "MediaType2", false, pBytes2, sPass2 ) ) return false; @@ -112,15 +124,27 @@ public class Test07 implements StorageTest { if ( !m_aTestHelper.checkEncrStream( xResultStorage, "SubStream1", "MediaType1", pBytes1, sPass1 ) ) return false; + if ( !m_aTestHelper.checkEncrStream( xResultStorage, "BigSubStream1", "MediaType1", pBigBytes, sPass1 ) ) + return false; + if ( !m_aTestHelper.checkEncrStream( xResultStorage, "SubStream2", "MediaType2", pBytes2, sPass2 ) ) return false; + if ( !m_aTestHelper.checkEncrStream( xResultStorage, "BigSubStream2", "MediaType2", pBigBytes, sPass2 ) ) + return false; + if ( !m_aTestHelper.checkEncrStream( x2CopyStorage, "SubStream1", "MediaType1", pBytes1, sPass1 ) ) return false; + if ( !m_aTestHelper.checkEncrStream( x2CopyStorage, "BigSubStream1", "MediaType1", pBigBytes, sPass1 ) ) + return false; + if ( !m_aTestHelper.checkEncrStream( x2CopyStorage, "SubStream2", "MediaType2", pBytes2, sPass2 ) ) return false; + if ( !m_aTestHelper.checkEncrStream( x2CopyStorage, "BigSubStream2", "MediaType2", pBigBytes, sPass2 ) ) + return false; + // dispose used storages to free resources if ( !m_aTestHelper.disposeStorage( xResultStorage ) ) return false; diff --git a/package/qa/storages/Test08.java b/package/qa/storages/Test08.java index e476397c8cd5..5e024db588c8 100644 --- a/package/qa/storages/Test08.java +++ b/package/qa/storages/Test08.java @@ -74,17 +74,25 @@ public class Test08 implements StorageTest { return false; } + byte pBigBytes[] = new byte[33000]; + for ( int nInd = 0; nInd < 33000; nInd++ ) + pBigBytes[nInd] = (byte)( nInd % 128 ); + // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes // the stream will be encrypted with common password byte pBytes1[] = { 1, 1, 1, 1, 1 }; if ( !m_aTestHelper.WBToSubstrOfEncr( xTempSubStorage, "SubStream1", "MediaType1", true, pBytes1, true ) ) return false; + if ( !m_aTestHelper.WBToSubstrOfEncr( xTempSubStorage, "BigSubStream1", "MediaType1", true, pBigBytes, true ) ) + return false; // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes // the stream will not be encrypted byte pBytes2[] = { 2, 2, 2, 2, 2 }; if ( !m_aTestHelper.WBToSubstrOfEncr( xTempSubStorage, "SubStream2", "MediaType2", false, pBytes2, false ) ) return false; + if ( !m_aTestHelper.WBToSubstrOfEncr( xTempSubStorage, "BigSubStream2", "MediaType2", false, pBigBytes, false ) ) + return false; // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes // the stream will be compressed with own password @@ -94,6 +102,8 @@ public class Test08 implements StorageTest { // the stream will not be encrypted if ( !m_aTestHelper.WriteBytesToEncrSubstream( xTempSubStorage, "SubStream3", "MediaType3", false, pBytes3, sPass2 ) ) return false; + if ( !m_aTestHelper.WriteBytesToEncrSubstream( xTempSubStorage, "BigSubStream3", "MediaType3", false, pBigBytes, sPass2 ) ) + return false; // set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempStorage, @@ -190,13 +200,19 @@ public class Test08 implements StorageTest { if ( !m_aTestHelper.checkEncrStream( xResultSubStorage, "SubStream1", "MediaType1", pBytes1, sPass1 ) ) return false; + if ( !m_aTestHelper.checkEncrStream( xResultSubStorage, "BigSubStream1", "MediaType1", pBigBytes, sPass1 ) ) + return false; if ( !m_aTestHelper.checkStream( xResultSubStorage, "SubStream2", "MediaType2", false, pBytes2 ) ) return false; + if ( !m_aTestHelper.checkStream( xResultSubStorage, "BigSubStream2", "MediaType2", false, pBigBytes ) ) + return false; // the common root storage password should allow to open this stream if ( !m_aTestHelper.checkStream( xResultSubStorage, "SubStream3", "MediaType3", true, pBytes3 ) ) return false; + if ( !m_aTestHelper.checkStream( xResultSubStorage, "BigSubStream3", "MediaType3", true, pBigBytes ) ) + return false; // dispose used storages to free resources if ( !m_aTestHelper.disposeStorage( xResultStorage ) ) diff --git a/package/qa/storages/Test09.java b/package/qa/storages/Test09.java index a8140369e564..2ce2dfb1e484 100644 --- a/package/qa/storages/Test09.java +++ b/package/qa/storages/Test09.java @@ -45,11 +45,16 @@ public class Test09 implements StorageTest { String sPass1 = "123"; String sPass2 = "321"; byte pBytes[] = { 1, 1, 1, 1, 1 }; + byte pBigBytes[] = new byte[33000]; + for ( int nInd = 0; nInd < 33000; nInd++ ) + pBigBytes[nInd] = (byte)( nInd % 128 ); // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes // the stream will not be encrypted if ( !m_aTestHelper.WriteBytesToEncrSubstream( xTempStorage, "SubStream1", "MediaType1", false, pBytes, sPass1 ) ) return false; + if ( !m_aTestHelper.WriteBytesToEncrSubstream( xTempStorage, "BigSubStream1", "MediaType1", false, pBigBytes, sPass1 ) ) + return false; // create temporary file String sTempFileURL = m_aTestHelper.CreateTempFile( m_xMSF ); @@ -84,6 +89,13 @@ public class Test09 implements StorageTest { else if ( nResult == -1 ) return true; // tested optional feature is not supported + // change password of the substream of new storage based on file + nResult = m_aTestHelper.ChangeStreamPass( xTempFileStorage, "BigSubStream1", sPass1, sPass2 ); + if ( nResult == 0 ) + return false; // test failed + else if ( nResult == -1 ) + return true; // tested optional feature is not supported + if ( !m_aTestHelper.commitStorage( xTempFileStorage ) ) return false; @@ -107,6 +119,8 @@ public class Test09 implements StorageTest { if ( !m_aTestHelper.checkEncrStream( xResultStorage, "SubStream1", "MediaType1", pBytes, sPass2 ) ) return false; + if ( !m_aTestHelper.checkEncrStream( xResultStorage, "BigSubStream1", "MediaType1", pBigBytes, sPass2 ) ) + return false; // dispose used storages to free resources if ( !m_aTestHelper.disposeStorage( xResultStorage ) ) diff --git a/package/qa/storages/Test10.java b/package/qa/storages/Test10.java index a1114b45c6b8..162daa5abe29 100644 --- a/package/qa/storages/Test10.java +++ b/package/qa/storages/Test10.java @@ -43,12 +43,20 @@ public class Test10 implements StorageTest { return false; } + byte pBigBytes[] = new byte[33000]; + for ( int nInd = 0; nInd < 33000; nInd++ ) + pBigBytes[nInd] = (byte)( nInd % 128 ); + byte pBytes1[] = { 1, 1, 1, 1, 1 }; // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes if ( !m_aTestHelper.WriteBytesToSubstream( xTempStorage, "SubStream1", "MediaType1", true, pBytes1 ) ) return false; + // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes + if ( !m_aTestHelper.WriteBytesToSubstream( xTempStorage, "BigSubStream1", "MediaType1", true, pBigBytes ) ) + return false; + // open a new substorage XStorage xTempSubStorage = m_aTestHelper.openSubStorage( xTempStorage, @@ -66,6 +74,10 @@ public class Test10 implements StorageTest { if ( !m_aTestHelper.WriteBytesToSubstream( xTempSubStorage, "SubStream2", "MediaType2", true, pBytes2 ) ) return false; + // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes + if ( !m_aTestHelper.WriteBytesToSubstream( xTempSubStorage, "BigSubStream2", "MediaType2", true, pBigBytes ) ) + return false; + // set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempStorage, "MediaType3", @@ -120,9 +132,16 @@ public class Test10 implements StorageTest { if ( !m_aTestHelper.InternalCheckStream( xClonedSubStream, "SubStream1", "MediaType1", true, pBytes1, true ) ) return false; + XStream xClonedBigSubStream = m_aTestHelper.cloneSubStream( xTempStorage, "BigSubStream1" ); + if ( !m_aTestHelper.InternalCheckStream( xClonedBigSubStream, "BigSubStream1", "MediaType1", true, pBigBytes, true ) ) + return false; + if ( !m_aTestHelper.disposeStream( xClonedSubStream, "SubStream1" ) ) return false; + if ( !m_aTestHelper.disposeStream( xClonedBigSubStream, "BigSubStream1" ) ) + return false; + // ============================== // commit substorage and check cloning // ============================== @@ -143,6 +162,9 @@ public class Test10 implements StorageTest { if ( !m_aTestHelper.checkStream( xClonedSubStorage, "SubStream2", "MediaType2", true, pBytes2 ) ) return false; + if ( !m_aTestHelper.checkStream( xClonedSubStorage, "BigSubStream2", "MediaType2", true, pBigBytes ) ) + return false; + XStorage xCloneOfRoot = m_aTestHelper.cloneStorage( m_xStorageFactory, xTempStorage ); if ( xCloneOfRoot == null ) { @@ -195,6 +217,9 @@ public class Test10 implements StorageTest { if ( !m_aTestHelper.checkStream( xSubStorageOfClone, "SubStream2", "MediaType2", true, pBytes2 ) ) return false; + if ( !m_aTestHelper.checkStream( xSubStorageOfClone, "BigSubStream2", "MediaType2", true, pBigBytes ) ) + return false; + return true; } catch( Exception e ) diff --git a/package/qa/storages/Test11.java b/package/qa/storages/Test11.java index a7949f79e7cc..198fa41fe588 100644 --- a/package/qa/storages/Test11.java +++ b/package/qa/storages/Test11.java @@ -44,6 +44,10 @@ public class Test11 implements StorageTest { return false; } + byte pBigBytes[] = new byte[33000]; + for ( int nInd = 0; nInd < 33000; nInd++ ) + pBigBytes[nInd] = (byte)( nInd % 128 ); + String sPass1 = "111111111"; byte pBytes1[] = { 1, 1, 1, 1, 1 }; @@ -51,6 +55,10 @@ public class Test11 implements StorageTest { if ( !m_aTestHelper.WriteBytesToEncrSubstream( xTempStorage, "SubStream1", "MediaType1", true, pBytes1, sPass1 ) ) return false; + // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes + if ( !m_aTestHelper.WriteBytesToEncrSubstream( xTempStorage, "BigSubStream1", "MediaType1", true, pBigBytes, sPass1 ) ) + return false; + // open a new substorage XStorage xTempSubStorage = m_aTestHelper.openSubStorage( xTempStorage, "SubStorage1", @@ -68,6 +76,10 @@ public class Test11 implements StorageTest { if ( !m_aTestHelper.WriteBytesToEncrSubstream( xTempSubStorage, "SubStream2", "MediaType2", true, pBytes2, sPass2 ) ) return false; + // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes + if ( !m_aTestHelper.WriteBytesToEncrSubstream( xTempSubStorage, "BigSubStream2", "MediaType2", true, pBigBytes, sPass2 ) ) + return false; + // set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempStorage, "MediaType3", @@ -122,9 +134,16 @@ public class Test11 implements StorageTest { if ( !m_aTestHelper.InternalCheckStream( xClonedSubStream, "SubStream1", "MediaType1", true, pBytes1, true ) ) return false; + XStream xClonedBigSubStream = m_aTestHelper.cloneEncrSubStream( xTempStorage, "BigSubStream1", sPass1 ); + if ( !m_aTestHelper.InternalCheckStream( xClonedBigSubStream, "BigSubStream1", "MediaType1", true, pBigBytes, true ) ) + return false; + if ( !m_aTestHelper.disposeStream( xClonedSubStream, "SubStream1" ) ) return false; + if ( !m_aTestHelper.disposeStream( xClonedBigSubStream, "BigSubStream1" ) ) + return false; + // ============================== // commit substorage and check cloning // ============================== @@ -145,6 +164,9 @@ public class Test11 implements StorageTest { if ( !m_aTestHelper.checkEncrStream( xClonedSubStorage, "SubStream2", "MediaType2", pBytes2, sPass2 ) ) return false; + if ( !m_aTestHelper.checkEncrStream( xClonedSubStorage, "BigSubStream2", "MediaType2", pBigBytes, sPass2 ) ) + return false; + // ============================== // commit the root storage and check cloning // ============================== @@ -165,6 +187,9 @@ public class Test11 implements StorageTest { if ( !m_aTestHelper.checkEncrStream( xCloneOfRoot, "SubStream1", "MediaType1", pBytes1, sPass1 ) ) return false; + if ( !m_aTestHelper.checkEncrStream( xCloneOfRoot, "BigSubStream1", "MediaType1", pBigBytes, sPass1 ) ) + return false; + XStorage xSubStorageOfClone = xCloneOfRoot.openStorageElement( "SubStorage1", ElementModes.READ ); if ( xSubStorageOfClone == null ) { @@ -178,6 +203,9 @@ public class Test11 implements StorageTest { if ( !m_aTestHelper.checkEncrStream( xSubStorageOfClone, "SubStream2", "MediaType2", pBytes2, sPass2 ) ) return false; + if ( !m_aTestHelper.checkEncrStream( xSubStorageOfClone, "BigSubStream2", "MediaType2", pBigBytes, sPass2 ) ) + return false; + return true; } catch( Exception e ) diff --git a/package/qa/storages/Test12.java b/package/qa/storages/Test12.java index 89d88819b79e..05928cf76b0d 100644 --- a/package/qa/storages/Test12.java +++ b/package/qa/storages/Test12.java @@ -60,12 +60,20 @@ public class Test12 implements StorageTest { return false; } + byte pBigBytes[] = new byte[33000]; + for ( int nInd = 0; nInd < 33000; nInd++ ) + pBigBytes[nInd] = (byte)( nInd % 128 ); + byte pBytes1[] = { 1, 1, 1, 1, 1 }; // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes if ( !m_aTestHelper.WriteBytesToSubstream( xTempSubStorage, "SubStream1", "MediaType1", true, pBytes1 ) ) return false; + // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes + if ( !m_aTestHelper.WriteBytesToSubstream( xTempSubStorage, "BigSubStream1", "MediaType1", true, pBigBytes ) ) + return false; + // set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempStorage, "MediaType2", @@ -96,7 +104,7 @@ public class Test12 implements StorageTest { // check substorage // ================================================ - if ( !checkSubStorages( xTempStorage, pBytes1 ) ) + if ( !checkSubStorages( xTempStorage, pBytes1, pBigBytes ) ) return false; // dispose used storage to free resources @@ -118,7 +126,7 @@ public class Test12 implements StorageTest { if ( !m_aTestHelper.checkStorageProperties( xResWriteStorage, "MediaType2", true, ElementModes.WRITE ) ) return false; - if( !checkSubStorages( xResWriteStorage, pBytes1 ) ) + if( !checkSubStorages( xResWriteStorage, pBytes1, pBigBytes ) ) return false; // try to open for writing after opening for reading @@ -137,6 +145,9 @@ public class Test12 implements StorageTest { if ( !m_aTestHelper.checkStream( xResWSubStorage, "SubStream1", "MediaType1", true, pBytes1 ) ) return false; + if ( !m_aTestHelper.checkStream( xResWSubStorage, "BigSubStream1", "MediaType1", true, pBigBytes ) ) + return false; + // dispose used storage to free resources if ( !m_aTestHelper.disposeStorage( xResWriteStorage ) ) return false; @@ -171,7 +182,7 @@ public class Test12 implements StorageTest { if ( !m_aTestHelper.checkStorageProperties( xResultStorage, "MediaType2", true, ElementModes.READ ) ) return false; - if( !checkSubStorages( xResultStorage, pBytes1 ) ) + if( !checkSubStorages( xResultStorage, pBytes1, pBigBytes ) ) return false; return true; @@ -183,7 +194,7 @@ public class Test12 implements StorageTest { } } - private boolean checkSubStorages( XStorage xStorage, byte[] pBytes1 ) + private boolean checkSubStorages( XStorage xStorage, byte[] pBytes1, byte[] pBigBytes ) { XStorage xReadSubStorage1 = m_aTestHelper.openSubStorage( xStorage, "SubStorage1", @@ -208,9 +219,15 @@ public class Test12 implements StorageTest { if ( !m_aTestHelper.checkStream( xReadSubStorage1, "SubStream1", "MediaType1", true, pBytes1 ) ) return false; + if ( !m_aTestHelper.checkStream( xReadSubStorage1, "BigSubStream1", "MediaType1", true, pBigBytes ) ) + return false; + if ( !m_aTestHelper.checkStream( xReadSubStorage2, "SubStream1", "MediaType1", true, pBytes1 ) ) return false; + if ( !m_aTestHelper.checkStream( xReadSubStorage2, "BigSubStream1", "MediaType1", true, pBigBytes ) ) + return false; + if ( !m_aTestHelper.disposeStorage( xReadSubStorage1 ) ) return false; diff --git a/package/qa/storages/Test13.java b/package/qa/storages/Test13.java index bec101914259..e8b05264f44d 100644 --- a/package/qa/storages/Test13.java +++ b/package/qa/storages/Test13.java @@ -44,6 +44,9 @@ public class Test13 implements StorageTest { String aSubStream1Path = aStreamPrefix + "SubStream1"; String aSubStream2Path = aStreamPrefix + "SubStream2"; String aSubStream3Path = aStreamPrefix + "SubStream3"; + String aBigSubStream1Path = aStreamPrefix + "BigSubStream1"; + String aBigSubStream2Path = aStreamPrefix + "BigSubStream2"; + String aBigSubStream3Path = aStreamPrefix + "BigSubStream3"; String sTempFileURL = m_aTestHelper.CreateTempFile( m_xMSF ); if ( sTempFileURL == null || sTempFileURL == "" ) @@ -65,12 +68,18 @@ public class Test13 implements StorageTest { return false; } + byte pBigBytes[] = new byte[33000]; + for ( int nInd = 0; nInd < 33000; nInd++ ) + pBigBytes[nInd] = (byte)( nInd % 128 ); + byte pBytes1[] = { 1, 1, 1, 1, 1 }; // open a new substream hierarchically, set "MediaType" and "Compressed" properties to it, write some bytes // and commit if ( !m_aTestHelper.WriteBytesToStreamH( xTempFileStorage, aSubStream1Path, "MediaType1", true, pBytes1, true ) ) return false; + if ( !m_aTestHelper.WriteBytesToStreamH( xTempFileStorage, aBigSubStream1Path, "MediaType1", true, pBigBytes, true ) ) + return false; byte pBytes2[] = { 2, 2, 2, 2, 2 }; @@ -78,11 +87,15 @@ public class Test13 implements StorageTest { // and commit if ( !m_aTestHelper.WriteBytesToStreamH( xTempFileStorage, aSubStream2Path, "MediaType2", false, pBytes2, true ) ) return false; + if ( !m_aTestHelper.WriteBytesToStreamH( xTempFileStorage, aBigSubStream2Path, "MediaType2", false, pBigBytes, true ) ) + return false; // open a new substream hierarchically, set "MediaType" and "Compressed" properties to it, write some bytes // and don't commit if ( !m_aTestHelper.WriteBytesToStreamH( xTempFileStorage, aSubStream3Path, "MediaType2", false, pBytes2, false ) ) return false; + if ( !m_aTestHelper.WriteBytesToStreamH( xTempFileStorage, aBigSubStream3Path, "MediaType2", false, pBigBytes, false ) ) + return false; // set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempFileStorage, @@ -120,21 +133,35 @@ public class Test13 implements StorageTest { if ( !m_aTestHelper.checkStreamH( xTempFileStorage, aSubStream1Path, "MediaType1", true, pBytes1 ) ) return false; + if ( !m_aTestHelper.checkStreamH( xTempFileStorage, aBigSubStream1Path, "MediaType1", true, pBigBytes ) ) + return false; + if ( !m_aTestHelper.checkStreamH( xTempFileStorage, aSubStream2Path, "MediaType2", false, pBytes2 ) ) return false; + if ( !m_aTestHelper.checkStreamH( xTempFileStorage, aBigSubStream2Path, "MediaType2", false, pBigBytes ) ) + return false; + if ( !m_aTestHelper.cantOpenStreamH( xTempFileStorage, aSubStream3Path, ElementModes.READ ) ) return false; + if ( !m_aTestHelper.cantOpenStreamH( xTempFileStorage, aBigSubStream3Path, ElementModes.READ ) ) + return false; + // open existing substream hierarchically, set "MediaType" and "Compressed" properties to it, write some bytes // and commit if ( !m_aTestHelper.WriteBytesToStreamH( xTempFileStorage, aSubStream1Path, "MediaType3", true, pBytes2, true ) ) return false; + if ( !m_aTestHelper.WriteBytesToStreamH( xTempFileStorage, aBigSubStream1Path, "MediaType3", true, pBigBytes, true ) ) + return false; + // open existing substream hierarchically, set "MediaType" and "Compressed" properties to it, write some bytes // and don't commit if ( !m_aTestHelper.WriteBytesToStreamH( xTempFileStorage, aSubStream2Path, "MediaType3", true, pBytes1, false ) ) return false; + if ( !m_aTestHelper.WriteBytesToStreamH( xTempFileStorage, aBigSubStream2Path, "MediaType3", true, pBigBytes, false ) ) + return false; // commit the root storage so the contents must be stored now if ( !m_aTestHelper.commitStorage( xTempFileStorage ) ) @@ -164,9 +191,11 @@ public class Test13 implements StorageTest { if ( !m_aTestHelper.checkStreamH( xResultStorage, aSubStream1Path, "MediaType3", true, pBytes2 ) ) return false; + if ( !m_aTestHelper.checkStreamH( xResultStorage, aBigSubStream1Path, "MediaType3", true, pBigBytes ) ) + return false; // the following stream was not commited last time, so the last change must be lost - if ( !m_aTestHelper.checkStreamH( xResultStorage, aSubStream2Path, "MediaType2", false, pBytes2 ) ) + if ( !m_aTestHelper.checkStreamH( xResultStorage, aBigSubStream2Path, "MediaType2", false, pBigBytes ) ) return false; // dispose used storages to free resources diff --git a/package/qa/storages/Test18.java b/package/qa/storages/Test18.java new file mode 100644 index 000000000000..335a230027ce --- /dev/null +++ b/package/qa/storages/Test18.java @@ -0,0 +1,172 @@ +package complex.storages; + +import com.sun.star.uno.XInterface; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.lang.XSingleServiceFactory; + +import com.sun.star.bridge.XUnoUrlResolver; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +import com.sun.star.embed.*; + +import share.LogWriter; +import complex.storages.TestHelper; +import complex.storages.StorageTest; + +public class Test18 implements StorageTest { + + XMultiServiceFactory m_xMSF; + XSingleServiceFactory m_xStorageFactory; + TestHelper m_aTestHelper; + + public Test18( XMultiServiceFactory xMSF, XSingleServiceFactory xStorageFactory, LogWriter aLogWriter ) + { + m_xMSF = xMSF; + m_xStorageFactory = xStorageFactory; + m_aTestHelper = new TestHelper( aLogWriter, "Test18: " ); + } + + public boolean test() + { + try + { + // test the default value of Compressed property + String sTempFileURL = m_aTestHelper.CreateTempFile( m_xMSF ); + if ( sTempFileURL == null || sTempFileURL == "" ) + { + m_aTestHelper.Error( "No valid temporary file was created!" ); + return false; + } + + // create temporary storage based on arbitrary medium + // after such a storage is closed it is lost + Object oTempStorage = m_xStorageFactory.createInstance(); + XStorage xTempStorage = (XStorage) UnoRuntime.queryInterface( XStorage.class, oTempStorage ); + if ( xTempStorage == null ) + { + m_aTestHelper.Error( "Can't create temporary storage representation!" ); + return false; + } + + // open a new substorage + XStorage xTempSubStorage = m_aTestHelper.openSubStorage( xTempStorage, + "SubStorage1", + ElementModes.WRITE ); + if ( xTempSubStorage == null ) + { + m_aTestHelper.Error( "Can't create substorage!" ); + return false; + } + + byte pBytes1[] = { 1, 1, 1, 1, 1 }; + + // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes + if ( !m_aTestHelper.WriteBytesToSubstreamDefaultCompressed( xTempSubStorage, "SubStream1", "image/jpeg", pBytes1 ) ) + return false; + + // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes + if ( !m_aTestHelper.WriteBytesToSubstreamDefaultCompressed( xTempSubStorage, "SubStream2", "image/png", pBytes1 ) ) + return false; + + // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes + if ( !m_aTestHelper.WriteBytesToSubstreamDefaultCompressed( xTempSubStorage, "SubStream3", "image/gif", pBytes1 ) ) + return false; + + // open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes + if ( !m_aTestHelper.WriteBytesToSubstreamDefaultCompressed( xTempSubStorage, "SubStream4", "MediaType1", pBytes1 ) ) + return false; + + // set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly + if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempStorage, + "MediaType3", + true, + ElementModes.WRITE ) ) + return false; + + // set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly + if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempSubStorage, + "MediaType4", + false, + ElementModes.WRITE ) ) + return false; + + // create temporary storage based on a previously created temporary file + Object pArgs[] = new Object[2]; + pArgs[0] = (Object) sTempFileURL; + pArgs[1] = new Integer( ElementModes.WRITE ); + + Object oTempFileStorage = m_xStorageFactory.createInstanceWithArguments( pArgs ); + XStorage xTempFileStorage = (XStorage)UnoRuntime.queryInterface( XStorage.class, oTempFileStorage ); + if ( xTempFileStorage == null ) + { + m_aTestHelper.Error( "Can't create storage based on temporary file!" ); + return false; + } + + // copy xTempStorage to xTempFileStorage + // xTempFileStorage will be automatically commited + if ( !m_aTestHelper.copyStorage( xTempStorage, xTempFileStorage ) ) + return false; + + // dispose used storages to free resources + if ( !m_aTestHelper.disposeStorage( xTempStorage ) || !m_aTestHelper.disposeStorage( xTempFileStorage ) ) + return false; + + // ================================================ + // now check all the written and copied information + // ================================================ + + // the temporary file must not be locked any more after storage disposing + pArgs[1] = new Integer( ElementModes.WRITE ); + Object oResultStorage = m_xStorageFactory.createInstanceWithArguments( pArgs ); + XStorage xResultStorage = (XStorage) UnoRuntime.queryInterface( XStorage.class, oResultStorage ); + if ( xResultStorage == null ) + { + m_aTestHelper.Error( "Can't reopen storage based on temporary file!" ); + return false; + } + + if ( !m_aTestHelper.checkStorageProperties( xResultStorage, "MediaType3", true, ElementModes.WRITE ) ) + return false; + + // open existing substorage + XStorage xResultSubStorage = m_aTestHelper.openSubStorage( xResultStorage, + "SubStorage1", + ElementModes.READ ); + if ( xResultSubStorage == null ) + { + m_aTestHelper.Error( "Can't open existing substorage!" ); + return false; + } + + if ( !m_aTestHelper.checkStorageProperties( xResultSubStorage, "MediaType4", false, ElementModes.READ ) ) + return false; + + if ( !m_aTestHelper.checkStream( xResultSubStorage, "SubStream1", "image/jpeg", false, pBytes1 ) ) + return false; + + if ( !m_aTestHelper.checkStream( xResultSubStorage, "SubStream2", "image/png", false, pBytes1 ) ) + return false; + + if ( !m_aTestHelper.checkStream( xResultSubStorage, "SubStream3", "image/gif", false, pBytes1 ) ) + return false; + + if ( !m_aTestHelper.checkStream( xResultSubStorage, "SubStream4", "MediaType1", true, pBytes1 ) ) + return false; + + // dispose used storages to free resources + if ( !m_aTestHelper.disposeStorage( xResultStorage ) ) + return false; + + return true; + } + catch( Exception e ) + { + m_aTestHelper.Error( "Exception: " + e ); + return false; + } + } + +} + diff --git a/package/qa/storages/TestHelper.java b/package/qa/storages/TestHelper.java index a6a05603ac1b..dc28786513b1 100644 --- a/package/qa/storages/TestHelper.java +++ b/package/qa/storages/TestHelper.java @@ -96,6 +96,99 @@ public class TestHelper { return true; } + public boolean WriteBytesToSubstreamDefaultCompressed( XStorage xStorage, + String sStreamName, + String sMediaType, + byte[] pBytes ) + { + // open substream element + XStream xSubStream = null; + try + { + Object oSubStream = xStorage.openStreamElement( sStreamName, ElementModes.WRITE ); + xSubStream = (XStream) UnoRuntime.queryInterface( XStream.class, oSubStream ); + if ( xSubStream == null ) + { + Error( "Can't create substream '" + sStreamName + "'!" ); + return false; + } + } + catch( Exception e ) + { + Error( "Can't create substream '" + sStreamName + "', exception : " + e + "!" ); + return false; + } + + // get output stream of substream + XOutputStream xOutput = xSubStream.getOutputStream(); + if ( xOutput == null ) + { + Error( "Can't get XOutputStream implementation from substream '" + sStreamName + "'!" ); + return false; + } + + // get XTrucate implementation from output stream + XTruncate xTruncate = (XTruncate) UnoRuntime.queryInterface( XTruncate.class, xOutput ); + if ( xTruncate == null ) + { + Error( "Can't get XTruncate implementation from substream '" + sStreamName + "'!" ); + return false; + } + + // write requested byte sequence + try + { + xTruncate.truncate(); + xOutput.writeBytes( pBytes ); + } + catch( Exception e ) + { + Error( "Can't write to stream '" + sStreamName + "', exception: " + e ); + return false; + } + + // get access to the XPropertySet interface + XPropertySet xPropSet = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, xSubStream ); + if ( xPropSet == null ) + { + Error( "Can't get XPropertySet implementation from substream '" + sStreamName + "'!" ); + return false; + } + + // set properties to the stream + // do not set the compressed property + try + { + xPropSet.setPropertyValue( "MediaType", sMediaType ); + } + catch( Exception e ) + { + Error( "Can't set properties to substream '" + sStreamName + "', exception: " + e ); + return false; + } + + // check size property of the stream + try + { + int nSize = AnyConverter.toInt( xPropSet.getPropertyValue( "Size" ) ); + if ( nSize != pBytes.length ) + { + Error( "The 'Size' property of substream '" + sStreamName + "' contains wrong value!" ); + return false; + } + } + catch( Exception e ) + { + Error( "Can't get 'Size' property from substream '" + sStreamName + "', exception: " + e ); + return false; + } + + // free the stream resources, garbage collector may remove the object too late + if ( !disposeStream( xSubStream, sStreamName ) ) + return false; + + return true; + } public boolean WriteBytesToSubstream( XStorage xStorage, String sStreamName, diff --git a/package/qa/storages/makefile.mk b/package/qa/storages/makefile.mk index a8a5bbf8219e..81cacb939510 100644 --- a/package/qa/storages/makefile.mk +++ b/package/qa/storages/makefile.mk @@ -64,6 +64,7 @@ JAVAFILES =\ Test15.java\ Test16.java\ Test17.java\ + Test18.java\ RegressionTest_114358.java\ RegressionTest_i29169.java\ RegressionTest_i30400.java\ diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index b3b9ec6affa2..079b23d7c17a 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -58,10 +58,42 @@ #include <rtl/digest.h> #include <rtl/logfile.hxx> +// since the copying uses 32000 blocks usually, it makes sense to have a smaller size +#define MAX_STORCACHE_SIZE 30000 + using namespace ::com::sun::star; //----------------------------------------------- +uno::Sequence< sal_Int8 > MakeKeyFromPass( ::rtl::OUString aPass, sal_Bool bUseUTF ) +{ + // MS_1252 encoding was used for SO60 document format password encoding, + // this encoding supports only a minor subset of nonascii characters, + // but for compatibility reasons it has to be used for old document formats + + ::rtl::OString aByteStrPass; + if ( bUseUTF ) + aByteStrPass = ::rtl::OUStringToOString( aPass, RTL_TEXTENCODING_UTF8 ); + else + aByteStrPass = ::rtl::OUStringToOString( aPass, RTL_TEXTENCODING_MS_1252 ); + + sal_uInt8 pBuffer[RTL_DIGEST_LENGTH_SHA1]; + rtlDigestError nError = rtl_digest_SHA1( aByteStrPass.getStr(), + aByteStrPass.getLength(), + pBuffer, + RTL_DIGEST_LENGTH_SHA1 ); + + if ( nError != rtl_Digest_E_None ) + throw uno::RuntimeException(); + + return uno::Sequence< sal_Int8 >( (sal_Int8*)pBuffer, RTL_DIGEST_LENGTH_SHA1 ); + +} + +// ================================================================ +namespace +{ +//----------------------------------------------- void SetEncryptionKeyProperty_Impl( const uno::Reference< beans::XPropertySet >& xPropertySet, const uno::Sequence< sal_Int8 >& aKey ) { @@ -142,7 +174,6 @@ sal_Bool KillFile( const ::rtl::OUString& aURL, const uno::Reference< lang::XMul const sal_Int32 n_ConstBufferSize = 32000; //----------------------------------------------- - ::rtl::OUString GetNewTempFileURL( const uno::Reference< lang::XMultiServiceFactory > xFactory ) { ::rtl::OUString aTempURL; @@ -169,31 +200,16 @@ const sal_Int32 n_ConstBufferSize = 32000; return aTempURL; } -uno::Sequence< sal_Int8 > MakeKeyFromPass( ::rtl::OUString aPass, sal_Bool bUseUTF ) +//----------------------------------------------- +uno::Reference< io::XStream > CreateMemoryStream( const uno::Reference< lang::XMultiServiceFactory >& xFactory ) { - // MS_1252 encoding was used for SO60 document format password encoding, - // this encoding supports only a minor subset of nonascii characters, - // but for compatibility reasons it has to be used for old document formats - - ::rtl::OString aByteStrPass; - if ( bUseUTF ) - aByteStrPass = ::rtl::OUStringToOString( aPass, RTL_TEXTENCODING_UTF8 ); - else - aByteStrPass = ::rtl::OUStringToOString( aPass, RTL_TEXTENCODING_MS_1252 ); - - sal_uInt8 pBuffer[RTL_DIGEST_LENGTH_SHA1]; - rtlDigestError nError = rtl_digest_SHA1( aByteStrPass.getStr(), - aByteStrPass.getLength(), - pBuffer, - RTL_DIGEST_LENGTH_SHA1 ); - - if ( nError != rtl_Digest_E_None ) + if ( !xFactory.is() ) throw uno::RuntimeException(); - return uno::Sequence< sal_Int8 >( (sal_Int8*)pBuffer, RTL_DIGEST_LENGTH_SHA1 ); - + return uno::Reference< io::XStream >( xFactory->createInstance ( ::rtl::OUString::createFromAscii( "com.sun.star.comp.MemoryStream" ) ), uno::UNO_QUERY_THROW ); } +} // anonymous namespace // ================================================================ //----------------------------------------------- @@ -203,6 +219,7 @@ OWriteStream_Impl::OWriteStream_Impl( OStorage_Impl* pParent, const uno::Reference< lang::XMultiServiceFactory >& xFactory, sal_Bool bForceEncrypted, sal_Int16 nStorageType, + sal_Bool bDefaultCompress, const uno::Reference< io::XInputStream >& xRelInfoStream ) : m_pAntiImpl( NULL ) , m_bHasDataToFlush( sal_False ) @@ -213,6 +230,7 @@ OWriteStream_Impl::OWriteStream_Impl( OStorage_Impl* pParent, , m_bForceEncrypted( bForceEncrypted ) , m_bUseCommonPass( !bForceEncrypted && nStorageType == PACKAGE_STORAGE ) , m_bHasCachedPassword( sal_False ) +, m_bCompressedSetExplicit( !bDefaultCompress ) , m_xPackage( xPackage ) , m_bHasInsertedStreamOptimization( sal_False ) , m_nStorageType( nStorageType ) @@ -238,6 +256,36 @@ OWriteStream_Impl::~OWriteStream_Impl() KillFile( m_aTempURL, GetServiceFactory() ); m_aTempURL = ::rtl::OUString(); } + + CleanCacheStream(); +} + +//----------------------------------------------- +void OWriteStream_Impl::CleanCacheStream() +{ + if ( m_xCacheStream.is() ) + { + try + { + uno::Reference< io::XInputStream > xInputCache = m_xCacheStream->getInputStream(); + if ( xInputCache.is() ) + xInputCache->closeInput(); + } + catch( uno::Exception& ) + {} + + try + { + uno::Reference< io::XOutputStream > xOutputCache = m_xCacheStream->getOutputStream(); + if ( xOutputCache.is() ) + xOutputCache->closeOutput(); + } + catch( uno::Exception& ) + {} + + m_xCacheStream = uno::Reference< io::XStream >(); + m_xCacheSeek = uno::Reference< io::XSeekable >(); + } } //----------------------------------------------- @@ -269,7 +317,7 @@ sal_Bool OWriteStream_Impl::IsEncrypted() if ( m_bForceEncrypted || m_bHasCachedPassword ) return sal_True; - if ( m_aTempURL.getLength() ) + if ( m_aTempURL.getLength() || m_xCacheStream.is() ) return sal_False; GetStreamProperties(); @@ -330,7 +378,7 @@ void OWriteStream_Impl::SetDecrypted() GetStreamProperties(); // let the stream be modified - GetFilledTempFile(); + FillTempGetFileName(); m_bHasDataToFlush = sal_True; // remove encryption @@ -355,7 +403,7 @@ void OWriteStream_Impl::SetEncryptedWithPass( const ::rtl::OUString& aPass ) GetStreamProperties(); // let the stream be modified - GetFilledTempFile(); + FillTempGetFileName(); m_bHasDataToFlush = sal_True; // introduce encryption info @@ -412,14 +460,14 @@ uno::Reference< lang::XMultiServiceFactory > OWriteStream_Impl::GetServiceFactor } //----------------------------------------------- -::rtl::OUString OWriteStream_Impl::GetFilledTempFile() +::rtl::OUString OWriteStream_Impl::GetFilledTempFileIfNo( const uno::Reference< io::XInputStream >& xStream ) { if ( !m_aTempURL.getLength() ) { - m_aTempURL = GetNewTempFileURL( GetServiceFactory() ); + ::rtl::OUString aTempURL = GetNewTempFileURL( GetServiceFactory() ); try { - if ( m_aTempURL ) + if ( aTempURL && xStream.is() ) { uno::Reference < ucb::XSimpleFileAccess > xTempAccess( GetServiceFactory()->createInstance ( @@ -430,64 +478,155 @@ uno::Reference< lang::XMultiServiceFactory > OWriteStream_Impl::GetServiceFactor throw uno::RuntimeException(); // TODO: - // in case of new inserted package stream it is possible that input stream still was not set - uno::Reference< io::XInputStream > xOrigStream = m_xPackageStream->getDataStream(); - if ( xOrigStream.is() ) + uno::Reference< io::XOutputStream > xTempOutStream = xTempAccess->openFileWrite( aTempURL ); + if ( xTempOutStream.is() ) { - uno::Reference< io::XOutputStream > xTempOutStream = xTempAccess->openFileWrite( m_aTempURL ); - if ( xTempOutStream.is() ) - { - // copy stream contents to the file - ::comphelper::OStorageHelper::CopyInputToOutput( xOrigStream, xTempOutStream ); - xTempOutStream->closeOutput(); - xTempOutStream = uno::Reference< io::XOutputStream >(); - } - else - throw io::IOException(); // TODO: + // the current position of the original stream should be still OK, copy further + ::comphelper::OStorageHelper::CopyInputToOutput( xStream, xTempOutStream ); + xTempOutStream->closeOutput(); + xTempOutStream = uno::Reference< io::XOutputStream >(); } + else + throw io::IOException(); // TODO: } } catch( packages::WrongPasswordException& ) { - KillFile( m_aTempURL, GetServiceFactory() ); - m_aTempURL = ::rtl::OUString(); - + KillFile( aTempURL, GetServiceFactory() ); throw; } catch( uno::Exception& ) { - KillFile( m_aTempURL, GetServiceFactory() ); - m_aTempURL = ::rtl::OUString(); + KillFile( aTempURL, GetServiceFactory() ); } + + if ( aTempURL.getLength() ) + CleanCacheStream(); + + m_aTempURL = aTempURL; } return m_aTempURL; } //----------------------------------------------- -uno::Reference< io::XStream > OWriteStream_Impl::GetTempFileAsStream() +::rtl::OUString OWriteStream_Impl::FillTempGetFileName() { - uno::Reference< io::XStream > xTempStream; + // should try to create cache first, if the amount of contents is too big, the temp file should be taken + if ( !m_xCacheStream.is() && !m_aTempURL.getLength() ) + { + uno::Reference< io::XInputStream > xOrigStream = m_xPackageStream->getDataStream(); + if ( !xOrigStream.is() ) + { + // in case of new inserted package stream it is possible that input stream still was not set + uno::Reference< io::XStream > xCacheStream = CreateMemoryStream( GetServiceFactory() ); + OSL_ENSURE( xCacheStream.is(), "If the stream can not be created an exception must be thrown!\n" ); + m_xCacheSeek.set( xCacheStream, uno::UNO_QUERY_THROW ); + m_xCacheStream = xCacheStream; + } + else + { + sal_Int32 nRead = 0; + uno::Sequence< sal_Int8 > aData( MAX_STORCACHE_SIZE + 1 ); + nRead = xOrigStream->readBytes( aData, MAX_STORCACHE_SIZE + 1 ); + if ( aData.getLength() > nRead ) + aData.realloc( nRead ); - if ( !m_aTempURL.getLength() ) - m_aTempURL = GetFilledTempFile(); + if ( nRead && nRead <= MAX_STORCACHE_SIZE ) + { + uno::Reference< io::XStream > xCacheStream = CreateMemoryStream( GetServiceFactory() ); + OSL_ENSURE( xCacheStream.is(), "If the stream can not be created an exception must be thrown!\n" ); + + uno::Reference< io::XOutputStream > xOutStream( xCacheStream->getOutputStream(), uno::UNO_SET_THROW ); + xOutStream->writeBytes( aData ); + m_xCacheSeek.set( xCacheStream, uno::UNO_QUERY_THROW ); + m_xCacheStream = xCacheStream; + m_xCacheSeek->seek( 0 ); + } + else if ( nRead && !m_aTempURL.getLength() ) + { + m_aTempURL = GetNewTempFileURL( GetServiceFactory() ); - uno::Reference < ucb::XSimpleFileAccess > xTempAccess( - GetServiceFactory()->createInstance ( - ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), - uno::UNO_QUERY ); + try { + if ( m_aTempURL.getLength() ) + { + uno::Reference < ucb::XSimpleFileAccess > xTempAccess( + GetServiceFactory()->createInstance ( + ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), + uno::UNO_QUERY ); - if ( !xTempAccess.is() ) - throw uno::RuntimeException(); // TODO: + if ( !xTempAccess.is() ) + throw uno::RuntimeException(); // TODO: - try - { - xTempStream = xTempAccess->openFileReadWrite( m_aTempURL ); + + uno::Reference< io::XOutputStream > xTempOutStream = xTempAccess->openFileWrite( m_aTempURL ); + if ( xTempOutStream.is() ) + { + // copy stream contents to the file + xTempOutStream->writeBytes( aData ); + + // the current position of the original stream should be still OK, copy further + ::comphelper::OStorageHelper::CopyInputToOutput( xOrigStream, xTempOutStream ); + xTempOutStream->closeOutput(); + xTempOutStream = uno::Reference< io::XOutputStream >(); + } + else + throw io::IOException(); // TODO: + } + } + catch( packages::WrongPasswordException& ) + { + KillFile( m_aTempURL, GetServiceFactory() ); + m_aTempURL = ::rtl::OUString(); + + throw; + } + catch( uno::Exception& ) + { + KillFile( m_aTempURL, GetServiceFactory() ); + m_aTempURL = ::rtl::OUString(); + } + } + } } - catch( uno::Exception& ) + + return m_aTempURL; +} + +//----------------------------------------------- +uno::Reference< io::XStream > OWriteStream_Impl::GetTempFileAsStream() +{ + uno::Reference< io::XStream > xTempStream; + + if ( !m_xCacheStream.is() ) { + if ( !m_aTempURL.getLength() ) + m_aTempURL = FillTempGetFileName(); + + if ( m_aTempURL.getLength() ) + { + // the temporary file is not used if the cache is used + uno::Reference < ucb::XSimpleFileAccess > xTempAccess( + GetServiceFactory()->createInstance ( + ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), + uno::UNO_QUERY ); + + if ( !xTempAccess.is() ) + throw uno::RuntimeException(); // TODO: + + try + { + xTempStream = xTempAccess->openFileReadWrite( m_aTempURL ); + } + catch( uno::Exception& ) + { + } + } } + if ( m_xCacheStream.is() ) + xTempStream = m_xCacheStream; + // the method must always return a stream // in case the stream can not be open // an exception should be thrown @@ -502,25 +641,35 @@ uno::Reference< io::XInputStream > OWriteStream_Impl::GetTempFileAsInputStream() { uno::Reference< io::XInputStream > xInputStream; - if ( !m_aTempURL.getLength() ) - m_aTempURL = GetFilledTempFile(); + if ( !m_xCacheStream.is() ) + { + if ( !m_aTempURL.getLength() ) + m_aTempURL = FillTempGetFileName(); - uno::Reference < ucb::XSimpleFileAccess > xTempAccess( - GetServiceFactory()->createInstance ( - ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), - uno::UNO_QUERY ); + if ( m_aTempURL.getLength() ) + { + // the temporary file is not used if the cache is used + uno::Reference < ucb::XSimpleFileAccess > xTempAccess( + GetServiceFactory()->createInstance ( + ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), + uno::UNO_QUERY ); - if ( !xTempAccess.is() ) - throw uno::RuntimeException(); // TODO: + if ( !xTempAccess.is() ) + throw uno::RuntimeException(); // TODO: - try - { - xInputStream = xTempAccess->openFileRead( m_aTempURL ); - } - catch( uno::Exception& ) - { + try + { + xInputStream = xTempAccess->openFileRead( m_aTempURL ); + } + catch( uno::Exception& ) + { + } + } } + if ( m_xCacheStream.is() ) + xInputStream = m_xCacheStream->getInputStream(); + // the method must always return a stream // in case the stream can not be open // an exception should be thrown @@ -534,29 +683,54 @@ uno::Reference< io::XInputStream > OWriteStream_Impl::GetTempFileAsInputStream() void OWriteStream_Impl::CopyTempFileToOutput( uno::Reference< io::XOutputStream > xOutStream ) { OSL_ENSURE( xOutStream.is(), "The stream must be specified!\n" ); - OSL_ENSURE( m_aTempURL.getLength(), "The temporary must exist!\n" ); - - uno::Reference < ucb::XSimpleFileAccess > xTempAccess( - GetServiceFactory()->createInstance ( - ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), - uno::UNO_QUERY ); - - if ( !xTempAccess.is() ) - throw uno::RuntimeException(); // TODO: + OSL_ENSURE( m_aTempURL.getLength() || m_xCacheStream.is(), "The temporary must exist!\n" ); uno::Reference< io::XInputStream > xTempInStream; - try + + if ( m_xCacheStream.is() ) { - xTempInStream = xTempAccess->openFileRead( m_aTempURL ); + if ( !m_xCacheSeek.is() ) + throw uno::RuntimeException(); + sal_Int64 nPos = m_xCacheSeek->getPosition(); + + try + { + m_xCacheSeek->seek( 0 ); + uno::Reference< io::XInputStream > xTempInp = m_xCacheStream->getInputStream(); + if ( xTempInp.is() ) + ::comphelper::OStorageHelper::CopyInputToOutput( xTempInStream, xOutStream ); + } + catch( uno::Exception& ) + { + m_xCacheSeek->seek( nPos ); + throw io::IOException(); //TODO: + } + + m_xCacheSeek->seek( nPos ); } - catch( uno::Exception& ) + else if ( m_aTempURL.getLength() ) { - } + uno::Reference < ucb::XSimpleFileAccess > xTempAccess( + GetServiceFactory()->createInstance ( + ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), + uno::UNO_QUERY ); - if ( !xTempInStream.is() ) - throw io::IOException(); //TODO: + if ( !xTempAccess.is() ) + throw uno::RuntimeException(); // TODO: + + try + { + xTempInStream = xTempAccess->openFileRead( m_aTempURL ); + } + catch( uno::Exception& ) + { + } + + if ( !xTempInStream.is() ) + throw io::IOException(); //TODO: - ::comphelper::OStorageHelper::CopyInputToOutput( xTempInStream, xOutStream ); + ::comphelper::OStorageHelper::CopyInputToOutput( xTempInStream, xOutStream ); + } } // ================================================================================================= @@ -576,7 +750,7 @@ void OWriteStream_Impl::InsertStreamDirectly( const uno::Reference< io::XInputSt if ( m_bHasDataToFlush ) throw io::IOException(); - OSL_ENSURE( !m_aTempURL.getLength(), "The temporary must not exist!\n" ); + OSL_ENSURE( !m_aTempURL.getLength() && !m_xCacheStream.is(), "The temporary must not exist!\n" ); // use new file as current persistent representation // the new file will be removed after it's stream is closed @@ -624,7 +798,10 @@ void OWriteStream_Impl::InsertStreamDirectly( const uno::Reference< io::XInputSt } if ( bCompressedIsSet ) - xPropertySet->setPropertyValue( aComprPropName, uno::makeAny( (sal_Bool)bCompressed ) ); + { + xPropertySet->setPropertyValue( aComprPropName, uno::makeAny( (sal_Bool)bCompressed ) ); + m_bCompressedSetExplicit = sal_True; + } if ( m_bUseCommonPass ) { @@ -655,34 +832,57 @@ void OWriteStream_Impl::Commit() return; uno::Reference< packages::XDataSinkEncrSupport > xNewPackageStream; + uno::Sequence< uno::Any > aSeq( 1 ); + aSeq[0] <<= sal_False; - OSL_ENSURE( m_bHasInsertedStreamOptimization || m_aTempURL.getLength(), "The temporary must exist!\n" ); - if ( m_aTempURL.getLength() ) + if ( m_xCacheStream.is() ) { - uno::Reference < io::XOutputStream > xTempOut( - GetServiceFactory()->createInstance ( - ::rtl::OUString::createFromAscii( "com.sun.star.io.TempFile" ) ), - uno::UNO_QUERY ); - uno::Reference < io::XInputStream > xTempIn( xTempOut, uno::UNO_QUERY ); + uno::Reference< io::XInputStream > xInStream( m_xCacheStream->getInputStream(), uno::UNO_SET_THROW ); - if ( !xTempOut.is() || !xTempIn.is() ) - throw io::IOException(); + xNewPackageStream = uno::Reference< packages::XDataSinkEncrSupport >( + m_xPackage->createInstanceWithArguments( aSeq ), + uno::UNO_QUERY_THROW ); + + xNewPackageStream->setDataStream( xInStream ); + + m_xCacheStream = uno::Reference< io::XStream >(); + m_xCacheSeek = uno::Reference< io::XSeekable >(); + + if ( m_pAntiImpl ) + m_pAntiImpl->DeInit(); + } + else if ( m_aTempURL.getLength() ) + { + uno::Reference < ucb::XSimpleFileAccess > xTempAccess( + GetServiceFactory()->createInstance ( + ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), + uno::UNO_QUERY ); + + if ( !xTempAccess.is() ) + throw uno::RuntimeException(); // TODO: + + uno::Reference< io::XInputStream > xInStream; + try + { + xInStream = xTempAccess->openFileRead( m_aTempURL ); + } + catch( uno::Exception& ) + { + } - // Copy temporary file to a new one - CopyTempFileToOutput( xTempOut ); - xTempOut->closeOutput(); + if ( !xInStream.is() ) + throw io::IOException(); - uno::Sequence< uno::Any > aSeq( 1 ); - aSeq[0] <<= sal_False; xNewPackageStream = uno::Reference< packages::XDataSinkEncrSupport >( m_xPackage->createInstanceWithArguments( aSeq ), - uno::UNO_QUERY ); - if ( !xNewPackageStream.is() ) - throw uno::RuntimeException(); + uno::UNO_QUERY_THROW ); + + // TODO/NEW: Let the temporary file be removed after commit + xNewPackageStream->setDataStream( xInStream ); + m_aTempURL = ::rtl::OUString(); - // use new file as current persistent representation - // the new file will be removed after it's stream is closed - xNewPackageStream->setDataStream( xTempIn ); + if ( m_pAntiImpl ) + m_pAntiImpl->DeInit(); } else // if ( m_bHasInsertedStreamOptimization ) { @@ -746,7 +946,13 @@ void OWriteStream_Impl::Revert() if ( !m_bHasDataToFlush ) return; // nothing to do - OSL_ENSURE( m_aTempURL.getLength(), "The temporary must exist!\n" ); + OSL_ENSURE( m_aTempURL.getLength() || m_xCacheStream.is(), "The temporary must exist!\n" ); + + if ( m_xCacheStream.is() ) + { + m_xCacheStream = uno::Reference< io::XStream >(); + m_xCacheSeek = uno::Reference< io::XSeekable >(); + } if ( m_aTempURL.getLength() ) { @@ -1071,7 +1277,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream( sal_Int32 nStreamMod // the stream must be resaved with new password encryption if ( nStreamMode & embed::ElementModes::WRITE ) { - GetFilledTempFile(); + FillTempGetFileName(); m_bHasDataToFlush = sal_True; // TODO/LATER: should the notification be done? @@ -1149,7 +1355,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre if ( ( nStreamMode & embed::ElementModes::READWRITE ) == embed::ElementModes::READ ) { uno::Reference< io::XInputStream > xInStream; - if ( m_aTempURL.getLength() ) + if ( m_xCacheStream.is() || m_aTempURL.getLength() ) xInStream = GetTempFileAsInputStream(); //TODO: else xInStream = m_xPackageStream->getDataStream(); @@ -1170,7 +1376,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre } else if ( ( nStreamMode & embed::ElementModes::READWRITE ) == embed::ElementModes::SEEKABLEREAD ) { - if ( !m_aTempURL.getLength() && !( m_xPackageStream->getDataStream().is() ) ) + if ( !m_xCacheStream.is() && !m_aTempURL.getLength() && !( m_xPackageStream->getDataStream().is() ) ) { // The stream does not exist in the storage throw io::IOException(); @@ -1202,10 +1408,12 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre if ( ( nStreamMode & embed::ElementModes::TRUNCATE ) == embed::ElementModes::TRUNCATE ) { if ( m_aTempURL.getLength() ) + { KillFile( m_aTempURL, GetServiceFactory() ); - - // open new empty temp file - m_aTempURL = GetNewTempFileURL( GetServiceFactory() ); + m_aTempURL = ::rtl::OUString(); + } + if ( m_xCacheStream.is() ) + CleanCacheStream(); m_bHasDataToFlush = sal_True; @@ -1213,11 +1421,13 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre if ( m_pParent ) m_pParent->m_bIsModified = sal_True; - xStream = GetTempFileAsStream(); + xStream = CreateMemoryStream( GetServiceFactory() ); + m_xCacheSeek.set( xStream, uno::UNO_QUERY_THROW ); + m_xCacheStream = xStream; } else if ( !m_bHasInsertedStreamOptimization ) { - if ( !m_aTempURL.getLength() && !( m_xPackageStream->getDataStream().is() ) ) + if ( !m_aTempURL.getLength() && !m_xCacheStream.is() && !( m_xPackageStream->getDataStream().is() ) ) { // The stream does not exist in the storage m_bHasDataToFlush = sal_True; @@ -1572,6 +1782,7 @@ OWriteStream::OWriteStream( OWriteStream_Impl* pImpl, sal_Bool bTransacted ) : m_pImpl( pImpl ) , m_bInStreamDisconnected( sal_False ) , m_bInitOnDemand( sal_True ) +, m_nInitPosition( 0 ) , m_bTransacted( bTransacted ) { OSL_ENSURE( pImpl, "No base implementation!\n" ); @@ -1588,6 +1799,7 @@ OWriteStream::OWriteStream( OWriteStream_Impl* pImpl, uno::Reference< io::XStrea : m_pImpl( pImpl ) , m_bInStreamDisconnected( sal_False ) , m_bInitOnDemand( sal_False ) +, m_nInitPosition( 0 ) , m_bTransacted( bTransacted ) { OSL_ENSURE( pImpl && xStream.is(), "No base implementation!\n" ); @@ -1631,6 +1843,21 @@ OWriteStream::~OWriteStream() } //----------------------------------------------- +void OWriteStream::DeInit() +{ + if ( !m_pImpl ) + return; // do nothing + + if ( m_xSeekable.is() ) + m_nInitPosition = m_xSeekable->getPosition(); + + m_xInStream = uno::Reference< io::XInputStream >(); + m_xOutStream = uno::Reference< io::XOutputStream >(); + m_xSeekable = uno::Reference< io::XSeekable >(); + m_bInitOnDemand = sal_True; +} + +//----------------------------------------------- void OWriteStream::CheckInitOnDemand() { if ( !m_pImpl ) @@ -1642,11 +1869,12 @@ void OWriteStream::CheckInitOnDemand() uno::Reference< io::XStream > xStream = m_pImpl->GetTempFileAsStream(); if ( xStream.is() ) { - m_xInStream = xStream->getInputStream(); - m_xOutStream = xStream->getOutputStream(); - m_xSeekable = uno::Reference< io::XSeekable >( xStream, uno::UNO_QUERY ); - OSL_ENSURE( m_xInStream.is() && m_xOutStream.is() && m_xSeekable.is(), "Stream implementation is incomplete!\n" ); + m_xInStream.set( xStream->getInputStream(), uno::UNO_SET_THROW ); + m_xOutStream.set( xStream->getOutputStream(), uno::UNO_SET_THROW ); + m_xSeekable.set( xStream, uno::UNO_QUERY_THROW ); + m_xSeekable->seek( m_nInitPosition ); + m_nInitPosition = 0; m_bInitOnDemand = sal_False; } } @@ -2072,11 +2300,54 @@ void SAL_CALL OWriteStream::writeBytes( const uno::Sequence< sal_Int8 >& aData ) { ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); - CheckInitOnDemand(); + // the write method makes initialization itself, since it depends from the aData length + // NO CheckInitOnDemand()! if ( !m_pImpl ) throw lang::DisposedException(); + if ( !m_bInitOnDemand ) + { + if ( !m_xOutStream.is() || !m_xSeekable.is()) + throw io::NotConnectedException(); + + if ( m_pImpl->m_xCacheStream.is() ) + { + // check whether the cache should be turned off + sal_Int64 nPos = m_xSeekable->getPosition(); + if ( nPos + aData.getLength() > MAX_STORCACHE_SIZE ) + { + // disconnect the cache and copy the data to the temporary file + m_xSeekable->seek( 0 ); + + // it is enough to copy the cached stream, the cache should already contain everything + if ( m_pImpl->GetFilledTempFileIfNo( m_xInStream ).getLength() ) + { + DeInit(); + // the last position is known and it is differs from the current stream position + m_nInitPosition = nPos; + } + } + } + } + + if ( m_bInitOnDemand ) + { + RTL_LOGFILE_CONTEXT( aLog, "package (mv76033) OWriteStream::CheckInitOnDemand, initializing" ); + uno::Reference< io::XStream > xStream = m_pImpl->GetTempFileAsStream(); + if ( xStream.is() ) + { + m_xInStream.set( xStream->getInputStream(), uno::UNO_SET_THROW ); + m_xOutStream.set( xStream->getOutputStream(), uno::UNO_SET_THROW ); + m_xSeekable.set( xStream, uno::UNO_QUERY_THROW ); + m_xSeekable->seek( m_nInitPosition ); + + m_nInitPosition = 0; + m_bInitOnDemand = sal_False; + } + } + + if ( !m_xOutStream.is() ) throw io::NotConnectedException(); @@ -2735,11 +3006,35 @@ void SAL_CALL OWriteStream::setPropertyValue( const ::rtl::OUString& aPropertyNa throw lang::DisposedException(); m_pImpl->GetStreamProperties(); + ::rtl::OUString aCompressedString( RTL_CONSTASCII_USTRINGPARAM( "Compressed" ) ); + ::rtl::OUString aMediaTypeString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ); + if ( m_pData->m_nStorageType == PACKAGE_STORAGE && aPropertyName.equals( aMediaTypeString ) ) + { + // if the "Compressed" property is not set explicitly, the MediaType can change the default value + sal_Bool bCompressedValueFromType = sal_True; + ::rtl::OUString aType; + aValue >>= aType; - if ( ( m_pData->m_nStorageType == PACKAGE_STORAGE || m_pData->m_nStorageType == OFOPXML_STORAGE ) - && aPropertyName.equalsAscii( "MediaType" ) - || aPropertyName.equalsAscii( "Compressed" ) ) + if ( !m_pImpl->m_bCompressedSetExplicit ) + { + if ( aType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "image/jpeg" ) ) ) + || aType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "image/png" ) ) ) + || aType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "image/gif" ) ) ) ) + bCompressedValueFromType = sal_False; + } + + for ( sal_Int32 nInd = 0; nInd < m_pImpl->m_aProps.getLength(); nInd++ ) + { + if ( aPropertyName.equals( m_pImpl->m_aProps[nInd].Name ) ) + m_pImpl->m_aProps[nInd].Value = aValue; + else if ( !m_pImpl->m_bCompressedSetExplicit && aCompressedString.equals( m_pImpl->m_aProps[nInd].Name ) ) + m_pImpl->m_aProps[nInd].Value <<= bCompressedValueFromType; + } + } + else if ( m_pData->m_nStorageType == PACKAGE_STORAGE && aPropertyName.equalsAscii( "Compressed" ) ) { + // if the "Compressed" property is not set explicitly, the MediaType can change the default value + m_pImpl->m_bCompressedSetExplicit = sal_True; for ( sal_Int32 nInd = 0; nInd < m_pImpl->m_aProps.getLength(); nInd++ ) { if ( aPropertyName.equals( m_pImpl->m_aProps[nInd].Name ) ) @@ -2771,6 +3066,15 @@ void SAL_CALL OWriteStream::setPropertyValue( const ::rtl::OUString& aPropertyNa else throw lang::IllegalArgumentException(); //TODO } + else if ( m_pData->m_nStorageType == OFOPXML_STORAGE + && ( aPropertyName.equalsAscii( "MediaType" ) || aPropertyName.equalsAscii( "Compressed" ) ) ) + { + for ( sal_Int32 nInd = 0; nInd < m_pImpl->m_aProps.getLength(); nInd++ ) + { + if ( aPropertyName.equals( m_pImpl->m_aProps[nInd].Name ) ) + m_pImpl->m_aProps[nInd].Value = aValue; + } + } else if ( m_pData->m_nStorageType == OFOPXML_STORAGE && aPropertyName.equalsAscii( "RelationsInfoStream" ) ) { uno::Reference< io::XInputStream > xInRelStream; diff --git a/package/source/xstor/owriteablestream.hxx b/package/source/xstor/owriteablestream.hxx index e9b10ce8ebc0..a3ee6d91862e 100644 --- a/package/source/xstor/owriteablestream.hxx +++ b/package/source/xstor/owriteablestream.hxx @@ -34,7 +34,6 @@ #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/XOutputStream.hpp> #include <com/sun/star/io/XStream.hpp> -#include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/XSeekable.hpp> #include <com/sun/star/io/XTruncate.hpp> #include <com/sun/star/packages/XDataSinkEncrSupport.hpp> @@ -106,6 +105,9 @@ struct OWriteStream_Impl : public PreCreationStruct OWriteStream* m_pAntiImpl; ::rtl::OUString m_aTempURL; + ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xCacheStream; + ::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable > m_xCacheSeek; + InputStreamsList_Impl m_aInputStreamsList; sal_Bool m_bHasDataToFlush; // only modified elements will be sent to the original content @@ -125,6 +127,8 @@ struct OWriteStream_Impl : public PreCreationStruct sal_Bool m_bHasCachedPassword; ::rtl::OUString m_aPass; + sal_Bool m_bCompressedSetExplicit; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > m_xPackage; sal_Bool m_bHasInsertedStreamOptimization; @@ -145,7 +149,8 @@ struct OWriteStream_Impl : public PreCreationStruct private: ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > GetServiceFactory(); - ::rtl::OUString GetFilledTempFile(); + ::rtl::OUString GetFilledTempFileIfNo( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xStream ); + ::rtl::OUString FillTempGetFileName(); ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > GetTempFileAsStream(); ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetTempFileAsInputStream(); @@ -169,11 +174,14 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory, sal_Bool bForceEncrypted, sal_Int16 nStorageType, + sal_Bool bDefaultCompress, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xRelInfoStream = ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >() ); ~OWriteStream_Impl(); + void CleanCacheStream(); + sal_Bool UsesCommonPass_Impl() { return m_bUseCommonPass; } sal_Bool HasTempFile_Impl() { return ( m_aTempURL.getLength() != 0 ); } sal_Bool IsTransacted(); @@ -279,6 +287,7 @@ protected: sal_Bool m_bInStreamDisconnected; sal_Bool m_bInitOnDemand; + sal_Int64 m_nInitPosition; sal_Bool m_bTransacted; @@ -298,6 +307,7 @@ public: virtual ~OWriteStream(); void CheckInitOnDemand(); + void DeInit(); // XInterface virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& rType ) diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 0d0b011aec35..3705e560890c 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -1384,7 +1384,7 @@ SotElement_Impl* OStorage_Impl::InsertStream( ::rtl::OUString aName, sal_Bool bE // the mode is not needed for storage stream internal implementation SotElement_Impl* pNewElement = InsertElement( aName, sal_False ); - pNewElement->m_pStream = new OWriteStream_Impl( this, xPackageSubStream, m_xPackage, m_xFactory, bEncr, m_nStorageType ); + pNewElement->m_pStream = new OWriteStream_Impl( this, xPackageSubStream, m_xPackage, m_xFactory, bEncr, m_nStorageType, sal_True ); m_aChildrenList.push_back( pNewElement ); m_bIsModified = sal_True; @@ -1425,7 +1425,7 @@ SotElement_Impl* OStorage_Impl::InsertRawStream( ::rtl::OUString aName, const un // the mode is not needed for storage stream internal implementation SotElement_Impl* pNewElement = InsertElement( aName, sal_False ); - pNewElement->m_pStream = new OWriteStream_Impl( this, xPackageSubStream, m_xPackage, m_xFactory, sal_True, m_nStorageType ); + pNewElement->m_pStream = new OWriteStream_Impl( this, xPackageSubStream, m_xPackage, m_xFactory, sal_True, m_nStorageType, sal_False ); // the stream is inserted and must be treated as a commited one pNewElement->m_pStream->SetToBeCommited(); @@ -1564,7 +1564,7 @@ void OStorage_Impl::OpenSubStream( SotElement_Impl* pElement ) throw uno::RuntimeException(); // TODO // the stream can never be inserted here, because inserted stream element holds the stream till commit or destruction - pElement->m_pStream = new OWriteStream_Impl( this, xPackageSubStream, m_xPackage, m_xFactory, sal_False, m_nStorageType, GetRelInfoStreamForName( pElement->m_aOriginalName ) ); + pElement->m_pStream = new OWriteStream_Impl( this, xPackageSubStream, m_xPackage, m_xFactory, sal_False, m_nStorageType, sal_False, GetRelInfoStreamForName( pElement->m_aOriginalName ) ); } } diff --git a/package/source/zipapi/XFileStream.cxx b/package/source/zipapi/XFileStream.cxx index 220c7e8f1b0e..09df729809d4 100644 --- a/package/source/zipapi/XFileStream.cxx +++ b/package/source/zipapi/XFileStream.cxx @@ -84,7 +84,7 @@ XFileStream::XFileStream( ZipEntry & rEntry, if ( bHaveEncryptData ) { if ( !bNewRawStream ) - ZipFile::StaticGetCipher ( rData, maCipher ); + ZipFile::StaticGetCipher ( rData, maCipher, sal_True ); else { // Put in the EncryptedDataHeader diff --git a/package/source/zipapi/XUnbufferedStream.cxx b/package/source/zipapi/XUnbufferedStream.cxx index ff8a085e6b8d..cb99c085bc28 100644 --- a/package/source/zipapi/XUnbufferedStream.cxx +++ b/package/source/zipapi/XUnbufferedStream.cxx @@ -93,7 +93,7 @@ XUnbufferedStream::XUnbufferedStream( ZipEntry & rEntry, sal_Bool bMustDecrypt = ( nStreamMode == UNBUFF_STREAM_DATA && bHaveEncryptData && bIsEncrypted ) ? sal_True : sal_False; if ( bMustDecrypt ) - ZipFile::StaticGetCipher ( rData, maCipher ); + ZipFile::StaticGetCipher ( rData, maCipher, sal_True ); if ( bHaveEncryptData && mbWrappedRaw && bIsEncrypted ) { // if we have the data needed to decrypt it, but didn't want it decrypted (or @@ -147,7 +147,7 @@ XUnbufferedStream::XUnbufferedStream( const Reference < XInputStream >& xRawStre mnZipEnd = mnZipCurrent + mnZipSize; - ZipFile::StaticGetCipher ( rData, maCipher ); + ZipFile::StaticGetCipher ( rData, maCipher, sal_True ); } XUnbufferedStream::~XUnbufferedStream() diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 291357c1adb2..0be136e75d6f 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -127,8 +127,9 @@ void ZipFile::setInputStream ( Reference < XInputStream > xNewStream ) aGrabber.setInputStream ( xStream ); } -void ZipFile::StaticGetCipher ( const ORef < EncryptionData > & xEncryptionData, rtlCipher &rCipher ) +sal_Bool ZipFile::StaticGetCipher ( const ORef < EncryptionData > & xEncryptionData, rtlCipher &rCipher, sal_Bool bDecode ) { + sal_Bool bResult = sal_False; if ( ! xEncryptionData.isEmpty() ) { Sequence < sal_uInt8 > aDerivedKey (16); @@ -144,13 +145,17 @@ void ZipFile::StaticGetCipher ( const ORef < EncryptionData > & xEncryptionData, xEncryptionData->nIterationCount ); rCipher = rtl_cipher_create (rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeStream); - aResult = rtl_cipher_init( rCipher, rtl_Cipher_DirectionDecode, + aResult = rtl_cipher_init( rCipher, bDecode ? rtl_Cipher_DirectionDecode : rtl_Cipher_DirectionEncode, aDerivedKey.getConstArray(), aDerivedKey.getLength(), reinterpret_cast < const sal_uInt8 * > ( xEncryptionData->aInitVector.getConstArray() ), xEncryptionData->aInitVector.getLength()); OSL_ASSERT (aResult == rtl_Cipher_E_None); + + bResult = ( aResult == rtl_Cipher_E_None ); } + + return bResult; } void ZipFile::StaticFillHeader ( const ORef < EncryptionData > & rData, @@ -335,7 +340,7 @@ sal_Bool ZipFile::StaticHasValidPassword( const Sequence< sal_Int8 > &aReadBuffe // make a temporary cipher rtlCipher aCipher; - StaticGetCipher ( rData, aCipher ); + StaticGetCipher ( rData, aCipher, sal_True ); Sequence < sal_Int8 > aDecryptBuffer ( nSize ); rtlDigest aDigest = rtl_digest_createSHA1(); @@ -434,7 +439,7 @@ Reference < XInputStream > ZipFile::createMemoryStream( if ( bMustDecrypt ) { - StaticGetCipher ( rData, aCipher ); + StaticGetCipher ( rData, aCipher, sal_True ); aDecryptBuffer.realloc ( nSize ); } diff --git a/package/source/zipapi/ZipOutputStream.cxx b/package/source/zipapi/ZipOutputStream.cxx index a1504f0aa526..8954db47d63c 100644 --- a/package/source/zipapi/ZipOutputStream.cxx +++ b/package/source/zipapi/ZipOutputStream.cxx @@ -36,6 +36,7 @@ #include <EncryptionData.hxx> #include <PackageConstants.hxx> #include <ZipEntry.hxx> +#include <ZipFile.hxx> #ifndef _VOS_REF_H_ #include <vos/ref.hxx> #endif @@ -103,15 +104,9 @@ void SAL_CALL ZipOutputStream::putNextEntry( ZipEntry& rEntry, if (bEncrypt) { bEncryptCurrentEntry = sal_True; - rtlCipherError aResult; - - aCipher = rtl_cipher_create ( rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeStream); - aResult = rtl_cipher_init( aCipher, rtl_Cipher_DirectionEncode, - reinterpret_cast < const sal_uInt8 * > (xEncryptData->aKey.getConstArray() ), - xEncryptData->aKey.getLength(), - reinterpret_cast < const sal_uInt8 * > ( xEncryptData->aInitVector.getConstArray() ), - xEncryptData->aInitVector.getLength()); - OSL_ASSERT( aResult == rtl_Cipher_E_None ); + + ZipFile::StaticGetCipher( xEncryptData, aCipher, sal_False ); + aDigest = rtl_digest_createSHA1(); mnDigested = 0; rEntry.nFlag |= 1 << 4; diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx index 1d5e900e28fe..8e0c8718dbfb 100644 --- a/package/source/zippackage/ZipPackageFolder.cxx +++ b/package/source/zippackage/ZipPackageFolder.cxx @@ -449,25 +449,16 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr if ( bToBeEncrypted && !bTransportOwnEncrStreamAsRaw ) { Sequence < sal_uInt8 > aSalt ( 16 ), aVector ( 8 ); - Sequence < sal_Int8 > aKey ( 16 ); rtl_random_getBytes ( rRandomPool, aSalt.getArray(), 16 ); rtl_random_getBytes ( rRandomPool, aVector.getArray(), 8 ); sal_Int32 nIterationCount = 1024; - if ( pStream->HasOwnKey() ) - rtl_digest_PBKDF2 ( reinterpret_cast < sal_uInt8 * > (aKey.getArray()), 16, - reinterpret_cast < const sal_uInt8 * > (pStream->getKey().getConstArray()), pStream->getKey().getLength(), - reinterpret_cast < const sal_uInt8 * > ( aSalt.getConstArray() ), 16, - nIterationCount ); - else - rtl_digest_PBKDF2 ( reinterpret_cast < sal_uInt8 * > (aKey.getArray()), 16, - reinterpret_cast < const sal_uInt8 * > (rEncryptionKey.getConstArray()), rEncryptionKey.getLength(), - reinterpret_cast < const sal_uInt8 * > ( aSalt.getConstArray() ), 16, - nIterationCount ); + if ( !pStream->HasOwnKey() ) + pStream->setKey ( rEncryptionKey ); + pStream->setInitialisationVector ( aVector ); pStream->setSalt ( aSalt ); pStream->setIterationCount ( nIterationCount ); - pStream->setKey ( aKey ); } // last property is digest, which is inserted later if we didn't have diff --git a/setup_native/scripts/admin.pl b/setup_native/scripts/admin.pl index ae01e6f9a99d..81d5649ffec6 100644 --- a/setup_native/scripts/admin.pl +++ b/setup_native/scripts/admin.pl @@ -29,6 +29,7 @@ # #************************************************************************* +use Cwd; use File::Copy; ################################################################################# @@ -44,6 +45,7 @@ BEGIN $globaltempdirname = "ooopackaging"; $savetemppath = ""; $msiinfo_available = 0; + $path_displayed = 0; $plat = $^O; @@ -435,7 +437,20 @@ sub unpack_cabinet_file { my ($cabfilename, $unpackdir) = @_; - my $expandfile = "expand.exe"; # Has to be in the path + my $expandfile = "expand.exe"; # has to be in the PATH + + # expand.exe has to be located in the system directory. + # Cygwin has another tool expand.exe, that converts tabs to spaces. This cannot be used of course. + # But this wrong expand.exe is typically in the PATH before this expand.exe, to unpack + # cabinet files. + + if ( $^O =~ /cygwin/i ) + { + $expandfile = $ENV{'SYSTEMROOT'} . "/system32/expand.exe"; # Has to be located in the systemdirectory + $expandfile =~ s/\\/\//; + if ( ! -f $expandfile ) { exit_program("ERROR: Did not find file $expandfile in the Windows system folder!"); } + } + my $expandlogfile = $unpackdir . $separator . "expand.log"; # exclude cabinet file @@ -445,7 +460,12 @@ sub unpack_cabinet_file if ( $^O =~ /cygwin/i ) { my $localunpackdir = qx{cygpath -w "$unpackdir"}; $localunpackdir =~ s/\\/\\\\/g; - $systemcall = $expandfile . " " . $cabfilename . " -F:\\\* " . $localunpackdir; + + my $localcabfilename = qx{cygpath -w "$cabfilename"}; + $localcabfilename =~ s/\\/\\\\/g; + $localcabfilename =~ s/\s*$//g; + + $systemcall = $expandfile . " " . $localcabfilename . " -F:\* " . $localunpackdir . " \>\/dev\/null 2\>\&1"; } else { @@ -470,6 +490,16 @@ sub extract_tables_from_database my $systemcall = ""; my $returnvalue = ""; + if ( $^O =~ /cygwin/i ) { + chomp( $fullmsidatabasepath = qx{cygpath -w "$fullmsidatabasepath"} ); + # msidb.exe really wants backslashes. (And double escaping because system() expands the string.) + $fullmsidatabasepath =~ s/\\/\\\\/g; + $workdir =~ s/\\/\\\\/g; + # and if there are still slashes, they also need to be double backslash + $fullmsidatabasepath =~ s/\//\\\\/g; + $workdir =~ s/\//\\\\/g; + } + # Export of all tables by using "*" $systemcall = $msidb . " -d " . $fullmsidatabasepath . " -f " . $workdir . " -e $tablelist"; @@ -626,6 +656,32 @@ sub create_directory_structure return \%fullpathhash; } +#################################################################################### +# Cygwin: Setting privileges for files +#################################################################################### + +sub change_privileges +{ + my ($destfile, $privileges) = @_; + + my $localcall = "chmod $privileges " . "\"" . $destfile . "\""; + system($localcall); +} + +#################################################################################### +# Cygwin: Setting privileges for files recursively +#################################################################################### + +sub change_privileges_full +{ + my ($target) = @_; + + print "Changing privileges\n"; + + my $localcall = "chmod -R 755 " . "\"" . $target . "\""; + system($localcall); +} + ###################################################### # Creating a new directory with defined privileges ###################################################### @@ -739,6 +795,7 @@ sub copy_files_into_directory_structure if ( $destfile =~ /\.oxt\s*$/ ) { push(@extensions, $destfile); } # Searching unopkg.exe if ( $destfile =~ /unopkg\.exe\s*$/ ) { $unopkgfile = $destfile; } + # if (( $^O =~ /cygwin/i ) && ( $destfile =~ /\.exe\s*$/ )) { change_privileges($destfile, "775"); } } # else # allowing missing sequence numbers ? # { @@ -844,12 +901,38 @@ sub register_one_extension { my ($unopkgfile, $extension, $temppath) = @_; - print "... $extension\n"; + my $from = cwd(); + + my $path = $unopkgfile; + get_path_from_fullqualifiedname(\$path); + $path =~ s/\\\s*$//; + $path =~ s/\/\s*$//; + + my $executable = $unopkgfile; + make_absolute_filename_to_relative_filename(\$executable); + + chdir($path); + + if ( ! $path_displayed ) + { + print "... current dir: $path ...\n"; + $path_displayed = 1; + } $temppath =~ s/\\/\//g; $temppath = "/".$temppath; - my $systemcall = "\"" . $unopkgfile . "\"" . " add --shared --verbose " . "\"" . $extension . "\"" . " -env:UserInstallation=file://" . "\"" . $temppath . "\"" . " 2\>\&1 |"; + # Converting path of $extension for cygwin + + my $localextension = $extension; + if ( $^O =~ /cygwin/i ) { + $localextension = qx{cygpath -w "$extension"}; + $localextension =~ s/\\/\\\\/g; + } + + my $systemcall = $executable . " add --shared --verbose " . "\"" . $localextension . "\"" . " -env:UserInstallation=file://" . $temppath . " 2\>\&1 |"; + + print "... $systemcall\n"; my @unopkgoutput = (); @@ -865,6 +948,8 @@ sub register_one_extension for ( my $j = 0; $j <= $#unopkgoutput; $j++ ) { print "$unopkgoutput[$j]"; } exit_program("ERROR: $systemcall failed!"); } + + chdir($from); } #################################################################################### @@ -879,11 +964,15 @@ sub register_extensions { print "Registering extensions:\n"; - if (( ! -f $unopkgfile ) || ( $unopkgfile eq "" )) { exit_program("ERROR: Could not find unopkg.exe!"); } - - foreach $extension ( @{$extensions} ) { register_one_extension($unopkgfile, $extension, $temppath); } - - remove_complete_directory($temppath, 1) + if (( ! -f $unopkgfile ) || ( $unopkgfile eq "" )) + { + print("WARNING: Could not find unopkg.exe (Language Pack?)!\n"); + } + else + { + foreach $extension ( @{$extensions} ) { register_one_extension($unopkgfile, $extension, $temppath); } + remove_complete_directory($temppath, 1) + } } else { @@ -951,7 +1040,7 @@ sub get_sis_time_string sub write_sis_info { - my ($msidatabase) = @_ ; + my ($msidatabase) = @_; print "Setting SIS in msi database\n"; @@ -971,7 +1060,17 @@ sub write_sis_info my $lastprinted = get_sis_time_string(); my $lastsavedby = "Installer"; - $systemcall = $msiinfo . " " . "\"" . $msidatabase . "\"" . " -w " . $wordcount . " -s " . "\"" . $lastprinted . "\"" . " -l $lastsavedby"; + my $localmsidatabase = $msidatabase; + + if( $^O =~ /cygwin/i ) + { + $localmsidatabase = qx{cygpath -w "$localmsidatabase"}; + $localmsidatabase =~ s/\\/\\\\/g; + $localmsidatabase =~ s/\s*$//g; + } + + $systemcall = $msiinfo . " " . "\"" . $localmsidatabase . "\"" . " -w " . $wordcount . " -s " . "\"" . $lastprinted . "\"" . " -l $lastsavedby"; + $returnvalue = system($systemcall); if ($returnvalue) @@ -1059,7 +1158,9 @@ extract_tables_from_database($databasepath, $helperdir, $tablelist); # Unpack all cab files into $helperdir, cab files must be located next to msi database my $installdir = $databasepath; + get_path_from_fullqualifiedname(\$installdir); + my $databasefilename = $databasepath; make_absolute_filename_to_relative_filename(\$databasefilename); @@ -1096,6 +1197,7 @@ my $fullpathhash = create_directory_structure($dirhash, $targetdir); # Copying files my ($unopkgfile, $extensions) = copy_files_into_directory_structure($fileorder, $filehash, $componenthash, $fullpathhash, $maxsequence, $unpackdir, $installdir, $dirhash); +if ( $^O =~ /cygwin/i ) { change_privileges_full($targetdir); } my $msidatabase = $targetdir . $separator . $databasefilename; my $copyreturn = copy($databasepath, $msidatabase); diff --git a/setup_native/source/packinfo/packinfo_office.txt b/setup_native/source/packinfo/packinfo_office.txt index 14a77c11a55c..0bea0106c6b8 100755 --- a/setup_native/source/packinfo/packinfo_office.txt +++ b/setup_native/source/packinfo/packinfo_office.txt @@ -164,8 +164,8 @@ module = "gid_Module_Optional_Binfilter" solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-binfilter" solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01" packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-binfilter" -freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-calc,%BASISPACKAGEPREFIX%OOOBASEVERSION-draw,%BASISPACKAGEPREFIX%OOOBASEVERSION-impress,%BASISPACKAGEPREFIX%OOOBASEVERSION-math,%BASISPACKAGEPREFIX%OOOBASEVERSION-writer" -requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-calc,%BASISPACKAGEPREFIX%OOOBASEVERSION-draw,%BASISPACKAGEPREFIX%OOOBASEVERSION-impress,%BASISPACKAGEPREFIX%OOOBASEVERSION-math,%BASISPACKAGEPREFIX%OOOBASEVERSION-writer" +freebsdrequires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" +requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" copyright = "1999-2009 by OpenOffice.org" solariscopyright = "solariscopyrightfile" vendor = "OpenOffice.org" @@ -891,20 +891,6 @@ destpath = "/opt" packageversion = "%PACKAGEVERSION" End -Start -module = "gid_Module_Optional_Writer2latex" -script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-writer2latex" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-writer (Name="Writer module for OpenOffice.org %OOOBASEVERSION"), %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-writer2latex" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%BASISPACKAGEPREFIX%OOOBASEVERSION-writer,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" -linuxpatchrequires = "" -copyright = "2002-2009 by Henrik Just" -vendor = "Henrik Just" -description = "Writer2LaTeX" -destpath = "/opt" -packageversion = "%PACKAGEVERSION" -End Start module = "gid_Module_Optional_OGLTrans" diff --git a/setup_native/source/win32/customactions/relnotes/exports.dxp b/setup_native/source/win32/customactions/relnotes/exports.dxp index 77db8f131f5f..55a454d3d58f 100644 --- a/setup_native/source/win32/customactions/relnotes/exports.dxp +++ b/setup_native/source/win32/customactions/relnotes/exports.dxp @@ -1,2 +1,3 @@ ShowReleaseNotesBefore ShowReleaseNotesAfter +ShowSurveyAfter diff --git a/setup_native/source/win32/customactions/relnotes/relnotes.cxx b/setup_native/source/win32/customactions/relnotes/relnotes.cxx index 7b1bd3a2964c..174a0d6eb120 100644 --- a/setup_native/source/win32/customactions/relnotes/relnotes.cxx +++ b/setup_native/source/win32/customactions/relnotes/relnotes.cxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: relnotes.cxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -42,7 +39,7 @@ #include <string.h> #include <malloc.h> #include <stdio.h> -#include "strsafe.h" +#include <strsafe.h> //---------------------------------------------------------- #ifdef DEBUG @@ -70,22 +67,28 @@ inline bool IsValidHandle( HANDLE handle ) //---------------------------------------------------------- //---------------------------------------------------------- //---------------------------------------------------------- -UINT ShowReleaseNotes( MSIHANDLE , TCHAR* pFileName ) +UINT ShowReleaseNotes( TCHAR* pFileName, TCHAR* pFilePath ) { - TCHAR szPath[MAX_PATH]; + TCHAR sFullPath[ MAX_PATH ]; - if( FAILED( SHGetSpecialFolderPath( NULL, szPath, CSIDL_COMMON_DOCUMENTS, true ) ) ) + if ( FAILED( StringCchCopy( sFullPath, MAX_PATH, pFilePath ) ) ) + { + OutputDebugStringFormat( TEXT("DEBUG: ShowReleaseNotes: Could not copy path [%s]"), pFilePath ); return ERROR_SUCCESS; + } - if ( FAILED( StringCchCat( szPath, sizeof( szPath ), pFileName ) ) ) + if ( FAILED( StringCchCat( sFullPath, MAX_PATH, pFileName ) ) ) + { + OutputDebugStringFormat( TEXT("DEBUG: ShowReleaseNotes: Could not append filename [%s]"), pFileName ); return ERROR_SUCCESS; + } - HANDLE hFile = CreateFile( szPath, 0, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE hFile = CreateFile( sFullPath, 0, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if ( IsValidHandle(hFile) ) { CloseHandle( hFile ); - OutputDebugStringFormat( TEXT("DEBUG: ShowReleaseNotes: Found file [%s]"), szPath ); + OutputDebugStringFormat( TEXT("DEBUG: ShowReleaseNotes: Found file [%s]"), sFullPath ); SHELLEXECUTEINFOW aExecInf; ZeroMemory( &aExecInf, sizeof( aExecInf ) ); @@ -93,7 +96,7 @@ UINT ShowReleaseNotes( MSIHANDLE , TCHAR* pFileName ) aExecInf.cbSize = sizeof( aExecInf ); aExecInf.fMask = SEE_MASK_FLAG_DDEWAIT | SEE_MASK_FLAG_NO_UI; aExecInf.lpVerb = TEXT("open"); - aExecInf.lpFile = szPath; + aExecInf.lpFile = sFullPath; aExecInf.lpDirectory = NULL; aExecInf.nShow = SW_SHOWNORMAL; @@ -102,24 +105,56 @@ UINT ShowReleaseNotes( MSIHANDLE , TCHAR* pFileName ) } else { - OutputDebugStringFormat( TEXT("DEBUG: ShowReleaseNotes: File not found [%s]"), szPath ); - return ERROR_SUCCESS; + OutputDebugStringFormat( TEXT("DEBUG: ShowReleaseNotes: File not found [%s]"), sFullPath ); } return ERROR_SUCCESS; } //---------------------------------------------------------- -extern "C" UINT __stdcall ShowReleaseNotesBefore( MSIHANDLE hMSI ) +extern "C" UINT __stdcall ShowReleaseNotesBefore( MSIHANDLE ) { + TCHAR szPath[MAX_PATH]; + + if( FAILED( SHGetSpecialFolderPath( NULL, szPath, CSIDL_COMMON_DOCUMENTS, true ) ) ) + return ERROR_SUCCESS; + OutputDebugString( TEXT("DEBUG: ShowReleaseNotesBefore called") ); - return ShowReleaseNotes( hMSI, TEXT("\\sun\\releasenote1.url") ); + + return ShowReleaseNotes( TEXT("\\sun\\releasenote1.url"), szPath ); } //---------------------------------------------------------- -extern "C" UINT __stdcall ShowReleaseNotesAfter( MSIHANDLE hMSI ) +extern "C" UINT __stdcall ShowReleaseNotesAfter( MSIHANDLE ) { + TCHAR szPath[MAX_PATH]; + + if( FAILED( SHGetSpecialFolderPath( NULL, szPath, CSIDL_COMMON_DOCUMENTS, true ) ) ) + return ERROR_SUCCESS; + OutputDebugString( TEXT("DEBUG: ShowReleaseNotesAfter called") ); - return ShowReleaseNotes( hMSI, TEXT("\\sun\\releasenote2.url") ); + + return ShowReleaseNotes( TEXT("\\sun\\releasenote2.url"), szPath ); +} + +//---------------------------------------------------------- +extern "C" UINT __stdcall ShowSurveyAfter( MSIHANDLE ) +{ + OutputDebugString( TEXT("DEBUG: ShowSurveyAfter called") ); + + SHELLEXECUTEINFOW aExecInf; + ZeroMemory( &aExecInf, sizeof( aExecInf ) ); + + aExecInf.cbSize = sizeof( aExecInf ); + aExecInf.fMask = SEE_MASK_FLAG_DDEWAIT | SEE_MASK_FLAG_NO_UI; + aExecInf.lpVerb = TEXT("open"); + aExecInf.lpFile = TEXT("http://surveys.services.openoffice.org/deinstall"); + aExecInf.lpDirectory = NULL; + aExecInf.nShow = SW_SHOWNORMAL; + + SetLastError( 0 ); + ShellExecuteEx( &aExecInf ); + + return ERROR_SUCCESS; } diff --git a/setup_native/source/win32/msi-encodinglist.txt b/setup_native/source/win32/msi-encodinglist.txt index fc2a2c425ec4..ad3f1fb15824 100644 --- a/setup_native/source/win32/msi-encodinglist.txt +++ b/setup_native/source/win32/msi-encodinglist.txt @@ -92,11 +92,11 @@ sa-IN 0 1103 # Sanskrit sat 0 1606 # Santali sb 0 1070 # Sorbian sd 0 1113 # Sindhi -sh 0 2074 # Serbian Latin +sh 1250 2074 # Serbian Latin sk 1250 1051 # Slovak sl 1250 1060 # Slovenian sq 1250 1052 # Albanian -sr 0 3098 # Serbian Cyrillic +sr 1251 3098 # Serbian Cyrillic sr-SP 1251 3098 # Serbian Cyrillic ss 0 1579 # Swazi st 0 1072 # Southern Sotho, Sutu diff --git a/setup_native/source/win32/stwrapper/resource.rc b/setup_native/source/win32/stwrapper/resource.rc index 1551d5c49208..7951547dcfaf 100644 --- a/setup_native/source/win32/stwrapper/resource.rc +++ b/setup_native/source/win32/stwrapper/resource.rc @@ -10,9 +10,9 @@ //#define VER_BETA 6 #define VER_FINAL 0 -#define VER_DAY 26 -#define VER_MONTH 9 -#define VER_YEAR 07 +#define VER_DAY 1 +#define VER_MONTH 4 +#define VER_YEAR 09 // Header diff --git a/wizards/com/sun/star/wizards/common/ConfigGroup.java b/wizards/com/sun/star/wizards/common/ConfigGroup.java index 7f0654849b75..b2870535123a 100644 --- a/wizards/com/sun/star/wizards/common/ConfigGroup.java +++ b/wizards/com/sun/star/wizards/common/ConfigGroup.java @@ -87,6 +87,7 @@ public class ConfigGroup implements ConfigNode * Java Object value. * @param field * @return the value of the field as a Object. + * @throws IllegalAccessException */ public Object convertValue(Field field) throws IllegalAccessException { diff --git a/wizards/com/sun/star/wizards/common/Configuration.java b/wizards/com/sun/star/wizards/common/Configuration.java index b17eccbcf3bf..ead63de88183 100644 --- a/wizards/com/sun/star/wizards/common/Configuration.java +++ b/wizards/com/sun/star/wizards/common/Configuration.java @@ -152,7 +152,12 @@ public abstract class Configuration ((XHierarchicalPropertySet) UnoRuntime.queryInterface(XHierarchicalPropertySet.class, parent)).setHierarchicalPropertyValue(name, value); } - /** Creates a new instance of RegistryEntry */ + /** Creates a new instance of RegistryEntry + * @param name + * @param parent + * @return + * @throws Exception + */ public static Object getConfigurationNode(String name, Object parent) throws Exception { return ((XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, parent)).getByName(name); diff --git a/wizards/com/sun/star/wizards/common/Desktop.java b/wizards/com/sun/star/wizards/common/Desktop.java index a18365f5fe0b..064033585ac1 100644 --- a/wizards/com/sun/star/wizards/common/Desktop.java +++ b/wizards/com/sun/star/wizards/common/Desktop.java @@ -29,10 +29,13 @@ ************************************************************************/ package com.sun.star.wizards.common; +// import java.util.Date; + +// import com.sun.star.awt.XToolkit; import com.sun.star.beans.PropertyValue; -import com.sun.star.frame.XDesktop; -import com.sun.star.frame.XFrame; -import com.sun.star.frame.XFramesSupplier; +// import com.sun.star.frame.XDesktop; +// import com.sun.star.frame.XFrame; +// import com.sun.star.frame.XFramesSupplier; import com.sun.star.lang.WrappedTargetException; import com.sun.star.lang.XComponent; diff --git a/wizards/com/sun/star/wizards/common/FileAccess.java b/wizards/com/sun/star/wizards/common/FileAccess.java index 229778b61ada..25dadf1643d3 100644 --- a/wizards/com/sun/star/wizards/common/FileAccess.java +++ b/wizards/com/sun/star/wizards/common/FileAccess.java @@ -136,8 +136,13 @@ public class FileAccess /** * Further information on arguments value see in OO Developer Guide, * chapter 6.2.7 + * @param xMSF + * @param sPath * @param sType use "share" or "user". Set to "" if not needed eg for the WorkPath; * In the return Officepath a possible slash at the end is cut off + * @param sSearchDir + * @return + * @throws NoValidPathException */ public static String getOfficePath(XMultiServiceFactory xMSF, String sPath, String sType, String sSearchDir) throws NoValidPathException { @@ -211,12 +216,12 @@ public class FileAccess return ResultPath; } - public static ArrayList getOfficePaths(XMultiServiceFactory xMSF, String _sPath, String sType, String sSearchDir) throws NoValidPathException + public static ArrayList<String> getOfficePaths(XMultiServiceFactory xMSF, String _sPath, String sType, String sSearchDir) throws NoValidPathException { //This method currently only works with sPath="Template" // String ResultPath = ""; - ArrayList aPathList = new ArrayList(); + ArrayList<String> aPathList = new ArrayList<String>(); String Template_writable = ""; String[] Template_internal; String[] Template_user; @@ -604,8 +609,8 @@ public class FileAccess String[][] LocLayoutFiles = new String[2][]; //{"",""}{""}; try { - java.util.Vector TitleVector = null; - java.util.Vector NameVector = null; + java.util.Vector<String> TitleVector = null; + java.util.Vector<String> NameVector = null; XInterface xDocInterface = (XInterface) xMSF.createInstance("com.sun.star.document.DocumentProperties"); XDocumentProperties xDocProps = (XDocumentProperties) UnoRuntime.queryInterface(XDocumentProperties.class, xDocInterface); @@ -615,8 +620,8 @@ public class FileAccess String[] nameList = xSimpleFileAccess.getFolderContents(FolderName, false); - TitleVector = new java.util.Vector(nameList.length); - NameVector = new java.util.Vector(nameList.length); + TitleVector = new java.util.Vector<String>(/*nameList.length*/); + NameVector = new java.util.Vector<String>(nameList.length); FilterName = FilterName == null || FilterName.equals("") ? null : FilterName + "-"; @@ -734,8 +739,8 @@ public class FileAccess { throw new NoValidPathException(null, "Path not given."); } - ArrayList TitleVector = new ArrayList(); - ArrayList URLVector = new ArrayList(); + ArrayList<String> TitleVector = new ArrayList<String>(); + ArrayList<String> URLVector = new ArrayList<String>(); com.sun.star.ucb.XSimpleFileAccess xSimpleFileAccess = null; try @@ -1135,7 +1140,7 @@ public class FileAccess String[] sFileData = null; try { - Vector oDataVector = new Vector(); + Vector<String> oDataVector = new Vector<String>(); Object oSimpleFileAccess = _xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, oSimpleFileAccess); if (xSimpleFileAccess.exists(_filepath)) @@ -1147,7 +1152,7 @@ public class FileAccess xActiveDataSink.setInputStream(xInputStream); while (!xTextInputStream.isEOF()) { - oDataVector.addElement((String) xTextInputStream.readLine()); + oDataVector.addElement( xTextInputStream.readLine()); } xTextInputStream.closeInput(); sFileData = new String[oDataVector.size()]; diff --git a/wizards/com/sun/star/wizards/common/Helper.java b/wizards/com/sun/star/wizards/common/Helper.java index ddde8f07f277..946548ec1032 100644 --- a/wizards/com/sun/star/wizards/common/Helper.java +++ b/wizards/com/sun/star/wizards/common/Helper.java @@ -36,8 +36,10 @@ import java.util.Calendar; import com.sun.star.beans.Property; import com.sun.star.beans.PropertyValue; import com.sun.star.beans.XPropertySet; +// import com.sun.star.i18n.NumberFormatIndex; import com.sun.star.lang.Locale; import com.sun.star.lang.XMultiServiceFactory; +// import com.sun.star.uno.Any; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.RuntimeException; import com.sun.star.uno.UnoRuntime; @@ -204,7 +206,7 @@ public class Helper if (oUnoObject != null) { XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oUnoObject); - Property[] aProps = xPSet.getPropertySetInfo().getProperties(); + // Property[] aProps = xPSet.getPropertySetInfo().getProperties(); Object oObject = xPSet.getPropertyValue(PropertyName); return oObject; } diff --git a/wizards/com/sun/star/wizards/common/Renderer.java b/wizards/com/sun/star/wizards/common/IRenderer.java index 08334351326b..a7f15d3f6dff 100644 --- a/wizards/com/sun/star/wizards/common/Renderer.java +++ b/wizards/com/sun/star/wizards/common/IRenderer.java @@ -1,4 +1,5 @@ -/************************************************************************* +/* + ************************************************************************ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -35,7 +36,7 @@ package com.sun.star.wizards.common; * Can be used to reference resources, internationalizartion * a.s.o */ -public interface Renderer +public interface IRenderer { public String render(Object object); diff --git a/wizards/com/sun/star/wizards/common/JavaTools.java b/wizards/com/sun/star/wizards/common/JavaTools.java index f8a85037c84a..f5d87a570bf2 100644 --- a/wizards/com/sun/star/wizards/common/JavaTools.java +++ b/wizards/com/sun/star/wizards/common/JavaTools.java @@ -30,11 +30,8 @@ package com.sun.star.wizards.common; import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.sdb.CommandType; -import com.sun.star.uno.UnoRuntime; import com.sun.star.util.DateTime; import com.sun.star.beans.PropertyValue; -import java.net.URLDecoder; import java.util.*; import java.io.File; @@ -55,6 +52,7 @@ public class JavaTools { } +/* public static void main(String args[]) { String sPath = ""; @@ -78,7 +76,7 @@ public class JavaTools exception.printStackTrace(System.out); } } - +*/ public static String[] copyStringArray(String[] FirstArray) { if (FirstArray != null) @@ -144,7 +142,7 @@ public class JavaTools * @param _aIntegerVector * @return */ - public static int[] IntegerTointList(Vector _aIntegerVector) + public static int[] IntegerTointList(Vector<Integer> _aIntegerVector) { try { @@ -170,7 +168,7 @@ public class JavaTools * @param _aBooleanVector * @return */ - public static boolean[] BooleanTobooleanList(Vector _aBooleanVector) + public static boolean[] BooleanTobooleanList(Vector<Boolean> _aBooleanVector) { try { @@ -540,9 +538,7 @@ public class JavaTools public static String[][] removeOutdatedFields(String[][] baselist, String[] _complist, int _compindex) { - String[][] retarray = new String[][] - { - }; + String[][] retarray = new String[][] {}; if ((baselist != null) && (_complist != null)) { if (baselist.length > 0) @@ -550,7 +546,8 @@ public class JavaTools Vector retvector = new Vector(); for (int i = 0; i < baselist.length; i++) { - if (FieldInList(_complist, baselist[i][_compindex]) != -1) + String sValue = baselist[i][_compindex]; + if (FieldInList(_complist, sValue) != -1) { retvector.add(baselist[i]); // else diff --git a/wizards/com/sun/star/wizards/common/NumberFormatter.java b/wizards/com/sun/star/wizards/common/NumberFormatter.java index 2b4f9d0b2521..a837b78ebbad 100644 --- a/wizards/com/sun/star/wizards/common/NumberFormatter.java +++ b/wizards/com/sun/star/wizards/common/NumberFormatter.java @@ -85,6 +85,10 @@ public class NumberFormatter /** + * @param _xMSF + * @param _xNumberFormatsSupplier + * @return + * @throws Exception * @deprecated * */ @@ -167,9 +171,8 @@ public class NumberFormatter /** * returns a numberformat for a FormatString. - * @param _xFormatObject - * @param _xNumberFormats - * @param FormatString + * @param _FormatString + * @param _aLocale * @return */ public int defineNumberFormat(String _FormatString, Locale _aLocale) diff --git a/wizards/com/sun/star/wizards/common/NumericalHelper.java b/wizards/com/sun/star/wizards/common/NumericalHelper.java index f65de8327677..bd92b6eb6fc3 100644 --- a/wizards/com/sun/star/wizards/common/NumericalHelper.java +++ b/wizards/com/sun/star/wizards/common/NumericalHelper.java @@ -106,7 +106,7 @@ public class NumericalHelper { byte retValue = 0; - boolean hasConversionWarning = false; + // boolean hasConversionWarning = false; TypeObject aTypeObject = getTypeObject(aValue); switch (aTypeObject.iType) { diff --git a/wizards/com/sun/star/wizards/common/PropertySetHelper.java b/wizards/com/sun/star/wizards/common/PropertySetHelper.java index 546a57644096..0881d97d623e 100644 --- a/wizards/com/sun/star/wizards/common/PropertySetHelper.java +++ b/wizards/com/sun/star/wizards/common/PropertySetHelper.java @@ -45,7 +45,7 @@ public class PropertySetHelper { protected XPropertySet m_xPropertySet; - private HashMap m_aHashMap; + private HashMap<String, Object> m_aHashMap; public PropertySetHelper(Object _aObj) { @@ -56,11 +56,11 @@ public class PropertySetHelper m_xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _aObj); } - private HashMap getHashMap() + private HashMap<String, Object> getHashMap() { if (m_aHashMap == null) { - m_aHashMap = new HashMap(); + m_aHashMap = new HashMap<String, Object>(); } return m_aHashMap; } diff --git a/wizards/com/sun/star/wizards/common/Resource.java b/wizards/com/sun/star/wizards/common/Resource.java index 49a84c98bc37..d8c4e2c6115c 100644 --- a/wizards/com/sun/star/wizards/common/Resource.java +++ b/wizards/com/sun/star/wizards/common/Resource.java @@ -43,7 +43,11 @@ public class Resource String Unit; String Module; - /** Creates a new instance of Resource */ + /** Creates a new instance of Resource + * @param _xMSF + * @param _Unit + * @param _Module + */ public Resource(XMultiServiceFactory _xMSF, String _Unit, String _Module) { this.xMSF = _xMSF; @@ -60,7 +64,7 @@ public class Resource Object[][] DummyArray = new Object[1][]; Object[] nIDArray = new Object[1]; nIDArray[0] = new Integer(nID); - String IDString = (String) xInvocation.invoke("getString", nIDArray, PointerArray, DummyArray); + final String IDString = (String) xInvocation.invoke("getString", nIDArray, PointerArray, DummyArray); return IDString; } catch (Exception exception) diff --git a/wizards/com/sun/star/wizards/common/SystemDialog.java b/wizards/com/sun/star/wizards/common/SystemDialog.java index 5416f8e8fbd0..79ecb3ac4e0f 100644 --- a/wizards/com/sun/star/wizards/common/SystemDialog.java +++ b/wizards/com/sun/star/wizards/common/SystemDialog.java @@ -152,7 +152,6 @@ public class SystemDialog * * @param displayDir * @param defaultName - * @param url should the returned path be an url. If false converts the * given url to a local path. * @return */ @@ -293,7 +292,7 @@ public class SystemDialog int MaxCount = xPropertyValue.length; for (int i = 0; i < MaxCount; i++) { - PropertyValue aValue = (PropertyValue) xPropertyValue[i]; + PropertyValue aValue = xPropertyValue[i]; if (aValue != null && aValue.Name.equals("UIName")) { return AnyConverter.toString(aValue.Value); diff --git a/wizards/com/sun/star/wizards/common/TerminateWizardException.java b/wizards/com/sun/star/wizards/common/TerminateWizardException.java index 593cfd62a9c8..8437633dd61a 100644 --- a/wizards/com/sun/star/wizards/common/TerminateWizardException.java +++ b/wizards/com/sun/star/wizards/common/TerminateWizardException.java @@ -31,7 +31,7 @@ ************************************************************************/ package com.sun.star.wizards.common; -import com.sun.star.wizards.common.Resource; +// import com.sun.star.wizards.common.Resource; import com.sun.star.lang.XMultiServiceFactory; public class TerminateWizardException extends Exception diff --git a/wizards/com/sun/star/wizards/common/UCB.java b/wizards/com/sun/star/wizards/common/UCB.java index 98f149bf66cd..562a52a8bf8d 100644 --- a/wizards/com/sun/star/wizards/common/UCB.java +++ b/wizards/com/sun/star/wizards/common/UCB.java @@ -55,11 +55,14 @@ import com.sun.star.uno.UnoRuntime; * There is an incosistency with argument order. * It should be always: dir,filename. */ -public class UCB { +public class UCB +{ + private Object ucb; private FileAccess fa; - public UCB(XMultiServiceFactory xmsf) throws Exception { + public UCB(XMultiServiceFactory xmsf) throws Exception + { String[] keys = new String[2]; keys[ 0 ] = "Local"; keys[ 1 ] = "Office"; @@ -72,31 +75,43 @@ public class UCB { throws Exception { if (!fa.exists(dir,true)) + { return; + } List l = listFiles(dir,null); for (int i = 0; i<l.size(); i++) + { delete(FileAccess.connectURLs(dir ,(String)l.get(i))); } + } - public void delete(String filename) throws Exception { + public void delete(String filename) throws Exception + { //System.out.println("UCB.delete(" + filename); executeCommand( getContent(filename),"delete",Boolean.TRUE); } - public void copy(String sourceDir, String targetDir) throws Exception { + public void copy(String sourceDir, String targetDir) throws Exception + { copy(sourceDir,targetDir,(Verifier)null); } - public void copy(String sourceDir, String targetDir, Verifier verifier) throws Exception { + public void copy(String sourceDir, String targetDir, Verifier verifier) throws Exception + { List files = listFiles(sourceDir,verifier); for (int i = 0; i<files.size(); i++) + { copy(sourceDir, (String)files.get(i), targetDir); + } } - public void copy(String sourceDir, String filename, String targetDir, String targetName ) throws Exception { + public void copy(String sourceDir, String filename, String targetDir, String targetName) throws Exception + { if (!fa.exists(targetDir,true)) + { fa.fileAccess.createFolder(targetDir); + } //System.out.println("UCB.copy(" + sourceDir + ", " + filename + ", " + targetDir+ ", " + targetName); executeCommand(ucb, "globalTransfer", copyArg(sourceDir,filename, targetDir,targetName)); } @@ -108,18 +123,21 @@ public class UCB { * @param targetDir * @throws Exception */ - public void copy(String sourceDir, String filename, String targetDir) throws Exception { + public void copy(String sourceDir, String filename, String targetDir) throws Exception + { copy(sourceDir,filename, targetDir, ""); } + /** * target name can be "", in which case the name stays lige the source name * @param sourceDir - * @param filename + * @param sourceFilename * @param targetDir - * @param targetName + * @param targetFilename * @return */ - public GlobalTransferCommandArgument copyArg(String sourceDir, String sourceFilename, String targetDir, String targetFilename) { + public GlobalTransferCommandArgument copyArg(String sourceDir, String sourceFilename, String targetDir, String targetFilename) + { GlobalTransferCommandArgument aArg = new GlobalTransferCommandArgument(); aArg.Operation = TransferCommandOperation.COPY; @@ -144,7 +162,8 @@ public class UCB { return xCmdProcessor.execute(aCommand, 0, null); } - public List listFiles(String path,Verifier verifier) throws Exception { + public List listFiles(String path, Verifier verifier) throws Exception + { Object xContent = getContent(path); OpenCommandArgument2 aArg = new OpenCommandArgument2(); @@ -166,27 +185,40 @@ public class UCB { List files = new Vector(); - if (xResultSet.first()) { + if (xResultSet.first()) + { // obtain XContentAccess interface for child content access and XRow for properties XContentAccess xContentAccess = (XContentAccess)UnoRuntime.queryInterface( XContentAccess.class, xResultSet); XRow xRow = (XRow)UnoRuntime.queryInterface(XRow.class, xResultSet); - do { + do + { // Obtain URL of child. String aId = xContentAccess.queryContentIdentifierString(); // First column: Title (column numbers are 1-based!) String aTitle = xRow.getString(1); if (aTitle.length() == 0 && xRow.wasNull()) - ;//ignore + { + ; //ignore + } else + { files.add(aTitle); - } while (xResultSet.next()); // next child + } + } + while (xResultSet.next()); // next child } if (verifier != null) + { for (int i = 0; i<files.size(); i++) + { if (!verifier.verify(files.get(i))) + { files.remove(i--); + } + } + } return files; } @@ -202,29 +234,40 @@ public class UCB { Object row = executeCommand(content,"getPropertyValues",pv); XRow xrow = (XRow)UnoRuntime.queryInterface(XRow.class,row); if (type.equals(String.class)) + { return xrow.getString(1); + } else if (type.equals(Boolean.class)) + { return xrow.getBoolean(1) ? Boolean.TRUE : Boolean.FALSE; + } else if (type.equals(Integer.class)) + { return new Integer(xrow.getInt(1)); + } else if (type.equals(Short.class)) + { return new Short(xrow.getShort(1)); - else return null; + } + else + { + return null; + } } - public Object getContent(String path) throws Exception { + public Object getContent(String path) throws Exception + { //System.out.println("Getting Content for : " + path); - XContentIdentifier id = ((XContentIdentifierFactory)UnoRuntime - .queryInterface(XContentIdentifierFactory.class,ucb)).createContentIdentifier(path); + XContentIdentifier id = ((XContentIdentifierFactory) UnoRuntime.queryInterface(XContentIdentifierFactory.class, ucb)).createContentIdentifier(path); return ((XContentProvider)UnoRuntime.queryInterface( XContentProvider.class,ucb)).queryContent(id); } - public static interface Verifier { + public static interface Verifier + { + public boolean verify(Object object); } - - } diff --git a/wizards/com/sun/star/wizards/db/ColumnPropertySet.java b/wizards/com/sun/star/wizards/db/ColumnPropertySet.java index 8e7af2924f85..5e7a26cb2381 100644 --- a/wizards/com/sun/star/wizards/db/ColumnPropertySet.java +++ b/wizards/com/sun/star/wizards/db/ColumnPropertySet.java @@ -31,15 +31,10 @@ package com.sun.star.wizards.db; import com.sun.star.beans.Property; import com.sun.star.beans.PropertyValue; -import com.sun.star.beans.PropertyVetoException; -import com.sun.star.beans.UnknownPropertyException; import com.sun.star.beans.XPropertySet; -import com.sun.star.lang.IllegalArgumentException; -import com.sun.star.lang.WrappedTargetException; import com.sun.star.sdbc.DataType; -import com.sun.star.uno.AnyConverter; import com.sun.star.wizards.common.Properties; -import com.sun.star.wizards.db.TypeInspector; +// import com.sun.star.wizards.db.TypeInspector; public class ColumnPropertySet { diff --git a/wizards/com/sun/star/wizards/db/CommandMetaData.java b/wizards/com/sun/star/wizards/db/CommandMetaData.java index adaeacb1a965..b26259fc8a47 100644 --- a/wizards/com/sun/star/wizards/db/CommandMetaData.java +++ b/wizards/com/sun/star/wizards/db/CommandMetaData.java @@ -54,7 +54,7 @@ import com.sun.star.frame.*; public class CommandMetaData extends DBMetaData { public Map FieldTitleSet = new HashMap(); - public String[] AllFieldNames = new String[]{}; + public String[] m_aAllFieldNames = new String[]{}; public FieldColumn[] FieldColumns = new FieldColumn[]{}; // public String[] FieldNames = new String[] {}; public String[] GroupFieldNames = new String[] {}; @@ -63,7 +63,7 @@ public class CommandMetaData extends DBMetaData public String[][] AggregateFieldNames = new String[][] {}; public String[] NumericFieldNames = new String[] {}; public String[] NonAggregateFieldNames; - public int[] FieldTypes; + // private int[] FieldTypes; private int CommandType; private String Command; boolean bCatalogAtStart = true; @@ -92,10 +92,10 @@ public class CommandMetaData extends DBMetaData for (int i = 0; i < _FieldNames.length; i++) { FieldColumns[i] = new FieldColumn(this, _FieldNames[i], this.getCommandName(), false); - if (_bgetDefaultValue) - { - FieldColumns[i].getDefaultValue(); - } +// if (_bgetDefaultValue) +// { +// FieldColumns[i].getDefaultValue(); +// } } } @@ -153,7 +153,7 @@ public class CommandMetaData extends DBMetaData } String CurCommandName = CurFieldColumn.getCommandName(); CommandObject oCommand = getTableByName(CurCommandName); - Object oColumn = oCommand.xColumns.getByName(CurFieldColumn.m_sFieldName); + Object oColumn = oCommand.getColumns().getByName(CurFieldColumn.getFieldName()); XPropertySet xColumn = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oColumn); return xColumn; } @@ -212,7 +212,7 @@ public class CommandMetaData extends DBMetaData { for (int i = 0; i < FieldColumns.length; i++) { - if (FieldColumns[i].m_sFieldName.equals(_FieldName)) + if (FieldColumns[i].getFieldName().equals(_FieldName)) { if (FieldColumns[i].getCommandName().equals(_CommandName)) @@ -231,7 +231,7 @@ public class CommandMetaData extends DBMetaData { for (int i = 0; i < FieldColumns.length; i++) { - String sFieldName = FieldColumns[i].m_sFieldName; + String sFieldName = FieldColumns[i].getFieldName(); if (sFieldName.equals(_FieldName)) { return FieldColumns[i]; @@ -284,7 +284,7 @@ public class CommandMetaData extends DBMetaData // LLA: Group works with fields direct for (int i = 0; i < FieldColumns.length; i++) { - if (FieldColumns[i].m_sFieldName.equals(_FieldTitle)) + if (FieldColumns[i].getFieldName().equals(_FieldTitle)) { return FieldColumns[i]; } @@ -297,16 +297,17 @@ public class CommandMetaData extends DBMetaData { try { - Object oField; - java.util.Vector ResultFieldNames = new java.util.Vector(10); + // Object oField; + java.util.Vector<String> ResultFieldNames = new java.util.Vector<String>(10); String[] FieldNames; CommandObject oCommand = this.getCommandByName(_commandname, _commandtype); - FieldNames = oCommand.xColumns.getElementNames(); + FieldNames = oCommand.getColumns().getElementNames(); if (FieldNames.length > 0) { for (int n = 0; n < FieldNames.length; n++) { - oField = oCommand.xColumns.getByName(FieldNames[n]); + final String sFieldName = FieldNames[n]; + Object oField = oCommand.getColumns().getByName(sFieldName); int iType = AnyConverter.toInt(Helper.getUnoPropertyValue(oField, "Type")); // BinaryFieldTypes are not included in the WidthList if (JavaTools.FieldInIntTable(WidthList, iType) >= 0) @@ -314,13 +315,17 @@ public class CommandMetaData extends DBMetaData // if (_bAppendMode) // ResultFieldNames.addElement(_commandname + "." + FieldNames[n]); // else - ResultFieldNames.addElement(FieldNames[n]); + ResultFieldNames.addElement(sFieldName); + } + else if (JavaTools.FieldInIntTable(BinaryTypes, iType) >= 0) + { + ResultFieldNames.addElement(sFieldName); } } - FieldNames = new String[FieldNames.length]; - FieldTypes = new int[FieldNames.length]; - AllFieldNames = new String[ResultFieldNames.size()]; - ResultFieldNames.copyInto(AllFieldNames); + // FieldNames = new String[FieldNames.length]; + // FieldTypes = new int[FieldNames.length]; + m_aAllFieldNames = new String[ResultFieldNames.size()]; + ResultFieldNames.copyInto(m_aAllFieldNames); return true; } } @@ -342,7 +347,7 @@ public class CommandMetaData extends DBMetaData public String[] getOrderableColumns(String[] _fieldnames) { - Vector aOrderableColumns = new Vector(); + Vector<String> aOrderableColumns = new Vector<String>(); int ncount = 0; for (int i = 0; i < _fieldnames.length; i++) { @@ -367,7 +372,7 @@ public class CommandMetaData extends DBMetaData return Command; } /** - * @param command The command to set. + * @param _command The command to set. */ public void setCommandName(String _command) { @@ -383,7 +388,7 @@ public class CommandMetaData extends DBMetaData } /** - * @param commandType The commandType to set. + * @param _commandType The commandType to set. */ public void setCommandType(int _commandType) { @@ -396,7 +401,7 @@ public class CommandMetaData extends DBMetaData try { CommandObject oTable = super.getTableByName(_oFieldColumn.getCommandName()); - Object oField = oTable.xColumns.getByName(_oFieldColumn.getFieldName()); + Object oField = oTable.getColumns().getByName(_oFieldColumn.getFieldName()); int iType = AnyConverter.toInt(Helper.getUnoPropertyValue(oField, "Type")); int ifound = java.util.Arrays.binarySearch(NumericTypes, iType); if ((ifound < NumericTypes.length) && (ifound > 0)) @@ -419,7 +424,7 @@ public class CommandMetaData extends DBMetaData { try { - Vector numericfieldsvector = new java.util.Vector(); + Vector<String> numericfieldsvector = new java.util.Vector<String>(); for (int i = 0; i < FieldColumns.length; i++) { if (isnumeric(FieldColumns[i])) @@ -440,14 +445,14 @@ public class CommandMetaData extends DBMetaData public String[] getFieldNames(String[] _sDisplayFieldNames, String _sCommandName) { - Vector sFieldNamesVector = new java.util.Vector(); + Vector<String> sFieldNamesVector = new java.util.Vector<String>(); for (int i = 0; i < FieldColumns.length; i++) { if (_sCommandName.equals(FieldColumns[i].getCommandName())) { if (JavaTools.FieldInList(_sDisplayFieldNames, FieldColumns[i].getDisplayFieldName()) > -1) { - sFieldNamesVector.addElement(FieldColumns[i].m_sFieldName); + sFieldNamesVector.addElement(FieldColumns[i].getFieldName()); } } } @@ -463,7 +468,7 @@ public class CommandMetaData extends DBMetaData String[] sFieldNames = new String[FieldColumns.length]; for (int i = 0; i < FieldColumns.length; i++) { - sFieldNames[i] = FieldColumns[i].m_sFieldName; + sFieldNames[i] = FieldColumns[i].getFieldName(); } return sFieldNames; } @@ -483,7 +488,7 @@ public class CommandMetaData extends DBMetaData { try { - Vector nonaggregatefieldsvector = new java.util.Vector(); + Vector<String> nonaggregatefieldsvector = new java.util.Vector<String>(); for (int i = 0; i < FieldColumns.length; i++) { if (JavaTools.FieldInTable(AggregateFieldNames, FieldColumns[i].getDisplayFieldName()) == -1) @@ -504,7 +509,7 @@ public class CommandMetaData extends DBMetaData /** * the fieldnames passed over are not necessarily the ones that are defined in the class - * @param FieldNames + * @param _DisplayFieldNames * @return */ public boolean hasNumericalFields(String[] _DisplayFieldNames) @@ -589,7 +594,7 @@ public class CommandMetaData extends DBMetaData int a = 0; for (int i = 0; i < TotFieldCount; i++) { - CurFieldName = FieldColumns[i].m_sFieldName; + CurFieldName = FieldColumns[i].getFieldName(); if (JavaTools.FieldInList(GroupFieldNames, CurFieldName) < 0) { RecordFieldNames[a] = CurFieldName; @@ -659,7 +664,9 @@ public class CommandMetaData extends DBMetaData XComponentLoader xLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class,xFac.createInstanceWithArguments(args)); ret[0] = xLoader.loadComponentFromURL(surl, "_self", 0, _rArgs); if ( ret[0] != null) + { ret[0] = (XComponent)UnoRuntime.queryInterface(XComponent.class,xLoader); + } } catch (Exception exception) { @@ -682,8 +689,8 @@ public class CommandMetaData extends DBMetaData { if (xDBMetaData.supportsIntegrityEnhancementFacility()) { - java.util.Vector TableVector = new java.util.Vector(); - Object oTable = xTableNames.getByName(_stablename); + java.util.Vector<String> TableVector = new java.util.Vector<String>(); + Object oTable = getTableNamesAsNameAccess().getByName(_stablename); XKeysSupplier xKeysSupplier = (XKeysSupplier) UnoRuntime.queryInterface(XKeysSupplier.class, oTable); xIndexKeys = xKeysSupplier.getKeys(); for (int i = 0; i < xIndexKeys.getCount(); i++) @@ -694,7 +701,7 @@ public class CommandMetaData extends DBMetaData { // getImportedKeys (RelationController.cxx /source/ui/relationdesign) /Zeile 475 String sreftablename = AnyConverter.toString(xPropertySet.getPropertyValue("ReferencedTable")); - if (xTableNames.hasByName(sreftablename)) + if (getTableNamesAsNameAccess().hasByName(sreftablename)) { TableVector.addElement(sreftablename); } @@ -732,7 +739,7 @@ public class CommandMetaData extends DBMetaData if (curtype == KeyType.FOREIGN) { String scurreftablename = AnyConverter.toString(xPropertySet.getPropertyValue("ReferencedTable")); - if (xTableNames.hasByName(scurreftablename)) + if (getTableNamesAsNameAccess().hasByName(scurreftablename)) { if (scurreftablename.equals(_sreferencedtablename)) { @@ -778,7 +785,7 @@ public class CommandMetaData extends DBMetaData { try { - boolean bCatalogAtStart = xDBMetaData.isCatalogAtStart(); + boolean bCatalogAtStart2 = xDBMetaData.isCatalogAtStart(); sCatalogSep = xDBMetaData.getCatalogSeparator(); sIdentifierQuote = xDBMetaData.getIdentifierQuoteString(); bCommandComposerAttributesalreadyRetrieved = true; diff --git a/wizards/com/sun/star/wizards/db/DBMetaData.java b/wizards/com/sun/star/wizards/db/DBMetaData.java index af9605cb99c6..be8721a8febe 100644 --- a/wizards/com/sun/star/wizards/db/DBMetaData.java +++ b/wizards/com/sun/star/wizards/db/DBMetaData.java @@ -90,30 +90,14 @@ import com.sun.star.sdbcx.XTablesSupplier; public class DBMetaData { - public XNameAccess xTableNames; - public XNameAccess xQueryNames; - private XInteractionHandler oInteractionHandler; - private XNameAccess xNameAccess; - private XInterface xDatabaseContext; + private XNameAccess xQueryNames; public XDatabaseMetaData xDBMetaData; - public XDataSource xDataSource; - public XOfficeDatabaseDocument xModel; - private XCompletedConnection xCompleted; - public XPropertySet xDataSourcePropertySet; - // private int[] nDataTypes = null; - private XWindowPeer xWindowPeer; + private XDataSource xDataSource; + private XOfficeDatabaseDocument xModel; + private XPropertySet xDataSourcePropertySet; public String[] DataSourceNames; public String[] CommandNames; - public String[] TableNames = new String[] - { - }; - public String[] QueryNames = new String[] - { - }; public java.util.Vector CommandObjects = new Vector(1); - public int[][] WidthList; - public int[] NumericTypes; - public int[] BinaryTypes; public Locale aLocale; public int[] CommandTypes; public String DataSourceName; @@ -122,16 +106,54 @@ public class DBMetaData public com.sun.star.lang.XMultiServiceFactory xMSF; public XComponent xConnectionComponent; public SQLQueryComposer oSQLQueryComposer; - int iMaxColumnsInSelect; - int iMaxColumnsInGroupBy; - int iMaxColumnsInTable; - int iMaxColumnNameLength = -1; - int iMaxTableNameLength = -1; + + private XNameAccess m_xTableNames; + private XInteractionHandler oInteractionHandler; + private XNameAccess xNameAccess; + private XInterface xDatabaseContext; + private XCompletedConnection xCompleted; + // private int[] nDataTypes = null; + private XWindowPeer xWindowPeer; + private String[] TableNames = new String[] {}; + private String[] QueryNames = new String[] {}; + + protected int[][] WidthList; + protected static final int[] NumericTypes = { + DataType.TINYINT, // == -6; + DataType.BIGINT, // == -5 + DataType.NUMERIC, // == - 2 + DataType.DECIMAL, // == 3; + DataType.INTEGER, // == 4; + DataType.SMALLINT, // == 5; + DataType.FLOAT, // == 6; + DataType.REAL, // == 7; + DataType.DOUBLE, // == 8; + }; + protected static final int[] BinaryTypes = { //new int[12]; + DataType.BINARY, + DataType.VARBINARY, + DataType.LONGVARBINARY, + DataType.BLOB, + DataType.SQLNULL, + DataType.OBJECT, + DataType.DISTINCT, + DataType.STRUCT, + DataType.ARRAY, + DataType.CLOB, + DataType.REF + /* DataType.OTHER, */ + }; + + private int iMaxColumnsInSelect; + private int iMaxColumnsInGroupBy; + private int iMaxColumnsInTable; + private int iMaxColumnNameLength = -1; + private int iMaxTableNameLength = -1; private boolean bPasswordIsRequired; // private boolean bFormatKeysareset = false; - final int NOLIMIT = 9999999; - final int RID_DB_COMMON = 1000; - final int INVALID = 9999999; + private final static int NOLIMIT = 9999999; + protected final static int RID_DB_COMMON = 1000; + private final static int INVALID = 9999999; public TypeInspector oTypeInspector; private PropertyValue[] aInfoPropertyValues = null; private boolean bisSQL92CheckEnabled = false; @@ -139,6 +161,11 @@ public class DBMetaData private long lDateCorrection = INVALID; private boolean bdisposeConnection = false; + public XPropertySet getDataSourcePropertySet() + { + return xDataSourcePropertySet; + } + public DBMetaData(XMultiServiceFactory xMSF) { getInterfaces(xMSF); @@ -231,8 +258,8 @@ public class DBMetaData public boolean hasTableByName(String _stablename) { - getTableNames(); - return xTableNames.hasByName(_stablename); + // getTableNames(); + return getTableNamesAsNameAccess().hasByName(_stablename); } public void setTableByName(String _tableName) @@ -279,10 +306,10 @@ public class DBMetaData public class CommandObject { - public XNameAccess xColumns; - public XPropertySet xPropertySet; - public String Name; - public int CommandType; + private XNameAccess xColumns; + private XPropertySet xPropertySet; + private String Name; + private int CommandType; public CommandObject(String _CommandName, int _CommandType) { @@ -291,20 +318,21 @@ public class DBMetaData Object oCommand; this.Name = _CommandName; this.CommandType = _CommandType; - if (xTableNames == null) - { - setCommandNames(); - } + // if (getTableNamesAsNameAccess() == null) + // { + // initCommandNames(); + // } if (CommandType == com.sun.star.sdb.CommandType.TABLE) { - oCommand = xTableNames.getByName(Name); + oCommand = getTableNamesAsNameAccess().getByName(Name); } else { - oCommand = xQueryNames.getByName(Name); + oCommand = getQueryNamesAsNameAccess().getByName(Name); } XColumnsSupplier xCommandCols = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, oCommand); xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oCommand); +// TODO: Performance leak getColumns() take very long. xColumns = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xCommandCols.getColumns()); } catch (Exception exception) @@ -312,6 +340,18 @@ public class DBMetaData exception.printStackTrace(System.out); } } + public XNameAccess getColumns() + { + return xColumns; + } + public String getName() + { + return Name; + } + public XPropertySet getPropertySet() + { + return xPropertySet; + } } public boolean hasEscapeProcessing(XPropertySet _xQueryPropertySet) @@ -331,13 +371,36 @@ public class DBMetaData return bHasEscapeProcessing; } - public void setCommandNames() + // public void initCommandNames() + // { + // getTableNames(); + // } + + public XNameAccess getQueryNamesAsNameAccess() { - getTableNames(); XQueriesSupplier xDBQueries = (XQueriesSupplier) UnoRuntime.queryInterface(XQueriesSupplier.class, DBConnection); xQueryNames = (XNameAccess) xDBQueries.getQueries(); - QueryNames = xQueryNames.getElementNames(); + return xQueryNames; + } + public XNameAccess getTableNamesAsNameAccess() + { + XTablesSupplier xDBTables = (XTablesSupplier) UnoRuntime.queryInterface(XTablesSupplier.class, DBConnection); + XNameAccess xTableNames = xDBTables.getTables(); + return xTableNames; + } + + public String[] getQueryNames() + { + if (QueryNames != null) + { + if (QueryNames.length > 0) + { + return QueryNames; + } + } + QueryNames = getQueryNamesAsNameAccess().getElementNames(); + return QueryNames; } public String[] getTableNames() @@ -349,9 +412,7 @@ public class DBMetaData return TableNames; } } - XTablesSupplier xDBTables = (XTablesSupplier) UnoRuntime.queryInterface(XTablesSupplier.class, DBConnection); - xTableNames = (XNameAccess) xDBTables.getTables(); - TableNames = (String[]) xTableNames.getElementNames(); + TableNames = (String[]) getTableNamesAsNameAccess().getElementNames(); return TableNames; } @@ -377,30 +438,8 @@ public class DBMetaData WidthList[16][0] = DataType.TIMESTAMP; // == 93; // NumericTypes are all types where aggregate functions can be performed on. // Similarly to a major competitor date/time/timmestamp fields are not included - NumericTypes = new int[9]; - NumericTypes[0] = DataType.TINYINT; // == -6; - NumericTypes[1] = DataType.BIGINT; // == -5 - NumericTypes[2] = DataType.NUMERIC; // == - 2 - NumericTypes[3] = DataType.DECIMAL; // == 3; - NumericTypes[4] = DataType.INTEGER; // == 4; - NumericTypes[5] = DataType.SMALLINT; // == 5; - NumericTypes[6] = DataType.FLOAT; // == 6; - NumericTypes[7] = DataType.REAL; // == 7; - NumericTypes[8] = DataType.DOUBLE; // == 8; - - BinaryTypes = new int[12]; - BinaryTypes[0] = DataType.BINARY; - BinaryTypes[1] = DataType.VARBINARY; - BinaryTypes[2] = DataType.LONGVARBINARY; - BinaryTypes[3] = DataType.BLOB; - BinaryTypes[4] = DataType.SQLNULL; - BinaryTypes[5] = DataType.OBJECT; - BinaryTypes[6] = DataType.DISTINCT; - BinaryTypes[7] = DataType.STRUCT; - BinaryTypes[8] = DataType.ARRAY; - BinaryTypes[9] = DataType.CLOB; - BinaryTypes[10] = DataType.REF; - BinaryTypes[11] = DataType.OTHER; + + } public boolean isBinaryDataType(int _itype) @@ -521,15 +560,32 @@ public class DBMetaData return _sname; } + public XDataSource getDataSource() + { + if (xDataSource == null) + { + try + { + Object oDataSource = xNameAccess.getByName(DataSourceName); + xDataSource = (XDataSource) UnoRuntime.queryInterface(XDataSource.class, oDataSource); + } + catch (com.sun.star.container.NoSuchElementException e) + { + } + catch (com.sun.star.lang.WrappedTargetException e) + { + } + } + return xDataSource; + } + private void setDataSourceByName(String _DataSourceName, boolean bgetInterfaces) { try { this.DataSourceName = _DataSourceName; - Object oDataSource = xNameAccess.getByName(DataSourceName); - xDataSource = (XDataSource) UnoRuntime.queryInterface(XDataSource.class, oDataSource); getDataSourceInterfaces(); - XDocumentDataSource xDocu = (XDocumentDataSource) UnoRuntime.queryInterface(XDocumentDataSource.class, this.xDataSource); + XDocumentDataSource xDocu = (XDocumentDataSource) UnoRuntime.queryInterface(XDocumentDataSource.class, getDataSource()); if (xDocu != null) { xModel = xDocu.getDatabaseDocument(); @@ -1078,7 +1134,6 @@ public class DBMetaData public void finish() { - xTableNames = null; xQueryNames = null; oInteractionHandler = null; xNameAccess = null; diff --git a/wizards/com/sun/star/wizards/db/FieldColumn.java b/wizards/com/sun/star/wizards/db/FieldColumn.java index 2b2826b40d02..c1909cdd2c25 100644 --- a/wizards/com/sun/star/wizards/db/FieldColumn.java +++ b/wizards/com/sun/star/wizards/db/FieldColumn.java @@ -40,26 +40,31 @@ import com.sun.star.wizards.common.*; public class FieldColumn { + protected int ColIndex; - public Object DefaultValue; - public String m_sFieldName; + private Object DefaultValue; + private String m_sFieldName; private String m_sDisplayFieldName; private String FieldTitle; - public int ColIndex; private String m_sCommandName; - public int FieldWidth; - public int DBFormatKey; - public int FieldType; - public int StandardFormatKey; - public boolean bIsNumberFormat; - public XPropertySet m_xColPropertySet; - public int iType; - protected int iDateFormatKey; - protected int iDateTimeFormatKey; - protected int iNumberFormatKey; - protected int iTextFormatKey; - protected int iTimeFormatKey; - protected int iLogicalFormatKey; + private int m_nDBFormatKey; + private int m_nFieldType; + private XPropertySet m_xColPropertySet; + + // field meta data + private int FieldWidth; + private int StandardFormatKey; + private boolean bIsNumberFormat; + + private static boolean bFormatKeysInitialized = false; + private static int iDateFormatKey; + private static int iDateTimeFormatKey; + private static int iNumberFormatKey; + private static int iTextFormatKey; + private static int iTimeFormatKey; + private static int iLogicalFormatKey; + + private CommandMetaData m_aCommandMetaData; public FieldColumn(CommandMetaData oCommandMetaData, String _DisplayFieldName) { @@ -67,10 +72,10 @@ public class FieldColumn m_sCommandName = oCommandMetaData.getCommandName(); m_sFieldName = getOnlyFieldName(m_sDisplayFieldName, m_sCommandName); // TODO: could be wrong here! - FieldTitle = _DisplayFieldName; // oCommandMetaData.getFieldTitle(m_sFieldName); +// FieldTitle = _DisplayFieldName; // oCommandMetaData.getFieldTitle(m_sFieldName); FieldTitle = m_sFieldName; DBMetaData.CommandObject oTable = oCommandMetaData.getTableByName(m_sCommandName); - setFormatKeys(oCommandMetaData, oTable.xColumns); + initializeFormatKeys(oCommandMetaData, oTable.getColumns()); } public FieldColumn(CommandMetaData oCommandMetaData, String _FieldName, String _CommandName, boolean _bInstantiateByDisplayName) @@ -87,17 +92,49 @@ public class FieldColumn m_sDisplayFieldName = composeDisplayFieldName(_CommandName, m_sFieldName); } FieldTitle = m_sFieldName; - DBMetaData.CommandObject oTable = oCommandMetaData.getTableByName(m_sCommandName); - setFormatKeys(oCommandMetaData, oTable.xColumns); + m_aCommandMetaData = oCommandMetaData; } public FieldColumn(CommandMetaData oCommandMetaData, XNameAccess _xColumns, String _FieldName) { m_sFieldName = _FieldName; - FieldTitle = m_sFieldName; +// FieldTitle = m_sFieldName; m_sDisplayFieldName = m_sFieldName; ColIndex = JavaTools.FieldInList(_xColumns.getElementNames(), m_sFieldName) + 1; - setFormatKeys(oCommandMetaData, _xColumns); + initializeFormatKeys(oCommandMetaData, _xColumns); + } + + public int getFieldType() + { + if (m_nFieldType == 0) + { + DBMetaData.CommandObject oTable = m_aCommandMetaData.getTableByName(m_sCommandName); + initializeFormatKeys(m_aCommandMetaData, oTable.getColumns()); + } + return m_nFieldType; + } + + public int getFieldWidth() + { + getFieldType(); // will collect meta data 'bout the column, if not already done so + return FieldWidth; + } + + public int getDBFormatKey() + { + getFieldType(); // will collect meta data 'bout the column, if not already done so + return m_nDBFormatKey; + } + + public int getStandardFormatKey() + { + getFieldType(); // will collect meta data 'bout the column, if not already done so + return StandardFormatKey; + } + public boolean isNumberFormat() + { + getFieldType(); // will collect meta data 'bout the column, if not already done so + return bIsNumberFormat; } /** @@ -117,23 +154,27 @@ public class FieldColumn return _sCommandName + "." + _sFieldName; } - private void setFormatKeys(CommandMetaData oCommandMetaData, XNameAccess _xColumns) + private void initializeFormatKeys(CommandMetaData oCommandMetaData, XNameAccess _xColumns) { try { m_xColPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _xColumns.getByName(m_sFieldName)); ColIndex = JavaTools.FieldInList(_xColumns.getElementNames(), m_sFieldName) + 1; - iType = AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Type")); - - final NumberFormatter aNumberFormatter = oCommandMetaData.getNumberFormatter(); - iDateFormatKey = aNumberFormatter.getDateFormatKey(); - iDateTimeFormatKey = aNumberFormatter.getDateTimeFormatKey(); - iNumberFormatKey = aNumberFormatter.getNumberFormatKey(); - iTextFormatKey = aNumberFormatter.getTextFormatKey(); - iTimeFormatKey = aNumberFormatter.getTimeFormatKey(); - iLogicalFormatKey = aNumberFormatter.getLogicalFormatKey(); - - DefaultValue = getTyperelatedFieldData(); + m_nFieldType = AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Type")); + getTyperelatedFieldData(); + + if (bFormatKeysInitialized == false) + { + final NumberFormatter aNumberFormatter = oCommandMetaData.getNumberFormatter(); + + iDateFormatKey = aNumberFormatter.getDateFormatKey(); + iDateTimeFormatKey = aNumberFormatter.getDateTimeFormatKey(); + iNumberFormatKey = aNumberFormatter.getNumberFormatKey(); + iTextFormatKey = aNumberFormatter.getTextFormatKey(); + iTimeFormatKey = aNumberFormatter.getTimeFormatKey(); + iLogicalFormatKey = aNumberFormatter.getLogicalFormatKey(); + bFormatKeysInitialized = true; + } } catch (Exception e) { @@ -143,6 +184,7 @@ public class FieldColumn public XPropertySet getXColumnPropertySet() { + getFieldType(); // will collect meta data 'bout the column, if not already done so return m_xColPropertySet; } @@ -188,59 +230,26 @@ public class FieldColumn return locCommandName; } - public int getFormatKey() - { - try - { - // int iKey; - int nDBFormatKey; - Object oKey = m_xColPropertySet.getPropertyValue("FormatKey"); - if (AnyConverter.isVoid(oKey)) - { - nDBFormatKey = StandardFormatKey; - } - else - { - nDBFormatKey = AnyConverter.toInt(oKey); - } - return nDBFormatKey; - } - catch (Exception exception) - { - exception.printStackTrace(System.out); - return StandardFormatKey; - } - } - public boolean isBoolean() { boolean bIsBoolean = false; - try + switch ( getFieldType() ) { - FieldType = AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Type")); - switch (FieldType) - { - case DataType.BIT: // == -7; - case DataType.BOOLEAN: - bIsBoolean = true; - break; - default: - bIsBoolean = false; - } - } - catch (Exception exception) - { - exception.printStackTrace(System.out); + case DataType.BIT: // == -7; + case DataType.BOOLEAN: + bIsBoolean = true; + break; + default: + bIsBoolean = false; } return bIsBoolean; } - private Object getTyperelatedFieldData() + private void getTyperelatedFieldData() { try { - FieldType = AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Type")); - switch (FieldType) + switch ( getFieldType() ) { case DataType.BIT: // == -7; case DataType.BOOLEAN: @@ -340,20 +349,26 @@ public class FieldColumn bIsNumberFormat = true; break; } - DBFormatKey = getFormatKey(); - // TODO: the DefaultValue is not set in this function!!! - return DefaultValue; + + Object oKey = m_xColPropertySet.getPropertyValue("FormatKey"); + if (AnyConverter.isVoid(oKey)) + { + m_nDBFormatKey = StandardFormatKey; + } + else + { + m_nDBFormatKey = AnyConverter.toInt(oKey); + } } catch (Exception exception) { exception.printStackTrace(System.out); - return null; + m_nDBFormatKey = StandardFormatKey; } } private void getTextFieldWidth(int iWidth) { - // int iNewWidth = iWidth; try { FieldWidth = AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Precision")); @@ -375,9 +390,9 @@ public class FieldColumn } } - public Object getDefaultValue() + public void initDefaultValue() { - switch (FieldType) + switch (getFieldType()) { case DataType.BIT: // == -7; case DataType.BOOLEAN: @@ -447,6 +462,13 @@ public class FieldColumn default: break; } + } + + public Object getDefaultValue() + { + if ( DefaultValue == null ) + initDefaultValue(); return DefaultValue; } + } diff --git a/wizards/com/sun/star/wizards/db/QueryMetaData.java b/wizards/com/sun/star/wizards/db/QueryMetaData.java index 44b8833be6ea..229dd8624691 100644 --- a/wizards/com/sun/star/wizards/db/QueryMetaData.java +++ b/wizards/com/sun/star/wizards/db/QueryMetaData.java @@ -163,7 +163,7 @@ public class QueryMetaData extends CommandMetaData FieldColumn[] LocFieldColumns = new FieldColumn[FieldColumns.length - 1]; for (int i = 0; i < FieldColumns.length; i++) { - if (!FieldColumns[i].m_sFieldName.equals(_sFieldName)) + if (!FieldColumns[i].getFieldName().equals(_sFieldName)) { if (!FieldColumns[i].getCommandName().equals(_sCommandName)) { @@ -222,8 +222,7 @@ public class QueryMetaData extends CommandMetaData public String[] getFieldNamesOfCommand(String _sCommandName) { CommandObject oTable = getTableByName(_sCommandName); - return oTable.xColumns.getElementNames(); - + return oTable.getColumns().getElementNames(); } public void initializeFieldTitleSet(boolean _bAppendMode) @@ -238,9 +237,10 @@ public class QueryMetaData extends CommandMetaData String[] aCommandNames = getIncludedCommandNames(); for (int i = 0; i < aCommandNames.length; i++) { - CommandObject oTable = getTableByName(aCommandNames[i]); - String sTableName = oTable.Name; - String[] LocFieldNames = oTable.xColumns.getElementNames(); + String sCommandName = aCommandNames[i]; + CommandObject oTable = getTableByName(sCommandName); + String sTableName = oTable.getName(); + String[] LocFieldNames = oTable.getColumns().getElementNames(); for (int a = 0; a < LocFieldNames.length; a++) { String sDisplayFieldName = FieldColumn.composeDisplayFieldName(sTableName, LocFieldNames[a]); @@ -276,7 +276,7 @@ public class QueryMetaData extends CommandMetaData { for (int i = 0; i < FieldColumns.length; i++) { - if (FieldColumns[i].bIsNumberFormat) + if (FieldColumns[i].isNumberFormat()) { return true; } diff --git a/wizards/com/sun/star/wizards/db/RecordParser.java b/wizards/com/sun/star/wizards/db/RecordParser.java index 4de36970acae..cf2853861ccd 100644 --- a/wizards/com/sun/star/wizards/db/RecordParser.java +++ b/wizards/com/sun/star/wizards/db/RecordParser.java @@ -29,7 +29,6 @@ ************************************************************************/ package com.sun.star.wizards.db; -import com.sun.star.awt.XWindow; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.container.XNameAccess; import com.sun.star.lang.XComponent; @@ -252,7 +251,7 @@ public class RecordParser extends QueryMetaData String[] sFieldNames = getFieldNames(); for (int i = 0; i < FieldColumns.length; i++) { - String sFieldName = FieldColumns[i].m_sFieldName; + String sFieldName = FieldColumns[i].getFieldName(); int nColIndex = JavaTools.FieldInList(AllQueryFieldNames, sFieldName) + 1; FieldColumns[i].ColIndex = nColIndex; if (nColIndex == -1) @@ -284,7 +283,7 @@ public class RecordParser extends QueryMetaData public Object getGroupColumnValue(int ColIndex) { FieldColumn CurDBFieldColumn = this.GroupFieldColumns[ColIndex]; - return getColumnValue(CurDBFieldColumn.ColIndex, CurDBFieldColumn.FieldType); + return getColumnValue(CurDBFieldColumn.ColIndex, CurDBFieldColumn.getFieldType()); } public boolean getcurrentRecordData(java.util.Vector DataVector) @@ -293,7 +292,7 @@ public class RecordParser extends QueryMetaData for (int i = 0; i < RecordFieldColumns.length; i++) { FieldColumn CurDBFieldColumn = this.RecordFieldColumns[i]; - RecordValueArray[i] = getColumnValue(CurDBFieldColumn.ColIndex, CurDBFieldColumn.FieldType); //FinalColIndex + RecordValueArray[i] = getColumnValue(CurDBFieldColumn.ColIndex, CurDBFieldColumn.getFieldType()); //FinalColIndex } DataVector.addElement(RecordValueArray); return true; diff --git a/wizards/com/sun/star/wizards/db/RelationController.java b/wizards/com/sun/star/wizards/db/RelationController.java index a292cd3c8775..25563f5b9a78 100644 --- a/wizards/com/sun/star/wizards/db/RelationController.java +++ b/wizards/com/sun/star/wizards/db/RelationController.java @@ -31,14 +31,9 @@ package com.sun.star.wizards.db; import java.util.Vector; -import com.sun.star.beans.XPropertySet; import com.sun.star.sdbc.SQLException; import com.sun.star.sdbc.XResultSet; import com.sun.star.sdbc.XRow; -import com.sun.star.sdbcx.KeyType; -import com.sun.star.sdbcx.XColumnsSupplier; -import com.sun.star.uno.AnyConverter; -import com.sun.star.uno.Any; import com.sun.star.uno.UnoRuntime; import com.sun.star.wizards.common.JavaTools; diff --git a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java index c8e419a86161..db5ccd32b8f7 100644 --- a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java +++ b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java @@ -40,7 +40,6 @@ import com.sun.star.container.XIndexAccess; // import com.sun.star.container.XNameAccess; import com.sun.star.sdbcx.XColumnsSupplier; // import com.sun.star.sdb.XColumn; -import com.sun.star.sdb.XSQLQueryComposer; import com.sun.star.sdb.XSQLQueryComposerFactory; import com.sun.star.sdb.XSingleSelectQueryComposer; import com.sun.star.sdb.XSingleSelectQueryAnalyzer; @@ -338,7 +337,7 @@ public class SQLQueryComposer FieldColumn CurFieldColumn = CurDBMetaData.getFieldColumnByDisplayName(_fieldname); CommandName curComposedCommandName = getComposedCommandByDisplayName(CurFieldColumn.getCommandName()); String curAliasName = curComposedCommandName.getAliasName(); - return quoteName(curAliasName) + "." + quoteName(CurFieldColumn.m_sFieldName); + return quoteName(curAliasName) + "." + quoteName(CurFieldColumn.getFieldName()); } private CommandName getComposedCommandByAliasName(String _AliasName) diff --git a/wizards/com/sun/star/wizards/db/TableDescriptor.java b/wizards/com/sun/star/wizards/db/TableDescriptor.java index 35cf52373921..aa9986b8d9db 100644 --- a/wizards/com/sun/star/wizards/db/TableDescriptor.java +++ b/wizards/com/sun/star/wizards/db/TableDescriptor.java @@ -34,9 +34,7 @@ import com.sun.star.beans.PropertyVetoException; import com.sun.star.beans.UnknownPropertyException; import com.sun.star.lang.IllegalArgumentException; import com.sun.star.lang.WrappedTargetException; -import com.sun.star.lang.XInitialization; import com.sun.star.sdbc.SQLException; -import com.sun.star.ui.dialogs.XExecutableDialog; import com.sun.star.wizards.common.JavaTools; import com.sun.star.wizards.ui.WizardDialog; import java.util.Vector; @@ -59,7 +57,6 @@ import com.sun.star.sdbcx.XColumnsSupplier; import com.sun.star.sdbcx.XDataDescriptorFactory; import com.sun.star.sdbcx.XDrop; import com.sun.star.sdbcx.XKeysSupplier; -import com.sun.star.sdbcx.XTablesSupplier; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.UnoRuntime; import com.sun.star.wizards.common.Desktop; @@ -89,7 +86,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen private boolean bIDFieldisInserted = false; private String IDFieldName = ""; private String sColumnAlreadyExistsMessage = ""; - private WizardDialog oUnoDialog; +// private WizardDialog oUnoDialog; private XWindow xWindow; /** @@ -121,11 +118,11 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen { if (super.getConnection(_curPropertyValue)) { - XTablesSupplier xDBTables = (XTablesSupplier) UnoRuntime.queryInterface(XTablesSupplier.class, DBConnection); - xTableNames = xDBTables.getTables(); - xTableAppend = (XAppend) UnoRuntime.queryInterface(XAppend.class, xTableNames); - xTableDrop = (XDrop) UnoRuntime.queryInterface(XDrop.class, xTableNames); - xTableDataDescriptorFactory = (XDataDescriptorFactory) UnoRuntime.queryInterface(XDataDescriptorFactory.class, xTableNames); + // XTablesSupplier xDBTables = (XTablesSupplier) UnoRuntime.queryInterface(XTablesSupplier.class, DBConnection); + // xTableNames = xDBTables.getTables(); + xTableAppend = (XAppend) UnoRuntime.queryInterface(XAppend.class, getTableNamesAsNameAccess()); + xTableDrop = (XDrop) UnoRuntime.queryInterface(XDrop.class, getTableNamesAsNameAccess()); + xTableDataDescriptorFactory = (XDataDescriptorFactory) UnoRuntime.queryInterface(XDataDescriptorFactory.class, getTableNamesAsNameAccess()); xPropTableDataDescriptor = xTableDataDescriptorFactory.createDataDescriptor(); XColumnsSupplier xColumnsSupplier = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, xPropTableDataDescriptor); xNameAccessColumns = xColumnsSupplier.getColumns(); @@ -133,7 +130,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen try { createTypeInspector(); - sTableFilters = (String[]) AnyConverter.toArray(xDataSourcePropertySet.getPropertyValue("TableFilter")); + sTableFilters = (String[]) AnyConverter.toArray(getDataSourcePropertySet().getPropertyValue("TableFilter")); } catch (Exception e) { @@ -246,7 +243,10 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen /** * creates the table under the passed name + * @param _catalogname + * @param _schemaname * @param _tablename is made unique if necessary + * @param _fieldnames * @return true or false to indicate successful creation or not */ public boolean createTable(String _catalogname, String _schemaname, String _tablename, String[] _fieldnames) @@ -261,9 +261,9 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen if (!isColunnNameDuplicate(xNameAccessColumns, xColPropertySet)) { xAppendColumns.appendByDescriptor(xColPropertySet); //xColPropertySet.setPropertyValue("Type", new Integer(32423)) - } - else - { + } + else + { breturn = false; } } @@ -272,7 +272,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen assignTableProperty("Name", _tablename); assignTableProperty("CatalogName", _catalogname); assignTableProperty("SchemaName", _schemaname); - xTableContainer = (XContainer) UnoRuntime.queryInterface(XContainer.class, xTableNames); + xTableContainer = (XContainer) UnoRuntime.queryInterface(XContainer.class, getTableNamesAsNameAccess()); xTableContainer.addContainerListener(this); if (keycolumncontainer.size() > 0) { @@ -295,6 +295,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen } if (breturn) { + // TODO: LLA: describe what is he doing here. xTableAppend.appendByDescriptor(xPropTableDataDescriptor); } } @@ -340,7 +341,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen } if (xTableDrop != null) { - if (xTableNames.hasByName(_tablename)) + if (getTableNamesAsNameAccess().hasByName(_tablename)) { xTableDrop.dropByName(_tablename); } @@ -850,7 +851,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen sTableFilters = sNewTableFilters; try { - xDataSourcePropertySet.setPropertyValue("TableFilter", sTableFilters); + getDataSourcePropertySet().setPropertyValue("TableFilter", sTableFilters); } catch (Exception e) { diff --git a/wizards/com/sun/star/wizards/db/TypeInspector.java b/wizards/com/sun/star/wizards/db/TypeInspector.java index 689910b87e4c..479c3b6d5980 100644 --- a/wizards/com/sun/star/wizards/db/TypeInspector.java +++ b/wizards/com/sun/star/wizards/db/TypeInspector.java @@ -31,9 +31,7 @@ package com.sun.star.wizards.db; import java.util.Vector; -import com.sun.star.beans.UnknownPropertyException; import com.sun.star.beans.XPropertySet; -import com.sun.star.lang.WrappedTargetException; import com.sun.star.sdbc.ColumnSearch; import com.sun.star.sdbc.ColumnValue; import com.sun.star.sdbc.DataType; @@ -82,15 +80,15 @@ public class TypeInspector try { xResultSet = _xResultSet; - Vector aTypeNameVector = new Vector(); - Vector aTypeVector = new Vector(); - Vector aNullableVector = new Vector(); - Vector aAutoIncrementVector = new Vector(); - Vector aPrecisionVector = new Vector(); - Vector aMinScaleVector = new Vector(); - Vector aMaxScaleVector = new Vector(); - Vector aSearchableVector = new Vector(); - Integer[] aIntegerDataTypes = null; + Vector<String> aTypeNameVector = new Vector<String>(); + Vector<Integer> aTypeVector = new Vector<Integer>(); + Vector<Integer> aNullableVector = new Vector<Integer>(); + Vector<Boolean> aAutoIncrementVector = new Vector<Boolean>(); + Vector<Integer> aPrecisionVector = new Vector<Integer>(); + Vector<Integer> aMinScaleVector = new Vector<Integer>(); + Vector<Integer> aMaxScaleVector = new Vector<Integer>(); + Vector<Integer> aSearchableVector = new Vector<Integer>(); + // Integer[] aIntegerDataTypes = null; // XResultSet xResultSet = xDBMetaDagetTypeInfo(); XRow xRow = (XRow) UnoRuntime.queryInterface(XRow.class, xResultSet); while (xResultSet.next()) diff --git a/wizards/com/sun/star/wizards/document/Control.java b/wizards/com/sun/star/wizards/document/Control.java index c5f2ed8ff403..602aab2fd423 100644 --- a/wizards/com/sun/star/wizards/document/Control.java +++ b/wizards/com/sun/star/wizards/document/Control.java @@ -35,14 +35,10 @@ import com.sun.star.awt.XControl; import com.sun.star.awt.XControlModel; import com.sun.star.awt.XLayoutConstrains; import com.sun.star.awt.XWindowPeer; -import com.sun.star.beans.PropertyVetoException; -import com.sun.star.beans.UnknownPropertyException; import com.sun.star.beans.XPropertySet; -import com.sun.star.container.ElementExistException; import com.sun.star.container.XNameAccess; import com.sun.star.container.XNameContainer; import com.sun.star.container.XNamed; -import com.sun.star.sdbc.DataType; import com.sun.star.wizards.common.*; import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; @@ -50,7 +46,6 @@ import com.sun.star.uno.AnyConverter; import com.sun.star.drawing.XShape; import com.sun.star.drawing.XShapes; import com.sun.star.lang.IllegalArgumentException; -import com.sun.star.lang.WrappedTargetException; public class Control extends Shape { @@ -65,9 +60,9 @@ public class Control extends Shape String sServiceName; XNamed xNamed; final int SOMAXTEXTSIZE = 50; - int icontroltype; + private int icontroltype; protected XNameContainer xFormName; - protected final int IIMGFIELDWIDTH = 2000; + protected final int IIMGFIELDWIDTH = 3000; public Control() { @@ -102,8 +97,8 @@ public class Control extends Shape { try { - this.icontroltype = _icontroltype; - this.sServiceName = oFormHandler.sModelServices[icontroltype]; + icontroltype = _icontroltype; + sServiceName = oFormHandler.sModelServices[getControlType()]; Object oControlModel = oFormHandler.xMSFDoc.createInstance(sServiceName); xControlModel = (XControlModel) UnoRuntime.queryInterface(XControlModel.class, oControlModel); xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oControlModel); @@ -194,7 +189,7 @@ public class Control extends Shape public int getPreferredHeight(String sText) { Size aPeerSize = getPreferredSize(sText); - if (icontroltype == FormHandler.SOCHECKBOX) + if (getControlType() == FormHandler.SOCHECKBOX) { return (aPeerSize.Height * oFormHandler.getXPixelFactor()); } @@ -206,7 +201,7 @@ public class Control extends Shape public int getPreferredWidth() { - if (icontroltype == FormHandler.SOIMAGECONTROL) + if (getControlType() == FormHandler.SOIMAGECONTROL) { return IIMGFIELDWIDTH; } @@ -215,7 +210,7 @@ public class Control extends Shape Size aPeerSize = getPeerSize(); // We increase the preferred Width a bit so that the control does not become too small // when we change the border from "3D" to "Flat" - if (icontroltype == FormHandler.SOCHECKBOX) + if (getControlType() == FormHandler.SOCHECKBOX) { return ((aPeerSize.Width * oFormHandler.getXPixelFactor())); } @@ -228,7 +223,7 @@ public class Control extends Shape public int getPreferredHeight() { - if (this.icontroltype == FormHandler.SOIMAGECONTROL) + if (getControlType() == FormHandler.SOIMAGECONTROL) { return 2000; } @@ -310,17 +305,17 @@ public class Control extends Shape aPreferredSize = getPeer().getPreferredSize(); xPropertySet.setPropertyValue("EffectiveValue", com.sun.star.uno.Any.VOID); } - else if (this.icontroltype == FormHandler.SOCHECKBOX) + else if (getControlType() == FormHandler.SOCHECKBOX) { aPreferredSize = getPeer().getPreferredSize(); } - else if (this.icontroltype == FormHandler.SODATECONTROL) + else if (getControlType() == FormHandler.SODATECONTROL) { xPropertySet.setPropertyValue("Date", new Integer(4711)); //TODO find a better date aPreferredSize = getPeer().getPreferredSize(); xPropertySet.setPropertyValue("Date", com.sun.star.uno.Any.VOID); } - else if (this.icontroltype == FormHandler.SOTIMECONTROL) + else if (getControlType() == FormHandler.SOTIMECONTROL) { xPropertySet.setPropertyValue("Time", new Integer(47114)); //TODO find a better time aPreferredSize = getPeer().getPreferredSize(); diff --git a/wizards/com/sun/star/wizards/document/DatabaseControl.java b/wizards/com/sun/star/wizards/document/DatabaseControl.java index f809ef479f05..ed48ddbc04ea 100644 --- a/wizards/com/sun/star/wizards/document/DatabaseControl.java +++ b/wizards/com/sun/star/wizards/document/DatabaseControl.java @@ -31,17 +31,10 @@ package com.sun.star.wizards.document; import com.sun.star.awt.Point; -import com.sun.star.awt.Size; import com.sun.star.beans.XPropertySet; -import com.sun.star.container.ElementExistException; -import com.sun.star.container.XNameAccess; import com.sun.star.container.XNameContainer; import com.sun.star.drawing.XShapes; -import com.sun.star.lang.IllegalArgumentException; -import com.sun.star.lang.WrappedTargetException; import com.sun.star.sdbc.DataType; -import com.sun.star.uno.AnyConverter; -import com.sun.star.uno.UnoRuntime; import com.sun.star.wizards.common.Desktop; import com.sun.star.wizards.common.Helper; import com.sun.star.wizards.db.FieldColumn; @@ -55,42 +48,55 @@ import com.sun.star.wizards.db.FieldColumn; public class DatabaseControl extends Control { - protected int ifieldtype; - private int iMemofieldwidth = IIMGFIELDWIDTH; - private int iMemofieldheight = -1; - private FieldColumn m_FieldColumn; + private int m_nFieldType; + // private int iMemofieldwidth = IIMGFIELDWIDTH; + // private int iMemofieldheight = -1; + // private FieldColumn m_FieldColumn; public DatabaseControl(GridControl _oGridControl, FieldColumn _curfieldcolumn) { super(); - m_FieldColumn = _curfieldcolumn; - if (_curfieldcolumn.FieldType != DataType.TIMESTAMP) + // m_FieldColumn = _curfieldcolumn; + if (_curfieldcolumn.getFieldType() != DataType.TIMESTAMP) { - createGridColumn(_oGridControl, _curfieldcolumn, _curfieldcolumn.FieldType, _curfieldcolumn.getFieldTitle()); + createGridColumn(_oGridControl, _curfieldcolumn, _curfieldcolumn.getFieldType(), _curfieldcolumn.getFieldTitle()); } } public DatabaseControl(GridControl _oGridControl, FieldColumn _curfieldcolumn, int _fieldtype, String _columntitle) { super(); - m_FieldColumn = _curfieldcolumn; + // m_FieldColumn = _curfieldcolumn; createGridColumn(_oGridControl, _curfieldcolumn, _fieldtype, _columntitle); } + protected int getFieldType() + { + return m_nFieldType; + } + private void createGridColumn(GridControl _oGridControl, FieldColumn _curfieldcolumn, int _fieldtype, String _columntitle) { try { - ifieldtype = _fieldtype; - String suniqueName = Desktop.getUniqueName(_oGridControl.xNameAccess, _curfieldcolumn.m_sFieldName); - XPropertySet xPropColumn = _oGridControl.xGridColumnFactory.createColumn(getGridColumnName()); - xPropColumn.setPropertyValue("Name", suniqueName); - xPropColumn.setPropertyValue("Hidden", new Boolean(_fieldtype == DataType.LONGVARBINARY)); //TODO CONTROLType abfragen!!!!!! - xPropColumn.setPropertyValue("DataField", _curfieldcolumn.m_sFieldName); + m_nFieldType = _fieldtype; + String sFieldName = _curfieldcolumn.getFieldName(); + String sUniqueName = Desktop.getUniqueName(_oGridControl.xNameAccess, sFieldName); + + String sGridColumnName = getGridColumnName(); + XPropertySet xPropColumn = _oGridControl.xGridColumnFactory.createColumn(sGridColumnName); + xPropColumn.setPropertyValue("Name", sUniqueName); + boolean bHidden = false; + if (_fieldtype == DataType.LONGVARBINARY) //TODO CONTROLType abfragen!!!!!! + { + bHidden = true; + } + xPropColumn.setPropertyValue("Hidden", new Boolean(bHidden)); + xPropColumn.setPropertyValue("DataField", sFieldName); xPropColumn.setPropertyValue("Label", _columntitle); xPropColumn.setPropertyValue("Width", new Integer(0)); // Width of column is adjusted to Columname - setNumerics(); - _oGridControl.xNameContainer.insertByName(_curfieldcolumn.m_sFieldName, xPropColumn); + setNumericLimits(); + _oGridControl.xNameContainer.insertByName(sFieldName, xPropColumn); } catch (Exception e) { @@ -108,9 +114,9 @@ public class DatabaseControl extends Control super(_oFormHandler, _xFormName, _oFormHandler.getControlType(_fieldtype), _curFieldName, _aPoint, null); try { - this.ifieldtype = _fieldtype; + m_nFieldType = _fieldtype; Helper.setUnoPropertyValue(xControlModel, "DataField", _curFieldName); - setNumerics(); + setNumericLimits(); } catch (Exception e) { @@ -123,9 +129,9 @@ public class DatabaseControl extends Control super(_oFormHandler, _xGroupShapes, _xFormName, _oFormHandler.getControlType(_fieldtype), _aPoint, null); try { - this.ifieldtype = _fieldtype; + m_nFieldType = _fieldtype; Helper.setUnoPropertyValue(xControlModel, "DataField", _curFieldName); - setNumerics(); + setNumericLimits(); } catch (Exception e) { @@ -137,7 +143,7 @@ public class DatabaseControl extends Control { for (int i = 0; i < FormHandler.oControlData.length; i++) { - if (FormHandler.oControlData[i].DataType == this.ifieldtype) + if (FormHandler.oControlData[i].DataType == getFieldType()) { return FormHandler.oControlData[i].GridColumnName; } @@ -145,39 +151,39 @@ public class DatabaseControl extends Control return ""; } - public int getDBHeight() + public int getControlHeight() { - if (this.icontroltype == FormHandler.SOIMAGECONTROL) + if (getControlType() == FormHandler.SOIMAGECONTROL) { - return oFormHandler.getImageControlHeight(); + // return oFormHandler.getImageControlHeight(); + final int nMemofieldheight = oFormHandler.getControlReferenceHeight() * 4; + return nMemofieldheight; } else { - if (this.ifieldtype == DataType.LONGVARCHAR) + if (getFieldType() == DataType.LONGVARCHAR) { - if (iMemofieldheight == -1) - { - Helper.setUnoPropertyValue(xControlModel, "MultiLine", Boolean.TRUE); - iMemofieldheight = oFormHandler.getDBRefHeight() * 4; - } - return iMemofieldheight; + // Helper.setUnoPropertyValue(xControlModel, "MultiLine", Boolean.TRUE); + final int nMemofieldheight = oFormHandler.getControlReferenceHeight() * 4; + return nMemofieldheight; } - else if (this.icontroltype == FormHandler.SOCHECKBOX) + else if (getControlType() == FormHandler.SOCHECKBOX) { return super.getPreferredHeight(); } - else - { - return oFormHandler.getDBRefHeight(); - } } + return oFormHandler.getControlReferenceHeight(); } - public int getDBWidth() + public int getControlWidth() { - if (this.ifieldtype == DataType.LONGVARCHAR) + if (getControlType() == FormHandler.SOIMAGECONTROL) { - return 2 * getDBHeight(); + return 2 * getControlHeight(); + } + if (getFieldType() == DataType.LONGVARCHAR) + { + return 2 * getControlHeight(); } else { @@ -185,26 +191,49 @@ public class DatabaseControl extends Control } } - public void setNumerics() + private static long m_nLongMax = 0; + public static long getLongMax() + { + if (m_nLongMax == 0) + { + } + return m_nLongMax; + } + public void setNumericLimits() { try { - if (this.icontroltype == FormHandler.SONUMERICCONTROL) + if (getControlType() == FormHandler.SONUMERICCONTROL) { xPropertySet.setPropertyValue("TreatAsNumber", Boolean.TRUE); - switch (ifieldtype) + // Math. + // 2^63 - 1 = 9223372036854775807 + // int nIntMax = 0x7fffffff; + // int nIntMin = -0x80000000; + // long nLongMax = nIntMax; + // nLongMax <<= (4*4); + // nLongMax |= 0xffff; + // nLongMax <<= (4*4); + // nLongMax |= 0xffff; + + // long nLongMin = nIntMin; + // nLongMin <<= (8*4); + + // long nLong2 = (long)9223372036854775807; + + switch (getFieldType()) { case DataType.BIGINT: - xPropertySet.setPropertyValue("EffectiveMax", new Double(2147483647 * 2147483647)); - xPropertySet.setPropertyValue("EffectiveMin", new Double(-(-2147483648 * -2147483648))); + xPropertySet.setPropertyValue("EffectiveMax", new Double(Long.MAX_VALUE)); + xPropertySet.setPropertyValue("EffectiveMin", new Double(Long.MIN_VALUE)); break; case DataType.INTEGER: - xPropertySet.setPropertyValue("EffectiveMax", new Double(2147483647)); - xPropertySet.setPropertyValue("EffectiveMin", new Double(-2147483648)); + xPropertySet.setPropertyValue("EffectiveMax", new Double(Integer.MAX_VALUE)); + xPropertySet.setPropertyValue("EffectiveMin", new Double(Integer.MIN_VALUE)); break; case DataType.SMALLINT: - xPropertySet.setPropertyValue("EffectiveMax", new Double(32767)); - xPropertySet.setPropertyValue("EffectiveMin", new Double(-32768)); + xPropertySet.setPropertyValue("EffectiveMax", new Double(Short.MAX_VALUE)); + xPropertySet.setPropertyValue("EffectiveMin", new Double(Short.MIN_VALUE)); break; case DataType.TINYINT: xPropertySet.setPropertyValue("EffectiveMax", new Double(127)); @@ -218,11 +247,12 @@ public class DatabaseControl extends Control break; } } - else if (icontroltype == FormHandler.SOTEXTBOX) - { // com.sun.star.sdbc.DataType.CHAR, com.sun.star.sdbc.DataType.VARCHAR, com.sun.star.sdbc.DataType.LONGVARCHAR - } - else if (icontroltype == FormHandler.SOCHECKBOX) + // else if (getControlType() == FormHandler.SOTEXTBOX) + // { // com.sun.star.sdbc.DataType.CHAR, com.sun.star.sdbc.DataType.VARCHAR, com.sun.star.sdbc.DataType.LONGVARCHAR + // } + else if (getControlType() == FormHandler.SOIMAGECONTROL) { + xPropertySet.setPropertyValue("ScaleMode", com.sun.star.awt.ImageScaleMode.Isotropic); } } catch (Exception e) diff --git a/wizards/com/sun/star/wizards/document/FormHandler.java b/wizards/com/sun/star/wizards/document/FormHandler.java index 1c8f18844101..20555455e2fe 100644 --- a/wizards/com/sun/star/wizards/document/FormHandler.java +++ b/wizards/com/sun/star/wizards/document/FormHandler.java @@ -34,17 +34,16 @@ import com.sun.star.awt.Size; import com.sun.star.awt.VclWindowPeerAttribute; import com.sun.star.awt.XControlModel; import com.sun.star.awt.XDevice; -import com.sun.star.beans.PropertyVetoException; -import com.sun.star.beans.UnknownPropertyException; import com.sun.star.beans.XPropertySet; import com.sun.star.container.NoSuchElementException; import com.sun.star.container.XChild; import com.sun.star.container.XNameAccess; import com.sun.star.container.XNameContainer; +import com.sun.star.lang.WrappedTargetException; import com.sun.star.view.XControlAccess; import com.sun.star.wizards.common.*; -import com.sun.star.sdbc.*; +import com.sun.star.sdbc.DataType; import com.sun.star.text.XTextDocument; import com.sun.star.uno.Exception; import com.sun.star.uno.Type; @@ -55,13 +54,10 @@ import com.sun.star.drawing.XControlShape; import com.sun.star.drawing.XDrawPage; import com.sun.star.drawing.XDrawPageSupplier; import com.sun.star.drawing.XShape; -//import com.sun.star.drawing.XShapeGroup; import com.sun.star.drawing.XShapeGrouper; import com.sun.star.drawing.XShapes; import com.sun.star.form.XFormsSupplier; import com.sun.star.lang.IllegalArgumentException; -import com.sun.star.lang.IndexOutOfBoundsException; -import com.sun.star.lang.WrappedTargetException; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.lang.XServiceInfo; @@ -76,8 +72,8 @@ public class FormHandler public XDrawPage xDrawPage; private XDrawPageSupplier xDrawPageSupplier; public String[] sModelServices = new String[8]; - public XNameContainer xNamedForm; public static ControlData[] oControlData; + public final static int SOLABEL = 0; public final static int SOTEXTBOX = 1; public final static int SOCHECKBOX = 2; @@ -129,29 +125,32 @@ public class FormHandler sModelServices[SONUMERICCONTROL] = "com.sun.star.form.component.FormattedField"; sModelServices[SOGRIDCONTROL] = "com.sun.star.form.component.GridControl"; sModelServices[SOIMAGECONTROL] = "com.sun.star.form.component.DatabaseImageControl"; - oControlData = new ControlData[17]; - oControlData[0] = createControlData(DataType.BIT, SOCHECKBOX, "CheckBox", "CheckBox", false); - oControlData[1] = createControlData(DataType.BOOLEAN, SOCHECKBOX, "CheckBox", "CheckBox", false); - oControlData[2] = createControlData(DataType.TINYINT, SONUMERICCONTROL, "FormattedField", "FormattedField", false); - oControlData[3] = createControlData(DataType.SMALLINT, SONUMERICCONTROL, "FormattedField", "FormattedField", false); - oControlData[4] = createControlData(DataType.INTEGER, SONUMERICCONTROL, "FormattedField", "FormattedField", false); - oControlData[5] = createControlData(DataType.BIGINT, SONUMERICCONTROL, "FormattedField", "FormattedField", false); - oControlData[6] = createControlData(DataType.FLOAT, SONUMERICCONTROL, "FormattedField", "FormattedField", false); - oControlData[7] = createControlData(DataType.REAL, SONUMERICCONTROL, "FormattedField", "FormattedField", false); - oControlData[8] = createControlData(DataType.DOUBLE, SONUMERICCONTROL, "FormattedField", "FormattedField", false); - oControlData[9] = createControlData(DataType.NUMERIC, SONUMERICCONTROL, "FormattedField", "FormattedField", false); - oControlData[10] = createControlData(DataType.DECIMAL, SONUMERICCONTROL, "FormattedField", "FormattedField", false); - oControlData[11] = createControlData(DataType.CHAR, SOTEXTBOX, "TextField", "TextField", false); - oControlData[12] = createControlData(DataType.VARCHAR, SOTEXTBOX, "TextField", "TextField", true); + + oControlData = new ControlData[22]; + oControlData[0] = createControlData(DataType.BIT, SOCHECKBOX, "CheckBox", "CheckBox", false); + oControlData[1] = createControlData(DataType.BOOLEAN, SOCHECKBOX, "CheckBox", "CheckBox", false); + oControlData[2] = createControlData(DataType.TINYINT, SONUMERICCONTROL, "FormattedField", "FormattedField", false); + oControlData[3] = createControlData(DataType.SMALLINT, SONUMERICCONTROL, "FormattedField", "FormattedField", false); + oControlData[4] = createControlData(DataType.INTEGER, SONUMERICCONTROL, "FormattedField", "FormattedField", false); + oControlData[5] = createControlData(DataType.BIGINT, SONUMERICCONTROL, "FormattedField", "FormattedField", false); + oControlData[6] = createControlData(DataType.FLOAT, SONUMERICCONTROL, "FormattedField", "FormattedField", false); + oControlData[7] = createControlData(DataType.REAL, SONUMERICCONTROL, "FormattedField", "FormattedField", false); + oControlData[8] = createControlData(DataType.DOUBLE, SONUMERICCONTROL, "FormattedField", "FormattedField", false); + oControlData[9] = createControlData(DataType.NUMERIC, SONUMERICCONTROL, "FormattedField", "FormattedField", false); + oControlData[10] = createControlData(DataType.DECIMAL, SONUMERICCONTROL, "FormattedField", "FormattedField", false); + oControlData[11] = createControlData(DataType.CHAR, SOTEXTBOX, "TextField", "TextField", false); + oControlData[12] = createControlData(DataType.VARCHAR, SOTEXTBOX, "TextField", "TextField", true); oControlData[13] = createControlData(DataType.LONGVARCHAR, SOTEXTBOX, "TextField", "TextField", true); - oControlData[14] = createControlData(DataType.DATE, SODATECONTROL, "DateField", "DateField", false); - oControlData[15] = createControlData(DataType.TIME, SOTIMECONTROL, "TimeField", "TimeField", false); - oControlData[16] = createControlData(DataType.TIMESTAMP, SODATECONTROL, "DateField", "TextField", false); - ControlData[] oImageControlData = new ControlData[4]; - oImageControlData[0] = createControlData(DataType.BINARY, SOIMAGECONTROL, "ImageControl", "TextField", false); - oImageControlData[1] = createControlData(DataType.VARBINARY, SOIMAGECONTROL, "ImageControl", "TextField", false); - oImageControlData[2] = createControlData(DataType.LONGVARBINARY, SOIMAGECONTROL, "ImageControl", "TextField", false); - oImageControlData[3] = createControlData(DataType.BLOB, SOIMAGECONTROL, "ImageControl", "TextField", false); + oControlData[14] = createControlData(DataType.DATE, SODATECONTROL, "DateField", "DateField", false); + oControlData[15] = createControlData(DataType.TIME, SOTIMECONTROL, "TimeField", "TimeField", false); + oControlData[16] = createControlData(DataType.TIMESTAMP, SODATECONTROL, "DateField", "TextField", false); + // oImageControlData = new ControlData[4]; + oControlData[17] = createControlData(DataType.BINARY, SOIMAGECONTROL, "ImageControl", "TextField", false); + oControlData[18] = createControlData(DataType.VARBINARY, SOIMAGECONTROL, "ImageControl", "TextField", false); + oControlData[19] = createControlData(DataType.LONGVARBINARY, SOIMAGECONTROL, "ImageControl", "TextField", false); + oControlData[20] = createControlData(DataType.BLOB, SOIMAGECONTROL, "ImageControl", "TextField", false); + + oControlData[21] = createControlData(DataType.OTHER, SOIMAGECONTROL, "ImageControl", "TextField", false); } public int getControlType(int _fieldtype) @@ -160,7 +159,8 @@ public class FormHandler { if (oControlData[i].DataType == _fieldtype) { - return oControlData[i].ControlType; + final int nType = oControlData[i].ControlType; + return nType; } } return -1; @@ -190,6 +190,7 @@ public class FormHandler XDevice xDevice = (XDevice) UnoRuntime.queryInterface(XDevice.class, oLabelControl.xWindowPeer); iXPixelFactor = (int) (100000 / xDevice.getInfo().PixelPerMeterX); iYPixelFactor = (int) (100000 / xDevice.getInfo().PixelPerMeterY); + nLabelHeight = (oLabelControl.getPreferredHeight("The quick brown fox...") + 1); Control oTextControl = new Control(this, SOTEXTBOX, new Point(), new Size()); nDBRefHeight = (oTextControl.getPreferredHeight("The quick brown fox...") + 1); @@ -299,7 +300,7 @@ public class FormHandler { for (int i = xDrawPage.getCount() - 1; i >= 0; i--) { - if (hasControlByName(_FormName, xDrawPage.getByIndex(i))) + if (belongsToForm(xDrawPage.getByIndex(i), _FormName)) { XShape xShape = (XShape) UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i)); xDrawPage.remove(xShape); @@ -312,7 +313,23 @@ public class FormHandler } } - public boolean hasControlByName(String _FormName, Object _oDrawPageElement) + public void removeElement( XNameContainer _parentContainer, String _formName ) + { + try + { + _parentContainer.removeByName( _formName ); + } + catch ( WrappedTargetException e ) + { + e.printStackTrace( System.err ); + } + catch( final NoSuchElementException e ) + { + e.printStackTrace( System.err ); + } + } + + public boolean belongsToForm(Object _oDrawPageElement, String _FormName) { XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, _oDrawPageElement); if (xServiceInfo.supportsService("com.sun.star.drawing.ControlShape")) @@ -325,7 +342,7 @@ public class FormHandler XChild xChild = (XChild) UnoRuntime.queryInterface(XChild.class, xControlModel); XNamed xNamed = (XNamed) UnoRuntime.queryInterface(XNamed.class, xChild.getParent()); String sName = xNamed.getName(); - return _FormName.equals(xNamed.getName()); + return _FormName.equals(sName); } } return false; @@ -340,6 +357,7 @@ public class FormHandler { oDBForm = xMSFDoc.createInstance("com.sun.star.form.component.Form"); _xNamedFormContainer.insertByName(_FormName, oDBForm); + XNameContainer xNamedForm; xNamedForm = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, oDBForm); return xNamedForm; } @@ -543,7 +561,7 @@ public class FormHandler /** * @return */ - public int getDBRefHeight() + public int getControlReferenceHeight() { if (this.nDBRefHeight == -1) { diff --git a/wizards/com/sun/star/wizards/document/GridControl.java b/wizards/com/sun/star/wizards/document/GridControl.java index 54814f3fc3b4..426aa026213b 100644 --- a/wizards/com/sun/star/wizards/document/GridControl.java +++ b/wizards/com/sun/star/wizards/document/GridControl.java @@ -40,7 +40,6 @@ import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; import com.sun.star.container.XNameAccess; import com.sun.star.container.XNameContainer; -import com.sun.star.container.XNamed; import com.sun.star.form.XGridColumnFactory; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; @@ -78,7 +77,7 @@ public class GridControl extends Shape for (int i = 0; i < fieldcolumns.length; i++) { FieldColumn curfieldcolumn = fieldcolumns[i]; - if (curfieldcolumn.FieldType == DataType.TIMESTAMP) + if (curfieldcolumn.getFieldType() == DataType.TIMESTAMP) { TimeStampControl oControl = new TimeStampControl(new Resource(_xMSF, "", "dbw"), this, curfieldcolumn); } diff --git a/wizards/com/sun/star/wizards/document/Shape.java b/wizards/com/sun/star/wizards/document/Shape.java index fb41e3e0ad17..a038ad629d6a 100644 --- a/wizards/com/sun/star/wizards/document/Shape.java +++ b/wizards/com/sun/star/wizards/document/Shape.java @@ -40,9 +40,7 @@ import com.sun.star.lang.XServiceInfo; import com.sun.star.text.TextContentAnchorType; import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; -import com.sun.star.wizards.common.Desktop; import com.sun.star.wizards.common.Helper; -import com.sun.star.wizards.common.JavaTools; /** * @author Administrator diff --git a/wizards/com/sun/star/wizards/document/TimeStampControl.java b/wizards/com/sun/star/wizards/document/TimeStampControl.java index 343aad8de747..52209308edc1 100644 --- a/wizards/com/sun/star/wizards/document/TimeStampControl.java +++ b/wizards/com/sun/star/wizards/document/TimeStampControl.java @@ -36,14 +36,12 @@ import com.sun.star.beans.XPropertySet; import com.sun.star.wizards.common.*; import com.sun.star.wizards.db.FieldColumn; import com.sun.star.wizards.ui.*; -import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.sdbc.*; import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; import com.sun.star.container.XNameContainer; import com.sun.star.drawing.XControlShape; import com.sun.star.drawing.XShape; -import com.sun.star.drawing.XShapeGroup; import com.sun.star.drawing.XShapes; public class TimeStampControl extends DatabaseControl @@ -69,7 +67,7 @@ public class TimeStampControl extends DatabaseControl oResource = _oResource; // xGroupShape = xShape; oDateControl = new DatabaseControl(oFormHandler, _xFormName, _curFieldName, DataType.DATE, aPoint); - int nDBHeight = oDateControl.getDBHeight(); + int nDBHeight = oDateControl.getControlHeight(); nDateWidth = oDateControl.getPreferredWidth(); oDateControl.setSize(new Size(nDateWidth, nDBHeight)); Point aTimePoint = new Point(aPoint.X + 10 + nDateWidth, aPoint.Y); diff --git a/wizards/com/sun/star/wizards/form/DataEntrySetter.java b/wizards/com/sun/star/wizards/form/DataEntrySetter.java index 5b9473ba4c60..e147910fa90a 100644 --- a/wizards/com/sun/star/wizards/form/DataEntrySetter.java +++ b/wizards/com/sun/star/wizards/form/DataEntrySetter.java @@ -41,19 +41,19 @@ import com.sun.star.wizards.ui.UIConsts; public class DataEntrySetter { - WizardDialog CurUnoDialog; - short curtabindex; - XRadioButton optNewDataOnly; - XRadioButton optDisplayAllData; - XCheckBox chknomodification; - XCheckBox chknodeletion; - XCheckBox chknoaddition; + private WizardDialog CurUnoDialog; + private short curtabindex; + private XRadioButton optNewDataOnly; + private XRadioButton optDisplayAllData; + private XCheckBox chknomodification; + private XCheckBox chknodeletion; + private XCheckBox chknoaddition; public DataEntrySetter(WizardDialog _CurUnoDialog) { this.CurUnoDialog = _CurUnoDialog; - curtabindex = (short) (FormWizard.SODATAPAGE * 100); - Integer IDataStep = new Integer(FormWizard.SODATAPAGE); + curtabindex = (short) (FormWizard.SODATA_PAGE * 100); + Integer IDataStep = new Integer(FormWizard.SODATA_PAGE); String sNewDataOnly = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 44); // String sDisplayAllData = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 46); // String sNoModification = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 47); // AllowUpdates diff --git a/wizards/com/sun/star/wizards/form/FieldLinker.java b/wizards/com/sun/star/wizards/form/FieldLinker.java index 2bcee88c84d0..3e2721161c60 100644 --- a/wizards/com/sun/star/wizards/form/FieldLinker.java +++ b/wizards/com/sun/star/wizards/form/FieldLinker.java @@ -29,18 +29,13 @@ ************************************************************************/ package com.sun.star.wizards.form; -import java.beans.PropertyChangeEvent; - import com.sun.star.awt.ItemEvent; import com.sun.star.awt.VclWindowPeerAttribute; import com.sun.star.awt.XFixedText; import com.sun.star.awt.XListBox; -import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.Exception; import com.sun.star.wizards.common.Helper; import com.sun.star.wizards.common.JavaTools; -import com.sun.star.wizards.common.SystemDialog; -import com.sun.star.wizards.db.CommandMetaData; import com.sun.star.wizards.db.RelationController; import com.sun.star.wizards.ui.UnoDialog; import com.sun.star.wizards.ui.WizardDialog; @@ -50,22 +45,22 @@ import com.sun.star.wizards.ui.DBLimitedFieldSelection; public class FieldLinker extends DBLimitedFieldSelection { - XFixedText[] lblSlaveFields; - XFixedText[] lblMasterFields; - XListBox[] lstSlaveFields; - XListBox[] lstMasterFields; - final int SOMASTERINDEX = 1; - final int SOSLAVEINDEX = 0; - int SOFIRSTLINKLST = 0; - int SOSECLINKLST = 1; - int SOTHIRDLINKLST = 2; - int SOFOURTHLINKLST = 3; - int[] SOLINKLST = null; - String[] sSlaveListHeader; - String[] sMasterListHeader; //CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 40); - String sSlaveHidString; - String sMasterHidString; - Integer IListBoxPosX; + private XFixedText[] lblSlaveFields; + private XFixedText[] lblMasterFields; + private XListBox[] lstSlaveFields; + private XListBox[] lstMasterFields; + private final int SOMASTERINDEX = 1; + private final int SOSLAVEINDEX = 0; + private int SOFIRSTLINKLST = 0; + private int SOSECLINKLST = 1; + private int SOTHIRDLINKLST = 2; + private int SOFOURTHLINKLST = 3; + private int[] SOLINKLST = null; + private String[] sSlaveListHeader; + private String[] sMasterListHeader; //CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 40); + private String sSlaveHidString; + private String sMasterHidString; + private Integer IListBoxPosX; public FieldLinker(WizardDialog _CurUnoDialog, int iStep, int iCompPosX, int iCompPosY, int iCompWidth, int _firsthelpid) { @@ -109,11 +104,29 @@ public class FieldLinker extends DBLimitedFieldSelection lstSlaveFields[i] = CurUnoDialog.insertListBox("lstSlaveFieldLink" + new Integer(i + 1).toString(), SOLINKLST[i], null, new ItemListenerImpl(), new String[] { - "Dropdown", "Enabled", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width" + "Dropdown", + "Enabled", + "Height", + "HelpURL", + "LineCount", + "PositionX", + "PositionY", + "Step", + "TabIndex", + "Width" }, new Object[] { - Boolean.TRUE, new Boolean(bDoEnable), UIConsts.INTEGER_12, sSlaveHidString, new Integer(97), new Integer(iCurPosY + 10), IStep, new Short(curtabindex++), new Integer(97) + Boolean.TRUE, + new Boolean(bDoEnable), + UIConsts.INTEGER_12, + sSlaveHidString, + Short.valueOf(UnoDialog.getListBoxLineCount()), + new Integer(97), + new Integer(iCurPosY + 10), + IStep, + new Short(curtabindex++), + new Integer(97) }); lblMasterFields[i] = CurUnoDialog.insertLabel("lblMasterFieldLink" + new Integer(i + 1).toString(), @@ -129,11 +142,29 @@ public class FieldLinker extends DBLimitedFieldSelection lstMasterFields[i] = CurUnoDialog.insertListBox("lstMasterFieldLink" + new Integer(i + 1).toString(), SOLINKLST[i], null, new ItemListenerImpl(), new String[] { - "Dropdown", "Enabled", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width" + "Dropdown", + "Enabled", + "Height", + "HelpURL", + "LineCount", + "PositionX", + "PositionY", + "Step", + "TabIndex", + "Width" }, new Object[] { - Boolean.TRUE, new Boolean(bDoEnable), UIConsts.INTEGER_12, sMasterHidString, new Integer(206), new Integer(iCurPosY + 10), IStep, new Short(curtabindex++), new Integer(97) + Boolean.TRUE, + new Boolean(bDoEnable), + UIConsts.INTEGER_12, + sMasterHidString, + Short.valueOf(UnoDialog.getListBoxLineCount()), + new Integer(206), + new Integer(iCurPosY + 10), + IStep, + new Short(curtabindex++), + new Integer(97) }); iCurPosY = iCurPosY + 38; } @@ -145,8 +176,10 @@ public class FieldLinker extends DBLimitedFieldSelection protected void enableNextControlRow(int curindex) { - setMaxSelIndex(); - boolean bDoEnable = ((lstSlaveFields[curindex].getSelectedItemPos() > 0) && (lstMasterFields[curindex].getSelectedItemPos() > 0)); + // setMaxSelIndex(); + boolean bSlaveField = lstSlaveFields[curindex].getSelectedItemPos() > 0; + boolean bMasterField = lstMasterFields[curindex].getSelectedItemPos() > 0; + boolean bDoEnable = (bSlaveField && bMasterField); if (!bDoEnable) { moveupSelectedItems(curindex, bDoEnable); @@ -157,9 +190,9 @@ public class FieldLinker extends DBLimitedFieldSelection } } - protected void setMaxSelIndex() + protected int getMaxSelIndex() { - MaxSelIndex = -1; + int MaxSelIndex = -1; for (int i = 0; i < rowcount; i++) { if ((lstSlaveFields[i].getSelectedItemPos() > 0) && (lstMasterFields[i].getSelectedItemPos() > 0)) @@ -167,6 +200,7 @@ public class FieldLinker extends DBLimitedFieldSelection MaxSelIndex += 1; } } + return MaxSelIndex; } protected void toggleControlRow(int i, boolean bDoEnable) @@ -179,14 +213,8 @@ public class FieldLinker extends DBLimitedFieldSelection Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[i]), "Enabled", new Boolean(bDoEnable)); if (bDoEnable == false) { - Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[i]), "SelectedItems", new short[] - { - 0 - }); - Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[i]), "SelectedItems", new short[] - { - 0 - }); + Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[i]), "SelectedItems", new short[] { 0 }); + Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[i]), "SelectedItems", new short[] { 0 }); } } } @@ -198,34 +226,22 @@ public class FieldLinker extends DBLimitedFieldSelection if ((iNextMasterItemPos != 0) && (iNextSlaveItemPos != 0)) { - Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[curindex]), "SelectedItems", new short[] - { - iNextMasterItemPos - }); - Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[curindex]), "SelectedItems", new short[] - { - iNextSlaveItemPos - }); + Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[curindex]), "SelectedItems", new short[] {iNextMasterItemPos }); + Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[curindex]), "SelectedItems", new short[] {iNextSlaveItemPos}); - Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[curindex + 1]), "SelectedItems", new short[] - { - 0 - }); - Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[curindex + 1]), "SelectedItems", new short[] - { - 0 - }); + Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[curindex + 1]), "SelectedItems", new short[] { 0 }); + Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[curindex + 1]), "SelectedItems", new short[] { 0 }); toggleControlRow(curindex, true); } } public void initialize(String[] _AllMasterFieldNames, String[] _AllSlaveFieldNames, String[][] _LinkFieldNames) { - short[] MasterSelList = null; - short[] SlaveSelList = null; + // short[] MasterSelList = null; + // short[] SlaveSelList = null; String[] MasterLinkNames = JavaTools.ArrayOutOfMultiDimArray(_LinkFieldNames, SOMASTERINDEX); String[] SlaveLinkNames = JavaTools.ArrayOutOfMultiDimArray(_LinkFieldNames, SOSLAVEINDEX); - String[] ViewMasterFieldNames = addNoneFieldItemToList(_AllMasterFieldNames); + String[] ViewMasterFieldNames = addNoneFieldItemToList(_AllMasterFieldNames); // add '-undefiened-' String[] ViewSlaveFieldNames = addNoneFieldItemToList(_AllSlaveFieldNames); for (int i = 0; i < super.rowcount; i++) { @@ -254,10 +270,10 @@ public class FieldLinker extends DBLimitedFieldSelection */ public String[][] getLinkFieldNames() { - String sLinkFieldsAreDuplicate = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 19); - setMaxSelIndex(); - String[][] LinkFieldNames = new String[2][MaxSelIndex + 1]; - for (int i = 0; i <= MaxSelIndex; i++) + // setMaxSelIndex(); + int nSelectedIndex = getMaxSelIndex(); + String[][] LinkFieldNames = new String[2][nSelectedIndex + 1]; + for (int i = 0; i <= nSelectedIndex; i++) { LinkFieldNames[0][i] = lstSlaveFields[i].getSelectedItem(); LinkFieldNames[1][i] = lstMasterFields[i].getSelectedItem(); @@ -265,18 +281,17 @@ public class FieldLinker extends DBLimitedFieldSelection int iduplicate = JavaTools.getDuplicateFieldIndex(LinkFieldNames); if (iduplicate != -1) { + String sLinkFieldsAreDuplicate = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 19); String sLocLinkFieldsAreDuplicate = JavaTools.replaceSubString(sLinkFieldsAreDuplicate, LinkFieldNames[0][iduplicate], "<FIELDNAME1>"); sLocLinkFieldsAreDuplicate = JavaTools.replaceSubString(sLocLinkFieldsAreDuplicate, LinkFieldNames[1][iduplicate], "<FIELDNAME2>"); - CurUnoDialog.setCurrentStep(FormWizard.SOFIELDLINKERPAGE); + CurUnoDialog.setCurrentStep(FormWizard.SOFIELDLINKER_PAGE); CurUnoDialog.enableNavigationButtons(true, true, true); CurUnoDialog.showMessageBox("WarningBox", VclWindowPeerAttribute.OK, sLocLinkFieldsAreDuplicate); CurUnoDialog.setFocus("lstSlaveFieldLink" + (iduplicate + 1)); return null; } - else - { return LinkFieldNames; - } + } public void enable(boolean _bdoenable) diff --git a/wizards/com/sun/star/wizards/form/Finalizer.java b/wizards/com/sun/star/wizards/form/Finalizer.java index eb5a0d312f13..2b1ffc5786e2 100644 --- a/wizards/com/sun/star/wizards/form/Finalizer.java +++ b/wizards/com/sun/star/wizards/form/Finalizer.java @@ -32,8 +32,6 @@ package com.sun.star.wizards.form; import com.sun.star.awt.XRadioButton; import com.sun.star.awt.XTextComponent; import com.sun.star.wizards.common.Desktop; -import com.sun.star.wizards.common.JavaTools; -import com.sun.star.wizards.db.DBMetaData; import com.sun.star.wizards.ui.UIConsts; import com.sun.star.wizards.ui.*; @@ -57,7 +55,7 @@ public class Finalizer public Finalizer(WizardDialog _CurUnoDialog) { this.CurUnoDialog = _CurUnoDialog; - curtabindex = (short) (FormWizard.SOSTOREPAGE * 100); + curtabindex = (short) (FormWizard.SOSTORE_PAGE * 100); String slblFormName = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 50); String slblProceed = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 51); diff --git a/wizards/com/sun/star/wizards/form/FormConfiguration.java b/wizards/com/sun/star/wizards/form/FormConfiguration.java index 3ae38c477094..989bb333b437 100644 --- a/wizards/com/sun/star/wizards/form/FormConfiguration.java +++ b/wizards/com/sun/star/wizards/form/FormConfiguration.java @@ -35,7 +35,6 @@ import com.sun.star.awt.XListBox; import com.sun.star.awt.XRadioButton; import com.sun.star.wizards.common.Helper; import com.sun.star.wizards.ui.CommandFieldSelection; -import com.sun.star.wizards.ui.FieldSelection; import com.sun.star.wizards.ui.UIConsts; import com.sun.star.wizards.ui.UnoDialog; import com.sun.star.wizards.ui.WizardDialog; @@ -59,7 +58,7 @@ public class FormConfiguration XFixedText lblRelations; XListBox lstRelations; String[] sreferencedTables; - Integer ISubFormStep; + // Integer ISubFormStep; CommandFieldSelection CurSubFormFieldSelection; String SSUBFORMMODE = "toggleSubFormMode"; String STOGGLESTEPS = "toggleSteps"; @@ -70,14 +69,15 @@ public class FormConfiguration public FormConfiguration(WizardDialog _CurUnoDialog) { this.CurUnoDialog = _CurUnoDialog; - curtabindex = (short) (FormWizard.SOSUBFORMPAGE * 100); - Integer ISubFormStep = new Integer(FormWizard.SOSUBFORMPAGE); + curtabindex = (short) (FormWizard.SOSUBFORM_PAGE * 100); + Integer ISubFormStep = new Integer(FormWizard.SOSUBFORM_PAGE); String sOnExistingRelation = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 5); String sOnManualRelation = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 7); String sSelectManually = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 4); String sSelectRelation = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 8); String sSubFormDescription = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 3); + // CheckBox 'Add sub form' chkcreateSubForm = CurUnoDialog.insertCheckBox("chkcreateSubForm", SSUBFORMMODE, this, new String[] { @@ -135,6 +135,11 @@ public class FormConfiguration CurUnoDialog.insertInfoImage(97, 120, ISubFormStep.intValue()); } + // public void disableSubFormCheckBox() + // { + // Helper.setUnoPropertyValue(UnoDialog.getModel(chkcreateSubForm), "Enabled", Boolean.FALSE); + // } + public RelationController getRelationController() { return oRelationController; @@ -175,15 +180,15 @@ public class FormConfiguration } else if (optSelectManually.getState()) { - CurUnoDialog.enablefromStep(FormWizard.SOFIELDLINKERPAGE, (CurSubFormFieldSelection.getSelectedFieldNames().length > 0)); - CurUnoDialog.setStepEnabled(FormWizard.SOSUBFORMFIELDSPAGE, true); + CurUnoDialog.enablefromStep(FormWizard.SOFIELDLINKER_PAGE, (CurSubFormFieldSelection.getSelectedFieldNames().length > 0)); + CurUnoDialog.setStepEnabled(FormWizard.SOSUBFORMFIELDS_PAGE, true); } } else { - CurUnoDialog.setStepEnabled(FormWizard.SOSUBFORMFIELDSPAGE, false); - CurUnoDialog.setStepEnabled(FormWizard.SOFIELDLINKERPAGE, false); - CurUnoDialog.enablefromStep(FormWizard.SOCONTROLPAGE, true); + CurUnoDialog.setStepEnabled(FormWizard.SOSUBFORMFIELDS_PAGE, false); + CurUnoDialog.setStepEnabled(FormWizard.SOFIELDLINKER_PAGE, false); + CurUnoDialog.enablefromStep(FormWizard.SOCONTROL_PAGE, true); } toggleRelationsListbox(); } @@ -211,18 +216,18 @@ public class FormConfiguration { if (CurSubFormFieldSelection.getSelectedCommandName().equals(scurreferencedTableName)) { - CurUnoDialog.enablefromStep(FormWizard.SOSUBFORMFIELDSPAGE, true); - CurUnoDialog.setStepEnabled(FormWizard.SOFIELDLINKERPAGE, false); + CurUnoDialog.enablefromStep(FormWizard.SOSUBFORMFIELDS_PAGE, true); + CurUnoDialog.setStepEnabled(FormWizard.SOFIELDLINKER_PAGE, false); return; } else { - CurUnoDialog.setStepEnabled(FormWizard.SOSUBFORMFIELDSPAGE, true); - CurUnoDialog.enablefromStep(FormWizard.SOFIELDLINKERPAGE, false); + CurUnoDialog.setStepEnabled(FormWizard.SOSUBFORMFIELDS_PAGE, true); + CurUnoDialog.enablefromStep(FormWizard.SOFIELDLINKER_PAGE, false); return; } } - CurUnoDialog.enablefromStep(FormWizard.SOSUBFORMFIELDSPAGE, false); + CurUnoDialog.enablefromStep(FormWizard.SOSUBFORMFIELDS_PAGE, false); } private void toggleRelationsListbox() diff --git a/wizards/com/sun/star/wizards/form/FormControlArranger.java b/wizards/com/sun/star/wizards/form/FormControlArranger.java index 73bad73b5fb1..1f67ee576196 100644 --- a/wizards/com/sun/star/wizards/form/FormControlArranger.java +++ b/wizards/com/sun/star/wizards/form/FormControlArranger.java @@ -31,15 +31,13 @@ package com.sun.star.wizards.form; import com.sun.star.awt.Point; import com.sun.star.awt.Size; -import com.sun.star.beans.UnknownPropertyException; import com.sun.star.container.XNameContainer; -import com.sun.star.lang.IllegalArgumentException; -import com.sun.star.lang.WrappedTargetException; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.sdbc.DataType; import com.sun.star.task.XStatusIndicator; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.Exception; +import com.sun.star.wizards.common.Helper; import com.sun.star.wizards.common.Resource; import com.sun.star.wizards.db.*; import com.sun.star.wizards.document.Control; @@ -51,44 +49,45 @@ import com.sun.star.wizards.document.TimeStampControl; public class FormControlArranger { - XNameContainer xFormName; - XMultiServiceFactory xMSF; - public DatabaseControl[] DBControlList = null; - public Control[] LabelControlList = null; + protected DatabaseControl[] DBControlList = null; + + private XNameContainer xFormName; + private XMultiServiceFactory xMSF; + private Control[] LabelControlList = null; private XStatusIndicator xProgressBar; private FieldColumn[] FieldColumns; - DatabaseControl curDBControl; - Control curLabelControl; - int icurArrangement; - boolean bIsFirstRun; - boolean bIsVeryFirstRun; - boolean bControlsareCreated; - int cXOffset; - int cYOffset; - final int cVertDistance = 200; - final int cHoriDistance = 300; - final int cLabelGap = 100; - final double CMAXREDUCTION = 0.7; - FormHandler oFormHandler; - int iReduceWidth; - int nXTCPos; - int nYTCPos; - int nXDBPos; - int nYDBPos; - int nTCHeight; - int nTCWidth; - int nDBHeight; - int nDBWidth; - int nMaxTCWidth; - int nFormWidth; - int nFormHeight; - int nMaxRowY; - int nSecMaxRowY; - int nMaxColRightX; - int a; - int StartA; - int nMaxDBYPos = 0; //the maximum YPosition of a DBControl in the form - Short NBorderType = new Short((short) 1); //3-D Border + private DatabaseControl curDBControl; + // Control curLabelControl; + private int icurArrangement; + private boolean bIsFirstRun; + private boolean bIsVeryFirstRun; + private boolean bControlsareCreated; + private int cXOffset; + private int cYOffset; + private static final int cVertDistance = 200; + private static final int cHoriDistance = 300; + private static final int cLabelGap = 100; + private static final double CMAXREDUCTION = 0.7; + private FormHandler oFormHandler; + private int iReduceWidth; + private int nXTCPos; + private int nYTCPos; + private int nXDBPos; + private int nYDBPos; + private int nTCHeight; + private int nTCWidth; + private int nDBHeight; + private int nDBWidth; + private int nMaxTCWidth; + private int nFormWidth; + private int nFormHeight; + private int nMaxRowY; + private int nSecMaxRowY; + private int nMaxColRightX; + private int a; + private int StartA; + private int nMaxDBYPos = 0; //the maximum YPosition of a DBControl in the form + private Short NBorderType = new Short((short) 1); //3-D Border public FormControlArranger(FormHandler _oFormHandler, XNameContainer _xFormName, CommandMetaData oDBMetaData, XStatusIndicator _xProgressBar, Point _StartPoint, Size _FormSize) { @@ -122,13 +121,18 @@ public class FormControlArranger NBorderType = new Short(_nBorderType); } + public Control[] getLabelControlList() + { + return LabelControlList; + } + private int getCheckBoxDiffHeight(int LastIndex) { if ((LastIndex < DBControlList.length)) { if (DBControlList[LastIndex].getControlType() == FormHandler.SOCHECKBOX) { - return (int) ((oFormHandler.getDBRefHeight() - DBControlList[LastIndex].getDBHeight()) / 2); + return (int) ((oFormHandler.getControlReferenceHeight() - DBControlList[LastIndex].getControlHeight()) / 2); } } return 0; @@ -137,7 +141,7 @@ public class FormControlArranger private boolean isReducable(int _index) { boolean bisreducable = false; - int ntype = this.FieldColumns[_index].FieldType; + int ntype = this.FieldColumns[_index].getFieldType(); switch (ntype) { case DataType.TINYINT: @@ -277,7 +281,7 @@ public class FormControlArranger { int nControlBaseWidth = 0; curDBControl = this.DBControlList[i]; - curLabelControl = this.LabelControlList[i]; + Control curLabelControl = this.LabelControlList[i]; if (i != StartIndex) { curLabelControl.setPosition(new Point(iLocTCPosX, curLabelControl.getPosition().Y)); @@ -291,7 +295,7 @@ public class FormControlArranger { nControlBaseWidth = curDBControl.getSize().Width; } - if (FieldColumns[i].FieldType == DataType.TIMESTAMP) + if (FieldColumns[i].getFieldType() == DataType.TIMESTAMP) { TimeStampControl oDBTimeStampControl = (TimeStampControl) curDBControl; nControlBaseWidth = oDBTimeStampControl.getSize().Width; @@ -380,12 +384,19 @@ public class FormControlArranger xProgressBar.start("", FieldColumns.length); for (int i = 0; i < FieldColumns.length; i++) { - insertLabel(i, _iAlign); - insertDBControl(i); - bIsVeryFirstRun = false; - DBControlList[i].setPropertyValue("LabelControl", curLabelControl.xPropertySet); - resetPosSizes(i); - xProgressBar.setValue(i + 1); + try + { + insertLabel(i, _iAlign); + insertDBControl(i); + bIsVeryFirstRun = false; + DBControlList[i].setPropertyValue("LabelControl", LabelControlList[i].xPropertySet); + resetPosSizes(i); + xProgressBar.setValue(i + 1); + } + catch (RuntimeException e) + { + int dummy = 0; + } } xProgressBar.end(); bControlsareCreated = true; @@ -523,7 +534,7 @@ public class FormControlArranger nXTCPos = cXOffset; nTCWidth = 2000; nDBWidth = 2000; - nDBHeight = oFormHandler.getDBRefHeight(); + nDBHeight = oFormHandler.getControlReferenceHeight(); nTCHeight = oFormHandler.getLabelHeight(); iReduceWidth = 0; if (icurArrangement == FormWizard.SOCOLUMNARLEFT) @@ -560,7 +571,8 @@ public class FormControlArranger { Point aPoint = new Point(nXTCPos, nYTCPos); Size aSize = new Size(nTCWidth, nTCHeight); - this.LabelControlList[i] = new Control(oFormHandler, xFormName, FormHandler.SOLABEL, FieldColumns[i].m_sFieldName, aPoint, aSize); + final String sFieldName = FieldColumns[i].getFieldName(); + this.LabelControlList[i] = new Control(oFormHandler, xFormName, FormHandler.SOLABEL, sFieldName, aPoint, aSize); if (bIsVeryFirstRun) { if (icurArrangement == FormWizard.SOCOLUMNARTOP) @@ -568,9 +580,10 @@ public class FormControlArranger nYDBPos = nYTCPos + nTCHeight; } } - nTCWidth = LabelControlList[i].getPreferredWidth(FieldColumns[i].getFieldTitle()); - } - curLabelControl = LabelControlList[i]; + String sTitle = FieldColumns[i].getFieldTitle(); + nTCWidth = LabelControlList[i].getPreferredWidth(sTitle); + } + Control curLabelControl = LabelControlList[i]; if (icurArrangement == FormWizard.SOCOLUMNARLEFT) { // Note This If Sequence must be called before retrieving the outer Points @@ -613,6 +626,9 @@ public class FormControlArranger { try { + String sFieldName = FieldColumns[i].getFieldName(); + int nFieldType = FieldColumns[i].getFieldType(); + Point aPoint = new Point(nXDBPos, nYDBPos); if (bControlsareCreated) { @@ -620,34 +636,39 @@ public class FormControlArranger } else { - if (FieldColumns[i].FieldType == DataType.TIMESTAMP) + if (nFieldType == DataType.TIMESTAMP) { - DBControlList[i] = new TimeStampControl(new Resource(xMSF, "FormWizard", "dbw"), oFormHandler, xFormName, FieldColumns[i].m_sFieldName, aPoint); + DBControlList[i] = new TimeStampControl(new Resource(xMSF, "FormWizard", "dbw"), oFormHandler, xFormName, sFieldName, aPoint); } else { - DBControlList[i] = new DatabaseControl(oFormHandler, xFormName, FieldColumns[i].m_sFieldName, FieldColumns[i].FieldType, aPoint); + DBControlList[i] = new DatabaseControl(oFormHandler, xFormName, sFieldName, nFieldType, aPoint); if (DBControlList[i].getControlType() == FormHandler.SOCHECKBOX) { + // Checkboxes have no Label near by DBControlList[i].setPropertyValue("Label", ""); } } } - this.curDBControl = DBControlList[i]; - nDBHeight = curDBControl.getDBHeight(); - nDBWidth = curDBControl.getDBWidth(); - if (FieldColumns[i].FieldType != DataType.TIMESTAMP) + DatabaseControl aDBControl = DBControlList[i]; + nDBHeight = aDBControl.getControlHeight(); + nDBWidth = aDBControl.getControlWidth(); + if (nFieldType != DataType.TIMESTAMP) { - curDBControl.setSize(new Size(nDBWidth, nDBHeight)); + aDBControl.setSize(new Size(nDBWidth, nDBHeight)); } - if (curDBControl.getControlType() == FormHandler.SOCHECKBOX) + if (aDBControl.getControlType() == FormHandler.SOCHECKBOX) { - nYDBPos = nYDBPos + /*(int)*/ ((oFormHandler.getDBRefHeight() - nDBHeight) / 2); + nYDBPos = nYDBPos + /*(int)*/ ((oFormHandler.getControlReferenceHeight() - nDBHeight) / 2); aPoint = new Point(nXDBPos, nYDBPos); - curDBControl.setPosition(aPoint); + aDBControl.setPosition(aPoint); + } + if (nFieldType == DataType.LONGVARCHAR) /* memo */ + { + Helper.setUnoPropertyValue(LabelControlList[i], "MultiLine", Boolean.TRUE); } checkOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, true); - curDBControl.setPropertyValue("Border", NBorderType); + aDBControl.setPropertyValue("Border", NBorderType); } catch (Exception e) { diff --git a/wizards/com/sun/star/wizards/form/FormDocument.java b/wizards/com/sun/star/wizards/form/FormDocument.java index 5e07324d3182..b3e163859f7b 100644 --- a/wizards/com/sun/star/wizards/form/FormDocument.java +++ b/wizards/com/sun/star/wizards/form/FormDocument.java @@ -37,7 +37,6 @@ import com.sun.star.awt.Size; import com.sun.star.beans.PropertyValue; import com.sun.star.beans.XPropertySet; import com.sun.star.container.XNameContainer; -import com.sun.star.frame.XModel; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; @@ -53,35 +52,28 @@ import com.sun.star.wizards.document.GridControl; public class FormDocument extends TextDocument { - - public FormHandler oFormHandler; - public ViewHandler oViewHandler; - public TextStyleHandler oTextStyleHandler; - public XPropertySet xPropPageStyle; - public final int SOSYMBOLMARGIN = 2000; + protected Vector oControlForms = new Vector(); + protected CommandMetaData oMainFormDBMetaData; + protected CommandMetaData oSubFormDBMetaData; + protected String[][] LinkFieldNames; + + private FormHandler oFormHandler; + private ViewHandler oViewHandler; + private TextStyleHandler oTextStyleHandler; + private XPropertySet xPropPageStyle; private final int SOFORMGAP = 2000; - public Vector oControlForms = new Vector(); - public CommandMetaData oMainFormDBMetaData; - public CommandMetaData oSubFormDBMetaData; private boolean bhasSubForm; private UIControlArranger curUIControlArranger; - public StyleApplier curStyleApplier; - public String[][] LinkFieldNames; - public XModel xModel; - private String sMsgEndAutopilot; - int MainFormStandardHeight; - int nPageWidth; - int nPageHeight; - int nFormWidth; - int nFormHeight; - int nMainFormFieldCount; - int totfieldcount; - Point aMainFormPoint; - Point aSubFormPoint; - final static String SOMAINFORM = "MainForm"; - final static String SOSUBFORM = "SubForm"; - - public FormDocument(XMultiServiceFactory xMSF, Resource oResource) + private StyleApplier curStyleApplier; + private int nPageWidth; + private int nPageHeight; + private int nFormWidth; + private int nFormHeight; + private Point aMainFormPoint; + private final static String SOMAINFORM = "MainForm"; + private final static String SOSUBFORM = "SubForm"; + + public FormDocument(XMultiServiceFactory xMSF) { super(xMSF, new TextDocument.ModuleIdentifier("com.sun.star.sdb.FormDesign"), true); try @@ -101,7 +93,6 @@ public class FormDocument extends TextDocument Size aSize = oTextStyleHandler.changePageAlignment(xPropPageStyle, true); nPageWidth = aSize.Width; nPageHeight = aSize.Height; - sMsgEndAutopilot = oResource.getResText(UIConsts.RID_DB_COMMON + 33); } catch (Exception e) { @@ -129,7 +120,7 @@ public class FormDocument extends TextDocument try { int nMargin; - totfieldcount = getTotFieldCount(); + int totfieldcount = getMainFieldCount() + getSubFieldCount(); if (totfieldcount > 30) { nMargin = 500; @@ -156,15 +147,16 @@ public class FormDocument extends TextDocument } } - public void initialize(boolean _baddParentForm, boolean _bhasSubForm, boolean _bModifySubForm, Short _NBorderType) + public void initialize(boolean _baddParentForm, boolean _bShouldHaveSubForm, boolean _bModifySubForm, Short _NBorderType) { - bhasSubForm = _bhasSubForm; + bhasSubForm = _bShouldHaveSubForm; adjustPageStyle(); if (_baddParentForm) { if (oControlForms.size() == 0) { - oControlForms.addElement(new ControlForm(this, SOMAINFORM, aMainFormPoint, getMainFormSize(FormWizard.SOGRID))); + final ControlForm aMainControlForm = new ControlForm(this, SOMAINFORM, aMainFormPoint, getMainFormSize(FormWizard.SOGRID)); + oControlForms.addElement(aMainControlForm); } else { @@ -173,13 +165,15 @@ public class FormDocument extends TextDocument } ((ControlForm) oControlForms.get(0)).initialize(curUIControlArranger.getSelectedArrangement(0), _NBorderType); } - if (_bhasSubForm) + if (_bShouldHaveSubForm) { if (oControlForms.size() == 1) { adjustMainFormSize(_NBorderType); - oControlForms.addElement(new ControlForm(this, SOSUBFORM, getSubFormPoint(), getSubFormSize())); - ((ControlForm) oControlForms.get(1)).initialize(curUIControlArranger.getSelectedArrangement(1), _NBorderType); + final ControlForm aSubControlForm = new ControlForm(this, SOSUBFORM, getSubFormPoint(), getSubFormSize()); + oControlForms.addElement(aSubControlForm); + /* ((ControlForm) oControlForms.get(1))*/ + aSubControlForm.initialize(curUIControlArranger.getSelectedArrangement(1), _NBorderType); } else if (_bModifySubForm) { @@ -193,20 +187,28 @@ public class FormDocument extends TextDocument } else { - if (oFormHandler.hasFormByName(SOSUBFORM)) - { - oFormHandler.removeFormByName(SOSUBFORM); + ControlForm aMainForm = (ControlForm) oControlForms.get(0); + // boolean bHasSubForm = aMainForm.xFormContainer.hasByName(SOSUBFORM); + // WRONG if (oFormHandler.hasFormByName(SOSUBFORM)) + if (aMainForm.xFormContainer != null && aMainForm.xFormContainer.hasByName(SOSUBFORM)) + { + oFormHandler.removeControlsofForm(SOSUBFORM); + oFormHandler.removeElement( aMainForm.xFormContainer, SOSUBFORM ); + ((ControlForm) oControlForms.get(1)).oFormController = null; + // aMainForm.xFormContainer = null; // .removeFormByName(SOSUBFORM); oControlForms.remove(1); adjustMainFormSize(_NBorderType); } } } - private int getTotFieldCount() + private int getMainFieldCount() + { + return oMainFormDBMetaData.getFieldNames().length; + } + private int getSubFieldCount() { - nMainFormFieldCount = oMainFormDBMetaData.getFieldNames().length; - totfieldcount = nMainFormFieldCount + oSubFormDBMetaData.getFieldNames().length; - return totfieldcount; + return oSubFormDBMetaData.getFieldNames().length; } private Size getMainFormSize(int _curArrangement) @@ -220,12 +222,11 @@ public class FormDocument extends TextDocument } else { - totfieldcount = getTotFieldCount(); - nMainFormHeight = (int) (((double) nMainFormFieldCount / (double) totfieldcount) * ((double) (nFormHeight - SOFORMGAP) / 2)); + int nTotalFieldCount = getMainFieldCount() + getSubFieldCount(); + nMainFormHeight = (int) (((double) getMainFieldCount() / (double) nTotalFieldCount) * ((double) (nFormHeight - SOFORMGAP) / 2)); } } Size aMainFormSize = new Size(nFormWidth, nMainFormHeight); - MainFormStandardHeight = nMainFormHeight; return aMainFormSize; } @@ -442,7 +443,7 @@ public class FormDocument extends TextDocument { if (oFormController != null) { - return oFormController.LabelControlList; + return oFormController.getLabelControlList(); } else { diff --git a/wizards/com/sun/star/wizards/form/FormWizard.java b/wizards/com/sun/star/wizards/form/FormWizard.java index 2330832a45a3..5b0a7939f6c2 100644 --- a/wizards/com/sun/star/wizards/form/FormWizard.java +++ b/wizards/com/sun/star/wizards/form/FormWizard.java @@ -29,13 +29,11 @@ ************************************************************************/ package com.sun.star.wizards.form; +import com.sun.star.awt.XWindowPeer; import com.sun.star.beans.PropertyValue; import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.sdb.CommandType; -import com.sun.star.uno.AnyConverter; import com.sun.star.lang.XComponent; import com.sun.star.wizards.common.*; -import com.sun.star.wizards.db.DBMetaData; import com.sun.star.wizards.db.RelationController; import com.sun.star.wizards.document.OfficeDocument; import com.sun.star.wizards.ui.*; @@ -43,39 +41,35 @@ import com.sun.star.wizards.ui.*; public class FormWizard extends WizardDialog { - CommandFieldSelection curDBCommandFieldSelection; - FormConfiguration curFormConfiguration; - CommandFieldSelection curSubFormFieldSelection; - FormDocument curFormDocument; - FieldLinker curFieldLinker; - UIControlArranger curControlArranger; - DataEntrySetter CurDataEntrySetter; - StyleApplier curStyleApplier; - Finalizer curFinalizer; - static String slblFields; - static String slblSelFields; - String sShowBinaryFields = ""; - String sMsgWizardName = ""; - String serrFormNameexists = ""; - public static final int SONULLPAGE = 0; - public static final int SOMAINPAGE = 1; - public static final int SOSUBFORMPAGE = 2; - public static final int SOSUBFORMFIELDSPAGE = 3; - public static final int SOFIELDLINKERPAGE = 4; - public static final int SOCONTROLPAGE = 5; - public static final int SODATAPAGE = 6; - public static final int SOSTYLEPAGE = 7; - public static final int SOSTOREPAGE = 8; + private CommandFieldSelection curDBCommandFieldSelection; + private FormConfiguration curFormConfiguration; + private CommandFieldSelection curSubFormFieldSelection; + private FormDocument curFormDocument; + private FieldLinker curFieldLinker; + private UIControlArranger curControlArranger; + private DataEntrySetter CurDataEntrySetter; + private StyleApplier curStyleApplier; + private Finalizer curFinalizer; + private static String slblFields; + private static String slblSelFields; + private String sShowBinaryFields = ""; + private String serrFormNameexists = ""; + public static final int SOMAIN_PAGE = 1; + public static final int SOSUBFORM_PAGE = 2; + public static final int SOSUBFORMFIELDS_PAGE = 3; + public static final int SOFIELDLINKER_PAGE = 4; + public static final int SOCONTROL_PAGE = 5; + public static final int SODATA_PAGE = 6; + public static final int SOSTYLE_PAGE = 7; + public static final int SOSTORE_PAGE = 8; public static final int SOCOLUMNARLEFT = 1; public static final int SOCOLUMNARTOP = 2; public static final int SOGRID = 3; public static final int SOTOPJUSTIFIED = 4; - String WizardHeaderText[] = new String[8]; - String slblTables; - boolean bFormOpenMode; - boolean bcreateForm = false; - String FormName; - Short NBorderValue = null; + private String slblTables; + private boolean bFormOpenMode; + private boolean bcreateForm = false; + private String FormName; public FormWizard(XMultiServiceFactory xMSF) { @@ -97,11 +91,12 @@ public class FormWizard extends WizardDialog } } + // @Override protected void enterStep(int nOldStep, int nNewStep) { try { - if ((nOldStep < SOCONTROLPAGE) && (nNewStep >= SOCONTROLPAGE)) + if ((nOldStep < SOCONTROL_PAGE) && (nNewStep >= SOCONTROL_PAGE)) { curFormDocument.initialize(curDBCommandFieldSelection.isModified(), curFormConfiguration.hasSubForm(), curSubFormFieldSelection.isModified(), getBorderType()); curDBCommandFieldSelection.setModified(false); @@ -109,29 +104,51 @@ public class FormWizard extends WizardDialog } switch (nNewStep) { - case SOMAINPAGE: + case SOMAIN_PAGE: curDBCommandFieldSelection.setModified(false); break; - case SOSUBFORMPAGE: - RelationController oRelationController = new RelationController(curFormDocument.oMainFormDBMetaData, curDBCommandFieldSelection.getSelectedCommandName()); + case SOSUBFORM_PAGE: + { + final String sCommandName = curDBCommandFieldSelection.getSelectedCommandName(); + RelationController oRelationController = new RelationController(curFormDocument.oMainFormDBMetaData, sCommandName); curFormConfiguration.initialize(curSubFormFieldSelection, oRelationController); + } break; - case SOSUBFORMFIELDSPAGE: - String spreselectedTableName = curFormConfiguration.getreferencedTableName(); - curSubFormFieldSelection.preselectCommand(spreselectedTableName, (spreselectedTableName.length() > 0)); + case SOSUBFORMFIELDS_PAGE: + { + String sPreSelectedTableName = curFormConfiguration.getreferencedTableName(); + boolean bReadOnly = (sPreSelectedTableName.length() > 0); + if (sPreSelectedTableName.length() == 0) + { + final String sTableName = curSubFormFieldSelection.getSelectedCommandName(); + String[] aFieldNames = curSubFormFieldSelection.getSelectedFieldNames(); + curFormDocument.oSubFormDBMetaData.initializeFieldColumns(true, sTableName, aFieldNames); + } + else + { + curSubFormFieldSelection.preselectCommand(sPreSelectedTableName, bReadOnly); + } + } break; - case SOFIELDLINKERPAGE: - curFieldLinker.initialize(curFormDocument.oMainFormDBMetaData.getFieldNames(), curFormDocument.oSubFormDBMetaData.getFieldNames(), curFormDocument.LinkFieldNames); + case SOFIELDLINKER_PAGE: + { + final String[] aMainFieldNames = curFormDocument.oMainFormDBMetaData.getFieldNames(); + final String[] aSubFieldNames = curFormDocument.oSubFormDBMetaData.getFieldNames(); + curFieldLinker.initialize(aMainFieldNames, aSubFieldNames, curFormDocument.LinkFieldNames); + } break; - case SOCONTROLPAGE: + case SOCONTROL_PAGE: curControlArranger.enableSubFormImageList(curFormConfiguration.hasSubForm()); break; - case SODATAPAGE: + case SODATA_PAGE: break; - case SOSTYLEPAGE: + case SOSTYLE_PAGE: break; - case SOSTOREPAGE: - this.curFinalizer.initialize(this.curDBCommandFieldSelection.getSelectedCommandName(), curFormDocument); + case SOSTORE_PAGE: + { + String sTableName = this.curDBCommandFieldSelection.getSelectedCommandName(); + this.curFinalizer.initialize(sTableName, curFormDocument); + } break; default: break; @@ -148,36 +165,61 @@ public class FormWizard extends WizardDialog return curStyleApplier.getBorderType(); } + // @Override protected void leaveStep(int nOldStep, int nNewStep) { switch (nOldStep) { - case SOMAINPAGE: + case SOMAIN_PAGE: // curFormDocument.oMainFormDBMetaData.setFieldNames(curDBCommandFieldSelection.getSelectedFieldNames()); - curFormDocument.oMainFormDBMetaData.initializeFieldColumns(true, curDBCommandFieldSelection.getSelectedCommandName(), curDBCommandFieldSelection.getSelectedFieldNames()); - curFormDocument.LinkFieldNames = JavaTools.removeOutdatedFields(curFormDocument.LinkFieldNames, curFormDocument.oMainFormDBMetaData.getFieldNames(), 1); + { + final String sTableName = curDBCommandFieldSelection.getSelectedCommandName(); + final String[] aFieldNames = curDBCommandFieldSelection.getSelectedFieldNames(); + curFormDocument.oMainFormDBMetaData.initializeFieldColumns(true, sTableName, aFieldNames); + + final String[] aMainFieldNames = curFormDocument.oMainFormDBMetaData.getFieldNames(); + try + { + curFormDocument.LinkFieldNames = JavaTools.removeOutdatedFields(curFormDocument.LinkFieldNames, aMainFieldNames, 1); + } + catch (java.lang.Exception e) + {} + } break; - case SOSUBFORMPAGE: + case SOSUBFORM_PAGE: break; - case SOSUBFORMFIELDSPAGE: - curFormDocument.oSubFormDBMetaData.initializeFieldColumns(true, curSubFormFieldSelection.getSelectedCommandName(), curSubFormFieldSelection.getSelectedFieldNames()); - curFormDocument.LinkFieldNames = JavaTools.removeOutdatedFields(curFormDocument.LinkFieldNames, curFormDocument.oSubFormDBMetaData.getFieldNames(), 0); + case SOSUBFORMFIELDS_PAGE: + { + final String sTableName = curSubFormFieldSelection.getSelectedCommandName(); + final String[] aFieldNames = curSubFormFieldSelection.getSelectedFieldNames(); + curFormDocument.oSubFormDBMetaData.initializeFieldColumns(true, sTableName, aFieldNames); + + final String[] aSubFieldNames = curFormDocument.oSubFormDBMetaData.getFieldNames(); + try + { + curFormDocument.LinkFieldNames = JavaTools.removeOutdatedFields(curFormDocument.LinkFieldNames, aSubFieldNames, 0); + } + catch (java.lang.Exception e) + {} + } break; - case SOFIELDLINKERPAGE: + case SOFIELDLINKER_PAGE: + curFormDocument.LinkFieldNames = curFieldLinker.getLinkFieldNames(); break; - case SOCONTROLPAGE: + case SOCONTROL_PAGE: break; - case SODATAPAGE: + case SODATA_PAGE: break; - case SOSTYLEPAGE: + case SOSTYLE_PAGE: break; - case SOSTOREPAGE: + case SOSTORE_PAGE: break; default: break; } } +/* public static void main(String args[]) { @@ -193,7 +235,14 @@ public class FormWizard extends WizardDialog curproperties = new PropertyValue[1]; // curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/MyHSQL.odb"); curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/MyHSQL.odb"); - curproperties[0] = Properties.createProperty("DataSourceName", "MyHSQLDatabase"); //file:///C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/myjapanesehsqldatasourceMyDocAssign.odb"); //MyDBase; Mydbwizard2DocAssign.odb; MyDBase.odb, Mydbwizard2DocAssign.odb ; Mydbwizard2DocAssign.odb; NewAccessDatabase, MyDocAssign baseLocation ); "DataSourceName", "db1");*// /--/curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///x:/bc/MyHSQL Database.odb"); //MyDBase; Mydbwizard2DocAssign.odb; MyDBase.odb, Mydbwizard2DocAssign.odb ; Mydbwizard2DocAssign.odb; NewAccessDatabase, baseLocation ); "DataSourceName", "db1");*// curproperties[0] = Properties.createProperty("DataSourceName", "Bibliography");* // curproperties[0] = Properties.createProperty("DataSourceName", "Bibliography"); //Bibliography* CurTableWizard.startTableWizard(xLocMSF, curproperties); + curproperties[0] = Properties.createProperty("DataSourceName", "MyHSQLDatabase"); + // file:///C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/myjapanesehsqldatasourceMyDocAssign.odb"); + // MyDBase; Mydbwizard2DocAssign.odb; MyDBase.odb, Mydbwizard2DocAssign.odb ; Mydbwizard2DocAssign.odb; NewAccessDatabase, MyDocAssign baseLocation ); "DataSourceName", "db1"); + // /--/curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///x:/bc/MyHSQL Database.odb"); //MyDBase; Mydbwizard2DocAssign.odb; MyDBase.odb, Mydbwizard2DocAssign.odb ; Mydbwizard2DocAssign.odb; NewAccessDatabase, baseLocation ); "DataSourceName", "db1"); + // curproperties[0] = Properties.createProperty("DataSourceName", "Bibliography"); + // curproperties[0] = Properties.createProperty("DataSourceName", "Bibliography"); + // Bibliography* CurTableWizard.startTableWizard(xLocMSF, curproperties); + CurFormWizard.startFormWizard(xLocMSF, curproperties); } } @@ -202,13 +251,14 @@ public class FormWizard extends WizardDialog exception.printStackTrace(System.out); } } +*/ public void buildSteps() throws NoValidPathException { curDBCommandFieldSelection = new CommandFieldSelection(this, curFormDocument.oMainFormDBMetaData, 92, slblFields, slblSelFields, slblTables, true, 34411); curDBCommandFieldSelection.addFieldSelectionListener(new FieldSelectionListener()); curFormDocument.xProgressBar.setValue(20); - + // Label Help Text insertLabel("lblBinaryHelpText", new String[] { @@ -216,13 +266,13 @@ public class FormWizard extends WizardDialog }, new Object[] { - new Integer(28), sShowBinaryFields, Boolean.TRUE, new Integer(95), new Integer(154), new Integer(SOMAINPAGE), new Integer(210) + new Integer(28), sShowBinaryFields, Boolean.TRUE, new Integer(95), new Integer(154), new Integer(SOMAIN_PAGE), new Integer(210) }); curFormConfiguration = new FormConfiguration(this); curFormDocument.xProgressBar.setValue(30); - curSubFormFieldSelection = new CommandFieldSelection(this, curFormDocument.oSubFormDBMetaData, SOSUBFORMFIELDSPAGE, 92, slblFields, slblSelFields, slblTables, true, 34431); + curSubFormFieldSelection = new CommandFieldSelection(this, curFormDocument.oSubFormDBMetaData, SOSUBFORMFIELDS_PAGE, 92, slblFields, slblSelFields, slblTables, true, 34431); curSubFormFieldSelection.addFieldSelectionListener(new FieldSelectionListener()); insertLabel("lblSubFormBinaryHelpText", new String[] @@ -231,12 +281,12 @@ public class FormWizard extends WizardDialog }, new Object[] { - new Integer(28), sShowBinaryFields, Boolean.TRUE, new Integer(95), new Integer(154), new Integer(SOSUBFORMFIELDSPAGE), new Integer(210) + new Integer(28), sShowBinaryFields, Boolean.TRUE, new Integer(95), new Integer(154), new Integer(SOSUBFORMFIELDS_PAGE), new Integer(210) }); curFormDocument.xProgressBar.setValue(40); - curFieldLinker = new FieldLinker(this, SOFIELDLINKERPAGE, 95, 30, 210, 34441); + curFieldLinker = new FieldLinker(this, SOFIELDLINKER_PAGE, 95, 30, 210, 34441); curFormDocument.xProgressBar.setValue(50); curControlArranger = new UIControlArranger(this, curFormDocument); @@ -257,10 +307,11 @@ public class FormWizard extends WizardDialog curFormDocument.xProgressBar.end(); } + // @Override public void finishWizard() { int ncurStep = getCurrentStep(); - if ((switchToStep(ncurStep, SOSTOREPAGE)) || (ncurStep == SOSTOREPAGE)) + if ((switchToStep(ncurStep, SOSTORE_PAGE)) || (ncurStep == SOSTORE_PAGE)) { this.curFinalizer.initialize(curDBCommandFieldSelection.getSelectedCommandName(), this.curFormDocument); String sNewFormName = curFinalizer.getName(); @@ -270,7 +321,7 @@ public class FormWizard extends WizardDialog FormName = curFinalizer.getName(); if (curFormDocument.finalizeForms(CurDataEntrySetter, curFieldLinker, curFormConfiguration)) { - ; + if (curFinalizer.finish()) { bcreateForm = true; @@ -286,6 +337,7 @@ public class FormWizard extends WizardDialog } } + // @Override public void cancelWizard() { bcreateForm = false; @@ -296,14 +348,14 @@ public class FormWizard extends WizardDialog { addRoadmap(); int i = 0; - i = insertRoadmapItem(0, true, m_oResource.getResText(UIConsts.RID_FORM + 80), SOMAINPAGE); - i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 81), SOSUBFORMPAGE); - i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 82), SOSUBFORMFIELDSPAGE); - i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 83), SOFIELDLINKERPAGE); - i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 84), SOCONTROLPAGE); - i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 85), SODATAPAGE); - i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 86), SOSTYLEPAGE); - i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 87), SOSTOREPAGE); + i = insertRoadmapItem(0, true, m_oResource.getResText(UIConsts.RID_FORM + 80), SOMAIN_PAGE); + i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 81), SOSUBFORM_PAGE); + i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 82), SOSUBFORMFIELDS_PAGE); + i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 83), SOFIELDLINKER_PAGE); + i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 84), SOCONTROL_PAGE); + i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 85), SODATA_PAGE); + i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 86), SOSTYLE_PAGE); + i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 87), SOSTORE_PAGE); setRoadmapInteractive(true); setRoadmapComplete(true); setCurrentRoadmapItemID((short) 1); @@ -314,7 +366,7 @@ public class FormWizard extends WizardDialog XComponent[] ret = null; try { - curFormDocument = new FormDocument(xMSF, m_oResource); + curFormDocument = new FormDocument(xMSF); if (curFormDocument.oMainFormDBMetaData.getConnection(CurPropertyValue)) { curFormDocument.oSubFormDBMetaData.getConnection(new PropertyValue[] @@ -322,10 +374,12 @@ public class FormWizard extends WizardDialog Properties.createProperty("ActiveConnection", curFormDocument.oMainFormDBMetaData.DBConnection) }); curFormDocument.xProgressBar.setValue(20); + // SystemDialog.showMessageBox(xMSF, "FormName", 0, "slblFields"); buildSteps(); + // SystemDialog.showMessageBox(xMSF, "FormName", 0, "slblFields"); this.curDBCommandFieldSelection.preselectCommand(CurPropertyValue, false); - createWindowPeer(curFormDocument.xWindowPeer); - curFormDocument.oMainFormDBMetaData.setWindowPeer(xControl.getPeer()); + XWindowPeer xWindowPeer2 = createWindowPeer(curFormDocument.xWindowPeer); + curFormDocument.oMainFormDBMetaData.setWindowPeer(xWindowPeer2 /* xControl.getPeer() */ ); // setAutoMnemonic("lblDialogHeader", false); insertFormRelatedSteps(); short RetValue = executeDialog(curFormDocument.xFrame); @@ -348,9 +402,8 @@ public class FormWizard extends WizardDialog return ret; } - public boolean getFormResources() + private boolean getFormResources() { - sMsgWizardName = super.m_oResource.getResText(UIConsts.RID_FORM); sShowBinaryFields = m_oResource.getResText(UIConsts.RID_FORM + 2); slblTables = m_oResource.getResText(UIConsts.RID_FORM + 6); slblFields = m_oResource.getResText(UIConsts.RID_FORM + 12); @@ -365,11 +418,13 @@ public class FormWizard extends WizardDialog protected int ID; + // @Override public int getID() { return ID; } + // @Override public void setID(String sIncSuffix) { ID = 1; @@ -384,6 +439,7 @@ public class FormWizard extends WizardDialog } } + // @Override public void shiftFromLeftToRight(String[] SelItems, String[] NewItems) { if (ID == 1) @@ -396,6 +452,7 @@ public class FormWizard extends WizardDialog } } + // @Override public void shiftFromRightToLeft(String[] SelItems, String[] NewItems) { // TODO When the ListFieldbox is refilled only fields of the current Command may be merged into the Listbox @@ -408,11 +465,12 @@ public class FormWizard extends WizardDialog toggleSubFormSteps(); } } - + // @Override public void moveItemDown(String item) { } + // @Override public void moveItemUp(String item) { } @@ -421,7 +479,7 @@ public class FormWizard extends WizardDialog { curSubFormFieldSelection.setModified(true); boolean benable = curSubFormFieldSelection.getSelectedFieldNames().length > 0; - enablefromStep(SOFIELDLINKERPAGE, benable); + enablefromStep(SOFIELDLINKER_PAGE, benable); if (benable) { curFieldLinker.enable(!curFormConfiguration.areexistingRelationsdefined()); @@ -433,7 +491,7 @@ public class FormWizard extends WizardDialog { curDBCommandFieldSelection.setModified(true); boolean benable = curDBCommandFieldSelection.getSelectedFieldNames().length > 0; - enablefromStep(SOSUBFORMPAGE, benable); + enablefromStep(SOSUBFORM_PAGE, benable); setControlProperty("btnWizardNext", "Enabled", new Boolean(benable)); if (benable) { @@ -443,8 +501,8 @@ public class FormWizard extends WizardDialog } else { - setStepEnabled(SOSUBFORMFIELDSPAGE, false); - setStepEnabled(SOFIELDLINKERPAGE, false); + setStepEnabled(SOSUBFORMFIELDS_PAGE, false); + setStepEnabled(SOFIELDLINKER_PAGE, false); } } setControlProperty("btnWizardFinish", "Enabled", new Boolean(benable)); diff --git a/wizards/com/sun/star/wizards/form/StyleApplier.java b/wizards/com/sun/star/wizards/form/StyleApplier.java index 93903ef4930c..153de51a1f45 100644 --- a/wizards/com/sun/star/wizards/form/StyleApplier.java +++ b/wizards/com/sun/star/wizards/form/StyleApplier.java @@ -29,20 +29,12 @@ ************************************************************************/ package com.sun.star.wizards.form; -import com.sun.star.awt.ItemEvent; import com.sun.star.awt.XListBox; import com.sun.star.awt.XRadioButton; -import com.sun.star.beans.Property; -import com.sun.star.beans.PropertyVetoException; -import com.sun.star.beans.UnknownPropertyException; import com.sun.star.beans.XPropertySet; import com.sun.star.container.XNameAccess; -import com.sun.star.drawing.XControlShape; -import com.sun.star.drawing.XShapes; import com.sun.star.lang.EventObject; import com.sun.star.lang.IllegalArgumentException; -import com.sun.star.lang.IndexOutOfBoundsException; -import com.sun.star.lang.WrappedTargetException; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.Exception; @@ -58,59 +50,60 @@ import com.sun.star.wizards.document.Control; import com.sun.star.wizards.document.DatabaseControl; import com.sun.star.wizards.document.GridControl; import com.sun.star.wizards.document.TimeStampControl; -import com.sun.star.wizards.text.TextDocument; import com.sun.star.wizards.text.TextStyleHandler; import com.sun.star.wizards.ui.*; import com.sun.star.wizards.ui.UIConsts; +import java.util.ArrayList; + +// TODO: Style Templates fuer OOo? public class StyleApplier { - WizardDialog CurUnoDialog; - XPropertySet xPageStylePropertySet; - XMultiServiceFactory xMSF; - short curtabindex; - XRadioButton optNoBorder; - XRadioButton opt3DLook; - XRadioButton optFlat; - XListBox lstStyles; - Desktop.OfficePathRetriever curofficepath;// String[][] sLayoutFiles; - FormDocument curFormDocument; - short iOldLayoutPos; - int SOLAYOUTLST = 0; - String SCHANGELAYOUT = "changeLayout"; - String SCHANGEBORDERTYPE = "changeBorderLayouts"; - String[] StyleNames; - String[] StyleNodeNames; - String[] FileNames; - String StylesPath; - final static int SOBACKGROUNDCOLOR = 0; - final static int SODBTEXTCOLOR = 1; - final static int SOLABELTEXTCOLOR = 2; + private WizardDialog CurUnoDialog; + private XPropertySet xPageStylePropertySet; + private XMultiServiceFactory xMSF; + private short curtabindex; + private XRadioButton optNoBorder; + private XRadioButton opt3DLook; + private XRadioButton optFlat; + private XListBox lstStyles; + private Desktop.OfficePathRetriever curofficepath;// String[][] sLayoutFiles; + private FormDocument curFormDocument; + private short iOldLayoutPos; + private int SOLAYOUTLST = 0; + private static final String SCHANGELAYOUT = "changeLayout"; + private static final String SCHANGEBORDERTYPE = "changeBorderLayouts"; + private String[] StyleNames; + private String[] StyleNodeNames; + private String[] FileNames; + // private String StylesPath; + private final static int SOBACKGROUNDCOLOR = 0; + private final static int SODBTEXTCOLOR = 1; + private final static int SOLABELTEXTCOLOR = 2; // final static int SODBCONTROLBACKGROUNDCOLOR = 3; - final static int SOLABELBACKGROUNDCOLOR = 4; - final static int SOBORDERCOLOR = 5; - Short IBorderValue = new Short((short) 1); + private final static int SOLABELBACKGROUNDCOLOR = 4; + private final static int SOBORDERCOLOR = 5; + private Short IBorderValue = new Short((short) 1); public StyleApplier(WizardDialog _CurUnoDialog, FormDocument _curFormDocument) throws NoValidPathException { - try - { +// try +// { this.curFormDocument = _curFormDocument; xMSF = curFormDocument.xMSF; - StylesPath = FileAccess.getOfficePath(xMSF, "Config", "", ""); - StylesPath = FileAccess.combinePaths(xMSF, StylesPath, "/wizard/form/styles"); + TextStyleHandler oTextStyleHandler = new TextStyleHandler(xMSF, curFormDocument.xTextDocument); xPageStylePropertySet = oTextStyleHandler.getStyleByName("PageStyles", "Standard"); this.CurUnoDialog = _CurUnoDialog; - curtabindex = (short) (FormWizard.SOSTYLEPAGE * 100); - Integer IStyleStep = new Integer(FormWizard.SOSTYLEPAGE); + curtabindex = (short) (FormWizard.SOSTYLE_PAGE * 100); + Integer IStyleStep = new Integer(FormWizard.SOSTYLE_PAGE); String sPageStyles = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 86); String sNoBorder = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 29); String s3DLook = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 30); String sFlat = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 31); String sFieldBorder = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 28); - XInterface xUcbInterface = (XInterface) _curFormDocument.xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); +// XInterface xUcbInterface = (XInterface) _curFormDocument.xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); setStyles(); short[] SelLayoutPos; SelLayoutPos = new short[] @@ -177,11 +170,11 @@ public class StyleApplier { UIConsts.INTEGERS[8], sFieldBorder, new Integer(192), new Integer(25), IStyleStep, new Short(curtabindex++), new Integer(98) }); - } - catch (Exception e) - { - e.printStackTrace(System.out); - } +// } +// catch (Exception e) +// { +// e.printStackTrace(System.out); +// } } /* public void initialize(short _iStyleindex){ @@ -365,9 +358,49 @@ public class StyleApplier return -1; } + private XMultiServiceFactory getMSF() + { + return xMSF; + } + + private ArrayList<String> getStylePaths() + { + ArrayList<String> aStylePaths = new ArrayList<String>(); + try + { + // TODO: check different languages in header layouts + aStylePaths = FileAccess.getOfficePaths(getMSF(), "Config", "", ""); + FileAccess.combinePaths(getMSF(), aStylePaths, "/wizard/form/styles"); + + String[][] LayoutFiles = FileAccess.getFolderTitles(getMSF(), null, aStylePaths, ".css"); + + } + catch (com.sun.star.wizards.common.NoValidPathException e) + { + // if there are problems, don't show anything is a little bit hard. + aStylePaths.add("default"); + } + return aStylePaths; + } + + private String getStylePath() + { +// TODO: umstellen auf mehrere Pfade + String StylesPath = ""; + try + { + StylesPath = FileAccess.getOfficePath(xMSF, "Config", "", ""); + StylesPath = FileAccess.combinePaths(xMSF, StylesPath, "/wizard/form/styles"); + } + catch (NoValidPathException e) + { + } + return StylesPath; + } + private int[] getStyleColors(String _filename) { - String sFilePath = this.StylesPath + "/" + _filename; + String sFilePath = getStylePath() + "/" + _filename; int[] oStylePropList = new int[6]; String[] sData = FileAccess.getDataFromTextFile(xMSF, sFilePath); oStylePropList[SOBACKGROUNDCOLOR] = getStyleColor(sData, ".toctitle {", "background-color:"); @@ -423,9 +456,12 @@ public class StyleApplier { if (_iStyleColors[SODBTEXTCOLOR] > -1) { - if (DBControls[n].xServiceInfo.supportsService("com.sun.star.drawing.ShapeCollection")) + DatabaseControl aDBControl = DBControls[n]; + if (aDBControl != null) + { + if (aDBControl.xServiceInfo.supportsService("com.sun.star.drawing.ShapeCollection")) { - TimeStampControl oTimeStampControl = (TimeStampControl) DBControls[n]; + TimeStampControl oTimeStampControl = (TimeStampControl) aDBControl; for (int i = 0; i < 2; i++) { XPropertySet xPropertySet = oTimeStampControl.getControlofGroupShapeByIndex(i); @@ -434,7 +470,8 @@ public class StyleApplier } else { - setDBControlColors(DBControls[n].xPropertySet, _iStyleColors); + setDBControlColors(aDBControl.xPropertySet, _iStyleColors); + } } } } diff --git a/wizards/com/sun/star/wizards/form/UIControlArranger.java b/wizards/com/sun/star/wizards/form/UIControlArranger.java index ead1681e87d6..5e967e3fa096 100644 --- a/wizards/com/sun/star/wizards/form/UIControlArranger.java +++ b/wizards/com/sun/star/wizards/form/UIControlArranger.java @@ -33,18 +33,16 @@ import com.sun.star.awt.ItemEvent; import com.sun.star.awt.Size; import com.sun.star.awt.XControl; -import com.sun.star.awt.XItemEventBroadcaster; import com.sun.star.awt.XItemListener; import com.sun.star.awt.XRadioButton; import com.sun.star.lang.EventObject; -import com.sun.star.wizards.common.FileAccess; import com.sun.star.wizards.common.Helper; import com.sun.star.wizards.common.NoValidPathException; import com.sun.star.wizards.document.Control; -import com.sun.star.wizards.ui.ImageList; +// import com.sun.star.wizards.ui.ImageList; +import com.sun.star.wizards.ui.ButtonList; import com.sun.star.wizards.ui.UIConsts; import com.sun.star.wizards.ui.UnoDialog; -import com.sun.star.wizards.ui.WizardDialog; import javax.swing.DefaultListModel; import javax.swing.ListModel; @@ -54,37 +52,32 @@ import javax.swing.event.ListDataListener; public class UIControlArranger { - FormWizard CurUnoDialog; - FormDocument curFormDocument; - short curtabindex; - XRadioButton optAlignLeft; - XRadioButton optAlignRight; - XControl flnLabelPlacement; - int Index = 1; - String[] HelpTexts = new String[4]; - String[] sArrangementHeader = new String[2]; - ArrangeImageList[] oImageList = new ArrangeImageList[2]; - Integer IControlStep; - final int SOBASEIMAGEYPOSITION = 66; - final int SOIMAGELISTHEIGHT = 60; - final String SOALIGNMETHOD = "alignLabelControls"; + private FormWizard CurUnoDialog; + private FormDocument curFormDocument; + private short curtabindex; + private XRadioButton optAlignLeft; + private XRadioButton optAlignRight; + private XControl flnLabelPlacement; + private String[] HelpTexts = new String[4]; + // private String[] sArrangementHeader = new String[2]; + // private ArrangeImageList[] m_aArrangeList = new ArrangeImageList[2]; + private ArrangeButtonList[] m_aArrangeList = new ArrangeButtonList[2]; + private Integer IControlStep; + private final int SOBASEIMAGEYPOSITION = 66; + private final int SOIMAGELISTHEIGHT = 60; + private final String SOALIGNMETHOD = "alignLabelControls"; public UIControlArranger(FormWizard _CurUnoDialog, FormDocument _curFormDocument) throws NoValidPathException { this.CurUnoDialog = _CurUnoDialog; this.curFormDocument = _curFormDocument; - curtabindex = (short) (FormWizard.SOCONTROLPAGE * 100); - IControlStep = new Integer(FormWizard.SOCONTROLPAGE); + curtabindex = (short) (FormWizard.SOCONTROL_PAGE * 100); + IControlStep = new Integer(FormWizard.SOCONTROL_PAGE); String sLabelPlacment = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 32); String sAlignLeft = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 33); String sAlignRight = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 34); - sArrangementHeader[0] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 41); - sArrangementHeader[1] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 42); - HelpTexts[0] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 36); - HelpTexts[1] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 37); - HelpTexts[2] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 40); - HelpTexts[3] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 39); + // Label "Label Placement" ----------------- flnLabelPlacement = CurUnoDialog.insertFixedLine("lnLabelPlacement", new String[] { @@ -94,6 +87,7 @@ public class UIControlArranger { UIConsts.INTEGERS[8], sLabelPlacment, new Integer(97), new Integer(25), IControlStep, new Short(curtabindex++), new Integer(207) }); + // Radio Button "Align Left" optAlignLeft = CurUnoDialog.insertRadioButton("optAlignLeft", SOALIGNMETHOD, this, new String[] { @@ -103,6 +97,7 @@ public class UIControlArranger { UIConsts.INTEGERS[10], "HID:34451", sAlignLeft, new Integer(107), new Integer(38), new Short((short) 1), IControlStep, new Short(curtabindex++), new Integer(171) }); + // Radio Button "Align Right" optAlignRight = CurUnoDialog.insertRadioButton("optAlignRight", SOALIGNMETHOD, this, new String[] { @@ -113,23 +108,73 @@ public class UIControlArranger UIConsts.INTEGERS[10], "HID:34452", sAlignRight, Boolean.TRUE, new Integer(107), new Integer(50), IControlStep, new Short(curtabindex++), new Integer(171) }); + + HelpTexts[0] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 36); // "Columnar - Labels Left" + HelpTexts[1] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 37); // "Columnar - Labels of Top" + HelpTexts[2] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 40); // "As Data Sheet" + HelpTexts[3] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 39); // In Blocks - Labels Above" + +// flnLabelPlacement = CurUnoDialog.insertFixedLine("lnArrangementHeader1", +// new String[] +// { +// "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" +// }, +// new Object[] +// { +// UIConsts.INTEGERS[8], sArrangementHeader[0], new Integer(97), new Integer(60), IControlStep, new Short(curtabindex++), new Integer(207) +// }); +// +// boolean bEnabled = true; +// int nBtnWidth = 16; +// int nXPos = 97; +// int nYPos = 70; +// CurUnoDialog.insertButton("btnLayout1", "btnLayout1", +// new String[] +// { +// "Enabled", +// "Height", +// "HelpURL", +// "Label", +// "PositionX", +// "PositionY", +// "Step", +// "TabIndex", +// "Width" +// }, +// new Object[] +// { +// Boolean.valueOf(bEnabled), +// new Integer(14), +///* TODO: WRONG!*/ "HID:34452", +// "1", +// new Integer(nXPos + nBtnWidth), +// new Integer(nYPos), +// IControlStep, +// new Short(curtabindex++), +// new Integer(16) +// }); + DefaultListModel imageModel = new DefaultListModel(); for (int i = 0; i < HelpTexts.length; i++) { imageModel.addElement(new Integer(i)); } - oImageList[0] = new ArrangeImageList(0, imageModel); - oImageList[1] = new ArrangeImageList(1, imageModel); + String sMainArrangementHeader = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 41); // "Arrangement of the main form" + m_aArrangeList[0] = new ArrangeButtonList(0, imageModel, sMainArrangementHeader); + + String sSubArrangementHeader = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 42); // "Arrangement of the sub form" + m_aArrangeList[1] = new ArrangeButtonList(1, imageModel, sSubArrangementHeader); enableAlignControlGroup(false); } public int getSelectedArrangement(int _formindex) { - return oImageList[_formindex].ilLayouts.getSelected() + 1; + return m_aArrangeList[_formindex].m_aButtonList.getSelected() + 1; } - private class LayoutRenderer implements ImageList.ImageRenderer + private class LayoutRenderer implements ButtonList.IImageRenderer { + int Index = 1; public Object[] getImageUrls(Object listitem) { @@ -157,7 +202,7 @@ public class UIControlArranger public void enableSubFormImageList(boolean _bdoEnable) { - oImageList[1].ilLayouts.setenabled(_bdoEnable); + m_aArrangeList[1].m_aButtonList.setenabled(_bdoEnable); CurUnoDialog.setControlProperty("lnLabelPlacment_2", "Enabled", new Boolean(_bdoEnable)); } @@ -206,46 +251,180 @@ public class UIControlArranger Helper.setUnoPropertyValue(UnoDialog.getModel(optAlignRight), "Enabled", new Boolean(_bEnableAlignControlGroup)); } - private class ArrangeImageList implements XItemListener +// private class ArrangeImageList implements XItemListener +// { +// +// private int formindex; +// private ImageList m_aButtonList = null; // new ImageList(); +// +// public ArrangeImageList(int _formindex, ListModel model, String _sArrangementHeader) +// { +// formindex = _formindex; +// Integer YPos = new Integer(SOBASEIMAGEYPOSITION + _formindex * SOIMAGELISTHEIGHT); +// // Label ArrangementHeader ---------------------- +// CurUnoDialog.insertFixedLine("lnLabelPlacment_" + (_formindex + 1), +// new String[] +// { +// "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" +// }, +// new Object[] +// { +// UIConsts.INTEGERS[8], _sArrangementHeader, new Integer(97), YPos, IControlStep, new Short(curtabindex++), new Integer(207) +// }); +// +// int nypos = SOBASEIMAGEYPOSITION + 12 + _formindex * SOIMAGELISTHEIGHT; +// m_aButtonList = new ImageList(); +// m_aButtonList.setPos(new Size(107, nypos)); +// m_aButtonList.setImageSize(new Size(26, 26)); +// m_aButtonList.setCols(4); +// m_aButtonList.setRows(1); +// m_aButtonList.m_aControlName = "ImageList_" + formindex; +// m_aButtonList.setStep(new Short((short) FormWizard.SOCONTROL_PAGE)); +// m_aButtonList.setShowButtons(false); +// m_aButtonList.setRenderer(new LayoutRenderer()); +// m_aButtonList.setSelectionGap(new Size(2, 2)); +// m_aButtonList.setGap(new Size(3, 3)); +// m_aButtonList.scaleImages = Boolean.FALSE; +// m_aButtonList.tabIndex = (int) curtabindex++; +// m_aButtonList.helpURL = 34453 + (formindex * 4); +// +// m_aButtonList.setListModel(model); +// m_aButtonList.create(CurUnoDialog); +// m_aButtonList.setSelected(FormWizard.SOGRID - 1); +// m_aButtonList.addItemListener(this); +// } +// +// public void setToLeftAlign() +// { +// Helper.setUnoPropertyValue(UnoDialog.getModel(optAlignLeft), "State", new Short((short) 1)); +// } +// +// /* (non-Javadoc) +// * @see javax.swing.ListModel#addListDataListener(javax.swing.event.ListDataListener) +// */ +// public void addListDataListener(ListDataListener arg0) +// { +// // TODO Auto-generated method stub +// } +// +// public void itemStateChanged(ItemEvent arg0) +// { +// try +// { +// if (m_aArrangeList[formindex].m_aButtonList.isenabled()) +// { +// boolean bEnableAlignControlGroup; +// if (curFormDocument.oControlForms.size() == 2) +// { +// final int nSelected0 = (m_aArrangeList[0].m_aButtonList.getSelected() + 1); +// final int nSelected1 = (m_aArrangeList[1].m_aButtonList.getSelected() + 1); +// +// bEnableAlignControlGroup = ((nSelected0 == FormWizard.SOCOLUMNARLEFT) || +// (nSelected1 == FormWizard.SOCOLUMNARLEFT)); +// } +// else +// { +// final int nSelected0 = (m_aArrangeList[0].m_aButtonList.getSelected() + 1); +// bEnableAlignControlGroup = (nSelected0 == FormWizard.SOCOLUMNARLEFT); +// } +// enableAlignControlGroup(bEnableAlignControlGroup); +// final Short nBorderType = CurUnoDialog.getBorderType(); +// final int nSelected = m_aButtonList.getSelected() + 1; +// ((FormDocument.ControlForm) curFormDocument.oControlForms.get(formindex)).initialize(nSelected, nBorderType); +// } +// } +// catch (RuntimeException e) +// { +// e.printStackTrace(); +// } +// } +// +// /* (non-Javadoc) +// * @see javax.swing.event.ListDataListener#contentsChanged(javax.swing.event.ListDataEvent) +// */ +// public void contentsChanged(ListDataEvent arg0) +// { +// // TODO Auto-generated method stub +// } +// +// /* (non-Javadoc) +// * @see javax.swing.event.ListDataListener#intervalAdded(javax.swing.event.ListDataEvent) +// */ +// public void intervalAdded(ListDataEvent arg0) +// { +// // TODO Auto-generated method stub +// } +// +// /* (non-Javadoc) +// * @see javax.swing.event.ListDataListener#intervalRemoved(javax.swing.event.ListDataEvent) +// */ +// public void intervalRemoved(ListDataEvent arg0) +// { +// // TODO Auto-generated method stub +// } +// +// /* (non-Javadoc) +// * @see com.sun.star.lang.XEventListener#disposing(com.sun.star.lang.EventObject) +// */ +// public void disposing(EventObject arg0) +// { +// // TODO Auto-generated method stub +// } +// } + + private class ArrangeButtonList implements XItemListener { - int formindex; - ImageList ilLayouts = new ImageList(); + private int formindex; + private ButtonList m_aButtonList = null; // new ImageList(); - public ArrangeImageList(int _formindex, ListModel model) + public ArrangeButtonList(int _formindex, ListModel model, String _sArrangementHeader) { formindex = _formindex; Integer YPos = new Integer(SOBASEIMAGEYPOSITION + _formindex * SOIMAGELISTHEIGHT); + // Label ArrangementHeader ---------------------- CurUnoDialog.insertFixedLine("lnLabelPlacment_" + (_formindex + 1), new String[] { - "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" + "Height", + "Label", + "PositionX", + "PositionY", + "Step", + "TabIndex", + "Width" }, new Object[] { - UIConsts.INTEGERS[8], sArrangementHeader[_formindex], new Integer(97), YPos, IControlStep, new Short(curtabindex++), new Integer(207) + UIConsts.INTEGERS[8], + _sArrangementHeader, + new Integer(97), + YPos, + IControlStep, + new Short(curtabindex++), + new Integer(207) }); - int nypos = SOBASEIMAGEYPOSITION + 12 + _formindex * SOIMAGELISTHEIGHT; - ilLayouts = new ImageList(); - ilLayouts.setPos(new Size(107, nypos)); - ilLayouts.setImageSize(new Size(26, 26)); - ilLayouts.setCols(4); - ilLayouts.setRows(1); - ilLayouts.name = "ImageList_" + formindex; - ilLayouts.setStep(new Short((short) FormWizard.SOCONTROLPAGE)); - ilLayouts.setShowButtons(false); - ilLayouts.setRenderer(new LayoutRenderer()); - ilLayouts.setSelectionGap(new Size(2, 2)); - ilLayouts.setGap(new Size(3, 3)); - ilLayouts.scaleImages = Boolean.FALSE; - ilLayouts.tabIndex = (int) curtabindex++; - ilLayouts.helpURL = 34453 + (formindex * 4); - - ilLayouts.setListModel(model); - ilLayouts.create(CurUnoDialog); - ilLayouts.setSelected(FormWizard.SOGRID - 1); - ilLayouts.addItemListener(this); + int nypos = SOBASEIMAGEYPOSITION + 12 - 5 + _formindex * SOIMAGELISTHEIGHT; + m_aButtonList = new ButtonList(); + m_aButtonList.setPos(new Size(107, nypos)); + m_aButtonList.setButtonSize(new Size(26 + 6, 26 + 5)); + m_aButtonList.setCols(4); + m_aButtonList.setRows(1); + m_aButtonList.setName( "ButtonList_" + formindex ); + m_aButtonList.setStep(Short.valueOf((short) FormWizard.SOCONTROL_PAGE)); + m_aButtonList.setShowButtons(false); // shows a button line at ''wrong'' position like |<| 1..4/4 |>| + m_aButtonList.setRenderer(new LayoutRenderer()); + m_aButtonList.setSelectionGap(new Size(2, 2)); + m_aButtonList.setGap(new Size(3, 3)); +// m_aButtonList.scaleImages = Boolean.FALSE; + m_aButtonList.tabIndex = (int) curtabindex++; + m_aButtonList.helpURL = 34453 + (formindex * 4); + + m_aButtonList.setListModel(model); + m_aButtonList.create(CurUnoDialog); + m_aButtonList.setSelected(FormWizard.SOGRID - 1); + m_aButtonList.addItemListener(this); } public void setToLeftAlign() @@ -265,19 +444,26 @@ public class UIControlArranger { try { - if (oImageList[formindex].ilLayouts.isenabled()) + if (m_aArrangeList[formindex].m_aButtonList.isenabled()) { boolean bEnableAlignControlGroup; if (curFormDocument.oControlForms.size() == 2) { - bEnableAlignControlGroup = (((oImageList[0].ilLayouts.getSelected() + 1) == FormWizard.SOCOLUMNARLEFT) || ((oImageList[1].ilLayouts.getSelected() + 1) == FormWizard.SOCOLUMNARLEFT)); + final int nSelected0 = (m_aArrangeList[0].m_aButtonList.getSelected() + 1); + final int nSelected1 = (m_aArrangeList[1].m_aButtonList.getSelected() + 1); + + bEnableAlignControlGroup = ((nSelected0 == FormWizard.SOCOLUMNARLEFT) || + (nSelected1 == FormWizard.SOCOLUMNARLEFT)); } else { - bEnableAlignControlGroup = ((oImageList[0].ilLayouts.getSelected() + 1) == FormWizard.SOCOLUMNARLEFT); + final int nSelected0 = (m_aArrangeList[0].m_aButtonList.getSelected() + 1); + bEnableAlignControlGroup = (nSelected0 == FormWizard.SOCOLUMNARLEFT); } enableAlignControlGroup(bEnableAlignControlGroup); - ((FormDocument.ControlForm) curFormDocument.oControlForms.get(formindex)).initialize(ilLayouts.getSelected() + 1, CurUnoDialog.getBorderType()); + final Short nBorderType = CurUnoDialog.getBorderType(); + final int nSelected = m_aButtonList.getSelected() + 1; + ((FormDocument.ControlForm) curFormDocument.oControlForms.get(formindex)).initialize(nSelected, nBorderType); } } catch (RuntimeException e) diff --git a/wizards/com/sun/star/wizards/letter/LocaleCodes.java b/wizards/com/sun/star/wizards/letter/LocaleCodes.java index 08974e08eb4a..8e1ddfb34498 100644 --- a/wizards/com/sun/star/wizards/letter/LocaleCodes.java +++ b/wizards/com/sun/star/wizards/letter/LocaleCodes.java @@ -61,8 +61,9 @@ public class LocaleCodes extends Resource return LS; } - public String[] getIDs() { - String []Ids = new String [135]; + public String[] getIDs() + { + String[] Ids = new String[135]; Ids[0] = "Afrikaans;af;1078"; Ids[1] = "Albanian;sq;1052"; diff --git a/wizards/com/sun/star/wizards/makefile.mk b/wizards/com/sun/star/wizards/makefile.mk index 50c1f84397f0..d876d1903d5d 100644 --- a/wizards/com/sun/star/wizards/makefile.mk +++ b/wizards/com/sun/star/wizards/makefile.mk @@ -75,7 +75,7 @@ JAVAFILES= \ common$/ConfigSet.java \ common$/XMLProvider.java \ common$/XMLHelper.java \ - common$/Renderer.java \ + common$/IRenderer.java \ common$/Indexable.java \ common$/TerminateWizardException.java \ common$/UCB.java \ @@ -115,6 +115,7 @@ JAVAFILES= \ ui$/FilterComponent.java \ ui$/FieldSelection.java \ ui$/ImageList.java \ + ui$/ButtonList.java \ ui$/PathSelection.java \ ui$/PeerConfig.java \ ui$/SortingComponent.java \ diff --git a/wizards/com/sun/star/wizards/query/Finalizer.java b/wizards/com/sun/star/wizards/query/Finalizer.java index 8535b2a4a876..7079b1109742 100644 --- a/wizards/com/sun/star/wizards/query/Finalizer.java +++ b/wizards/com/sun/star/wizards/query/Finalizer.java @@ -51,7 +51,7 @@ public class Finalizer public Finalizer(QueryWizard _CurUnoDialog, QuerySummary _CurDBMetaData) { - short curtabindex = (short) (100 * QueryWizard.SOSUMMARYPAGE); + short curtabindex = (short) (100 * QueryWizard.SOSUMMARY_PAGE); String reslblQueryTitle; String resoptDisplayQuery; String resoptModifyQuery; @@ -73,7 +73,7 @@ public class Finalizer }, new Object[] { - new Integer(8), reslblQueryTitle, new Integer(95), new Integer(27), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(52) + new Integer(8), reslblQueryTitle, new Integer(95), new Integer(27), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(52) }); m_aTxtTitle = CurUnoDialog.insertTextField("txtQueryTitle", 0, null, new String[] { @@ -81,7 +81,7 @@ public class Finalizer }, new Object[] { - new Integer(12), "HID:" + curHelpIndex++, new Integer(95), new Integer(37), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(90) + new Integer(12), "HID:" + curHelpIndex++, new Integer(95), new Integer(37), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(90) }); CurUnoDialog.insertLabel("lblHowGoOn", new String[] { @@ -89,7 +89,7 @@ public class Finalizer }, new Object[] { - new Integer(16), reslblHowGoOn, Boolean.TRUE, new Integer(192), new Integer(27), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(112) + new Integer(16), reslblHowGoOn, Boolean.TRUE, new Integer(192), new Integer(27), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(112) }); this.xRadioDisplayQuery = CurUnoDialog.insertRadioButton("optDisplayQuery", new String[] @@ -98,7 +98,7 @@ public class Finalizer }, new Object[] { - new Integer(9), "HID:" + curHelpIndex++, resoptDisplayQuery, new Integer(192), new Integer(46), new Short((short) 1), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(118) + new Integer(9), "HID:" + curHelpIndex++, resoptDisplayQuery, new Integer(192), new Integer(46), new Short((short) 1), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(118) }); this.xRadioModifyQuery = CurUnoDialog.insertRadioButton("optModifyQuery", @@ -108,7 +108,7 @@ public class Finalizer }, new Object[] { - new Integer(10), "HID:" + curHelpIndex++, resoptModifyQuery, new Integer(192), new Integer(56), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(118) + new Integer(10), "HID:" + curHelpIndex++, resoptModifyQuery, new Integer(192), new Integer(56), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(118) }); CurUnoDialog.insertFixedLine("flnSummary", new String[] { diff --git a/wizards/com/sun/star/wizards/query/QuerySummary.java b/wizards/com/sun/star/wizards/query/QuerySummary.java index 07e66d0a7e1c..611068d8b953 100644 --- a/wizards/com/sun/star/wizards/query/QuerySummary.java +++ b/wizards/com/sun/star/wizards/query/QuerySummary.java @@ -54,8 +54,8 @@ public class QuerySummary extends QueryMetaData super(_xMSF); this.oResource = _oResource; // this.xMSF = _xMSF; - sAnd = oResource.getResText(RID_QUERY + 33); - sOr = oResource.getResText(RID_QUERY + 34); + sAnd = oResource.getResText(RID_QUERY + 38); + sOr = oResource.getResText(RID_QUERY + 39); sSeparator = oResource.getResText(RID_QUERY + 91); sReturnChar = String.valueOf((char) 13) + String.valueOf((char) 13); } @@ -150,7 +150,7 @@ public class QuerySummary extends QueryMetaData { CurString = BaseString; FieldColumn CurDBFieldColumn = super.getFieldColumnByDisplayName(FieldColumns[i].getDisplayFieldName()); - int iAggregate = getAggregateIndex(FieldColumns[i].m_sFieldName); + int iAggregate = getAggregateIndex(FieldColumns[i].getFieldName()); if (iAggregate > -1) { String sAggregateDisplay = AggregateFieldNames[iAggregate][1] + "(" + AggregateFieldNames[iAggregate][0] + ")"; @@ -254,4 +254,4 @@ public class QuerySummary extends QueryMetaData } return sReturn; } -}
\ No newline at end of file +} diff --git a/wizards/com/sun/star/wizards/query/QueryWizard.java b/wizards/com/sun/star/wizards/query/QueryWizard.java index 778faeb08903..181c83d9134a 100644 --- a/wizards/com/sun/star/wizards/query/QueryWizard.java +++ b/wizards/com/sun/star/wizards/query/QueryWizard.java @@ -53,36 +53,34 @@ public class QueryWizard extends WizardDialog return CurFrame; } public static final String SFILLUPFIELDSLISTBOX = "fillUpFieldsListbox"; - public static final int SOFIELDSELECTIONPAGE = 1; - public static final int SOSORTINGPAGE = 2; - public static final int SOFILTERPAGE = 3; - public static final int SOAGGREGATEPAGE = 4; - public static final int SOGROUPSELECTIONPAGE = 5; - public static final int SOGROUPFILTERPAGE = 6; - public static final int SOTITLESPAGE = 7; - public static final int SOSUMMARYPAGE = 8; - CommandFieldSelection CurDBCommandFieldSelection; - SortingComponent CurSortingComponent; - FieldSelection CurGroupFieldSelection; - TitlesComponent CurTitlesComponent; - FilterComponent CurFilterComponent; - FilterComponent CurGroupFilterComponent; - AggregateComponent CurAggregateComponent; - Finalizer CurFinalizer; - WizardDialog CurWizardDialog; - QuerySummary CurDBMetaData; - String[][] UIRepresentation; - String reslblFieldHeader; - String reslblAliasHeader; - String reslblFields; - String reslblSelFields; - String reslblTables; - String resQuery; - String resQueryWizard; - String reslblGroupBy; - String resmsgNonNumericAsGroupBy; - XComponent[] components = null; //Resources Object - short CurTabIndex = 0; + private static final int SOFIELDSELECTION_PAGE = 1; + private static final int SOSORTING_PAGE = 2; + private static final int SOFILTER_PAGE = 3; + private static final int SOAGGREGATE_PAGE = 4; + private static final int SOGROUPSELECTION_PAGE = 5; + private static final int SOGROUPFILTER_PAGE = 6; + private static final int SOTITLES_PAGE = 7; + protected static final int SOSUMMARY_PAGE = 8; + private CommandFieldSelection CurDBCommandFieldSelection; + private SortingComponent CurSortingComponent; + private FieldSelection CurGroupFieldSelection; + private TitlesComponent CurTitlesComponent; + private FilterComponent CurFilterComponent; + private FilterComponent CurGroupFilterComponent; + private AggregateComponent CurAggregateComponent; + private Finalizer CurFinalizer; + private QuerySummary CurDBMetaData; + private String reslblFieldHeader; + private String reslblAliasHeader; + private String reslblFields; + private String reslblSelFields; + private String reslblTables; + // private String resQuery; + private String resQueryWizard; + private String reslblGroupBy; + private String resmsgNonNumericAsGroupBy; + private XComponent[] components = null; //Resources Object + // private short CurTabIndex = 0; public QueryWizard(XMultiServiceFactory xMSF) { @@ -91,20 +89,18 @@ public class QueryWizard extends WizardDialog CurDBMetaData = new QuerySummary(xMSF, m_oResource); } - public static void main(String args[]) +/* public static void main(String args[]) { - String ConnectStr = "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.NamingService"; // //localhost ;Lo-1.Germany.sun.com; 10.16.65.155 + String ConnectStr = "uno:pipe,name=fs93730;urp;StarOffice.ServiceManager"; try { XMultiServiceFactory xLocMSF = Desktop.connect(ConnectStr); if (xLocMSF != null) { PropertyValue[] curproperties = new PropertyValue[1]; - curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/Mydbwizard2DocAssign.odb"); //Mydbwizard2DocAssign.odb; MyDBase.odb, Mydbwizard2DocAssign.odb MyDBase.odb; Mydbwizard2DocAssign.odb; NewAccessDatabase, MyDocAssign baseLocation ); "DataSourceName", "db1"); - curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///x:/bc/nyt1.odb"); //Mydbwizard2DocAssign.odb; MyDBase.odb, Mydbwizard2DocAssign.odb MyDBase.odb; Mydbwizard2DocAssign.odb; NewAccessDatabase, MyDocAssign baseLocation ); "DataSourceName", "db1"); - curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/MyHSQL.odb"); - + curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///G:/temp/abc.odb"); // curproperties[0] = Properties.createProperty("DataSourceName", "TESTDB"); + QueryWizard CurQueryWizard = new QueryWizard(xLocMSF); CurQueryWizard.startQueryWizard(xLocMSF, curproperties); } @@ -114,36 +110,8 @@ public class QueryWizard extends WizardDialog jexception.printStackTrace(System.out); } } -//!<<<<<<< QueryWizard.java -//! public void startQueryWizard(XMultiServiceFactory xMSF, PropertyValue[] CurPropertyValues) { -//! try { -//! if (CurDBMetaData.getConnection(CurPropertyValues)){ -//! reslblFields = m_oResource.getResText(UIConsts.RID_QUERY + 4); -//! reslblFieldHeader = m_oResource.getResText(UIConsts.RID_QUERY + 19); //Fielnames in AliasComponent -//! reslblAliasHeader = m_oResource.getResText(UIConsts.RID_QUERY + 20); //Fieldtitles header in AliasComponent -//! reslblSelFields = m_oResource.getResText(UIConsts.RID_QUERY + 50); -//! reslblTables = m_oResource.getResText(UIConsts.RID_QUERY + 3); -//! reslblGroupBy = m_oResource.getResText(UIConsts.RID_QUERY + 18); -//! resQueryWizard = m_oResource.getResText(UIConsts.RID_QUERY + 2); -//! resmsgNonNumericAsGroupBy = m_oResource.getResText(UIConsts.RID_QUERY + 88); -//! Helper.setUnoPropertyValues(xDialogModel, new String[] { "Height", "Moveable", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Title", "Width" }, -//! new Object[] { new Integer(210), Boolean.TRUE, "DialogQuery", new Integer(102), new Integer(41), new Integer(1), new Short((short) 0), resQueryWizard, new Integer(310)}); -//! drawNaviBar(); -//! setRightPaneHeaders(m_oResource, UIConsts.RID_QUERY + 70, 8); -//! this.setMaxStep(8); -//! buildSteps(); -//! this.CurDBCommandFieldSelection.preselectCommand(CurPropertyValues, false); -//! CurFrame = Desktop.getActiveFrame(xMSF); -//!// CurFrame = OfficeDocument.createNewFrame(xMSF, this); -//!// desktopFrame = Desktop.findAFrame(xMSF, CurFrame, desktopFrame); -//! -//! xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, CurFrame.getContainerWindow()); -//! this.xMSF = xMSF; -//! createWindowPeer(xWindowPeer); -//! CurDBMetaData.setWindowPeer(this.xControl.getPeer()); -//! insertQueryRelatedSteps(); -//! short RetValue = executeDialog(CurFrame.getContainerWindow().getPosSize()); -//!======= + */ + public XComponent[] startQueryWizard(XMultiServiceFactory xMSF, PropertyValue[] CurPropertyValues) { try @@ -179,8 +147,6 @@ public class QueryWizard extends WizardDialog { CurFrame = Desktop.getActiveFrame(xMSF); } - // CurFrame = OfficeDocument.createNewFrame(xMSF, this); - // desktopFrame = Desktop.findAFrame(xMSF, CurFrame, desktopFrame); XWindowPeer windowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, CurFrame.getContainerWindow()); this.xMSF = xMSF; @@ -193,7 +159,6 @@ public class QueryWizard extends WizardDialog catch (java.lang.Exception jexception) { jexception.printStackTrace(System.out); -//!>>>>>>> 1.14 } CurGroupFilterComponent = null; CurTitlesComponent = null; @@ -224,16 +189,16 @@ public class QueryWizard extends WizardDialog CurItemID = AnyConverter.toInt(Helper.getUnoPropertyValue(oRoadmapItem, "ID")); switch (CurItemID) { - case SOAGGREGATEPAGE: + case SOAGGREGATE_PAGE: if (_bEnabled == true) { bEnabled = ((CurDBMetaData.hasNumericalFields()) && (CurDBMetaData.xDBMetaData.supportsCoreSQLGrammar())); } break; - case SOGROUPSELECTIONPAGE: + case SOGROUPSELECTION_PAGE: bEnabled = CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY; break; - case SOGROUPFILTERPAGE: + case SOGROUPFILTER_PAGE: bEnabled = false; if (_bEnabled == true) { @@ -269,21 +234,21 @@ public class QueryWizard extends WizardDialog setRMItemLabels(m_oResource, UIConsts.RID_QUERY + 80); addRoadmap(); int i = 0; - i = insertRoadmapItem(0, true, SOFIELDSELECTIONPAGE - 1, SOFIELDSELECTIONPAGE); - i = insertRoadmapItem(i, false, SOSORTINGPAGE - 1, SOSORTINGPAGE); // Orderby is always supported - i = insertRoadmapItem(i, false, SOFILTERPAGE - 1, SOFILTERPAGE); + i = insertRoadmapItem(0, true, SOFIELDSELECTION_PAGE - 1, SOFIELDSELECTION_PAGE); + i = insertRoadmapItem(i, false, SOSORTING_PAGE - 1, SOSORTING_PAGE); // Orderby is always supported + i = insertRoadmapItem(i, false, SOFILTER_PAGE - 1, SOFILTER_PAGE); if (CurDBMetaData.xDBMetaData.supportsCoreSQLGrammar()) { - i = insertRoadmapItem(i, CurDBMetaData.hasNumericalFields(), SOAGGREGATEPAGE - 1, SOAGGREGATEPAGE); + i = insertRoadmapItem(i, CurDBMetaData.hasNumericalFields(), SOAGGREGATE_PAGE - 1, SOAGGREGATE_PAGE); } if (CurDBMetaData.xDBMetaData.supportsGroupBy()) { - i = insertRoadmapItem(i, false, SOGROUPSELECTIONPAGE - 1, SOGROUPSELECTIONPAGE); - i = insertRoadmapItem(i, false, SOGROUPFILTERPAGE - 1, SOGROUPFILTERPAGE); + i = insertRoadmapItem(i, false, SOGROUPSELECTION_PAGE - 1, SOGROUPSELECTION_PAGE); + i = insertRoadmapItem(i, false, SOGROUPFILTER_PAGE - 1, SOGROUPFILTER_PAGE); } // if (CurDBMetaData.xDBMetaData.supportsColumnAliasing()) don't use -> too dangerous!!! - i = insertRoadmapItem(i, false, SOTITLESPAGE - 1, SOTITLESPAGE); - i = insertRoadmapItem(i, false, SOSUMMARYPAGE - 1, SOSUMMARYPAGE); + i = insertRoadmapItem(i, false, SOTITLES_PAGE - 1, SOTITLES_PAGE); + i = insertRoadmapItem(i, false, SOSUMMARY_PAGE - 1, SOSUMMARY_PAGE); setRoadmapInteractive(true); setRoadmapComplete(true); setCurrentRoadmapItemID((short) 1); @@ -304,21 +269,21 @@ public class QueryWizard extends WizardDialog CurDBCommandFieldSelection = new CommandFieldSelection(this, CurDBMetaData, 120, reslblFields, reslblSelFields, reslblTables, true, 40850); CurDBCommandFieldSelection.setAppendMode(true); CurDBCommandFieldSelection.addFieldSelectionListener(new FieldSelectionListener()); - CurSortingComponent = new SortingComponent(this, SOSORTINGPAGE, 95, 27, 210, 40865); - CurFilterComponent = new FilterComponent(this, xMSF, SOFILTERPAGE, 97, 27, 209, 3, CurDBMetaData, 40878); + CurSortingComponent = new SortingComponent(this, SOSORTING_PAGE, 95, 27, 210, 40865); + CurFilterComponent = new FilterComponent(this, xMSF, SOFILTER_PAGE, 97, 27, 209, 3, CurDBMetaData, 40878); CurFilterComponent.addNumberFormats(); if (CurDBMetaData.xDBMetaData.supportsCoreSQLGrammar()) { - CurAggregateComponent = new AggregateComponent(this, CurDBMetaData, SOAGGREGATEPAGE, 97, 69, 209, 5, 40895); + CurAggregateComponent = new AggregateComponent(this, CurDBMetaData, SOAGGREGATE_PAGE, 97, 69, 209, 5, 40895); } if (CurDBMetaData.xDBMetaData.supportsGroupBy()) { - CurGroupFieldSelection = new FieldSelection(this, SOGROUPSELECTIONPAGE, 95, 27, 210, 150, reslblFields, this.reslblGroupBy, 40915, false); + CurGroupFieldSelection = new FieldSelection(this, SOGROUPSELECTION_PAGE, 95, 27, 210, 150, reslblFields, this.reslblGroupBy, 40915, false); CurGroupFieldSelection.addFieldSelectionListener(new FieldSelectionListener()); - CurGroupFilterComponent = new FilterComponent(this, xMSF, SOGROUPFILTERPAGE, 97, 27, 209, 3, CurDBMetaData, 40923); + CurGroupFilterComponent = new FilterComponent(this, xMSF, SOGROUPFILTER_PAGE, 97, 27, 209, 3, CurDBMetaData, 40923); } - CurTitlesComponent = new TitlesComponent(this, SOTITLESPAGE, 97, 37, 207, 7, reslblFieldHeader, reslblAliasHeader, 40940); + CurTitlesComponent = new TitlesComponent(this, SOTITLES_PAGE, 97, 37, 207, 7, reslblFieldHeader, reslblAliasHeader, 40940); CurFinalizer = new Finalizer(this, CurDBMetaData); enableNavigationButtons(false, false, false); } @@ -331,7 +296,7 @@ public class QueryWizard extends WizardDialog public void finishWizard() { int ncurStep = getCurrentStep(); - if ((switchToStep(ncurStep, SOSUMMARYPAGE)) || (ncurStep == SOSUMMARYPAGE)) + if ((switchToStep(ncurStep, SOSUMMARY_PAGE)) || (ncurStep == SOSUMMARY_PAGE)) { components = CurFinalizer.finish(); } @@ -341,7 +306,7 @@ public class QueryWizard extends WizardDialog { try { - if (nOldStep <= SOGROUPSELECTIONPAGE && nNewStep > SOGROUPSELECTIONPAGE) + if (nOldStep <= SOGROUPSELECTION_PAGE && nNewStep > SOGROUPSELECTION_PAGE) { if (CurDBMetaData.xDBMetaData.supportsGroupBy()) { @@ -352,26 +317,26 @@ public class QueryWizard extends WizardDialog } switch (nNewStep) { - case SOFIELDSELECTIONPAGE: + case SOFIELDSELECTION_PAGE: break; - case SOSORTINGPAGE: + case SOSORTING_PAGE: CurSortingComponent.initialize(CurDBMetaData.getDisplayFieldNames(), CurDBMetaData.getSortFieldNames()); break; - case SOFILTERPAGE: + case SOFILTER_PAGE: CurFilterComponent.initialize(CurDBMetaData.getFilterConditions(), CurDBMetaData.getDisplayFieldNames()); break; - case SOAGGREGATEPAGE: + case SOAGGREGATE_PAGE: CurAggregateComponent.initialize(); break; - case SOGROUPSELECTIONPAGE: + case SOGROUPSELECTION_PAGE: break; - case SOGROUPFILTERPAGE: + case SOGROUPFILTER_PAGE: CurGroupFilterComponent.initialize(CurDBMetaData.GroupByFilterConditions, CurDBMetaData.getGroupFieldNames()); break; - case SOTITLESPAGE: + case SOTITLES_PAGE: CurTitlesComponent.initialize(CurDBMetaData.getDisplayFieldNames(), CurDBMetaData.FieldTitleSet); break; - case SOSUMMARYPAGE: + case SOSUMMARY_PAGE: CurFinalizer.initialize(); break; default: @@ -388,35 +353,35 @@ public class QueryWizard extends WizardDialog { switch (nOldStep) { - case SOFIELDSELECTIONPAGE: + case SOFIELDSELECTION_PAGE: CurDBMetaData.reorderFieldColumns(CurDBCommandFieldSelection.getSelectedFieldNames()); CurDBMetaData.initializeFieldTitleSet(true); CurDBMetaData.setNumericFields(); searchForOutdatedFields(); break; - case SOSORTINGPAGE: + case SOSORTING_PAGE: CurDBMetaData.setSortFieldNames(CurSortingComponent.getSortFieldNames()); break; - case SOFILTERPAGE: + case SOFILTER_PAGE: CurDBMetaData.setFilterConditions(CurFilterComponent.getFilterConditions()); break; - case SOAGGREGATEPAGE: + case SOAGGREGATE_PAGE: CurDBMetaData.AggregateFieldNames = CurAggregateComponent.getAggregateFieldNames(); break; - case SOGROUPSELECTIONPAGE: + case SOGROUPSELECTION_PAGE: break; - case SOGROUPFILTERPAGE: + case SOGROUPFILTER_PAGE: CurDBMetaData.setGroupByFilterConditions(this.CurGroupFilterComponent.getFilterConditions()); break; - case SOTITLESPAGE: + case SOTITLES_PAGE: CurDBMetaData.setFieldTitles(CurTitlesComponent.getFieldTitles()); break; - case SOSUMMARYPAGE: + case SOSUMMARY_PAGE: break; default: break; } - if (nOldStep < SOGROUPSELECTIONPAGE && nNewStep >= SOGROUPSELECTIONPAGE) + if (nOldStep < SOGROUPSELECTION_PAGE && nNewStep >= SOGROUPSELECTION_PAGE) { try { @@ -428,7 +393,7 @@ public class QueryWizard extends WizardDialog CurGroupFieldSelection.initialize(CurDBMetaData.getUniqueAggregateFieldNames(), false, CurDBMetaData.xDBMetaData.getMaxColumnsInGroupBy()); CurGroupFieldSelection.intializeSelectedFields(CurDBMetaData.NonAggregateFieldNames); CurGroupFieldSelection.setMultipleMode(false); - setStepEnabled(SOGROUPFILTERPAGE, CurAggregateComponent.isGroupingpossible() && CurDBMetaData.NonAggregateFieldNames.length > 0); + setStepEnabled(SOGROUPFILTER_PAGE, CurAggregateComponent.isGroupingpossible() && CurDBMetaData.NonAggregateFieldNames.length > 0); } } } @@ -492,7 +457,7 @@ public class QueryWizard extends WizardDialog else { boolean bEnabled = (CurGroupFieldSelection.getSelectedFieldNames().length > 0); - Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPFILTERPAGE), "Enabled", new Boolean(bEnabled)); + Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPFILTER_PAGE), "Enabled", new Boolean(bEnabled)); } } @@ -502,17 +467,9 @@ public class QueryWizard extends WizardDialog if (ID == 1) { enableWizardSteps(NewItems); -//! <<<<<<< QueryWizard.java -//! String[] sSelfieldNames = CurDBMetaData.getFieldNames(SelItems, CurDBCommandFieldSelection.getSelectedCommandName()); -//! CurDBCommandFieldSelection.addItemsToFieldsListbox(sSelfieldNames); -//! CurDBMetaData.removeSeveralFieldColumnsByDisplayFieldName(SelItems); -//! // String[] sSelfieldNames = CurDBMetaData.getFieldNames(SelItems); -//! // CurDBCommandFieldSelection.fillUpFieldsListbox(); -//! ======= String[] sSelfieldNames = CurDBMetaData.getFieldNames(SelItems, CurDBCommandFieldSelection.getSelectedCommandName()); CurDBCommandFieldSelection.addItemsToFieldsListbox(sSelfieldNames); CurDBMetaData.removeSeveralFieldColumnsByDisplayFieldName(SelItems); -//! >>>>>>> 1.14 CurDBCommandFieldSelection.toggleCommandListBox(NewItems); } @@ -523,7 +480,7 @@ public class QueryWizard extends WizardDialog if (JavaTools.FieldInList(CurDBMetaData.NonAggregateFieldNames, CurDisplayFieldName) > -1) { showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, resmsgNonNumericAsGroupBy); - CurGroupFieldSelection.xSelFieldsListBox.addItems(SelItems, CurGroupFieldSelection.xSelFieldsListBox.getItemCount()); + CurGroupFieldSelection.xSelectedFieldsListBox.addItems(SelItems, CurGroupFieldSelection.xSelectedFieldsListBox.getItemCount()); String FieldList[] = CurGroupFieldSelection.xFieldsListBox.getItems(); int index = JavaTools.FieldInList(FieldList, CurDisplayFieldName); if (index > -1) @@ -533,7 +490,7 @@ public class QueryWizard extends WizardDialog } else { - Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPFILTERPAGE), "Enabled", new Boolean(bEnabled)); + Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPFILTER_PAGE), "Enabled", new Boolean(bEnabled)); } } } diff --git a/wizards/com/sun/star/wizards/report/DBColumn.java b/wizards/com/sun/star/wizards/report/DBColumn.java index 5377a62168c2..57e46662a2d1 100644 --- a/wizards/com/sun/star/wizards/report/DBColumn.java +++ b/wizards/com/sun/star/wizards/report/DBColumn.java @@ -105,7 +105,7 @@ public class DBColumn bIsGroupColumn = false; if (CurDBMetaData.RecordFieldColumns != null) { - CurDBField = CurDBMetaData.getFieldColumnByFieldName(CurDBMetaData.RecordFieldColumns[i].m_sFieldName); + CurDBField = CurDBMetaData.getFieldColumnByFieldName(CurDBMetaData.RecordFieldColumns[i].getFieldName()); } else { @@ -132,7 +132,7 @@ public class DBColumn XTextRange xTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xCell); String CompString = "Column"; XTextCursor xLocCellCursor = TextDocument.createTextCursor(xCell); - if (isNameCell(xLocCellCursor, CurDBField.m_sFieldName, CompString) || (_bforce)) + if (isNameCell(xLocCellCursor, CurDBField.getFieldName(), CompString) || (_bforce)) { xNameCell = xCell; xNameTextCell = xTextCell; @@ -196,7 +196,7 @@ public class DBColumn xTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xCell); String CompString = TableName.substring(4); XTextCursor xLocCellCursor = TextDocument.createTextCursor(xCell); - if (isNameCell(xLocCellCursor, CurDBField.m_sFieldName, CompString)) + if (isNameCell(xLocCellCursor, CurDBField.getFieldName(), CompString)) { xNameCell = xCell; xNameTextCell = xTextCell; @@ -244,7 +244,7 @@ public class DBColumn } else { - oTextTableHandler.getNumberFormatter().setNumberFormat(xValCell, CurDBField.DBFormatKey, CurDBMetaData.getNumberFormatter()); + oTextTableHandler.getNumberFormatter().setNumberFormat(xValCell, CurDBField.getDBFormatKey(), CurDBMetaData.getNumberFormatter()); } setCellFont(); } @@ -261,7 +261,7 @@ public class DBColumn xTextCursor.gotoStart(false); xTextCursor.gotoEnd(true); xTextCursor.setString(""); - oTextFieldHandler.insertUserField(xTextCursor, CurDBField.m_sFieldName, CurDBField.getFieldTitle()); + oTextFieldHandler.insertUserField(xTextCursor, CurDBField.getFieldName(), CurDBField.getFieldTitle()); } public void insertUserFieldToTableCell(TextFieldHandler oTextFieldHandler, XCell xCell) @@ -270,7 +270,7 @@ public class DBColumn xTextCursor.gotoStart(false); xTextCursor.gotoEnd(true); xTextCursor.setString(""); - oTextFieldHandler.insertUserField(xTextCursor, CurDBField.m_sFieldName, CurDBField.getFieldTitle()); + oTextFieldHandler.insertUserField(xTextCursor, CurDBField.getFieldName(), CurDBField.getFieldTitle()); } public void formatValueCell() @@ -284,7 +284,7 @@ public class DBColumn private boolean checkforLeftAlignment() { - bAlignLeft = ((CurDBField.bIsNumberFormat) && (ValColumn == xTableColumns.getCount() - 1)); + bAlignLeft = ((CurDBField.isNumberFormat()) && (ValColumn == xTableColumns.getCount() - 1)); return bAlignLeft; } @@ -364,9 +364,9 @@ public class DBColumn try { Object CurGroupValue; - if (bIsGroupColumn == false && CurDBField.bIsNumberFormat == false) + if (bIsGroupColumn == false && CurDBField.isNumberFormat() == false) { - CurGroupValue = BlindtextCreator.adjustBlindTextlength(CurDBField.getFieldTitle(), CurDBField.FieldWidth, _bIsLandscape, bIsGroupColumn, CurDBMetaData.getRecordFieldNames()); + CurGroupValue = BlindtextCreator.adjustBlindTextlength(CurDBField.getFieldTitle(), CurDBField.getFieldWidth(), _bIsLandscape, bIsGroupColumn, CurDBMetaData.getRecordFieldNames()); } else { @@ -378,7 +378,9 @@ public class DBColumn Helper.setUnoPropertyValue(xValCellCursor, "ParaAdjust", new Integer(ParagraphAdjust.LEFT_value)); } - if ((CurDBField.FieldType == com.sun.star.sdbc.DataType.BIT) || (CurDBField.FieldType == com.sun.star.sdbc.DataType.BOOLEAN)) + int nFieldType = CurDBField.getFieldType(); + if ((nFieldType == com.sun.star.sdbc.DataType.BIT) || + (nFieldType == com.sun.star.sdbc.DataType.BOOLEAN)) { CharFontName = "StarSymbol"; Helper.setUnoPropertyValue(xValCellCursor, "CharFontName", CharFontName); @@ -414,8 +416,9 @@ public class DBColumn try { XPropertyState xPropertyState; - int FieldType = CurDBField.FieldType; - if ((FieldType == com.sun.star.sdbc.DataType.BIT) || (CurDBField.FieldType == com.sun.star.sdbc.DataType.BOOLEAN)) + int nFieldType = CurDBField.getFieldType(); + if ((nFieldType == com.sun.star.sdbc.DataType.BIT) || + (nFieldType == com.sun.star.sdbc.DataType.BOOLEAN)) { CharFontName = "StarSymbol"; PropertyState = com.sun.star.beans.PropertyState.DIRECT_VALUE; diff --git a/wizards/com/sun/star/wizards/report/Dataimport.java b/wizards/com/sun/star/wizards/report/Dataimport.java index ef8a63146e4e..d0f6c4a0ceca 100644 --- a/wizards/com/sun/star/wizards/report/Dataimport.java +++ b/wizards/com/sun/star/wizards/report/Dataimport.java @@ -33,11 +33,8 @@ import com.sun.star.beans.PropertyValue; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.text.XTextDocument; -import com.sun.star.wizards.db.*; import com.sun.star.wizards.ui.*; import com.sun.star.wizards.common.*; -import com.sun.star.wizards.document.*; -import com.sun.star.wizards.text.*; import com.sun.star.uno.Exception; public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionListener diff --git a/wizards/com/sun/star/wizards/report/GroupFieldHandler.java b/wizards/com/sun/star/wizards/report/GroupFieldHandler.java index 5d4f1199e41b..579ffb43fd67 100644 --- a/wizards/com/sun/star/wizards/report/GroupFieldHandler.java +++ b/wizards/com/sun/star/wizards/report/GroupFieldHandler.java @@ -38,11 +38,11 @@ import java.util.Vector; public class GroupFieldHandler extends FieldSelection { - IReportDocument CurReportDocument; + private IReportDocument CurReportDocument; private Vector GroupFieldVector = new Vector(); - QueryMetaData CurDBMetaData; - WizardDialog oWizardDialog; - static final short MAXSELFIELDS = 4; + private QueryMetaData CurDBMetaData; + private WizardDialog oWizardDialog; + private static final short MAXSELFIELDS = 4; public GroupFieldHandler(IReportDocument _CurReportDocument, WizardDialog _CurUnoDialog) { @@ -128,18 +128,18 @@ public class GroupFieldHandler extends FieldSelection protected void toggleListboxButtons(short iFieldsSelIndex, short iSelFieldsSelIndex) { super.toggleListboxButtons(iFieldsSelIndex, iSelFieldsSelIndex); - int iSelCount = xSelFieldsListBox.getItemCount(); + int iSelCount = xSelectedFieldsListBox.getItemCount(); if (iSelCount >= MAXSELFIELDS) - { + { CurUnoDialog.setControlProperty("cmdMoveSelected" + sIncSuffix, "Enabled", Boolean.FALSE); } } public void selectFields(boolean bMoveAll) { - int iSelCount = xSelFieldsListBox.getItemCount(); + int iSelCount = xSelectedFieldsListBox.getItemCount(); if (iSelCount < MAXSELFIELDS) - { + { super.selectFields(bMoveAll); } @@ -150,18 +150,18 @@ public class GroupFieldHandler extends FieldSelection public void moveItemDown(String Selitem) { - CurReportDocument.refreshGroupFields(xSelFieldsListBox.getItems()); + CurReportDocument.refreshGroupFields(xSelectedFieldsListBox.getItems()); } public void moveItemUp(String item) { - CurReportDocument.refreshGroupFields(xSelFieldsListBox.getItems()); + CurReportDocument.refreshGroupFields(xSelectedFieldsListBox.getItems()); } public void shiftFromLeftToRight(String[] Selitems, String[] Newitems) { String CurGroupTitle = Selitems[0]; - int iSelCount = xSelFieldsListBox.getItemCount(); + int iSelCount = xSelectedFieldsListBox.getItemCount(); String[] CurGroupNames = xFieldsListBox.getItems(); CurReportDocument.liveupdate_addGroupNametoDocument(CurGroupNames, CurGroupTitle, GroupFieldVector, CurReportDocument.getReportPath(), iSelCount); CurUnoDialog.setControlProperty("lblBlindTextNote_1", "Enabled", new Boolean(true)); @@ -177,12 +177,12 @@ public class GroupFieldHandler extends FieldSelection if (iSelPos > 0) { String OldGroupTitle = OldSelitems[0]; - String[] NewSelList = xSelFieldsListBox.getItems(); + String[] NewSelList = xSelectedFieldsListBox.getItems(); CurReportDocument.liveupdate_removeGroupName(NewSelList, OldGroupTitle, GroupFieldVector); - String[] NewSelGroupNames = xSelFieldsListBox.getItems(); + String[] NewSelGroupNames = xSelectedFieldsListBox.getItems(); CurUnoDialog.setControlProperty("lblBlindTextNote_1", "Enabled", new Boolean(NewSelGroupNames.length == 0)); - // CurReportDocument.refreshGroupFields(xSelFieldsListBox.getItems()); + // CurReportDocument.refreshGroupFields(xSelectedFieldsListBox.getItems()); } } diff --git a/wizards/com/sun/star/wizards/report/ReportTextDocument.java b/wizards/com/sun/star/wizards/report/ReportTextDocument.java index ad85ccc5bd77..7e74e3fc685b 100644 --- a/wizards/com/sun/star/wizards/report/ReportTextDocument.java +++ b/wizards/com/sun/star/wizards/report/ReportTextDocument.java @@ -344,7 +344,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen for (int i = 0; i < nSize; i++) { DBColumn CurDBColumn = (DBColumn) DBColumnsVector.elementAt(i); - String sFieldName = CurDBColumn.CurDBField.m_sFieldName; + String sFieldName = CurDBColumn.CurDBField.getFieldName(); if (!sFieldName.equals(_sNewNames[i])) { CurDBColumn.CurDBField = CurDBMetaData.getFieldColumnByDisplayName(_sNewNames[i]); @@ -467,13 +467,13 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen { removeGroupNamesofRecordTable(iSelCount); FieldColumn CurFieldColumn = CurDBMetaData.getFieldColumnByTitle(CurGroupTitle); - GroupFieldVector.addElement(CurFieldColumn.m_sFieldName); + GroupFieldVector.addElement(CurFieldColumn.getFieldName()); GroupCount += 1; try { String sPath = FileAccess.getPathFromList(xMSF, ReportPath, "cnt-default.ott"); oTextSectionHandler.insertTextSection(GROUPSECTION + GroupCount, sPath, GroupCount == 1); - CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, CurFieldColumn.m_sFieldName, GroupCount - 1, TBLGROUPSECTION + (GroupCount)); + CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, CurFieldColumn.getFieldName(), GroupCount - 1, TBLGROUPSECTION + (GroupCount)); CurDBColumn.formatValueCell(); if (CurDBColumn != null) { @@ -500,7 +500,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen { removeGroupNamesofRecordTable(NewSelGroupNames.length + 1); FieldColumn CurFieldColumn = CurDBMetaData.getFieldColumnByTitle(CurGroupTitle); - GroupFieldVector.removeElement(CurFieldColumn.m_sFieldName); + GroupFieldVector.removeElement(CurFieldColumn.getFieldName()); try { oTextSectionHandler.removeLastTextSection(); @@ -610,8 +610,8 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen { FieldColumn oFieldColumn1 = (FieldColumn) _oObject1; FieldColumn oFieldColumn2 = (FieldColumn) _oObject2; - DBColumn oDBColumn1 = getDBColumnByName(oFieldColumn1.m_sFieldName); - DBColumn oDBColumn2 = getDBColumnByName(oFieldColumn2.m_sFieldName); + DBColumn oDBColumn1 = getDBColumnByName(oFieldColumn1.getFieldName()); + DBColumn oDBColumn2 = getDBColumnByName(oFieldColumn2.getFieldName()); if (oDBColumn1.ValColumn < oDBColumn2.ValColumn) { return -1; @@ -631,7 +631,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen for (int i = 0; i < DBColumnsVector.size(); i++) { DBColumn oDBColumn = (DBColumn) DBColumnsVector.get(i); - if (oDBColumn.CurDBField.m_sFieldName.equals(_FieldName)) + if (oDBColumn.CurDBField.getFieldName().equals(_FieldName)) { return oDBColumn; } @@ -647,7 +647,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen for (int i = 0; i < _FieldColumns.length; i++) { FieldColumn CurFieldColumn = _FieldColumns[i]; - if (!CurFieldColumn.m_sFieldName.equals(_FieldName)) + if (!CurFieldColumn.getFieldName().equals(_FieldName)) { aFieldColumns.add(CurFieldColumn); } diff --git a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java index fb45ad376107..3d79c5d2d8ac 100644 --- a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java +++ b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java @@ -257,9 +257,9 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme { getRecordParser().oSQLQueryComposer = new SQLQueryComposer(getRecordParser()); DBMetaData.CommandObject oCommand = getRecordParser().getQueryByName(sQueryName); - if (getRecordParser().hasEscapeProcessing(oCommand.xPropertySet)) + if (getRecordParser().hasEscapeProcessing(oCommand.getPropertySet())) { - getRecordParser().Command = (String) oCommand.xPropertySet.getPropertyValue("Command"); + getRecordParser().Command = (String) oCommand.getPropertySet().getPropertyValue("Command"); getRecordParser().oSQLQueryComposer.m_xQueryAnalyzer.setQuery(getRecordParser().Command); getRecordParser().oSQLQueryComposer.prependSortingCriteria(); } diff --git a/wizards/com/sun/star/wizards/report/ReportWizard.java b/wizards/com/sun/star/wizards/report/ReportWizard.java index 65ec553f6183..a4b4e3af18ad 100644 --- a/wizards/com/sun/star/wizards/report/ReportWizard.java +++ b/wizards/com/sun/star/wizards/report/ReportWizard.java @@ -72,57 +72,57 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple { // XMultiServiceFactory xMSF; // QueryMetaData CurDBMetaData; - FieldSelection CurGroupFieldSelection; - SortingComponent CurSortingComponent; - UnoDialog CurUnoProgressDialog; - TitlesComponent CurTitlesComponent; - CommandFieldSelection CurDBCommandFieldSelection; - GroupFieldHandler CurGroupFieldHandler; - ReportLayouter CurReportLayouter; - ReportFinalizer CurReportFinalizer; - PropertyValue[] DBGPROPERTYVALUE; - String sCommandName = ""; - int nCommandType = -1; - int nReportMode = ReportFinalizer.SOCREATEDOCUMENT; + protected FieldSelection CurGroupFieldSelection; + private SortingComponent CurSortingComponent; + // private UnoDialog CurUnoProgressDialog; + private TitlesComponent CurTitlesComponent; + private CommandFieldSelection CurDBCommandFieldSelection; + private GroupFieldHandler CurGroupFieldHandler; + private ReportLayouter CurReportLayouter; + private ReportFinalizer CurReportFinalizer; + private PropertyValue[] DBGPROPERTYVALUE; + // private String sCommandName = ""; + // private int nCommandType = -1; + private int nReportMode = ReportFinalizer.SOCREATEDOCUMENT; private String m_sReportName = ""; - public static final String SOREPORTFORMNAME = "ReportSource"; - final int SOSELGROUPLST = 33; - final int SOTXTCOLTITLE = 48; - final int SOTITLESCROLLBAR = 49; - public static final int SONULLPAGE = 0; - public static final int SOMAINPAGE = 1; - public static final int SOTITLEPAGE = 2; - public static final int SOGROUPPAGE = 3; - public static final int SOSORTPAGE = 4; - public static final int SOTEMPLATEPAGE = 5; - public static final int SOSTOREPAGE = 6; + protected static final String SOREPORTFORMNAME = "ReportSource"; + // private final int SOSELGROUPLST = 33; + // private final int SOTXTCOLTITLE = 48; + // private final int SOTITLESCROLLBAR = 49; + // private static final int SONULLPAGE = 0; + private static final int SOMAINPAGE = 1; + private static final int SOTITLEPAGE = 2; + protected static final int SOGROUPPAGE = 3; + private static final int SOSORTPAGE = 4; + protected static final int SOTEMPLATEPAGE = 5; + protected static final int SOSTOREPAGE = 6; // ReportTextDocument CurReportDocument; // ReportTextImplementation CurReportDocument; - IReportDocument CurReportDocument; - static String sMsgWizardName; - static String slblFields; - static String slblSelFields; - static String sShowBinaryFields; - static String sGroupings; - String[] WizardHeaderText = new String[6]; - static String[] WizardTitle = new String[6]; - static String sWriterFilterName; - static String slstDatabasesDefaultText; - static String slstTablesDefaultText; - static String sMsgErrorOccured; - static String sMsgSavingImpossible; - static String sMsgNoConnection; + protected IReportDocument CurReportDocument; + private static String sMsgWizardName; + private static String slblFields; + private static String slblSelFields; + private static String sShowBinaryFields; + // private static String sGroupings; + private String[] WizardHeaderText = new String[6]; + // private static String[] WizardTitle = new String[6]; + // private static String sWriterFilterName; + private static String slstDatabasesDefaultText; + private static String slstTablesDefaultText; + private static String sMsgErrorOccured; + private static String sMsgSavingImpossible; + // private static String sMsgNoConnection; // Progress display relevant Strings - static String slblColumnTitles; - static String slblColumnNames; - static String sMsgNoConnectionforDataimport; - static String sMsgQueryCreationImpossible; - public static String sMsgFilePathInvalid; - static String slblTables; + private static String slblColumnTitles; + private static String slblColumnNames; + private static String sMsgNoConnectionforDataimport; + private static String sMsgQueryCreationImpossible; + private static String sMsgFilePathInvalid; + private static String slblTables; // public static String sBlindTextNote; - public static boolean bCloseDocument; - public boolean bHasEscapeProcessing = true; + protected static boolean bCloseDocument; + private boolean bHasEscapeProcessing = true; public ReportWizard(XMultiServiceFactory xMSF) { @@ -133,11 +133,27 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple Helper.setUnoPropertyValues(xDialogModel, new String[] { - "Height", "Moveable", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Title", "Width" + "Height", + "Moveable", + "Name", + "PositionX", + "PositionY", + "Step", + "TabIndex", + "Title", + "Width" }, new Object[] { - new Integer(210), Boolean.TRUE, "DialogReport", new Integer(102), new Integer(41), new Integer(1), new Short((short) 0), sMsgWizardName, new Integer(310) + Integer.valueOf(210), + Boolean.TRUE, + "DialogReport", + new Integer(102), + new Integer(41), + new Integer(1), + new Short((short) 0), + sMsgWizardName, + new Integer(310) }); drawNaviBar(); setRightPaneHeaders(this.WizardHeaderText); @@ -325,8 +341,8 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple { String sQueryName = CurDBCommandFieldSelection.getSelectedCommandName(); DBMetaData.CommandObject oCommand = CurReportDocument.getRecordParser().getQueryByName(sQueryName); - bHasEscapeProcessing = CurReportDocument.getRecordParser().hasEscapeProcessing(oCommand.xPropertySet); - String sCommand = (String) oCommand.xPropertySet.getPropertyValue("Command"); + bHasEscapeProcessing = CurReportDocument.getRecordParser().hasEscapeProcessing(oCommand.getPropertySet()); + String sCommand = (String) oCommand.getPropertySet().getPropertyValue("Command"); if (bHasEscapeProcessing) { // String sCommand = (String) oCommand.xPropertySet.getPropertyValue("Command"); @@ -356,7 +372,7 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple } return bQueryCreated; } - +/* public static void main(String args[]) { String ConnectStr = "uno:socket,host=localhost,port=8107;urp;StarOffice.NamingService"; //localhost ;Lo-1.Germany.sun.com; 10.16.65.155 @@ -388,7 +404,8 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple } System.exit(1); } - +*/ +/* private static void tests(XMultiServiceFactory _xMSF) { try @@ -467,21 +484,25 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple } } +*/ public void buildSteps() { // CurReportDocument.getDoc().xProgressBar.setValue(30); CurDBCommandFieldSelection = new CommandFieldSelection(this, CurReportDocument.getRecordParser(), 100, slblFields, slblSelFields, slblTables, true, 34330); CurDBCommandFieldSelection.addFieldSelectionListener(new FieldSelectionListener()); - insertLabel("lblBinaryFields", - new String[] - { - "Height", "Label", "PositionX", "PositionY", "Step", "Width" - }, - new Object[] - { - new Integer(16), sShowBinaryFields, new Integer(95), new Integer(162), new Integer(1), new Integer(210) - }); + if ( !isReportBuilderInstalled() ) + { + insertLabel("lblBinaryFields", + new String[] + { + "Height", "Label", "PositionX", "PositionY", "Step", "Width" + }, + new Object[] + { + new Integer(16), sShowBinaryFields, new Integer(95), new Integer(162), new Integer(1), new Integer(210) + }); + } // CurReportDocument.getDoc().xProgressBar.setValue(40); CurTitlesComponent = new TitlesComponent(this, SOTITLEPAGE, 97, 37, 210, 7, slblColumnNames, slblColumnTitles, 34381); CurTitlesComponent.addTextListener(this); @@ -501,7 +522,7 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple public void finishWizard() { - int ncurStep = getCurrentStep(); + final int ncurStep = getCurrentStep(); if ((switchToStep(ncurStep, SOSTOREPAGE)) || (ncurStep == SOSTOREPAGE)) { if (this.executeQuery()) @@ -575,7 +596,7 @@ private static void initializeLogger(XMultiServiceFactory _xMSF) { XComponentContext xContext = Helper.getComponentContext(_xMSF); - Object aLoggerPool = xContext.getValueByName("/singletons/com.sun.star.logging.LoggerPool"); + final Object aLoggerPool = xContext.getValueByName("/singletons/com.sun.star.logging.LoggerPool"); if (aLoggerPool == null) { System.out.println("Can't get singleton from logging"); @@ -881,7 +902,7 @@ public static XLogger getLogger() { String sQueryName = CurDBCommandFieldSelection.getSelectedCommandName(); DBMetaData.CommandObject oCommand = CurReportDocument.getRecordParser().getQueryByName(sQueryName); - bdoenable = CurReportDocument.getRecordParser().hasEscapeProcessing(oCommand.xPropertySet); + bdoenable = CurReportDocument.getRecordParser().hasEscapeProcessing(oCommand.getPropertySet()); } super.setStepEnabled(SOSORTPAGE, bdoenable); diff --git a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java index 515d0c635ed0..dad827841e96 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java +++ b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java @@ -31,14 +31,7 @@ ************************************************************************/ package com.sun.star.wizards.reportbuilder; -// import com.sun.star.deployment.XPackageInformationProvider; -// import com.sun.star.lang.Locale; -// import com.sun.star.uno.XComponentContext; import com.sun.star.util.XModeSelector; -// import com.sun.star.wizards.common.PropertySetHelper; -// import com.sun.star.wizards.report.IReportDefinitionReadAccess; -// import com.sun.star.wizards.report.IReportBuilderLayouter; -// import com.sun.star.wizards.report.IReportDocument; import com.sun.star.wizards.report.*; import com.sun.star.awt.XWindowPeer; @@ -59,17 +52,14 @@ import com.sun.star.uno.UnoRuntime; import com.sun.star.util.XURLTransformer; import com.sun.star.wizards.common.Resource; import com.sun.star.wizards.db.FieldColumn; -// import java.io.File; -import java.io.File; import java.lang.reflect.Constructor; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Set; import java.util.Vector; -// import com.sun.star.wizards.ui.UIConsts; import com.sun.star.wizards.common.FileAccess; -// import com.sun.star.wizards.common.Configuration; + /** * This class use the IReportDocument Interface to communicate between the UI * and the ReportBuilderLayouter which communicates to the new Sun Report Builder. @@ -182,6 +172,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper aConnection.Value = _xConnection; args[1] = aConnection; + XReportDefinition xReportDefinition = null; final XMultiServiceFactory xMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, /* getRecordParser().getReportDocuments() */ _aDoc); try @@ -195,7 +186,20 @@ public class ReportBuilderImplementation extends ReportImplementationHelper aCommand.Name = "openDesign"; final com.sun.star.ucb.OpenCommandArgument2 aOpenCommand = new com.sun.star.ucb.OpenCommandArgument2(); aOpenCommand.Mode = com.sun.star.ucb.OpenMode.DOCUMENT; - aCommand.Argument = aOpenCommand; + + PropertyValue args2[] = new PropertyValue[2]; + + PropertyValue aPropOpenCommand = new PropertyValue(); + aPropOpenCommand.Name = ""; + aPropOpenCommand.Value = aOpenCommand; + args2[0] = aPropOpenCommand; + + PropertyValue aAddField = new PropertyValue(); + aAddField.Name = "Mode"; + aAddField.Value = "remote"; + args2[1] = aAddField; + + aCommand.Argument = args2; // com.sun.star.usb.XCommandEnvironment xEnv = new com.sun.star.ucb.XCommandEnvironment(); final Object aObj2 = xProcessor.execute(aCommand, xProcessor.createCommandIdentifier(), null); xReportDefinition = (XReportDefinition) UnoRuntime.queryInterface(XReportDefinition.class, aObj2); @@ -378,7 +382,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper { // removeGroupNamesofRecordTable(iSelCount); final FieldColumn CurFieldColumn = getRecordParser().getFieldColumnByTitle(CurGroupTitle); - GroupFieldVector.addElement(CurFieldColumn.m_sFieldName); + GroupFieldVector.addElement(CurFieldColumn.getFieldName()); } return true; } @@ -396,7 +400,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper { // throw new UnsupportedOperationException("Not supported yet."); final FieldColumn CurFieldColumn = getRecordParser().getFieldColumnByTitle(CurGroupTitle); - GroupFieldVector.removeElement(CurFieldColumn.m_sFieldName); + GroupFieldVector.removeElement(CurFieldColumn.getFieldName()); } private void setPageOrientation(int nOrientation, boolean bDoLayout) @@ -602,8 +606,8 @@ public class ReportBuilderImplementation extends ReportImplementationHelper int[] FieldWidths = new int[FieldNames.length]; for (int i = 0; i < FieldNames.length; i++) { - FieldTypes[i] = a.FieldColumns[i].FieldType; - FieldWidths[i] = a.FieldColumns[i].FieldWidth; + FieldTypes[i] = a.FieldColumns[i].getFieldType(); + FieldWidths[i] = a.FieldColumns[i].getFieldWidth(); } getReportBuilderLayouter().setTableName(_nType, TableName); // getReportBuilderLayouter().insertFields(getRecordParser().getRecordFieldNames()); diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java index 1488a9ca32a5..8ab20bb35e81 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java @@ -94,9 +94,10 @@ public class ColumnarSingleColumn extends ReportBuilderLayouter aRect = insertLabel(xSection, sLabel, aRect, nLabelWidth, aSOLabel); final String sFieldName = convertToFieldName(aFieldNames[i]); aRect = insertFormattedField(xSection, sFieldName, aRect, nWidth, aSOTextField); - aRect.Y += aSOLabel.getHeight(500); + int nHeight = aRect.Height; + aRect.Y += Math.max(aSOLabel.getHeight(LayoutConstants.LabelHeight), nHeight); } - aRect.Y += aSOLabel.getHeight(500); // one empty line + aRect.Y += aSOLabel.getHeight(LayoutConstants.EmptyLineHeight); // one empty line xSection.setHeight(aRect.Y); doNotBreakInTable(xSection); } diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java index 98147e93c095..372e8b596f2f 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java @@ -108,6 +108,7 @@ public class ColumnarTwoColumns extends ReportBuilderLayouter final SectionObject aSOLabel = getDesignTemplate().getDetailLabel(); aSOLabel.setFontToBold(); final SectionObject aSOTextField = getDesignTemplate().getDetailTextField(); + int nMaxHeight = 0; for (int x = 0; x < _nColumns; x++) { aRect.Y = 0; @@ -120,13 +121,15 @@ public class ColumnarTwoColumns extends ReportBuilderLayouter aRect = insertLabel(xSection, sLabel, aRect, nLabelWidth, aSOLabel); final String sFieldName = convertToFieldName(aFieldNames[i]); aRect = insertFormattedField(xSection, sFieldName, aRect, nWidth, aSOTextField); - aRect.Y += aSOLabel.getHeight(500); + + aRect.Y += Math.max(aSOLabel.getHeight(LayoutConstants.LabelHeight), aRect.Height); ++i; } } + nMaxHeight = Math.max(aRect.Y, nMaxHeight); } - aRect.Y = aSOLabel.getHeight(500) * nRows; - aRect.Y += aSOLabel.getHeight(500); // one empty line + aRect.Y = Math.max(aSOLabel.getHeight(LayoutConstants.LabelHeight) * nRows, nMaxHeight); + aRect.Y += aSOLabel.getHeight(LayoutConstants.EmptyLineHeight); // one empty line xSection.setHeight(aRect.Y); doNotBreakInTable(xSection); } diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java index df5228e18e4d..9d56cc8fc31c 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java @@ -91,7 +91,7 @@ public class InBlocksLabelsAbove extends ColumnarTwoColumns aRectLabels.Y = 0; aRectLabels.X = getLeftPageIndent() + getLeftGroupIndent(getCountOfGroups()); - aRectFields.Y = 500; + aRectFields.Y = LayoutConstants.LabelHeight; aRectFields.X = getLeftPageIndent() + getLeftGroupIndent(getCountOfGroups()); // first run only calculates the width. @@ -129,10 +129,11 @@ public class InBlocksLabelsAbove extends ColumnarTwoColumns aSOLabel.setFontToBold(); final SectionObject aSOTextField = getDesignTemplate().getDetailTextField(); - aRectFields.Y = aSOLabel.getHeight(500); + aRectFields.Y = aSOLabel.getHeight(LayoutConstants.LabelHeight); aRectFields.X = getLeftPageIndent() + getLeftGroupIndent(getCountOfGroups()); i = 0; nCount = aFieldTitleNames.length; + int nLastHeight = 0; while (nCount > 0) { final String sLabel = aFieldTitleNames[i]; @@ -141,21 +142,23 @@ public class InBlocksLabelsAbove extends ColumnarTwoColumns final String sFieldName = convertToFieldName(aFieldNames[i]); nFieldWidth = 3000 + nDelta; aRectFields = insertFormattedField(xSection, sFieldName, aRectFields, nFieldWidth, aSOTextField); - + nLastHeight = Math.max(nLastHeight, aRectFields.Height); int nNextX = aRectFields.X + nFieldWidth; if (nNextX > (getPageWidth() - getRightPageIndent()) & nCount > 1) { - aRectLabels.Y += (2 * aSOLabel.getHeight(500)); // 2 * label height + int nHeight = (aSOLabel.getHeight(LayoutConstants.LabelHeight) + Math.max(aSOTextField.getHeight(LayoutConstants.FormattedFieldHeight), nLastHeight)); + nLastHeight = 0; + aRectLabels.Y += nHeight; // 2 * label height aRectLabels.X = getLeftPageIndent() + getLeftGroupIndent(getCountOfGroups()); - aRectFields.Y += (2 * aSOTextField.getHeight(500)); + aRectFields.Y += nHeight; aRectFields.X = getLeftPageIndent() + getLeftGroupIndent(getCountOfGroups()); } ++i; --nCount; } - aRectFields.Y += aSOTextField.getHeight(500); - aRectFields.Y += aSOTextField.getHeight(500); // one empty line + aRectFields.Y += Math.max(aSOTextField.getHeight(LayoutConstants.FormattedFieldHeight), nLastHeight); + aRectFields.Y += aSOTextField.getHeight(LayoutConstants.EmptyLineHeight); // one empty line xSection.setHeight(aRectFields.Y); doNotBreakInTable(xSection); } diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java index f6f93e11e574..6a3d8602668c 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java @@ -104,6 +104,7 @@ public class InBlocksLabelsLeft extends ColumnarTwoColumns SectionObject aSOLabel = getDesignTemplate().getDetailLabel(); aSOLabel.setFontToBold(); SectionObject aSOTextField = getDesignTemplate().getDetailTextField(); + int nLastHeight = 0; while (nCount > 0) { final String sLabel = aFieldTitleNames[i]; @@ -112,18 +113,19 @@ public class InBlocksLabelsLeft extends ColumnarTwoColumns final String sFieldName = convertToFieldName(aFieldNames[i]); nFieldWidth = 3000 + nDelta; aRectLabelFields = insertFormattedField(xSection, sFieldName, aRectLabelFields, nFieldWidth, aSOTextField); - + nLastHeight = Math.max(aRectLabelFields.Height, nLastHeight); final int nNextX = aRectLabelFields.X + nLabelWidth + nFieldWidth; if (nNextX > (getPageWidth() - getRightPageIndent())) { // TODO: label height is fix - aRectLabelFields.Y += aSOTextField.getHeight(500); + aRectLabelFields.Y += Math.max(aSOTextField.getHeight(LayoutConstants.FormattedFieldHeight), nLastHeight); + nLastHeight = 0; aRectLabelFields.X = getLeftPageIndent() + getLeftGroupIndent(getCountOfGroups()); } ++i; --nCount; } - aRectLabelFields.Y += aSOLabel.getHeight(500); // one empty line + aRectLabelFields.Y += Math.max(aSOLabel.getHeight(LayoutConstants.EmptyLineHeight), nLastHeight); // one empty line xSection.setHeight(aRectLabelFields.Y); doNotBreakInTable(xSection); } diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/LayoutConstants.java b/wizards/com/sun/star/wizards/reportbuilder/layout/LayoutConstants.java new file mode 100644 index 000000000000..127f26e02a78 --- /dev/null +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/LayoutConstants.java @@ -0,0 +1,56 @@ +/* + * *********************************************************************** + * + * 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: InBlocksLabelsLeft.java,v $ + * + * $Revision: 1.2.36.1 $ + * + * 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. + * + * ********************************************************************** + */ + +package com.sun.star.wizards.reportbuilder.layout; + +/** + * + * @author ll93751 + */ +public class LayoutConstants +{ + public static final int LabelHeight = 500; + public static final int FormattedFieldHeight = 500; + public static final int EmptyLineHeight = 500; + + public static final int BinaryHeight = 4000; + public static final int MemoFieldHeight = 4000; + + public static final int LineHeight = 250; + + /** + * Groups will indent + * This is the factor (5mm) which will multiply with the current indent + */ + public static final int IndentFactorWidth = 500; +} diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java index 7b0c69c51115..891a57b30fb4 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java @@ -42,6 +42,7 @@ import com.sun.star.awt.XWindow; import com.sun.star.awt.XWindowPeer; import com.sun.star.beans.Property; import com.sun.star.beans.PropertyAttribute; +import com.sun.star.beans.UnknownPropertyException; import com.sun.star.beans.XPropertySet; import com.sun.star.beans.XPropertySetInfo; import com.sun.star.container.XEnumeration; @@ -53,10 +54,13 @@ import com.sun.star.report.XFixedText; import com.sun.star.report.XFormattedField; import com.sun.star.report.XGroup; import com.sun.star.report.XGroups; +import com.sun.star.report.XImageControl; import com.sun.star.report.XReportComponent; +import com.sun.star.report.XReportControlModel; import com.sun.star.report.XReportDefinition; import com.sun.star.report.XSection; import com.sun.star.drawing.XShape; +import com.sun.star.sdbc.DataType; import com.sun.star.style.XStyle; import com.sun.star.uno.UnoRuntime; import com.sun.star.util.XNumberFormatTypes; @@ -238,11 +242,11 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter final int MAX_INDENT = 2; if (_nGroupCount <= MAX_INDENT) { - nIndent = _nGroupCount * 500; + nIndent = _nGroupCount * LayoutConstants.IndentFactorWidth; } else { - nIndent = MAX_INDENT * 500; + nIndent = MAX_INDENT * LayoutConstants.IndentFactorWidth; } return nIndent; } @@ -434,7 +438,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter int nLabelHeight = 0; // if (aSO != null) // { - nLabelHeight = aSO.getHeight(500); + nLabelHeight = aSO.getHeight(LayoutConstants.LabelHeight); aRect = insertLabel(xGroupSection, getTitleFromFieldName(m_aGroupNames[i]), aRect, nLabelWidth, aSO); // } // else @@ -450,7 +454,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter aRect.X = nLeftPageIndent + getLeftGroupIndent(i); aRect.Y = nLabelHeight; final int nLineWidth = getPageWidth() - getRightPageIndent() - aRect.X; - final int nLineHeight = 250; + final int nLineHeight = LayoutConstants.LineHeight; insertHorizontalLine(xGroupSection, aRect, nLineWidth, nLineHeight); xGroupSection.setHeight(nLabelHeight + nLineHeight); } @@ -490,6 +494,18 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter return ""; } + protected int getTypeFromFieldName(String _sField) + { + for (int i = 0; i < m_aFieldNames.length; i++) + { + if (m_aFieldNames[i].equals(_sField)) + { + return m_aFieldTypes[i]; + } + } + return 0; + } + protected boolean listContains(String[] _aList, String _aValue) { for (int i = 0; i < _aList.length; i++) @@ -631,7 +647,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter final XFixedText xFixedText = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, aFixedText); - int nHeight = 500; // default height of label is fixed. + int nHeight = LayoutConstants.LabelHeight; // default height of label is fixed. if (_aSO != null) { if (_aSO instanceof SectionEmptyObject) @@ -651,7 +667,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter xFixedText.setFontDescriptor(aFD); copyProperties(_aSO.getParent(), xFixedText); } - nHeight = _aSO.getHeight(500); + nHeight = _aSO.getHeight(LayoutConstants.LabelHeight); } } xFixedText.setLabel(_sLabel); @@ -682,6 +698,16 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter return aDataField.toString(); } + protected String convertFromFieldName(String _sName) + { + if (_sName.startsWith("field:[")) + { + int nCloseBrace = _sName.lastIndexOf("]"); + final String sName = _sName.substring(7, nCloseBrace).trim(); + return sName; + } + return _sName; + } // ------------------------------------------------------------------------- /** * Insert a already formatted field name into a given section @@ -706,45 +732,96 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter { try { - final Object aFormattedField = getMSFofReportDefinition().createInstance("com.sun.star.report.FormattedField"); - final XFormattedField xFormattedField = (XFormattedField) UnoRuntime.queryInterface(XFormattedField.class, aFormattedField); - // #i86907# not documented right in idl description. - xFormattedField.setDataField(_sFormattedfield); - int nHeight = 500; - if (_aSO != null) + Object aField; + int nHeight = LayoutConstants.FormattedFieldHeight; + + int nType = getTypeFromFieldName(convertFromFieldName(_sFormattedfield)); + if (nType == DataType.BINARY || + nType == DataType.VARBINARY || + nType == DataType.LONGVARBINARY) { -// TODO: there seems to be some problems with copy all properties from the design template to the current design - final FontDescriptor aFD = _aSO.getFontDescriptor(); - if (aFD != null) + aField = getMSFofReportDefinition().createInstance("com.sun.star.report.ImageControl"); + nHeight = LayoutConstants.BinaryHeight; + } + else + { + aField = getMSFofReportDefinition().createInstance("com.sun.star.report.FormattedField"); + nHeight = LayoutConstants.FormattedFieldHeight; + if (nType == DataType.LONGVARCHAR) /* memo */ { - xFormattedField.setFontDescriptor(aFD); - copyProperties(_aSO.getParent(), xFormattedField); + nHeight = LayoutConstants.MemoFieldHeight; // special case for memo } - nHeight = _aSO.getHeight(500); } - xFormattedField.setPositionX(_aRect.X); - xFormattedField.setPositionY(_aRect.Y); - xFormattedField.setWidth(_nWidth); - _aRect.X += _nWidth; - xFormattedField.setHeight(nHeight); - - xFormattedField.setParaAdjust(_nAlignment); + _aRect.Height = nHeight; - // spezial case rpt:now() (default date format) - if (_sFormattedfield.equals("rpt:now()")) + final XReportControlModel xReportControlModel = (XReportControlModel) UnoRuntime.queryInterface(XReportControlModel.class, aField); + if (xReportControlModel != null) { - XNumberFormatsSupplier x = xFormattedField.getFormatsSupplier(); - XNumberFormats xFormats = x.getNumberFormats(); - XNumberFormatTypes x3 = (XNumberFormatTypes) UnoRuntime.queryInterface(XNumberFormatTypes.class, xFormats); - Locale.getDefault(); - com.sun.star.lang.Locale aLocale = new com.sun.star.lang.Locale(); - aLocale.Country = Locale.getDefault().getCountry(); - aLocale.Language = Locale.getDefault().getLanguage(); - - int nFormat = x3.getStandardFormat(com.sun.star.util.NumberFormat.DATE, aLocale); - xFormattedField.setFormatKey(nFormat); + // #i86907# not documented right in idl description. + xReportControlModel.setDataField(_sFormattedfield); + if (_aSO != null) + { + // TODO: there seems to be some problems with copy all properties from the design template to the current design + final FontDescriptor aFD = _aSO.getFontDescriptor(); + if (aFD != null) + { + xReportControlModel.setFontDescriptor(aFD); + copyProperties(_aSO.getParent(), xReportControlModel); + } + nHeight = _aSO.getHeight(nHeight); + } + xReportControlModel.setPositionX(_aRect.X); + xReportControlModel.setPositionY(_aRect.Y); + xReportControlModel.setWidth(_nWidth); + _aRect.X += _nWidth; + xReportControlModel.setHeight(nHeight); + + if (nType == DataType.BINARY || + nType == DataType.VARBINARY || + nType == DataType.LONGVARBINARY) + { + // aField = getMSFofReportDefinition().createInstance("com.sun.star.report.ImageControl"); + final XImageControl xImageControl = (XImageControl) UnoRuntime.queryInterface(XImageControl.class, xReportControlModel); + if (xImageControl != null) + { + // xImageControl.setScaleImage(true); + + xImageControl.setScaleMode(com.sun.star.awt.ImageScaleMode.Isotropic); + } + } + else + { + try + { + xReportControlModel.setParaAdjust(_nAlignment); + // if (nType == DataType.LONGVARCHAR) + // { + // xReportControlModel.??? + // } + } + catch (com.sun.star.beans.UnknownPropertyException e) + { + // seems we not able to set ParaAdjust + } + } + // spezial case rpt:now() (default date format) + if (_sFormattedfield.equals("rpt:now()")) + { + final XFormattedField xFormattedField = (XFormattedField) UnoRuntime.queryInterface(XFormattedField.class, xReportControlModel); + + XNumberFormatsSupplier x = xFormattedField.getFormatsSupplier(); + XNumberFormats xFormats = x.getNumberFormats(); + XNumberFormatTypes x3 = (XNumberFormatTypes) UnoRuntime.queryInterface(XNumberFormatTypes.class, xFormats); + Locale.getDefault(); + com.sun.star.lang.Locale aLocale = new com.sun.star.lang.Locale(); + aLocale.Country = Locale.getDefault().getCountry(); + aLocale.Language = Locale.getDefault().getLanguage(); + + int nFormat = x3.getStandardFormat(com.sun.star.util.NumberFormat.DATE, aLocale); + xFormattedField.setFormatKey(nFormat); + } + _xSection.add(xReportControlModel); } - _xSection.add(xFormattedField); } catch (com.sun.star.uno.Exception e) { @@ -1253,7 +1330,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter aRect.X = getLeftPageIndent(); SectionObject aSOLabel = SectionEmptyObject.create(); aSOLabel.setFontToBold(); - aRect.Y = aSOLabel.getHeight(500); + aRect.Y = aSOLabel.getHeight(LayoutConstants.LabelHeight); final int nWidth = 3000; @@ -1263,26 +1340,26 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter // aRect = insertFormattedField(xSection, "rpt:Title()", aRect, nTitleWidth); aRect = insertLabel(xSection, sTitle, aRect, nTitleWidth, aSOLabel); - aRect.Y += aSOLabel.getHeight(500) + 250; + aRect.Y += aSOLabel.getHeight(LayoutConstants.LabelHeight) + LayoutConstants.LineHeight; aRect.X = getLeftPageIndent(); aRect = insertLabel(xSection, sAuthorTitle, aRect, nWidth, aSOLabel); // aRect = insertFormattedField(xSection, "rpt:Author()", aRect, nWidth); aRect = insertLabel(xSection, sAuthor, aRect, nTitleWidth, aSOLabel); - aRect.Y += aSOLabel.getHeight(500); + aRect.Y += aSOLabel.getHeight(LayoutConstants.LabelHeight); aRect.X = getLeftPageIndent(); aRect = insertLabel(xSection, sDateTitle, aRect, nWidth, aSOLabel); // aRect = insertFormattedField(xSection, "rpt:Date()", aRect, nWidth); aRect = insertFormattedField(xSection, sDate, aRect, nTitleWidth, aSOLabel); - aRect.Y += aSOLabel.getHeight(500) + 250; + aRect.Y += aSOLabel.getHeight(LayoutConstants.FormattedFieldHeight) + LayoutConstants.LineHeight; // draw a line under the label/formattedfield aRect.X = getLeftPageIndent(); final int nLineWidth = getPageWidth() - getRightPageIndent() - aRect.X; - final int nLineHeight = 250; + final int nLineHeight = LayoutConstants.LineHeight; insertHorizontalLine(xSection, aRect, nLineWidth, nLineHeight); aRect.Y += nLineHeight; @@ -1366,18 +1443,18 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter // draw a line over the label/formattedfield final int nLineWidth = getPageWidth() - getRightPageIndent() - aRect.X; - final int nLineHeight = 250; + final int nLineHeight = LayoutConstants.LineHeight; insertHorizontalLine(xSection, aRect, nLineWidth, nLineHeight); aRect.Y += nLineHeight; - aRect.Y += 500; + aRect.Y += LayoutConstants.LabelHeight; final int nWidth = nUsablePageWidth; aRect.X = getLeftPageIndent(); aRect = insertFormattedField(xSection, "rpt:" + sNoFirstUnusedQuotes, aRect, nWidth, null, (short) com.sun.star.awt.TextAlign.CENTER); - aRect.Y += 500 + 250; + aRect.Y += LayoutConstants.FormattedFieldHeight + LayoutConstants.LineHeight; xSection.setHeight(aRect.Y); } catch (Exception e) diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java index 2bdc2cf8c929..caae8481ef10 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java @@ -68,7 +68,7 @@ abstract public class SectionObject public int getHeight(int _nDefault) { - final int nHeight = getPropertySetHelper().getPropertyValueAsInteger("Height", 500); + final int nHeight = getPropertySetHelper().getPropertyValueAsInteger("Height", _nDefault); return nHeight; } diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java b/wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java index b5ebc38a0453..e0dadcb3d567 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java @@ -85,13 +85,14 @@ public class Tabular extends ReportBuilderLayouter final int nWidth = calculateFieldWidth(getLeftGroupIndent(getCountOfGroups()), aFieldNames.length); final SectionObject aSO = getDesignTemplate().getDetailTextField(); - + int nHeight = LayoutConstants.FormattedFieldHeight; for (int i = 0; i < aFieldNames.length; i++) { final String sFieldName = convertToFieldName(aFieldNames[i]); aRect = insertFormattedField(xSection, sFieldName, aRect, nWidth, aSO); + nHeight = Math.max(aRect.Height, nHeight); } - int nHeight = aSO.getHeight(500); + nHeight = Math.max(aSO.getHeight(nHeight), nHeight); xSection.setHeight(nHeight); } @@ -141,14 +142,14 @@ public class Tabular extends ReportBuilderLayouter // TODO: getCountOfGroups() == nGroups??? aRect.X = getLeftPageIndent() + getLeftGroupIndent(getCountOfGroups()); // TODO: group line is fix - aRect.Y = aSO.getHeight(500) + 250; // group height + a little empty line + aRect.Y = aSO.getHeight(LayoutConstants.LabelHeight) + LayoutConstants.LineHeight; // group height + a little empty line final int nWidth = calculateFieldWidth(getLeftGroupIndent(getCountOfGroups()), aFieldTitleNames.length); for (int i = 0; i < aFieldTitleNames.length; i++) { aRect = insertLabel(xSection, aFieldTitleNames[i], aRect, nWidth, aSO); } - xSection.setHeight(aSO.getHeight(500) + 250 + aSO.getHeight(500)); + xSection.setHeight(aSO.getHeight(LayoutConstants.LabelHeight) + LayoutConstants.LineHeight + aSO.getHeight(LayoutConstants.LabelHeight)); } catch (com.sun.star.uno.Exception e) { diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/makefile.mk b/wizards/com/sun/star/wizards/reportbuilder/layout/makefile.mk index 5961467b2dcc..0bf60e0ba3d7 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/makefile.mk +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/makefile.mk @@ -53,6 +53,7 @@ JARCLASSDIRS = \ # --- Files -------------------------------------------------------- JAVAFILES= \ + LayoutConstants.java \ ReportBuilderLayouter.java \ Tabular.java \ ColumnarSingleColumn.java \ diff --git a/wizards/com/sun/star/wizards/table/CGCategory.java b/wizards/com/sun/star/wizards/table/CGCategory.java index ba5e9a0be31b..4179011cb368 100644 --- a/wizards/com/sun/star/wizards/table/CGCategory.java +++ b/wizards/com/sun/star/wizards/table/CGCategory.java @@ -29,17 +29,11 @@ ************************************************************************/ package com.sun.star.wizards.table; -import com.sun.star.container.NoSuchElementException; import com.sun.star.container.XNameAccess; -import com.sun.star.lang.Locale; -import com.sun.star.lang.WrappedTargetException; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; import com.sun.star.wizards.common.Configuration; -import com.sun.star.wizards.common.Desktop; -import com.sun.star.wizards.common.Helper; -import com.sun.star.wizards.common.Properties; /** * @author Administrator diff --git a/wizards/com/sun/star/wizards/table/CGTable.java b/wizards/com/sun/star/wizards/table/CGTable.java index 50e12debb279..0090eb38dc76 100644 --- a/wizards/com/sun/star/wizards/table/CGTable.java +++ b/wizards/com/sun/star/wizards/table/CGTable.java @@ -29,16 +29,10 @@ ************************************************************************/ package com.sun.star.wizards.table; -import com.sun.star.awt.XListBox; -import com.sun.star.container.NoSuchElementException; import com.sun.star.container.XNameAccess; -import com.sun.star.lang.WrappedTargetException; import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.wizards.common.ConfigGroup; import com.sun.star.wizards.common.Configuration; import com.sun.star.wizards.common.Desktop; -import com.sun.star.wizards.common.Helper; public class CGTable { diff --git a/wizards/com/sun/star/wizards/table/FieldDescription.java b/wizards/com/sun/star/wizards/table/FieldDescription.java index 3cb22c7535ea..7c4b2bcaa409 100644 --- a/wizards/com/sun/star/wizards/table/FieldDescription.java +++ b/wizards/com/sun/star/wizards/table/FieldDescription.java @@ -29,20 +29,15 @@ ************************************************************************/ package com.sun.star.wizards.table; -import java.util.Hashtable; import java.util.Vector; import com.sun.star.beans.PropertyValue; -import com.sun.star.beans.UnknownPropertyException; import com.sun.star.beans.XPropertySet; import com.sun.star.container.XNameAccess; import com.sun.star.lang.Locale; -import com.sun.star.lang.WrappedTargetException; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; -import com.sun.star.wizards.common.ConfigGroup; import com.sun.star.wizards.common.Configuration; -import com.sun.star.wizards.common.Desktop; import com.sun.star.wizards.common.Properties; public class FieldDescription @@ -184,4 +179,4 @@ public class FieldDescription } return null; } -}
\ No newline at end of file +} diff --git a/wizards/com/sun/star/wizards/table/FieldFormatter.java b/wizards/com/sun/star/wizards/table/FieldFormatter.java index faa736977679..1990eefda006 100644 --- a/wizards/com/sun/star/wizards/table/FieldFormatter.java +++ b/wizards/com/sun/star/wizards/table/FieldFormatter.java @@ -31,31 +31,17 @@ package com.sun.star.wizards.table; import com.sun.star.awt.FontDescriptor; import com.sun.star.awt.ItemEvent; -import com.sun.star.awt.TextEvent; -import com.sun.star.awt.VclWindowPeerAttribute; import com.sun.star.awt.XButton; import com.sun.star.awt.XItemListener; import com.sun.star.awt.XListBox; import com.sun.star.awt.XTextComponent; -import com.sun.star.awt.XTextListener; -import com.sun.star.beans.Property; -import com.sun.star.beans.PropertyVetoException; -import com.sun.star.beans.UnknownPropertyException; import com.sun.star.beans.XPropertySet; import com.sun.star.lang.EventObject; -import com.sun.star.lang.IllegalArgumentException; -import com.sun.star.lang.WrappedTargetException; -import com.sun.star.sdbc.DataType; -import com.sun.star.sdbc.SQLException; -import com.sun.star.uno.Any; -import com.sun.star.uno.AnyConverter; import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; -import com.sun.star.wizards.common.Configuration; import com.sun.star.wizards.common.Desktop; import com.sun.star.wizards.common.Helper; import com.sun.star.wizards.db.TableDescriptor; -import com.sun.star.wizards.ui.PeerConfig; import com.sun.star.wizards.ui.UIConsts; import com.sun.star.wizards.ui.UnoDialog; @@ -241,7 +227,7 @@ public class FieldFormatter implements XItemListener boolean benableShiftUpButton = false; boolean benableShiftDownButton = false; boolean bfieldnameisselected = Helper.getUnoArrayPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems") != null; - int ilistcount = UnoDialog.getListBoxItemCount(xlstFieldNames); + int ilistcount = /* xlstFieldNames.getItemCount();*/ UnoDialog.getListBoxItemCount(xlstFieldNames); boolean blistispopulated = (ilistcount > 0); if (bfieldnameisselected) { @@ -283,7 +269,7 @@ public class FieldFormatter implements XItemListener String fieldname = fieldnames[ipos]; xlstFieldNames.removeItems(ipos, (short) 1); CurUnoDialog.fielditems.remove(fieldname); - int ilistcount = UnoDialog.getListBoxItemCount(xlstFieldNames); + int ilistcount = /* xlstFieldNames.getItemCount();*/ UnoDialog.getListBoxItemCount(xlstFieldNames); if ((ipos) < ilistcount) { Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[] diff --git a/wizards/com/sun/star/wizards/table/Finalizer.java b/wizards/com/sun/star/wizards/table/Finalizer.java index dec58408d2fc..f25ad3152911 100644 --- a/wizards/com/sun/star/wizards/table/Finalizer.java +++ b/wizards/com/sun/star/wizards/table/Finalizer.java @@ -29,28 +29,13 @@ ************************************************************************/ package com.sun.star.wizards.table; -import com.sun.star.awt.FocusEvent; -import com.sun.star.awt.TextEvent; -import com.sun.star.awt.VclWindowPeerAttribute; -import com.sun.star.awt.XFocusListener; import com.sun.star.awt.XListBox; import com.sun.star.awt.XRadioButton; import com.sun.star.awt.XTextComponent; -import com.sun.star.awt.XTextListener; -import com.sun.star.awt.XWindow; -import com.sun.star.beans.UnknownPropertyException; -import com.sun.star.lang.EventObject; -import com.sun.star.lang.WrappedTargetException; import com.sun.star.sdbc.SQLException; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.wizards.common.Configuration; import com.sun.star.wizards.common.Desktop; -import com.sun.star.wizards.common.Helper; import com.sun.star.wizards.common.JavaTools; -import com.sun.star.wizards.common.SystemDialog; -import com.sun.star.wizards.db.DBMetaData; import com.sun.star.wizards.db.TableDescriptor; -import com.sun.star.wizards.ui.UIConsts; import com.sun.star.wizards.ui.*; public class Finalizer @@ -148,7 +133,7 @@ public class Finalizer }, new Object[] { - Boolean.TRUE, new Integer(12), "HID:41244", new Short("7"), new Integer(nListBoxPosX), new Integer(62), IFINALSTEP, sCatalogNames, new Short(curtabindex++), new Integer(80) + Boolean.TRUE, new Integer(12), "HID:41244", new Short(UnoDialog.getListBoxLineCount()), new Integer(nListBoxPosX), new Integer(62), IFINALSTEP, sCatalogNames, new Short(curtabindex++), new Integer(80) }); int isel = JavaTools.FieldInList(sCatalogNames, sCatalog); if (isel < 0) @@ -178,7 +163,7 @@ public class Finalizer String sSchema = ""; try { - sSchema = (String) curtabledescriptor.xDataSourcePropertySet.getPropertyValue("User"); + sSchema = (String) curtabledescriptor.getDataSourcePropertySet().getPropertyValue("User"); } catch (Exception e1) { @@ -203,7 +188,7 @@ public class Finalizer }, new Object[] { - Boolean.TRUE, new Integer(12), "HID:41245", new Short("7"), new Integer(nListBoxPosX), new Integer(62), IFINALSTEP, sSchemaNames, new Short(curtabindex++), new Integer(80) + Boolean.TRUE, new Integer(12), "HID:41245", new Short(UnoDialog.getListBoxLineCount()), new Integer(nListBoxPosX), new Integer(62), IFINALSTEP, sSchemaNames, new Short(curtabindex++), new Integer(80) }); int isel = JavaTools.FieldInList(sSchemaNames, sSchema); if (isel < 0) @@ -321,7 +306,7 @@ public class Finalizer { if (txtTableName.getText().equals("")) { - String ssuffix = Desktop.getIncrementSuffix(curtabledescriptor.xTableNames, getComposedTableName(_tablename)); + String ssuffix = Desktop.getIncrementSuffix(curtabledescriptor.getTableNamesAsNameAccess(), getComposedTableName(_tablename)); txtTableName.setText(_tablename + ssuffix); setCompletionFlag(); } diff --git a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java index 2e896ebc3c2d..afedae2fb7ad 100644 --- a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java +++ b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java @@ -33,47 +33,41 @@ import com.sun.star.awt.XCheckBox; import com.sun.star.awt.XFixedText; import com.sun.star.awt.XListBox; import com.sun.star.awt.XRadioButton; -import com.sun.star.awt.XTextComponent; -import com.sun.star.beans.UnknownPropertyException; import com.sun.star.beans.XPropertySet; import com.sun.star.lang.IllegalArgumentException; -import com.sun.star.lang.WrappedTargetException; -import com.sun.star.sdbc.DataType; import com.sun.star.uno.AnyConverter; import com.sun.star.wizards.common.Helper; import com.sun.star.wizards.common.JavaTools; -import com.sun.star.wizards.db.DBMetaData; import com.sun.star.wizards.db.TableDescriptor; import com.sun.star.wizards.db.TypeInspector; import com.sun.star.wizards.ui.FieldSelection; import com.sun.star.wizards.ui.UIConsts; import com.sun.star.wizards.ui.UnoDialog; -import com.sun.star.wizards.ui.WizardDialog; import com.sun.star.wizards.ui.XFieldSelectionListener; public class PrimaryKeyHandler implements XFieldSelectionListener { - TableWizard CurUnoDialog; - short curtabindex; - String SPRIMEKEYMODE = "togglePrimeKeyFields"; - String SSINGLEKEYMODE = "toggleSinglePrimeKeyFields"; - String SSEVERALKEYMODE = "toggleSeveralPrimeKeyFields"; - XRadioButton optAddAutomatically; - XRadioButton optUseExisting; - XRadioButton optUseSeveral; - XCheckBox chkUsePrimaryKey; - XCheckBox chkcreatePrimaryKey; - XCheckBox chkApplyAutoValueExisting; - XCheckBox chkApplyAutoValueAutomatic; - XListBox lstSinglePrimeKey; - XFixedText lblPrimeFieldName; - FieldSelection curPrimaryKeySelection; - String[] fieldnames; - TableDescriptor curTableDescriptor; - int nAutoPrimeKeyDataType; - boolean bAutoPrimaryKeysupportsAutoIncrmentation; - final String SAUTOMATICKEYFIELDNAME = "ID"; + private TableWizard CurUnoDialog; + private short curtabindex; + private final static String SPRIMEKEYMODE = "togglePrimeKeyFields"; + private final static String SSINGLEKEYMODE = "toggleSinglePrimeKeyFields"; + private final static String SSEVERALKEYMODE = "toggleSeveralPrimeKeyFields"; + private XRadioButton optAddAutomatically; + private XRadioButton optUseExisting; + private XRadioButton optUseSeveral; + private XCheckBox chkUsePrimaryKey; + private XCheckBox chkcreatePrimaryKey; + private XCheckBox chkApplyAutoValueExisting; + private XCheckBox chkApplyAutoValueAutomatic; + private XListBox lstSinglePrimeKey; + private XFixedText lblPrimeFieldName; + private FieldSelection curPrimaryKeySelection; + private String[] fieldnames; + private TableDescriptor curTableDescriptor; + private int nAutoPrimeKeyDataType; + private boolean bAutoPrimaryKeysupportsAutoIncrmentation; + private final static String SAUTOMATICKEYFIELDNAME = "ID"; public PrimaryKeyHandler(TableWizard _CurUnoDialog, TableDescriptor _curTableDescriptor) { @@ -82,15 +76,15 @@ public class PrimaryKeyHandler implements XFieldSelectionListener bAutoPrimaryKeysupportsAutoIncrmentation = isAutoPrimeKeyAutoIncrementationsupported(); curtabindex = (short) ((TableWizard.SOPRIMARYKEYPAGE * 100) - 20); Integer IPRIMEKEYSTEP = new Integer(TableWizard.SOPRIMARYKEYPAGE); - String sExplanations = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 26); - String screatePrimaryKey = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 27); - String slblPrimeFieldName = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 31); - String sApplyAutoValue = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 33); - String sAddAutomatically = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 28); - String sUseExisting = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 29); - String sUseSeveral = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 30); - String slblAvailableFields = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 4); - String slblSelPrimaryFields = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 32); + final String sExplanations = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 26); + final String screatePrimaryKey = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 27); + final String slblPrimeFieldName = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 31); + final String sApplyAutoValue = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 33); + final String sAddAutomatically = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 28); + final String sUseExisting = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 29); + final String sUseSeveral = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 30); + final String slblAvailableFields = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 4); + final String slblSelPrimaryFields = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 32); CurUnoDialog.insertLabel("lblExplanation", new String[] { @@ -164,11 +158,29 @@ public class PrimaryKeyHandler implements XFieldSelectionListener lstSinglePrimeKey = CurUnoDialog.insertListBox("lstSinglePrimeKey", "onPrimeKeySelected", null, this, new String[] { - "Dropdown", "Enabled", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width" + "Dropdown", + "Enabled", + "Height", + "HelpURL", + "LineCount", + "PositionX", + "PositionY", + "Step", + "TabIndex", + "Width" }, new Object[] { - Boolean.TRUE, Boolean.FALSE, new Integer(12), "HID:41231", new Integer(162), new Integer(115), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(80) + Boolean.TRUE, + Boolean.FALSE, + new Integer(12), + "HID:41231", + Short.valueOf(UnoDialog.getListBoxLineCount()), + new Integer(162), + new Integer(115), + IPRIMEKEYSTEP, + new Short(curtabindex++), + new Integer(80) }); chkApplyAutoValueExisting = CurUnoDialog.insertCheckBox("chkApplyAutoValueExisting", SPRIMEKEYMODE, this, @@ -187,7 +199,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener public void initialize() { - boolean breselect; + // boolean breselect; fieldnames = curTableDescriptor.getNonBinaryFieldNames(); String[] skeyfieldnames = curPrimaryKeySelection.getSelectedFieldNames(); curPrimaryKeySelection.initialize(fieldnames, false); diff --git a/wizards/com/sun/star/wizards/table/ScenarioSelector.java b/wizards/com/sun/star/wizards/table/ScenarioSelector.java index 90702e74c65d..43e250302781 100644 --- a/wizards/com/sun/star/wizards/table/ScenarioSelector.java +++ b/wizards/com/sun/star/wizards/table/ScenarioSelector.java @@ -29,24 +29,18 @@ ************************************************************************/ package com.sun.star.wizards.table; -import java.util.Hashtable; import java.util.Vector; import com.sun.star.awt.ItemEvent; -import com.sun.star.awt.XButton; import com.sun.star.awt.XFixedText; import com.sun.star.awt.XItemListener; import com.sun.star.awt.XListBox; import com.sun.star.awt.XRadioButton; import com.sun.star.beans.PropertyValue; -import com.sun.star.beans.XPropertySet; import com.sun.star.container.XNameAccess; import com.sun.star.lang.EventObject; import com.sun.star.lang.Locale; import com.sun.star.lang.XMultiServiceFactory; -//import com.sun.star.uno.Exception; -import com.sun.star.sdbc.SQLException; -import com.sun.star.uno.UnoRuntime; import com.sun.star.wizards.common.Configuration; import com.sun.star.wizards.common.Desktop; import com.sun.star.wizards.common.Helper; @@ -55,7 +49,6 @@ import com.sun.star.wizards.db.TableDescriptor; import com.sun.star.wizards.ui.FieldSelection; import com.sun.star.wizards.ui.UIConsts; import com.sun.star.wizards.ui.UnoDialog; -import com.sun.star.wizards.ui.WizardDialog; import com.sun.star.wizards.ui.XFieldSelectionListener; /** @@ -67,28 +60,27 @@ import com.sun.star.wizards.ui.XFieldSelectionListener; public class ScenarioSelector extends FieldSelection implements XItemListener, XFieldSelectionListener { - XFixedText lblExplanation; - XFixedText lblCategories; - XRadioButton optBusiness; - XRadioButton optPrivate; - XListBox xTableListBox; - TableWizard CurUnoDialog; - TableDescriptor curtabledescriptor; - CGCategory oCGCategory; - CGTable oCGTable; - String SELECTCATEGORY = "selectCategory"; + private XFixedText lblExplanation; + private XFixedText lblCategories; + private XRadioButton optBusiness; + private XRadioButton optPrivate; + private XListBox xTableListBox; + private TableWizard CurTableWizardUnoDialog; + private TableDescriptor curtabledescriptor; + private CGCategory oCGCategory; + protected CGTable oCGTable; + private String SELECTCATEGORY = "selectCategory"; private int curcategory; - public boolean bcolumnnameislimited; + protected boolean bcolumnnameislimited; private int imaxcolumnchars; - private String[] fieldnames; - String smytable; - Locale aLocale; - XMultiServiceFactory xMSF; + private String smytable; + private Locale aLocale; + private XMultiServiceFactory xMSF; public ScenarioSelector(TableWizard _CurUnoDialog, TableDescriptor _curtabledescriptor, String _reslblFields, String _reslblSelFields) { super(_CurUnoDialog, TableWizard.SOMAINPAGE, 91, 108, 230, 80, _reslblFields, _reslblSelFields, 41209, true); - CurUnoDialog = (TableWizard) _CurUnoDialog; + CurTableWizardUnoDialog = _CurUnoDialog; xMSF = CurUnoDialog.xMSF; aLocale = Configuration.getOfficeLocale(xMSF); curtabledescriptor = _curtabledescriptor; @@ -125,7 +117,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X new Integer(8), sCategories, new Integer(91), new Integer(60), IMAINSTEP, new Short(pretabindex++), new Integer(100) }); - optBusiness = CurUnoDialog.insertRadioButton("optBusiness", SELECTCATEGORY, this, + optBusiness = CurTableWizardUnoDialog.insertRadioButton("optBusiness", SELECTCATEGORY, this, new String[] { "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width" @@ -135,7 +127,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X UIConsts.INTEGERS[8], "HID:41206", sBusiness, new Integer(98), new Integer(70), new Short((short) 1), IMAINSTEP, new Short(pretabindex++), new Integer(78) }); - optPrivate = CurUnoDialog.insertRadioButton("optPrivate", SELECTCATEGORY, this, + optPrivate = CurTableWizardUnoDialog.insertRadioButton("optPrivate", SELECTCATEGORY, this, new String[] { "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" @@ -164,7 +156,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X }, new Object[] { - Boolean.TRUE, new Integer(12), "HID:41208", new Short("7"), new Integer(91), new Integer(92), IMAINSTEP, new Short(pretabindex++), getListboxWidth() + Boolean.TRUE, new Integer(12), "HID:41208", new Short(UnoDialog.getListBoxLineCount()), new Integer(91), new Integer(92), IMAINSTEP, new Short(pretabindex++), getListboxWidth() }); } catch (Exception e) @@ -227,13 +219,13 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X public String[] getSelectedFieldNames() { String[] displayfieldnames = super.getSelectedFieldNames(); - Vector afieldnameVector = new Vector(); + Vector<String> afieldnameVector = new Vector<String>(); int a = 0; for (int i = 0; i < displayfieldnames.length; i++) { try { - FieldDescription ofielddescription = (FieldDescription) CurUnoDialog.fielditems.get(displayfieldnames[i]); + FieldDescription ofielddescription = (FieldDescription) CurTableWizardUnoDialog.fielditems.get(displayfieldnames[i]); if (ofielddescription != null) { afieldnameVector.addElement(ofielddescription.getName()); @@ -245,7 +237,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X e.printStackTrace(System.out); } } - fieldnames = new String[a]; + String[] fieldnames = new String[a]; afieldnameVector.toArray(fieldnames); return fieldnames; } @@ -263,7 +255,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X { try { - FieldDescription curfielddescription = (FieldDescription) CurUnoDialog.fielditems.get(fieldnames[i]); + FieldDescription curfielddescription = (FieldDescription) CurTableWizardUnoDialog.fielditems.get(fieldnames[i]); PropertyValue[] aProperties = curfielddescription.getPropertyValues(); this.curtabledescriptor.addColumn(aProperties); } @@ -284,12 +276,12 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X String[] fieldnames = super.getSelectedFieldNames(); if ((fieldnames.length) > 0) { - for (int i = 0; i < CurUnoDialog.fielditems.size(); i++) + for (int i = 0; i < CurTableWizardUnoDialog.fielditems.size(); i++) { String stablename = ""; try { - FieldDescription ofielddescription = (FieldDescription) CurUnoDialog.fielditems.get(fieldnames[i]); + FieldDescription ofielddescription = (FieldDescription) CurTableWizardUnoDialog.fielditems.get(fieldnames[i]); stablename = ofielddescription.gettablename(); } catch (RuntimeException e) @@ -344,12 +336,12 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X public void shiftFromLeftToRight(String[] SelItems, String[] NewItems) { - if (!CurUnoDialog.verifyfieldcount(NewItems.length)) + if (!CurTableWizardUnoDialog.verifyfieldcount(NewItems.length)) { for (int i = 0; i < SelItems.length; i++) { int selindex = JavaTools.FieldInList(NewItems, SelItems[i]); - super.xSelFieldsListBox.removeItems((short) selindex, (short) 1); + super.xSelectedFieldsListBox.removeItems((short) selindex, (short) 1); /**TODO In this context the items should be better placed at their original position. * but how is this position retrieved? */ @@ -361,7 +353,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X for (int i = 0; i < NewItems.length; i++) { int iduplicate; - if (CurUnoDialog.fielditems.containsKey(NewItems[i])) + if (CurTableWizardUnoDialog.fielditems.containsKey(NewItems[i])) { iduplicate = JavaTools.getDuplicateFieldIndex(NewItems, NewItems[i]); if (iduplicate != -1) @@ -369,31 +361,31 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X XNameAccess xNameAccessFieldNode; String sdisplayname = Desktop.getUniqueName(NewItems, NewItems[iduplicate], ""); FieldDescription curfielddescription = new FieldDescription(xMSF, aLocale, this, sdisplayname, NewItems[iduplicate], imaxcolumnchars); - CurUnoDialog.fielditems.put(sdisplayname, curfielddescription); + CurTableWizardUnoDialog.fielditems.put(sdisplayname, curfielddescription); NewItems[iduplicate] = sdisplayname; setSelectedFieldNames(NewItems); } } else { - CurUnoDialog.fielditems.put(NewItems[i], new FieldDescription(xMSF, aLocale, this, NewItems[i], NewItems[i], imaxcolumnchars)); + CurTableWizardUnoDialog.fielditems.put(NewItems[i], new FieldDescription(xMSF, aLocale, this, NewItems[i], NewItems[i], imaxcolumnchars)); } } } - CurUnoDialog.setcompleted(TableWizard.SOMAINPAGE, NewItems.length > 0); + CurTableWizardUnoDialog.setcompleted(TableWizard.SOMAINPAGE, NewItems.length > 0); } public void shiftFromRightToLeft(String[] SelItems, String[] NewItems) { for (int i = 0; i < SelItems.length; i++) { - if (CurUnoDialog.fielditems.containsKey(SelItems[i])) + if (CurTableWizardUnoDialog.fielditems.containsKey(SelItems[i])) { - CurUnoDialog.fielditems.remove(SelItems[i]); + CurTableWizardUnoDialog.fielditems.remove(SelItems[i]); this.curtabledescriptor.dropColumnbyName(SelItems[i]); } } - CurUnoDialog.setcompleted(TableWizard.SOMAINPAGE, NewItems.length > 0); + CurTableWizardUnoDialog.setcompleted(TableWizard.SOMAINPAGE, NewItems.length > 0); } public void moveItemDown(String item) diff --git a/wizards/com/sun/star/wizards/table/TableWizard.java b/wizards/com/sun/star/wizards/table/TableWizard.java index 624eb0473074..8b4e0288ef8c 100644 --- a/wizards/com/sun/star/wizards/table/TableWizard.java +++ b/wizards/com/sun/star/wizards/table/TableWizard.java @@ -223,6 +223,7 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet } } +/* public static void main(String args[]) { String ConnectStr = "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.NamingService"; @@ -245,7 +246,7 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet exception.printStackTrace(System.out); } } - +*/ public void buildSteps() { curScenarioSelector = new ScenarioSelector(this, this.curTableDescriptor, slblFields, slblSelFields); @@ -331,7 +332,7 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet Object oFormWizard = this.xMSF.createInstance("com.sun.star.wizards.form.CallFormWizard"); PropertyValue[] aProperties = new PropertyValue[4]; aProperties[0] = Properties.createProperty("ActiveConnection", curTableDescriptor.DBConnection); - aProperties[1] = Properties.createProperty("DataSource", curTableDescriptor.xDataSource); + aProperties[1] = Properties.createProperty("DataSource", curTableDescriptor.getDataSource()); aProperties[2] = Properties.createProperty("CommandType", new Integer(CommandType.TABLE)); aProperties[3] = Properties.createProperty("Command", scomposedtablename); XInitialization xInitialization = (XInitialization) UnoRuntime.queryInterface(XInitialization.class, oFormWizard); diff --git a/wizards/com/sun/star/wizards/text/TextDocument.java b/wizards/com/sun/star/wizards/text/TextDocument.java index bdf193e8963b..c9af7bfb688c 100644 --- a/wizards/com/sun/star/wizards/text/TextDocument.java +++ b/wizards/com/sun/star/wizards/text/TextDocument.java @@ -46,7 +46,6 @@ import com.sun.star.frame.XModule; import com.sun.star.frame.XTerminateListener; import com.sun.star.frame.XStorable; import com.sun.star.i18n.NumberFormatIndex; -import com.sun.star.awt.Rectangle; import com.sun.star.awt.Size; import com.sun.star.awt.XWindow; import com.sun.star.awt.XWindowPeer; @@ -77,7 +76,6 @@ import com.sun.star.wizards.common.Configuration; import com.sun.star.wizards.common.Desktop; import com.sun.star.wizards.common.Helper; import com.sun.star.wizards.common.JavaTools; -import com.sun.star.wizards.common.Properties; import com.sun.star.wizards.common.Helper.DateUtils; import com.sun.star.wizards.document.OfficeDocument; diff --git a/wizards/com/sun/star/wizards/text/TextFieldHandler.java b/wizards/com/sun/star/wizards/text/TextFieldHandler.java index fc260b88834c..ea8f493f98ca 100644 --- a/wizards/com/sun/star/wizards/text/TextFieldHandler.java +++ b/wizards/com/sun/star/wizards/text/TextFieldHandler.java @@ -39,16 +39,11 @@ import com.sun.star.text.XTextCursor; import com.sun.star.text.XTextDocument; import com.sun.star.text.XTextFieldsSupplier; import com.sun.star.text.XTextRange; -import com.sun.star.beans.Property; import com.sun.star.beans.XPropertySet; -import com.sun.star.container.NoSuchElementException; import com.sun.star.container.XEnumeration; -import com.sun.star.container.XEnumerationAccess; -import com.sun.star.lang.WrappedTargetException; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.lang.XServiceInfo; -import com.sun.star.uno.Any; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; diff --git a/wizards/com/sun/star/wizards/text/TextStyleHandler.java b/wizards/com/sun/star/wizards/text/TextStyleHandler.java index b43d7cd2a7a6..28451620bfa6 100644 --- a/wizards/com/sun/star/wizards/text/TextStyleHandler.java +++ b/wizards/com/sun/star/wizards/text/TextStyleHandler.java @@ -30,12 +30,8 @@ package com.sun.star.wizards.text; import com.sun.star.awt.Size; -import com.sun.star.beans.PropertyVetoException; -import com.sun.star.beans.UnknownPropertyException; import com.sun.star.beans.XPropertySet; import com.sun.star.container.XNameAccess; -import com.sun.star.lang.IllegalArgumentException; -import com.sun.star.lang.WrappedTargetException; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.style.XStyleFamiliesSupplier; import com.sun.star.style.XStyleLoader; diff --git a/wizards/com/sun/star/wizards/text/TextTableHandler.java b/wizards/com/sun/star/wizards/text/TextTableHandler.java index acdd150c748c..e387c7516c7e 100644 --- a/wizards/com/sun/star/wizards/text/TextTableHandler.java +++ b/wizards/com/sun/star/wizards/text/TextTableHandler.java @@ -47,7 +47,6 @@ import com.sun.star.uno.AnyConverter; import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; -import com.sun.star.util.XNumberFormats; import com.sun.star.util.XNumberFormatsSupplier; import com.sun.star.view.XSelectionSupplier; import com.sun.star.wizards.common.Desktop; diff --git a/wizards/com/sun/star/wizards/ui/ButtonList.java b/wizards/com/sun/star/wizards/ui/ButtonList.java new file mode 100644 index 000000000000..d68306c5b915 --- /dev/null +++ b/wizards/com/sun/star/wizards/ui/ButtonList.java @@ -0,0 +1,911 @@ +/************************************************************************* + * + * 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: ImageList.java,v $ + * $Revision: 1.10 $ + * + * 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. + * + ************************************************************************/ +package com.sun.star.wizards.ui; + +import com.sun.star.awt.Size; +import com.sun.star.awt.XActionListener; +import com.sun.star.awt.XButton; +import com.sun.star.awt.XControl; +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XFixedText; +import com.sun.star.awt.XItemEventBroadcaster; +import com.sun.star.awt.XItemListener; +// import com.sun.star.awt.XView; +import com.sun.star.awt.XWindow; +import com.sun.star.lang.EventObject; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.wizards.common.Helper; +import com.sun.star.wizards.common.IRenderer; +import com.sun.star.wizards.common.PropertySetHelper; +// import com.sun.star.wizards.ui.event.*; +import javax.swing.ListModel; +import javax.swing.event.ListDataEvent; + +/** + * + * @author rpiterman,ll93751 + */ +public class ButtonList implements XItemEventBroadcaster, XActionListener +{ + + private XFixedText lblImageText; + private XButton btnBack; + private XButton btnNext; + private XFixedText lblCounter; + private XControl m_aButtons[]; + private boolean benabled = true; + private UnoDialog2 oUnoDialog; + private Size gap = new Size(4, 4); + private int cols = 4; + private int rows = 3; + private Size m_aButtonSize = new Size(20, 20); + private Size pos; + private Size selectionGap = new Size(2, 2); + private boolean showButtons = true; + private Short step; + private boolean refreshOverNull = true; + private int imageTextLines = 1; + private boolean rowSelect = false; + public int tabIndex; + public Boolean scaleImages = Boolean.TRUE; + private String m_aControlName = "il"; + private int m_nCurrentSelection = -1; + private int pageStart = 0; + public int helpURL = 0; + private IImageRenderer renderer; + private ListModel listModel; + public IRenderer counterRenderer = new SimpleCounterRenderer(); + private final static int LINE_HEIGHT = 8; //private MethodInvocation METHOD_MOUSE_ENTER_IMAGE; + + /** Getter for property m_aButtonSize. + * @return Value of property m_aButtonSize. + * + */ + public Size getButtonSize() + { + return this.m_aButtonSize; + } + public void setName(String _sName) + { + m_aControlName = _sName; + } + + /** Setter for property m_aButtonSize. + * @param imageSize New value of property m_aButtonSize. + */ + public void setButtonSize(Size imageSize) + { + this.m_aButtonSize = imageSize; + } + +// @Override + public void disposing(EventObject arg0) + { + // throw new UnsupportedOperationException("Not supported yet."); + } + + public void create(UnoDialog2 dialog) + { + oUnoDialog = dialog; + + int imageTextHeight = imageTextLines * LINE_HEIGHT; + + int nXPos = pos.Width + 1; + int nYPos = pos.Height + (m_aButtonSize.Height + gap.Height) * rows + gap.Height; + int nWidth = cols * (m_aButtonSize.Width + gap.Width) + gap.Width - 2; + + lblImageText = dialog.insertLabel(m_aControlName + "_imageText", + new String[] + { + "Height", + "HelpURL", + "Label", + "PositionX", + "PositionY", + "Step", + "TabIndex", + "Tabstop", + "Width" + }, + new Object[] + { + Integer.valueOf(imageTextHeight), + "", + "(1)", + Integer.valueOf(nXPos), + Integer.valueOf(nYPos), + step, + Short.valueOf((short) 0), + Boolean.FALSE, + Integer.valueOf(nWidth) + }); + + + if (showButtons) + { + final String[] pNames1 = new String[] + { + "Height", + "HelpURL", + "PositionX", + "PositionY", + "Step", + "TabIndex", + "Tabstop", + "Width" + }; + + final Integer btnSize = Integer.valueOf(14); + +// TODO: if list of strings not the same length of list object, office will die. + btnBack = dialog.insertButton(m_aControlName + "_btnBack", "prevPage", this, pNames1, new Object[] + { + btnSize, + "HID:" + helpURL++, + Integer.valueOf(pos.Width), + Integer.valueOf(pos.Height + (m_aButtonSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1), + step, + Short.valueOf((short) (tabIndex + 1)), + Boolean.TRUE, + btnSize + }); + + btnNext = dialog.insertButton(m_aControlName + "_btnNext", "nextPage", this, pNames1, new Object[] + { + btnSize, + "HID:" + helpURL++, + Integer.valueOf(pos.Width + (m_aButtonSize.Width + gap.Width) * cols + gap.Width - btnSize.intValue() + 1), + Integer.valueOf(pos.Height + (m_aButtonSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1), + step, + new Short((short) (tabIndex + 2)), + Boolean.TRUE, + btnSize + }); + + lblCounter = dialog.insertLabel(m_aControlName + "_lblCounter", pNames1, new Object[] + { + Integer.valueOf(LINE_HEIGHT), + "", + Integer.valueOf(pos.Width + btnSize.intValue() + 1), + Integer.valueOf(pos.Height + (m_aButtonSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + ((btnSize.intValue() - LINE_HEIGHT) / 2)), + step, + Short.valueOf((short) 0), + Boolean.FALSE, + Integer.valueOf(cols * (m_aButtonSize.Width + gap.Width) + gap.Width - 2 * btnSize.intValue() - 1) + }); + + Helper.setUnoPropertyValue(getModel(lblCounter), "Align", new Short((short) 1)); + Helper.setUnoPropertyValue(getModel(btnBack), "Label", "<"); + Helper.setUnoPropertyValue(getModel(btnNext), "Label", ">"); + + + } + + m_tabIndex = new Short((short) tabIndex); + + m_aButtons = new XControl[rows * cols]; + + + m_aButtonHeight = Integer.valueOf(m_aButtonSize.Height); + m_aButtonWidth = Integer.valueOf(m_aButtonSize.Width); + + for (int r = 0; r < rows; r++) + { + for (int c = 0; c < cols; c++) + { + XButton aButton = createButton(dialog, r, c); + XControl aControl = (XControl)UnoRuntime.queryInterface(XControl.class, aButton); + m_aButtons[r * cols + c] = aControl; + } + } + refreshImages(); + } + + private Integer m_aButtonHeight; + private Integer m_aButtonWidth; + private Short m_tabIndex; + + private XButton createButton(UnoDialog2 dialog, int _row, int _col) + { + String sButtonName = m_aControlName + "_button" + (_row * cols + _col); + int nButtonX = getButtonPosX(_col); + int nButtonY = getButtonPosY(_row); + XButton aButton = dialog.insertImageButton(sButtonName, this, + new String[] + { + /* "Border", */ + /* "BackgroundColor", */ + "Height", + "HelpURL", + /* "Label", */ + "PositionX", + "PositionY", + /* "ScaleImage", */ + "Step", + "TabIndex", + "Tabstop", + "Toggle", + "Width" + }, + new Object[] + { + /* Short.valueOf((short) 1), */ /* NO_BORDER, */ + /* BACKGROUND_COLOR, */ + m_aButtonHeight, + "HID:" + helpURL++, + /* "Test", */ + Integer.valueOf(nButtonX), + Integer.valueOf(nButtonY), + /* scaleImages, */ + step, + m_tabIndex, + Boolean.TRUE, + Boolean.TRUE, /* Toggle */ + m_aButtonWidth + }); + + XWindow win = (XWindow) UnoRuntime.queryInterface(XWindow.class, aButton); + win.setEnable(true); + win.setVisible(true); + return aButton; + } + + private int getButtonPosX(int _col) + { + final int nXPos = pos.Width + _col * (m_aButtonSize.Width + gap.Width) + gap.Width; + return nXPos; + } + + private int getButtonPosY(int _row) + { + final int nYPos = pos.Height + _row * (m_aButtonSize.Height + gap.Height) + gap.Height; + return nYPos; + } + + private void refreshImages() + { + if (showButtons) + { + refreshCounterText(); + } + if (refreshOverNull) + { + for (int i = 0; i < m_aButtons.length; i++) + { + setVisible(m_aButtons[i], false); + } + } + boolean focusable = true; + for (int i = 0; i < m_aButtons.length; i++) + { + Object[] oResources = renderer.getImageUrls(getObjectFor(i)); + if (oResources != null) + { + if (oResources.length == 1) + { + Helper.setUnoPropertyValue(m_aButtons[i].getModel(), "ImageURL", (String) oResources[0]); + } + else if (oResources.length == 2) + { + oUnoDialog.getPeerConfiguration().setImageUrl(m_aButtons[i].getModel(), oResources[0], oResources[1]); +// Helper.setUnoPropertyValue(m_aButtons[i].getModel(), "ImageURL", oResources[0]); + } + boolean bTabStop = Boolean.TRUE; // focusable ? Boolean.TRUE : Boolean.FALSE; + Helper.setUnoPropertyValue(m_aButtons[i].getModel(), "Tabstop", bTabStop); + // Object aEnabled = Helper.getUnoPropertyValue(m_aButtons[i].getModel(), "Enabled"); + if (refreshOverNull) + { + setVisible(m_aButtons[i], true); + } + focusable = false; + } + } +// refreshSelection(); + } + + private void refreshCounterText() + { + Helper.setUnoPropertyValue(getModel(lblCounter), "Label", counterRenderer.render(new Counter(pageStart + 1, pageEnd(), listModel.getSize()))); + } + + private int pageEnd() + { + int i = pageStart + cols * rows; + if (i > listModel.getSize() - 1) + { + return listModel.getSize(); + } + else + { + return i; + } + } + + /** Utility field holding list of ItemListeners. */ + private transient java.util.ArrayList<XItemListener> m_aItemListenerList; + private void setVisible(Object control, boolean visible) + { + final XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, control); + xWindow.setVisible(visible); + } + + /** + * + * @param i + * @return the Object in the list model corresponding to the given image index. + */ + private Object getObjectFor(int i) + { + int ii = getIndexFor(i); + if (listModel.getSize() <= ii) + { + return null; + } + else + { + return listModel.getElementAt(ii); + } + } + + /** + * + * @param i + * @return the index in the listModel for the given image index. + */ + private int getIndexFor(int i) + { + return pageStart + i; + } + + private int getImageIndexFor(int i) + { + return i - pageStart; + } + + public void contentsChanged(ListDataEvent event) + { + /*//if the content that was changed is in the displayed range, refresh... + if ( (event.getIndex1() < getIndexFor(0)) // range is before... + || event.getIndex0() > getIndexFor( cols*rows - 1)) ; //do nothing + else + refreshImages(); + */ //m_nCurrentSelection = 0; + //pageStart = 0; + //if (event.refreshImages(); + } + + public void intervalAdded(ListDataEvent event) + { + if (event.getIndex0() <= m_nCurrentSelection) + { + if (event.getIndex1() <= m_nCurrentSelection) + { + m_nCurrentSelection += event.getIndex1() - event.getIndex0() + 1; + } + } + if (event.getIndex0() < pageStart || event.getIndex1() < (pageStart + getRows() + getCols())) + { + refreshImages(); + } + } + + public void intervalRemoved(ListDataEvent event) + { + //contentsChanged(event); + } + + /** Registers ItemListener to receive events. + * @param listener The listener to register. + * + */ + // @Override + public synchronized void addItemListener(XItemListener listener) + { + if (m_aItemListenerList == null) + { + m_aItemListenerList = new java.util.ArrayList<XItemListener>(); + } + m_aItemListenerList.add(listener); + } + + /** Removes ItemListener from the list of listeners. + * @param listener The listener to remove. + * + */ + public synchronized void removeItemListener(XItemListener listener) + { + if (m_aItemListenerList != null) + { + m_aItemListenerList.remove(listener); + } + } + + /** Notifies all registered listeners about the event. + * + * @param event The event to be fired + * + */ + private void fireItemSelected() + { +// java.awt.event.ItemEvent event = new java.awt.event.ItemEvent(this, 0, +// getSelectedObject(), java.awt.event.ItemEvent.SELECTED); + java.util.ArrayList list; + synchronized(this) + { + if (m_aItemListenerList == null) + { + return; + } + list = (java.util.ArrayList) m_aItemListenerList.clone(); + } + for (int i = 0; i < list.size(); i++) + { + ((com.sun.star.awt.XItemListener) list.get(i)).itemStateChanged(null); + } + } + + /** + * @return + */ + public int getCols() + { + return cols; + } + + /** + * @return + */ + public Size getGap() + { + return gap; + } + + /** + * @return + */ + public ListModel getListModel() + { + return listModel; + } + + /** + * @return + */ + public Short getStep() + { + return step; + } + + /** + * @return + */ + public int getPageStart() + { + return pageStart; + } + + /** + * @return + */ + public Size getPos() + { + return pos; + } + + /** + * @return + */ + public IImageRenderer getRenderer() + { + return renderer; + } + + /** + * @return + */ + public int getRows() + { + return rows; + } + + /** + * @return + */ + public int getSelected() + { + return m_nCurrentSelection; + } + + /** + * @return + */ + public Size getSelectionGap() + { + return selectionGap; + } + + /** + * @return + */ + public boolean isShowButtons() + { + return showButtons; + } + + /** + * @param i + */ + public void setCols(int i) + { + cols = i; + } + + /** + * @param size + */ + public void setGap(Size size) + { + gap = size; + } + + /** + * @param model + */ + public void setListModel(ListModel model) + { + listModel = model; + } + + /** + * @param short1 + */ + public void setStep(Short short1) + { + step = short1; + } + + /** + * @param i + */ + public void setPageStart(int i) + { + if (i == pageStart) + { + return; + } + pageStart = i; + enableButtons(); + refreshImages(); + } + + /** + * @param _size + */ + public void setPos(Size _size) + { + pos = _size; + } + + /** + * @param _renderer + */ + public void setRenderer(IImageRenderer _renderer) + { + this.renderer = _renderer; + } + + /** + * @param i + */ + public void setRows(int i) + { + rows = i; + } + + /** + * @param i + */ + public void setSelected(int i) + { + if (rowSelect && (i >= 0)) + { + i = (i / cols) * cols; + } + if (m_nCurrentSelection == i) + { + return; + } + m_nCurrentSelection = i; + refreshImageText(); + refreshSelection(); + fireItemSelected(); + } + +/* + public void setSelected(Object object) + { + if (object == null) + { + setSelected(-1); + } + else + { + for (int i = 0; i < getListModel().getSize(); i++) + { + if (getListModel().getElementAt(i).equals(object)) + { + setSelected(i); + return; + } + } + } + setSelected(-1); + + } +*/ + + /** + * set the text under the button list + */ + private void refreshImageText() + { + Object item = m_nCurrentSelection >= 0 ? getListModel().getElementAt(m_nCurrentSelection) : null; + final String sText = " " + renderer.render(item); + Helper.setUnoPropertyValue(getModel(lblImageText), "Label", sText); + } + + /** + * @param size + */ + public void setSelectionGap(Size size) + { + selectionGap = size; + } + + /** + * @param b + */ + public void setShowButtons(boolean b) + { + showButtons = b; + } + + public void nextPage() + { + if (pageStart < getListModel().getSize() - rows * cols) + { + setPageStart(pageStart + rows * cols); + } + } + + public void prevPage() + { + if (pageStart == 0) + { + return; + } + int i = pageStart - rows * cols; + if (i < 0) + { + i = 0; + } + setPageStart(i); + } + + private void enableButtons() + { + enable(btnNext, new Boolean(pageStart + rows * cols < listModel.getSize())); + enable(btnBack, new Boolean(pageStart > 0)); + } + + private void enable(Object control, Boolean enable) + { + Helper.setUnoPropertyValue(getModel(control), "Enabled", enable); + } + + private Object getModel(Object control) + { + return ((XControl) UnoRuntime.queryInterface(XControl.class, control)).getModel(); + } + + private void setBorder(Object control, Short border) + { + Helper.setUnoPropertyValue(getModel(control), "Border", border); + //XWindowPeer peer = ((XControl)UnoRuntime.queryInterface(XControl.class,control)).getPeer(); + //peer.invalidate(InvalidateStyle.CHILDREN); + } + + + public Object[] getSelectedObjects() + { + return new Object[] + { + getListModel().getElementAt(m_nCurrentSelection) + }; + } + + + /** + */ + public static interface IImageRenderer extends IRenderer + { + + /** + * + * @param listItem + * @return two resource ids for an image referenced in the imaglist resourcefile of the + * wizards project; The second one of them is designed to be used for High Contrast Mode. + */ + public Object[] getImageUrls(Object listItem); + } + + private static class SimpleCounterRenderer implements IRenderer + { + + // @Override + public String render(Object counter) + { + return "" + ((Counter) counter).start + ".." + ((Counter) counter).end + "/" + ((Counter) counter).max; + } + } + + public static class Counter + { + + public int start, end, max; + + public Counter(int start_, int end_, int max_) + { + start = start_; + end = end_; + max = max_; + } + } + + public Object getSelectedObject() + { + return m_nCurrentSelection >= 0 ? getListModel().getElementAt(m_nCurrentSelection) : null; + } + + + public void setRowSelect(boolean b) + { + rowSelect = b; + } + + public boolean isRowSelect() + { + return rowSelect; + } + + + /** + * jump to the given item (display the screen + * that contains the given item). + * @param i + */ + public void display(int i) + { + int is = (getCols() * getRows()); + int ps = (listModel.getSize() / is) * is; + setPageStart(ps); + } + + /** + * @return + */ + public boolean isenabled() + { + return benabled; + } + + /** + * @param b + */ + public void setenabled(boolean b) + { + + for (int i = 0; i < m_aButtons.length; i++) + { + UnoDialog2.setEnabled(m_aButtons[i], b); + } +// UnoDialog2.setEnabled(grbxSelectedImage, b); + UnoDialog2.setEnabled(lblImageText, b); + if (showButtons) + { + UnoDialog2.setEnabled(btnBack, b); + UnoDialog2.setEnabled(btnNext, b); + UnoDialog2.setEnabled(lblCounter, b); + } + benabled = b; + } + +/** + * refresh on all buttons, the selected button will get state pressed + */ + private void refreshSelection() + { + // reset all buttons to not set + for (int i = 0; i < m_aButtons.length; i++) + { + if (m_aButtons[i] != null) + { + XControlModel xModel = (XControlModel)UnoDialog2.getModel(m_aButtons[i]); + PropertySetHelper aHelper = new PropertySetHelper(xModel); + if (i == m_nCurrentSelection) + { + final short one = 1; + aHelper.setPropertyValueDontThrow("State", Short.valueOf(one)); + } + else + { + final short zero = 0; + aHelper.setPropertyValueDontThrow("State", Short.valueOf(zero)); + } + } + } + } + +/** + * implementation of XActionListener + * will call if a button from the m_aButtonList is pressed. + * @param actionEvent + */ +// @Override + public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent) + { + // bStopProcess = true; + XControlModel xModel = (XControlModel)UnoDialog2.getModel(actionEvent.Source); + PropertySetHelper aHelper = new PropertySetHelper(xModel); + + int nState = aHelper.getPropertyValueAsInteger("State", -1); + if (nState == 0) + { + // this will avoid a wrong state, if already pressed. + aHelper.setPropertyValueDontThrow("State", Short.valueOf((short)1)); + } + + // check which Button is pressed. + String sControlName = aHelper.getPropertyValueAsString("Name", ""); + final String sButton = sControlName.substring(7 + m_aControlName.length()); + int nButton = new Integer(sButton).intValue(); + + // int image = getImageFromEvent(event); + int index = getIndexFor(nButton); + if (index < listModel.getSize()) + { + // focus(image); + setSelected(index); + } + + } + + +} diff --git a/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java b/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java index d5d787744fd5..37ff4a46b49e 100644 --- a/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java +++ b/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java @@ -31,35 +31,34 @@ package com.sun.star.wizards.ui; import com.sun.star.wizards.common.*; import com.sun.star.wizards.db.*; -import com.sun.star.awt.XWindow; +// import com.sun.star.awt.XWindow; import com.sun.star.lang.IllegalArgumentException; import com.sun.star.sdb.CommandType; // import com.sun.star.sdbc.SQLException; import com.sun.star.uno.AnyConverter; -import com.sun.star.uno.UnoRuntime; +// import com.sun.star.uno.UnoRuntime; import com.sun.star.awt.*; import com.sun.star.beans.PropertyValue; import java.text.Collator; import java.util.Comparator; -import java.util.Locale; public class CommandFieldSelection extends FieldSelection implements Comparator { - CommandMetaData CurDBMetaData; - XListBox xTableListBox; - XFixedText xlblTable; - String SFILLUPFIELDSLISTBOX = "fillUpFieldsListbox"; - String sTableListBoxName; - String sTableLabelName; - String sQueryPrefix; - String sTablePrefix; - short iSelPos = -1; - short iOldSelPos = -1; - boolean bpreselectCommand = true; - boolean bgetQueries; + private CommandMetaData CurDBMetaData; + private XListBox xTableListBox; + private XFixedText xlblTable; + // private String SFILLUPFIELDSLISTBOX = "fillUpFieldsListbox"; + private String sTableListBoxName; + private String sTableLabelName; + private String sQueryPrefix; + private String sTablePrefix; + private short m_iSelPos = -1; + private short iOldSelPos = -1; + private boolean bpreselectCommand = true; + private boolean bgetQueries; // boolean AppendMode; - WizardDialog oWizardDialog; + private WizardDialog oWizardDialog; private Collator aCollator = null; class ItemListenerImpl implements com.sun.star.awt.XItemListener @@ -70,9 +69,9 @@ public class CommandFieldSelection extends FieldSelection implements Comparator short[] SelItems = (short[]) CurUnoDialog.getControlProperty(sTableListBoxName, "SelectedItems"); if (SelItems.length > 0) { - iOldSelPos = iSelPos; - iSelPos = SelItems[0]; - if ((iSelPos > -1) && (iSelPos != iOldSelPos)) + iOldSelPos = m_iSelPos; + m_iSelPos = SelItems[0]; + if ((m_iSelPos > -1) && (m_iSelPos != iOldSelPos)) { if (!AppendMode) { @@ -138,6 +137,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator sTablePrefix = getTablePrefix(); sQueryPrefix = getQueryPrefix(); Integer LabelWidth = new Integer(getListboxWidth().intValue() + 6); + // Label 'Tables or Queries' xlblTable = CurUnoDialog.insertLabel(sTableLabelName, new String[] { @@ -147,6 +147,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator { Boolean.FALSE, new Integer(8), _reslblTables, new Integer(95), new Integer(27), IStep, new Short((short) 3), LabelWidth }); + // DropDown Listbox TableNames xTableListBox = CurUnoDialog.insertListBox(sTableListBoxName, 0, null, new ItemListenerImpl(), new String[] { @@ -154,9 +155,9 @@ public class CommandFieldSelection extends FieldSelection implements Comparator }, new Object[] { - Boolean.TRUE, Boolean.FALSE, new Integer(12), "HID:" + (super.FirstHelpIndex - 1), new Short("7"), new Integer(95), new Integer(37), IStep, new Short((short) 4), getListboxWidth() + Boolean.TRUE, Boolean.FALSE, new Integer(12), "HID:" + (super.FirstHelpIndex - 1), new Short(UnoDialog.getListBoxLineCount()), new Integer(95), new Integer(37), IStep, new Short((short) 4), getListboxWidth() }); - XWindow xTableListBoxWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xTableListBox); + // XWindow xTableListBoxWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xTableListBox); fillupCommandListBox(); } catch (Exception exception) @@ -233,27 +234,28 @@ public class CommandFieldSelection extends FieldSelection implements Comparator boolean binitialize = false; String curCommandName = ""; //As the peer of the control might not yet exist we have to query the model for the SelectedItems - String[] sLocList = (String[]) CurUnoDialog.getControlProperty(sTableListBoxName, "StringItemList"); short iSelPos = getselectedItemPos(); + // String[] sLocList = (String[]) CurUnoDialog.getControlProperty(sTableListBoxName, "StringItemList"); + final String sSelectedTableName = xTableListBox.getItem(iSelPos); if (!bgetQueries) { - curCommandName = sLocList[iSelPos]; + curCommandName = sSelectedTableName; // sLocList[iSelPos]; CurDBMetaData.setTableByName(curCommandName); binitialize = CurDBMetaData.getFieldNamesOfCommand(curCommandName, CommandType.TABLE, AppendMode); } else { - if (sLocList[iSelPos].startsWith(sTablePrefix)) + if (sSelectedTableName.startsWith(sTablePrefix)) { CurDBMetaData.setCommandType(CommandType.TABLE); - curCommandName = JavaTools.replaceSubString(sLocList[iSelPos], "", sTablePrefix); + curCommandName = JavaTools.replaceSubString(sSelectedTableName, "", sTablePrefix); CurDBMetaData.setTableByName(curCommandName); binitialize = CurDBMetaData.getFieldNamesOfCommand(curCommandName, CommandType.TABLE, AppendMode); } else { CurDBMetaData.setCommandType(CommandType.QUERY); - curCommandName = JavaTools.replaceSubString(sLocList[iSelPos], "", sQueryPrefix); + curCommandName = JavaTools.replaceSubString(sSelectedTableName, "", sQueryPrefix); CurDBMetaData.setQueryByName(curCommandName); binitialize = CurDBMetaData.getFieldNamesOfCommand(curCommandName, CommandType.QUERY, AppendMode); } @@ -261,11 +263,11 @@ public class CommandFieldSelection extends FieldSelection implements Comparator if (binitialize) { CurDBMetaData.setCommandName(curCommandName); - if (CurDBMetaData.AllFieldNames != null) + if (CurDBMetaData.m_aAllFieldNames != null) { - if (CurDBMetaData.AllFieldNames.length > 0) + if (CurDBMetaData.m_aAllFieldNames.length > 0) { - initialize(CurDBMetaData.AllFieldNames, AppendMode, CurDBMetaData.getMaxColumnsInSelect()); + initialize(CurDBMetaData.m_aAllFieldNames, AppendMode, CurDBMetaData.getMaxColumnsInSelect()); return; } } @@ -288,21 +290,21 @@ public class CommandFieldSelection extends FieldSelection implements Comparator short[] iSelArray = new short[0]; boolean bgetFields = false; String[] ContentList = new String[0]; - CurDBMetaData.setCommandNames(); + // CurDBMetaData.initCommandNames(); if (bgetQueries) { - ContentList = new String[CurDBMetaData.TableNames.length + CurDBMetaData.QueryNames.length]; - System.arraycopy(CurDBMetaData.QueryNames, 0, ContentList, CurDBMetaData.TableNames.length, CurDBMetaData.QueryNames.length); - ContentList = setPrefixinArray(ContentList, sQueryPrefix, CurDBMetaData.TableNames.length, CurDBMetaData.QueryNames.length); + ContentList = new String[CurDBMetaData.getTableNames().length + CurDBMetaData.getQueryNames().length]; + System.arraycopy(CurDBMetaData.getQueryNames(), 0, ContentList, CurDBMetaData.getTableNames().length, CurDBMetaData.getQueryNames().length); + ContentList = setPrefixinArray(ContentList, sQueryPrefix, CurDBMetaData.getTableNames().length, CurDBMetaData.getQueryNames().length); } else { - ContentList = new String[CurDBMetaData.TableNames.length]; + ContentList = new String[CurDBMetaData.getTableNames().length]; } - System.arraycopy(CurDBMetaData.TableNames, 0, ContentList, 0, CurDBMetaData.TableNames.length); + System.arraycopy(CurDBMetaData.getTableNames(), 0, ContentList, 0, CurDBMetaData.getTableNames().length); if (bgetQueries) { - ContentList = setPrefixinArray(ContentList, sTablePrefix, 0, CurDBMetaData.TableNames.length); + ContentList = setPrefixinArray(ContentList, sTablePrefix, 0, CurDBMetaData.getTableNames().length); } java.util.Arrays.sort(ContentList, this); Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "StringItemList", ContentList); @@ -321,10 +323,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator else { emptyFieldsListBoxes(); - iSelArray = new short[] - { - (short) iSelPos - }; + iSelArray = new short[] { (short) iSelPos }; } Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", iSelArray); toggleCommandListBox(true); @@ -460,22 +459,19 @@ public class CommandFieldSelection extends FieldSelection implements Comparator short iselpos = (short) JavaTools.FieldInList(sitems, getTablePrefix() + _selitem); if (iselpos > -1) { - Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[] - { - iselpos - }); + Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[] { iselpos }); } this.fillUpFieldsListbox(); } else { - Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[] - { - }); + Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[] {} ); + this.fillUpFieldsListbox(); } if (_bReadOnly) { Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "ReadOnly", new Boolean(_selitem.length() > 0)); } + toggleListboxButtons((short)-1,(short)-1); } } diff --git a/wizards/com/sun/star/wizards/ui/ControlScroller.java b/wizards/com/sun/star/wizards/ui/ControlScroller.java index 38fdca98edd7..2a2a373fa841 100644 --- a/wizards/com/sun/star/wizards/ui/ControlScroller.java +++ b/wizards/com/sun/star/wizards/ui/ControlScroller.java @@ -29,15 +29,11 @@ ************************************************************************/ package com.sun.star.wizards.ui; -import com.sun.star.awt.FocusEvent; -import com.sun.star.awt.XFocusListener; import com.sun.star.awt.XScrollBar; import com.sun.star.awt.AdjustmentEvent; import com.sun.star.beans.*; import com.sun.star.awt.*; -import com.sun.star.lang.EventObject; import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.Any; import com.sun.star.wizards.common.*; import java.util.*; @@ -120,7 +116,7 @@ public abstract class ControlScroller iStartPosY = iCompPosY + SORELFIRSTPOSY; int ScrollHeight = iCompHeight - 2; nlineincrement = 1; - sIncSuffix = com.sun.star.wizards.common.Desktop.getIncrementSuffix(CurUnoDialog.xDlgNameAccess, "imgBackground"); + sIncSuffix = com.sun.star.wizards.common.Desktop.getIncrementSuffix(CurUnoDialog.getDlgNameAccess(), "imgBackground"); oImgControl = CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlImageControlModel", "imgBackground" + sIncSuffix, new String[] { @@ -236,7 +232,7 @@ public abstract class ControlScroller PropertyValue[] valueProps = (PropertyValue[]) scrollfields.get(guiRow + nscrollvalue); for (int n = 0; n < nameProps.length; n++) { - if (CurUnoDialog.xDlgNameAccess.hasByName(nameProps[n].Name)) + if (CurUnoDialog.getDlgNameAccess().hasByName(nameProps[n].Name)) { setControlData(nameProps[n].Name, valueProps[n].Value); } @@ -418,7 +414,7 @@ public abstract class ControlScroller protected PropertyValue fieldInfo(PropertyValue valueProp, PropertyValue nameProp) { - if (CurUnoDialog.xDlgNameAccess.hasByName(nameProp.Name)) + if (CurUnoDialog.getDlgNameAccess().hasByName(nameProp.Name)) { valueProp.Value = getControlData(nameProp.Name); } diff --git a/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java b/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java index 40323852f3e7..7cf333ddf362 100644 --- a/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java +++ b/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java @@ -56,7 +56,7 @@ public abstract class DBLimitedFieldSelection protected int iCurPosY; protected int FirstHelpIndex; protected int iCompPosX; - protected int MaxSelIndex; + // protected int MaxSelIndex; public DBLimitedFieldSelection(WizardDialog _CurUnoDialog, int iStep, int _iCompPosX, int iCompPosY, int iCompWidth, int _FirstHelpIndex) { @@ -70,7 +70,7 @@ public abstract class DBLimitedFieldSelection ICompPosX = new Integer(iCompPosX); ICompPosY = new Integer(iCompPosY); ICompWidth = new Integer(iCompWidth); - boolean bDoEnable; + // boolean bDoEnable; iCurPosY = iCompPosY; for (int i = 0; i < rowcount; i++) { @@ -86,20 +86,22 @@ public abstract class DBLimitedFieldSelection protected abstract void updateFromNextControlRow(int CurIndex); - protected abstract void setMaxSelIndex(); + // protected abstract void setMaxSelIndex(); + + protected abstract int getMaxSelIndex(); protected void moveupSelectedItems(int CurIndex, boolean bDoEnable) { - short iNextItemPos; + // short iNextItemPos; if ((bDoEnable == false) && (MAXSELINDEX > CurIndex)) { for (int i = CurIndex; i < MAXSELINDEX; i++) { updateFromNextControlRow(i); } - if (MaxSelIndex < rowcount - 2) + if (getMaxSelIndex() < rowcount - 2) { - toggleControlRow(MaxSelIndex + 2, false); + toggleControlRow(getMaxSelIndex() + 2, false); } } else @@ -131,26 +133,17 @@ public abstract class DBLimitedFieldSelection int index = JavaTools.FieldInList(_AllFieldNames, _SelFieldNames[curindex]); if (index > -1) { - SelList = new short[] - { - (short) (index) - }; + SelList = new short[] { (short) (index) }; } else { - SelList = new short[] - { - (short) (0) - }; + SelList = new short[] { (short) (0) }; } Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), "SelectedItems", SelList); return; } } - SelList = new short[] - { - (short) (0) - }; + SelList = new short[] { (short) (0) }; Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), "SelectedItems", SelList); } @@ -160,10 +153,7 @@ public abstract class DBLimitedFieldSelection Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), "StringItemList", _AllFieldNames); short[] SelList = null; int index = JavaTools.FieldInList(_AllFieldNames, _SelFieldName); - SelList = new short[] - { - (short) (index) - }; + SelList = new short[] { (short) (index) }; Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), "SelectedItems", SelList); } } diff --git a/wizards/com/sun/star/wizards/ui/DocumentPreview.java b/wizards/com/sun/star/wizards/ui/DocumentPreview.java index 11aef9b6c0dc..522f9f0e32be 100644 --- a/wizards/com/sun/star/wizards/ui/DocumentPreview.java +++ b/wizards/com/sun/star/wizards/ui/DocumentPreview.java @@ -39,7 +39,6 @@ import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; import com.sun.star.util.CloseVetoException; import com.sun.star.util.XCloseable; -import com.sun.star.wizards.common.Desktop; import com.sun.star.wizards.common.Properties; /** diff --git a/wizards/com/sun/star/wizards/ui/FieldSelection.java b/wizards/com/sun/star/wizards/ui/FieldSelection.java index 652eb5f44392..dac15efc375a 100644 --- a/wizards/com/sun/star/wizards/ui/FieldSelection.java +++ b/wizards/com/sun/star/wizards/ui/FieldSelection.java @@ -42,39 +42,38 @@ import java.util.*; */ public class FieldSelection { + public XListBox xFieldsListBox; // Left ListBox + public XListBox xSelectedFieldsListBox; // right (selected) ListBox - public UnoDialog CurUnoDialog; - public XListBox xFieldsListBox; - public XListBox xSelFieldsListBox; - public XFieldSelectionListener xFieldSelection; - public int maxfieldcount = 10000000; - public String sIncSuffix; - protected Integer IStep; + protected UnoDialog CurUnoDialog; + protected String sIncSuffix; protected int FirstHelpIndex; - protected short curtabindex; - String[] AllFieldNames; - public Integer ListBoxWidth; - public Integer SelListBoxPosX; - boolean bisModified = false; - boolean AppendMode = false; - final int SOCMDMOVESEL = 1; - final int SOCMDMOVEALL = 2; - final int SOCMDREMOVESEL = 3; - final int SOCMDREMOVEALL = 4; - final int SOCMDMOVEUP = 5; - final int SOCMDMOVEDOWN = 6; - final int SOFLDSLST = 7; - final int SOSELFLDSLST = 8; - final int cmdButtonWidth = 16; - final int cmdButtonHoriDist = 4; - final int cmdButtonHeight = 14; - final int cmdButtonVertiDist = 2; - final int lblHeight = 8; - final int lblVertiDist = 2; - int CompPosX; - int CompPosY; - int CompHeight; - int CompWidth; + protected boolean AppendMode = false; + protected Integer IStep; + + protected int CompPosX; + protected int CompPosY; + protected int CompHeight; + protected int CompWidth; + + private XFieldSelectionListener xFieldSelection; + private int maxfieldcount = 10000000; + private String[] AllFieldNames; + private Integer ListBoxWidth; + + private Integer SelListBoxPosX; + + private boolean bisModified = false; + + private final static int SOCMDMOVESEL = 1; + private final static int SOCMDMOVEALL = 2; + private final static int SOCMDREMOVESEL = 3; + private final static int SOCMDREMOVEALL = 4; + private final static int SOCMDMOVEUP = 5; + private final static int SOCMDMOVEDOWN = 6; + private final static int SOFLDSLST = 7; + private final static int SOSELFLDSLST = 8; + class ItemListenerImpl implements com.sun.star.awt.XItemListener { @@ -179,18 +178,19 @@ public class FieldSelection return AppendMode; } - public FieldSelection(UnoDialog CurUnoDialog, int iStep, int CompPosX, int CompPosY, int CompWidth, int CompHeight, String slblFields, String slblSelFields, int _FirstHelpIndex, boolean bshowFourButtons) + public FieldSelection(UnoDialog CurUnoDialog, int _iStep, int CompPosX, int CompPosY, int CompWidth, int CompHeight, String slblFields, String slblSelFields, int _FirstHelpIndex, boolean bshowFourButtons) { try { - String AccessTextMoveSelected = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 39); - String AccessTextRemoveSelected = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 40); - String AccessTextMoveAll = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 41); - String AccessTextRemoveAll = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 42); - String AccessMoveFieldUp = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 43); - String AccessMoveFieldDown = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 44); + final String AccessTextMoveSelected = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 39); + final String AccessTextRemoveSelected = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 40); + final String AccessTextMoveAll = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 41); + final String AccessTextRemoveAll = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 42); + final String AccessMoveFieldUp = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 43); + final String AccessMoveFieldDown = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 44); + FirstHelpIndex = _FirstHelpIndex; - curtabindex = UnoDialog.setInitialTabindex(iStep); + short curtabindex = UnoDialog.setInitialTabindex(_iStep); int ShiftButtonCount = 2; int a = 0; this.CurUnoDialog = CurUnoDialog; @@ -201,12 +201,18 @@ public class FieldSelection Object btnmoveall = null; Object btnremoveall = null; - ListBoxWidth = new Integer((int) ((CompWidth - 3 * cmdButtonHoriDist - 2 * cmdButtonWidth) / 2)); - Integer cmdShiftButtonPosX = new Integer((int) (CompPosX + ListBoxWidth.intValue() + cmdButtonHoriDist)); + final int cmdButtonWidth = 16; + final int cmdButtonHoriDist = 4; + final int lblHeight = 8; + final int lblVertiDist = 2; + + ListBoxWidth = new Integer(((CompWidth - 3 * cmdButtonHoriDist - 2 * cmdButtonWidth) / 2)); + Integer cmdShiftButtonPosX = new Integer((CompPosX + ListBoxWidth.intValue() + cmdButtonHoriDist)); Integer ListBoxPosY = new Integer(CompPosY + lblVertiDist + lblHeight); Integer ListBoxHeight = new Integer(CompHeight - 8 - 2); SelListBoxPosX = new Integer(cmdShiftButtonPosX.intValue() + cmdButtonWidth + cmdButtonHoriDist); - IStep = new Integer(iStep); + + IStep = new Integer(_iStep); if (bshowFourButtons == true) { ShiftButtonCount = 4; @@ -217,8 +223,9 @@ public class FieldSelection Integer CmdButtonWidth = new Integer(cmdButtonWidth); - sIncSuffix = "_" + com.sun.star.wizards.common.Desktop.getIncrementSuffix(CurUnoDialog.xDlgNameAccess, "lblFields_"); + sIncSuffix = "_" + com.sun.star.wizards.common.Desktop.getIncrementSuffix(CurUnoDialog.getDlgNameAccess(), "lblFields_"); + // Label CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblFields" + sIncSuffix, new String[] { @@ -229,6 +236,7 @@ public class FieldSelection new Integer(8), slblFields, new Integer(CompPosX), new Integer(CompPosY), IStep, new Short(curtabindex), new Integer(109) }); + // Listbox 'Available fields' xFieldsListBox = CurUnoDialog.insertListBox("lstFields" + sIncSuffix, SOFLDSLST, new ActionListenerImpl(), new ItemListenerImpl(), new String[] { @@ -287,6 +295,7 @@ public class FieldSelection FontDescriptor oFontDesc = new FontDescriptor(); oFontDesc.Name = "StarSymbol"; + // Label 'Fields in the form' CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblSelFields" + sIncSuffix, new String[] { @@ -297,7 +306,8 @@ public class FieldSelection new Integer(8), slblSelFields, SelListBoxPosX, new Integer(CompPosY), IStep, new Short(curtabindex++), ListBoxWidth }); - xSelFieldsListBox = CurUnoDialog.insertListBox("lstSelFields" + sIncSuffix, SOSELFLDSLST, new ActionListenerImpl(), new ItemListenerImpl(), + // ListBox 'Fields in the form' + xSelectedFieldsListBox = CurUnoDialog.insertListBox("lstSelFields" + sIncSuffix, SOSELFLDSLST, new ActionListenerImpl(), new ItemListenerImpl(), new String[] { "Height", "HelpURL", "MultiSelection", "PositionX", "PositionY", "Step", "TabIndex", "Width" @@ -330,7 +340,7 @@ public class FieldSelection CurUnoDialog.getPeerConfiguration().setAccessibleName(btnmoveselected, AccessTextMoveSelected); CurUnoDialog.getPeerConfiguration().setAccessibleName(btnremoveselected, AccessTextRemoveSelected); CurUnoDialog.getPeerConfiguration().setAccessibleName(xFieldsListBox, JavaTools.replaceSubString(slblFields, "", "~")); - CurUnoDialog.getPeerConfiguration().setAccessibleName(xSelFieldsListBox, JavaTools.replaceSubString(slblSelFields, "", "~")); + CurUnoDialog.getPeerConfiguration().setAccessibleName(xSelectedFieldsListBox, JavaTools.replaceSubString(slblSelFields, "", "~")); if (btnmoveall != null) { CurUnoDialog.getPeerConfiguration().setAccessibleName(btnmoveall, AccessTextMoveAll); @@ -362,7 +372,10 @@ public class FieldSelection if (ButtonCount > 0) { YPosArray = new Integer[ButtonCount]; - YPosArray[0] = new Integer((int) (CompPosY + 10 + (((CompHeight - 10) - (ButtonCount * cmdButtonHeight) - ((ButtonCount - 1) * cmdButtonVertiDist)) / 2))); + final int cmdButtonHeight = 14; + final int cmdButtonVertiDist = 2; + + YPosArray[0] = new Integer( (CompPosY + 10 + (((CompHeight - 10) - (ButtonCount * cmdButtonHeight) - ((ButtonCount - 1) * cmdButtonVertiDist)) / 2))); if (ButtonCount > 1) { for (int i = 1; i < ButtonCount; i++) @@ -382,18 +395,18 @@ public class FieldSelection private void changeSelectionOrder(int iNeighbor) { - short[] iSelIndices = xSelFieldsListBox.getSelectedItemsPos(); + short[] iSelIndices = xSelectedFieldsListBox.getSelectedItemsPos(); // Todo: we are assuming that the array starts with the lowest index. Verfy this assumption!!!!! if (iSelIndices.length == 1) { short iSelIndex = iSelIndices[0]; - String[] NewItemList = xSelFieldsListBox.getItems(); + String[] NewItemList = xSelectedFieldsListBox.getItems(); String CurItem = NewItemList[iSelIndex]; String NeighborItem = NewItemList[iSelIndex + iNeighbor]; NewItemList[iSelIndex + iNeighbor] = CurItem; NewItemList[iSelIndex] = NeighborItem; CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, "StringItemList", NewItemList); - xSelFieldsListBox.selectItem(CurItem, true); + xSelectedFieldsListBox.selectItem(CurItem, true); if (xFieldSelection != null) { if (iNeighbor < 0) @@ -443,16 +456,16 @@ public class FieldSelection boolean bmoveUpenabled = false; boolean bmoveDownenabled = false; CurUnoDialog.selectListBoxItem(xFieldsListBox, iFieldsSelIndex); - CurUnoDialog.selectListBoxItem(xSelFieldsListBox, iSelFieldsSelIndex); - int SelListBoxSelLength = xSelFieldsListBox.getSelectedItems().length; + CurUnoDialog.selectListBoxItem(xSelectedFieldsListBox, iSelFieldsSelIndex); + int SelListBoxSelLength = xSelectedFieldsListBox.getSelectedItems().length; int ListBoxSelLength = xFieldsListBox.getSelectedItems().length; boolean bIsFieldSelected = (ListBoxSelLength > 0); int FieldCount = xFieldsListBox.getItemCount(); boolean bSelectSelected = (SelListBoxSelLength > 0); - int SelectCount = xSelFieldsListBox.getItemCount(); + int SelectCount = xSelectedFieldsListBox.getItemCount(); if (bSelectSelected) { - short[] iSelIndices = xSelFieldsListBox.getSelectedItemsPos(); + short[] iSelIndices = xSelectedFieldsListBox.getSelectedItemsPos(); bmoveUpenabled = ((iSelIndices[0] > 0) && (iSelIndices.length == 1)); bmoveDownenabled = (((iSelIndices[SelListBoxSelLength - 1]) < (short) (SelectCount - 1)) && (iSelIndices.length == 1)); } @@ -470,8 +483,8 @@ public class FieldSelection protected void toggleMoveButtons(boolean _btoggleMoveAll, boolean _btoggleMoveSelected) { - boolean btoggleMoveAll = (((xFieldsListBox.getItemCount() + xSelFieldsListBox.getItemCount()) < maxfieldcount) && (_btoggleMoveAll)); - boolean btoggleMoveSelected = (((xFieldsListBox.getSelectedItems().length + xSelFieldsListBox.getItemCount()) < maxfieldcount) && (_btoggleMoveSelected)); + boolean btoggleMoveAll = (((xFieldsListBox.getItemCount() + xSelectedFieldsListBox.getItemCount()) < maxfieldcount) && (_btoggleMoveAll)); + boolean btoggleMoveSelected = (((xFieldsListBox.getSelectedItems().length + xSelectedFieldsListBox.getItemCount()) < maxfieldcount) && (_btoggleMoveSelected)); CurUnoDialog.setControlProperty("cmdMoveAll" + sIncSuffix, "Enabled", new Boolean(btoggleMoveAll)); CurUnoDialog.setControlProperty("cmdMoveSelected" + sIncSuffix, "Enabled", new Boolean(btoggleMoveSelected)); } @@ -479,7 +492,7 @@ public class FieldSelection public void setMultipleMode(boolean _bisMultiple) { xFieldsListBox.setMultipleMode(_bisMultiple); - xSelFieldsListBox.setMultipleMode(_bisMultiple); + xSelectedFieldsListBox.setMultipleMode(_bisMultiple); } public void emptyFieldsListBoxes() @@ -502,25 +515,31 @@ public class FieldSelection public void mergeList(String[] AllFieldNames, String[] SecondList) { - int MaxIndex = SecondList.length; + // int MaxIndex = SecondList.length; xFieldsListBox.addItems(AllFieldNames, (short) 0); toggleListboxButtons((short) - 1, (short) - 1); } public void intializeSelectedFields(String[] _SelectedFieldNames) { - xSelFieldsListBox.addItems(_SelectedFieldNames, xSelFieldsListBox.getItemCount()); + xSelectedFieldsListBox.addItems(_SelectedFieldNames, xSelectedFieldsListBox.getItemCount()); } + + private void removeAllItems(XListBox _xListBox) + { + _xListBox.removeItems((short) 0, _xListBox.getItemCount()); + } + // Note Boolean Parameter public void initialize(String[] _AllFieldNames, boolean _AppendMode) { AppendMode = _AppendMode; - xFieldsListBox.removeItems((short) 0, xFieldsListBox.getItemCount()); + removeAllItems(xFieldsListBox); xFieldsListBox.addItems(_AllFieldNames, (short) 0); - this.AllFieldNames = xFieldsListBox.getItems(); - if ((xSelFieldsListBox.getItemCount() > 0) && (!AppendMode)) + AllFieldNames = xFieldsListBox.getItems(); + if ((xSelectedFieldsListBox.getItemCount() > 0) && (!AppendMode)) { - xSelFieldsListBox.removeItems((short) 0, xSelFieldsListBox.getItemCount()); + removeAllItems(xSelectedFieldsListBox); } toggleListboxControls(Boolean.TRUE); } @@ -543,8 +562,8 @@ public class FieldSelection public void initialize(String[] _AllFieldNames, String[] _SelFieldNames, boolean _AppendMode) { - xSelFieldsListBox.removeItems((short) 0, xSelFieldsListBox.getItemCount()); - xSelFieldsListBox.addItems(_SelFieldNames, (short) 0); + removeAllItems(xSelectedFieldsListBox); + xSelectedFieldsListBox.addItems(_SelFieldNames, (short) 0); initialize(_AllFieldNames, _AppendMode); } @@ -553,20 +572,20 @@ public class FieldSelection // int CurIndex; short iFieldSelected = (short) - 1; short iSelFieldSelected = (short) - 1; - // int MaxCurTarget = xSelFieldsListBox.getItemCount(); + // int MaxCurTarget = xSelectedFieldsListBox.getItemCount(); String[] SelFieldItems; if (bMoveAll) { SelFieldItems = xFieldsListBox.getItems(); - xFieldsListBox.removeItems((short) 0, xFieldsListBox.getItemCount()); + removeAllItems(xFieldsListBox); if (!AppendMode) { - xSelFieldsListBox.removeItems((short) 0, xSelFieldsListBox.getItemCount()); - xSelFieldsListBox.addItems(AllFieldNames, (short) 0); + removeAllItems(xSelectedFieldsListBox); + xSelectedFieldsListBox.addItems(AllFieldNames, (short) 0); } else { - xSelFieldsListBox.addItems(SelFieldItems, xSelFieldsListBox.getItemCount()); + xSelectedFieldsListBox.addItems(SelFieldItems, xSelectedFieldsListBox.getItemCount()); } } else @@ -576,18 +595,18 @@ public class FieldSelection if (MaxSourceSelected > 0) { iFieldSelected = xFieldsListBox.getSelectedItemPos(); - iSelFieldSelected = xSelFieldsListBox.getSelectedItemPos(); + iSelFieldSelected = xSelectedFieldsListBox.getSelectedItemPos(); short[] SourceSelList = new short[xFieldsListBox.getSelectedItemsPos().length]; SourceSelList = xFieldsListBox.getSelectedItemsPos(); - xSelFieldsListBox.addItems(SelFieldItems, xSelFieldsListBox.getItemCount()); + xSelectedFieldsListBox.addItems(SelFieldItems, xSelectedFieldsListBox.getItemCount()); CurUnoDialog.removeSelectedItems(xFieldsListBox); - xSelFieldsListBox.selectItemPos((short) 0, xSelFieldsListBox.getSelectedItems().length > 0); + xSelectedFieldsListBox.selectItemPos((short) 0, xSelectedFieldsListBox.getSelectedItems().length > 0); } } toggleListboxButtons(iFieldSelected, iSelFieldSelected); if (xFieldSelection != null) { - xFieldSelection.shiftFromLeftToRight(SelFieldItems, xSelFieldsListBox.getItems()); + xFieldSelection.shiftFromLeftToRight(SelFieldItems, xSelectedFieldsListBox.getItems()); } } @@ -596,21 +615,21 @@ public class FieldSelection // int m = 0; String SearchString; short iOldFieldSelected = xFieldsListBox.getSelectedItemPos(); - short iOldSelFieldSelected = xSelFieldsListBox.getSelectedItemPos(); - String[] OldSelFieldItems = xSelFieldsListBox.getSelectedItems(); + short iOldSelFieldSelected = xSelectedFieldsListBox.getSelectedItemPos(); + String[] OldSelFieldItems = xSelectedFieldsListBox.getSelectedItems(); if (bMoveAll) { - OldSelFieldItems = xSelFieldsListBox.getItems(); - xFieldsListBox.removeItems((short) 0, xFieldsListBox.getItemCount()); + OldSelFieldItems = xSelectedFieldsListBox.getItems(); + removeAllItems(xFieldsListBox); xFieldsListBox.addItems(AllFieldNames, (short) 0); - xSelFieldsListBox.removeItems((short) 0, xSelFieldsListBox.getItemCount()); + removeAllItems(xSelectedFieldsListBox); } else { int MaxOriginalCount = AllFieldNames.length; - int MaxSelected = OldSelFieldItems.length; + // int MaxSelected = OldSelFieldItems.length; String[] SelList = xFieldsListBox.getItems(); - Vector NewSourceVector = new Vector(); + Vector<String> NewSourceVector = new Vector<String>(); for (int i = 0; i < MaxOriginalCount; i++) { SearchString = AllFieldNames[i]; @@ -630,10 +649,10 @@ public class FieldSelection NewSourceVector.toArray(NewSourceList); xFieldsListBox.addItems(NewSourceList, (short) 0); } - CurUnoDialog.removeSelectedItems(xSelFieldsListBox); + CurUnoDialog.removeSelectedItems(xSelectedFieldsListBox); } toggleListboxButtons(iOldFieldSelected, iOldSelFieldSelected); - String[] NewSelFieldItems = xSelFieldsListBox.getItems(); + String[] NewSelFieldItems = xSelectedFieldsListBox.getItems(); if (xFieldSelection != null) { xFieldSelection.shiftFromRightToLeft(OldSelFieldItems, NewSelFieldItems); diff --git a/wizards/com/sun/star/wizards/ui/FilterComponent.java b/wizards/com/sun/star/wizards/ui/FilterComponent.java index e1ae043db571..6dbc246ca84c 100644 --- a/wizards/com/sun/star/wizards/ui/FilterComponent.java +++ b/wizards/com/sun/star/wizards/ui/FilterComponent.java @@ -56,12 +56,13 @@ public class FilterComponent { private Integer IStep; - private int iStartPosX; - private int iStartPosY; + // private int iStartPosX; + // private int iStartPosY; // int Count; private int RowCount; // private int FilterCount; private static String[] sLogicOperators; + private static String[] sBooleanValues; // private /* public */ String[] FieldNames; private XRadioButton optMatchAll; private XRadioButton optMatchAny; @@ -77,9 +78,6 @@ public class FilterComponent private ControlRow[] oControlRows; // private Vector FilterNames; private String sDuplicateCondition; - final int SOLSTFIELDNAME = 3; - final int SOLSTOPERATOR = 4; - final int SOTXTVALUE = 5; final int SOOPTORMODE = 100; final int SOOPTANDMODE = 101; QueryMetaData oQueryMetaData; @@ -113,6 +111,14 @@ public class FilterComponent { SO_FIRSTTEXTFIELD, SO_SECONDTEXTFIELD, SO_THIRDTEXTFIELD, SO_FOURTHTEXTFIELD }; + final int SO_FIRSTBOOLFIELDNAME = 256 + 1; + final int SO_SECONDBOOLFIELDNAME = 256 + 2; + final int SO_THIRDBOOLFIELDNAME = 256 + 3; + final int SO_FOURTHBOOLFIELDNAME = 256 + 4; + int SO_BOOLEANLIST[] = { + SO_FIRSTBOOLFIELDNAME, SO_SECONDBOOLFIELDNAME, SO_THIRDBOOLFIELDNAME, SO_FOURTHBOOLFIELDNAME + }; + final int SO_OPTQUERYMODE = 5; int SOI_MATCHALL = 0; int SOI_MATCHANY = 1; @@ -127,7 +133,7 @@ public class FilterComponent try { int iKey = CurUnoDialog.getControlKey(EventObject.Source, CurUnoDialog.ControlList); - String scontrolname = ""; + String sControlName = ""; switch (iKey) { // case SOOPTQUERYMODE: @@ -136,31 +142,55 @@ public class FilterComponent case SO_SECONDFIELDNAME: case SO_THIRDFIELDNAME: case SO_FOURTHFIELDNAME: - scontrolname = getControlName(EventObject.Source); - String scontrolnameSuffix = sIncSuffix + "_" + scontrolname.substring(scontrolname.length() - 1, scontrolname.length()); - XListBox xCurFieldListBox = (XListBox) UnoRuntime.queryInterface(XListBox.class, CurUnoDialog.xDlgContainer.getControl(scontrolname)); + sControlName = getControlName(EventObject.Source); + String sControlNameSuffix = sIncSuffix + "_" + getIndexNumber(sControlName); + XListBox xCurFieldListBox = (XListBox) UnoRuntime.queryInterface(XListBox.class, CurUnoDialog.xDlgContainer.getControl(sControlName)); String CurDisplayFieldName = xCurFieldListBox.getSelectedItem(); FieldColumn CurFieldColumn = new FieldColumn(oQueryMetaData, CurDisplayFieldName); - XControl xValueControl = CurUnoDialog.xDlgContainer.getControl("txtValue" + scontrolnameSuffix); - XInterface xValueModel = (XInterface) UnoDialog.getModel(xValueControl); - Helper.setUnoPropertyValue(xValueModel, "TreatAsNumber", new Boolean(CurFieldColumn.bIsNumberFormat)); - final NumberFormatter aNumberFormatter = oQueryMetaData.getNumberFormatter(); - aNumberFormatter.setNumberFormat(xValueModel, CurFieldColumn.DBFormatKey, aNumberFormatter); + + String sControlNameTextValue = "txtValue" + sControlNameSuffix; +// String sControlNameBooleanList = "lstBoolean" + sControlNameSuffix; +// if (aFieldColumn.FieldType == DataType.BOOLEAN) +// { +// // scheint aufgrund eines Fehlers in Toolkit nicht zu funktionieren +// CurUnoDialog.setControlVisible(sControlNameTextValue, false); +// CurUnoDialog.setControlVisible(sControlNameBooleanList, true); +// } +// else +// { +// CurUnoDialog.setControlVisible(sControlNameTextValue, true); +// CurUnoDialog.setControlVisible(sControlNameBooleanList, false); + + XControl xValueControl = CurUnoDialog.xDlgContainer.getControl(sControlNameTextValue); + XInterface xValueModel = (XInterface) UnoDialog.getModel(xValueControl); + Helper.setUnoPropertyValue(xValueModel, "TreatAsNumber", Boolean.valueOf(CurFieldColumn.isNumberFormat())); + final NumberFormatter aNumberFormatter = oQueryMetaData.getNumberFormatter(); + aNumberFormatter.setNumberFormat(xValueModel, CurFieldColumn.getDBFormatKey(), aNumberFormatter); +// } + break; case SO_FIRSTCONDITION: case SO_SECONDCONDITION: case SO_THIRDCONDITION: case SO_FOURTHCONDITION: - scontrolname = getControlName(EventObject.Source); + sControlName = getControlName(EventObject.Source); break; case SOOPTORMODE: case SOOPTANDMODE: // getfilterstate(); return; + + case SO_FIRSTBOOLFIELDNAME: + case SO_SECONDBOOLFIELDNAME: + case SO_THIRDBOOLFIELDNAME: + case SO_FOURTHBOOLFIELDNAME: + sControlName = getControlName(EventObject.Source); + break; + default: break; } - togglefollowingControlRow(scontrolname); + togglefollowingControlRow(sControlName); } catch (Exception exception) { @@ -217,13 +247,25 @@ public class FilterComponent } } + public static String getIndexNumber(String _sStr) + { + String sLastNumber = _sStr.substring(_sStr.length() - 1, _sStr.length()); + return sLastNumber; + } + + /** + * Enable the next ControlRow if the Condition is complete in the current line + * + * @param _scurName every control name ends with something like _1, _2, _3 this is the index number + * we try to interpret to check which line we currently use. (number - 1) + */ private void togglefollowingControlRow(String _scurName) { // String sNameSuffix = sIncSuffix + "_" + _scurName.substring(_scurName.length() - 1, _scurName.length()); - int Index = Integer.valueOf(_scurName.substring(_scurName.length() - 1, _scurName.length())).intValue(); + int Index = Integer.valueOf(getIndexNumber(_scurName)).intValue(); if (Index < oControlRows.length) { - boolean bValue = oControlRows[Index - 1].isComplete(); + boolean bValue = oControlRows[Index - 1].isConditionComplete(); oControlRows[Index].setEnabled(bValue); } } @@ -246,80 +288,84 @@ public class FilterComponent public PropertyValue[][] getFilterConditions() { - ControlRow CurControlRow; - Object curValue; + // ControlRow CurControlRow; // getfilterstate(); - int filtercount = getFilterCount(); - if (filtercount > 0) + int nFilterCount = getFilterCount(); + if (nFilterCount > 0) { if (this.getfilterstate() == this.SOI_MATCHALL) { - filterconditions = new PropertyValue[1][filtercount]; + filterconditions = new PropertyValue[1][nFilterCount]; } else { - filterconditions = new PropertyValue[filtercount][1]; + filterconditions = new PropertyValue[nFilterCount][1]; } int a = 0; for (int i = 0; i < RowCount; i++) { - CurControlRow = oControlRows[i]; + ControlRow CurControlRow = oControlRows[i]; if (CurControlRow.isEnabled()) { - if (CurControlRow.isComplete()) + if (CurControlRow.isConditionComplete()) { - String curFieldName = CurControlRow.getSelectedFieldName(); - int curOperator = (int) CurControlRow.getSelectedOperator() + 1; - FieldColumn CurFieldColumn = oQueryMetaData.getFieldColumnByDisplayName(curFieldName); - if (CurFieldColumn.StandardFormatKey == oQueryMetaData.getNumberFormatter().getTextFormatKey()) + Object aValue; + String sFieldName = CurControlRow.getSelectedFieldName(); + int nOperator = (int) CurControlRow.getSelectedOperator(); + FieldColumn aFieldColumn = oQueryMetaData.getFieldColumnByDisplayName(sFieldName); + if (aFieldColumn.getStandardFormatKey() == oQueryMetaData.getNumberFormatter().getTextFormatKey()) { - curValue = "'" + CurControlRow.getValue() + "'"; + aValue = "'" + CurControlRow.getValue() + "'"; } //// TODO the following code is bound to be deprecated as soon as the query composer is able to handle date/time values as numbers - else if ((CurFieldColumn.StandardFormatKey == oQueryMetaData.getNumberFormatter().getDateFormatKey()) || - (CurFieldColumn.StandardFormatKey == oQueryMetaData.getNumberFormatter().getDateTimeFormatKey())) + else if ((aFieldColumn.getStandardFormatKey() == oQueryMetaData.getNumberFormatter().getDateFormatKey()) || + (aFieldColumn.getStandardFormatKey() == oQueryMetaData.getNumberFormatter().getDateTimeFormatKey())) { String sDate = CurControlRow.getDateTimeString(true); - curValue = "{D '" + sDate + "' }"; // FormatsSupplier + aValue = "{D '" + sDate + "' }"; // FormatsSupplier } - else if (CurFieldColumn.StandardFormatKey == oQueryMetaData.getNumberFormatter().getTimeFormatKey()) + else if (aFieldColumn.getStandardFormatKey() == oQueryMetaData.getNumberFormatter().getTimeFormatKey()) { String sTime = CurControlRow.getDateTimeString(true); - curValue = "'{T '" + sTime + "' }"; + aValue = "'{T '" + sTime + "' }"; } else { - curValue = CurControlRow.getValue(); - switch (CurFieldColumn.FieldType) + aValue = CurControlRow.getValue(); + // if void + if (! AnyConverter.isVoid(aValue)) { - case DataType.TINYINT: - case DataType.BIGINT: - case DataType.INTEGER: - case DataType.SMALLINT: - curValue = String.valueOf(((Double) curValue).intValue()); - break; - case DataType.BIT: - case DataType.BOOLEAN: - // curValue = CurControlRow.getText(); // wrong! (creates something like 'WAHR'/'FALSCH' if german locale is used. - - // double dblvalue = ((Double) curValue).doubleValue(); - //curValue = new Boolean(dblvalue == 1.0); // wrong! we need a string, not a boolean value - - // converts the '1.0'/'0.0' (EffectiveValue) to a 'boolean' String like 'true'/'false' - curValue = String.valueOf(((Double) curValue).intValue() == 1); - break; - default: - curValue = String.valueOf(curValue); - break; + switch (aFieldColumn.getFieldType()) + { + case DataType.TINYINT: + case DataType.BIGINT: + case DataType.INTEGER: + case DataType.SMALLINT: + aValue = String.valueOf(((Double) aValue).intValue()); + break; + case DataType.BIT: + case DataType.BOOLEAN: + // curValue = CurControlRow.getText(); // wrong! (creates something like 'WAHR'/'FALSCH' if german locale is used. + + // double dblvalue = ((Double) curValue).doubleValue(); + //curValue = new Boolean(dblvalue == 1.0); // wrong! we need a string, not a boolean value + + // converts the '1.0'/'0.0' (EffectiveValue) to a 'boolean' String like 'true'/'false' + aValue = String.valueOf(((Double) aValue).intValue() == 1); + break; + default: + aValue = String.valueOf(aValue); + break; + } } } - PropertyValue oPropertyValue = Properties.createProperty(curFieldName, curValue, curOperator); + PropertyValue oPropertyValue = Properties.createProperty(sFieldName, aValue, nOperator); if (getfilterstate()/*this.ifilterstate*/ == this.SOI_MATCHALL) { if (i == 0) { - filterconditions[0] = new PropertyValue[filtercount]; + filterconditions[0] = new PropertyValue[nFilterCount]; } filterconditions[0][a] = oPropertyValue; } @@ -337,7 +383,7 @@ public class FilterComponent PropertyValue aduplicatecondition = filterconditions[iduplicate[0]][iduplicate[1]]; String smsgDuplicateCondition = getDisplayCondition(sDuplicateCondition, aduplicatecondition, null); CurUnoDialog.showMessageBox("WarningBox", VclWindowPeerAttribute.OK, smsgDuplicateCondition); - CurUnoDialog.vetoableChange(new java.beans.PropertyChangeEvent(CurUnoDialog, "Steps", new Integer(1), new Integer(2))); + CurUnoDialog.vetoableChange(new java.beans.PropertyChangeEvent(CurUnoDialog, "Steps", Integer.valueOf(1), Integer.valueOf(2))); return new PropertyValue[][] { }; @@ -422,7 +468,7 @@ public class FilterComponent int a = 0; for (int i = 0; i < RowCount; i++) { - if (oControlRows[i].isEnabled() && oControlRows[i].isComplete()) + if (oControlRows[i].isEnabled() && oControlRows[i].isConditionComplete()) { a++; } @@ -449,51 +495,86 @@ public class FilterComponent { this.curHelpID = _firstHelpID; this.xMSF = _xMSF; - this.IStep = new Integer(iStep); + this.IStep = Integer.valueOf(iStep); curtabindex = UnoDialog.setInitialTabindex(iStep); this.CurUnoDialog = CurUnoDialog; this.RowCount = FilterCount; this.oQueryMetaData = _oQueryMetaData; boolean bEnabled; - sIncSuffix = com.sun.star.wizards.common.Desktop.getIncrementSuffix(CurUnoDialog.xDlgNameAccess, "optMatchAll"); - iStartPosX = iPosX; - iStartPosY = iPosY; + sIncSuffix = com.sun.star.wizards.common.Desktop.getIncrementSuffix(CurUnoDialog.getDlgNameAccess(), "optMatchAll"); + // iStartPosX = iPosX; + // iStartPosY = iPosY; String soptMatchAll = CurUnoDialog.m_oResource.getResText(BaseID + 9); String soptMatchAny = CurUnoDialog.m_oResource.getResText(BaseID + 10); slblFieldNames = CurUnoDialog.m_oResource.getResText(BaseID + 17); slblOperators = CurUnoDialog.m_oResource.getResText(BaseID + 24); slblValue = CurUnoDialog.m_oResource.getResText(BaseID + 25); - sLogicOperators = CurUnoDialog.m_oResource.getResArray(BaseID + 26, 7); + sLogicOperators = CurUnoDialog.m_oResource.getResArray(BaseID + 26, 10 /* 7 */); // =, <>, <, >, <=, >=, like, !like, is null, !is null + sBooleanValues = CurUnoDialog.m_oResource.getResArray(BaseID + 36, 2); // true, false sDuplicateCondition = CurUnoDialog.m_oResource.getResText(BaseID + 89); + // create Radiobuttons + // * match all + // * match one optMatchAll = CurUnoDialog.insertRadioButton("optMatchAll" + sIncSuffix, SOOPTANDMODE, new ItemListenerImpl(), new String[] { - "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width" + "Height", + "HelpURL", + "Label", + "PositionX", + "PositionY", + "State", + "Step", + "TabIndex", + "Width" }, new Object[] { - new Integer(9), "HID:" + curHelpID++, soptMatchAll, new Integer(iPosX), new Integer(iStartPosY), new Short((short) 1), IStep, new Short(curtabindex++), new Integer(203) + Integer.valueOf(9), + "HID:" + curHelpID++, + soptMatchAll, + Integer.valueOf(iPosX), + Integer.valueOf(iPosY), + Short.valueOf((short) 1), + IStep, + Short.valueOf(curtabindex++), + Integer.valueOf(203) }); optMatchAny = CurUnoDialog.insertRadioButton("optMatchAny" + sIncSuffix, SOOPTORMODE, new ItemListenerImpl(), new String[] { - "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" + "Height", + "HelpURL", + "Label", + "PositionX", + "PositionY", + "Step", + "TabIndex", + "Width" }, new Object[] { - new Integer(9), "HID:" + curHelpID++, soptMatchAny, new Integer(iPosX), new Integer(iStartPosY + 12), IStep, new Short(curtabindex++), new Integer(203) + Integer.valueOf(9), + "HID:" + curHelpID++, + soptMatchAny, + Integer.valueOf(iPosX), + Integer.valueOf(iPosY + 12), + IStep, + Short.valueOf(curtabindex++), + Integer.valueOf(203) }); getfilterstate(); + oControlRows = new ControlRow[FilterCount]; for (int i = 0; i < FilterCount; i++) { bEnabled = (i == 0); - oControlRows[i] = new ControlRow(iStartPosY + 20, i, bEnabled, (this.curHelpID + (i * 3))); - iStartPosY += 43; + oControlRows[i] = new ControlRow(iPosX, iPosY + 20, i, bEnabled, (this.curHelpID + (i * 3))); + iPosY += 43; } } catch (Exception exception) @@ -504,42 +585,51 @@ public class FilterComponent public void initialize(PropertyValue[][] _filterconditions, String[] _fieldnames) { - for (int i = 0; i < RowCount; i++) + // String aFieldNamesWithAdditionalEmpty[] = new String[_fieldnames.length + 1]; + // for (int i = 0; i < _fieldnames.length; i++) + // { + // aFieldNamesWithAdditionalEmpty[i] = _fieldnames[i]; + // } + // aFieldNamesWithAdditionalEmpty[_fieldnames.length] = ""; + + int i; + for (i = 0; i < RowCount; i++) { oControlRows[i].setFieldNames(_fieldnames); + // oControlRows[i].setFieldNames(aFieldNamesWithAdditionalEmpty); } this.filterconditions = _filterconditions; PropertyValue[] curfilterconditions; - int a; + // int a; if (_filterconditions.length == 1) { curfilterconditions = filterconditions[0]; - for (a = 0; a < curfilterconditions.length; a++) + for (i = 0; i < curfilterconditions.length; i++) { - oControlRows[a].setCondition(filterconditions[0][a]); + oControlRows[i].setCondition(filterconditions[0][i]); } } else { - for (a = 0; a < filterconditions.length; a++) + for (i = 0; i < filterconditions.length; i++) { - oControlRows[a].setCondition(filterconditions[a][0]); + oControlRows[i].setCondition(filterconditions[i][0]); } } - while (a < oControlRows.length) + while (i < oControlRows.length) { - oControlRows[a].settovoid(); + oControlRows[i].settovoid(); boolean bdoenable; - if (a > 0) + if (i > 0) { - bdoenable = oControlRows[a - 1].isComplete(); + bdoenable = oControlRows[i - 1].isConditionComplete(); } else { bdoenable = true; } - oControlRows[a].setEnabled(bdoenable); - a++; + oControlRows[i].setEnabled(bdoenable); + i++; } } @@ -557,73 +647,218 @@ public class FilterComponent } } + // ------------------------------------------------------------------------- + // + // + // ------------------------------------------------------------------------- + class ControlRow { + private final static int SOLSTFIELDNAME = 3; + private final static int SOLSTOPERATOR = 4; + private final static int SOTXTVALUE = 5; protected XInterface[] ControlElements = new XInterface[6]; - private boolean bEnabled; + private boolean m_bEnabled; String[] FieldNames; - protected ControlRow(int iCompPosY, int Index, boolean _bEnabled, int _firstRowHelpID) + protected ControlRow(int iCompPosX, int iCompPosY, int Index, boolean _bEnabled, int _firstRowHelpID) { + int nFieldWidth = 71; + int nOperatorWidth = 70; + int nValueWidth = 44; + + int nPosX1 = iCompPosX + 10; + int nPosX2 = iCompPosX + 10 + nFieldWidth + 6; // 87 + int nPosX3 = iCompPosX + 10 + nFieldWidth + 6 + nOperatorWidth + 6; + + try { String sCompSuffix = sIncSuffix + "_" + String.valueOf(Index + 1); - this.bEnabled = _bEnabled; + m_bEnabled = _bEnabled; + + // Label Field ControlElements[0] = (XInterface) CurUnoDialog.insertLabel("lblFieldNames" + sCompSuffix, new String[] { - "Enabled", "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" + "Enabled", + "Height", + "Label", + "PositionX", + "PositionY", + "Step", + "TabIndex", + "Width" }, new Object[] { - new Boolean(bEnabled), new Integer(9), slblFieldNames, new Integer(iStartPosX + 10), new Integer(iCompPosY + 13), IStep, new Short(curtabindex++), new Integer(55) + Boolean.valueOf(isEnabled()), + Integer.valueOf(9), + slblFieldNames, + Integer.valueOf(nPosX1), + Integer.valueOf(iCompPosY + 13), + IStep, + Short.valueOf(curtabindex++), + Integer.valueOf(nFieldWidth) }); + + // Label Operator ControlElements[1] = (XInterface) CurUnoDialog.insertLabel("lblOperators" + sCompSuffix, new String[] { - "Enabled", "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" + "Enabled", + "Height", + "Label", + "PositionX", + "PositionY", + "Step", + "TabIndex", + "Width" }, new Object[] { - new Boolean(bEnabled), new Integer(9), slblOperators, new Integer(iStartPosX + 87), new Integer(iCompPosY + 13), IStep, new Short(curtabindex++), new Integer(52) + Boolean.valueOf(isEnabled()), + Integer.valueOf(9), + slblOperators, + Integer.valueOf(nPosX2), + Integer.valueOf(iCompPosY + 13), + IStep, + Short.valueOf(curtabindex++), + Integer.valueOf(nOperatorWidth) }); + + // Label Value ControlElements[2] = (XInterface) CurUnoDialog.insertLabel("lblValue" + sCompSuffix, new String[] { - "Enabled", "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" + "Enabled", + "Height", + "Label", + "PositionX", + "PositionY", + "Step", + "TabIndex", + "Width" }, new Object[] { - new Boolean(bEnabled), new Integer(9), slblValue, new Integer(iStartPosX + 162), new Integer(iCompPosY + 13), IStep, new Short(curtabindex++), new Integer(44) + Boolean.valueOf(isEnabled()), + Integer.valueOf(9), + slblValue, + Integer.valueOf(nPosX3), + Integer.valueOf(iCompPosY + 13), + IStep, + Short.valueOf(curtabindex++), + Integer.valueOf(nValueWidth) }); - ControlElements[3] = (XInterface) CurUnoDialog.insertListBox("lstFieldName" + sCompSuffix, SO_FIELDNAMELIST[Index], null, new ItemListenerImpl(), + + // Listbox Fields + ControlElements[SOLSTFIELDNAME] = (XInterface) CurUnoDialog.insertListBox("lstFieldName" + sCompSuffix, SO_FIELDNAMELIST[Index], null, new ItemListenerImpl(), new String[] { - "Enabled", "Dropdown", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width" + "Enabled", + "Dropdown", + "Height", + "HelpURL", + "LineCount", + "PositionX", + "PositionY", + "Step", + "TabIndex", + "Width" }, new Object[] { - new Boolean(bEnabled), Boolean.TRUE, new Integer(13), "HID:" + _firstRowHelpID++, new Integer(iStartPosX + 10), new Integer(iCompPosY + 23), IStep, new Short(curtabindex++), new Integer(71) + Boolean.valueOf(isEnabled()), + Boolean.TRUE, + Integer.valueOf(13), + "HID:" + _firstRowHelpID++, + Short.valueOf(UnoDialog.getListBoxLineCount() /* 7 */) , + Integer.valueOf(nPosX1), + Integer.valueOf(iCompPosY + 23), + IStep, + Short.valueOf(curtabindex++), + Integer.valueOf(nFieldWidth) }); - ControlElements[4] = (XInterface) CurUnoDialog.insertListBox("lstOperator" + sCompSuffix, SO_CONDITIONLIST[Index], null, new ItemListenerImpl(), + + // Listbox Operators + ControlElements[SOLSTOPERATOR] = (XInterface) CurUnoDialog.insertListBox("lstOperator" + sCompSuffix, SO_CONDITIONLIST[Index], null, new ItemListenerImpl(), new String[] { - "Enabled", "Dropdown", "Height", "HelpURL", "LineCount", "PositionX", "PositionY", "Step", "StringItemList", "TabIndex", "Width" + "Enabled", + "Dropdown", + "Height", + "HelpURL", + "LineCount", + "PositionX", + "PositionY", + "Step", + "StringItemList", + "TabIndex", + "Width" }, new Object[] { - new Boolean(bEnabled), Boolean.TRUE, new Integer(13), "HID:" + _firstRowHelpID++, new Short((short) 7), new Integer(iStartPosX + 87), new Integer(iCompPosY + 23), IStep, sLogicOperators, new Short(curtabindex++), new Integer(70) + Boolean.valueOf(isEnabled()), + Boolean.TRUE, + Integer.valueOf(13), + "HID:" + _firstRowHelpID++, + Short.valueOf((short) sLogicOperators.length /* 7 */ ), + Integer.valueOf(nPosX2), + Integer.valueOf(iCompPosY + 23), + IStep, + sLogicOperators, + Short.valueOf(curtabindex++), + Integer.valueOf(nOperatorWidth) }); - ControlElements[5] = (XInterface) CurUnoDialog.insertFormattedField("txtValue" + sCompSuffix, SO_TEXTFIELDLIST[Index], new TextListenerImpl(), + ControlElements[SOTXTVALUE] = (XInterface) CurUnoDialog.insertFormattedField("txtValue" + sCompSuffix, SO_TEXTFIELDLIST[Index], new TextListenerImpl(), new String[] { - "Enabled", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width" + "Enabled", + "Height", + "HelpURL", + "PositionX", + "PositionY", + "Step", + "TabIndex", + "Width" }, new Object[] { - new Boolean(bEnabled), new Integer(13), "HID:" + _firstRowHelpID++, new Integer(iStartPosX + 162), new Integer(iCompPosY + 23), IStep, new Short(curtabindex++), new Integer(44) + Boolean.valueOf(isEnabled()), + Integer.valueOf(13), + "HID:" + _firstRowHelpID++, + Integer.valueOf(nPosX3), + Integer.valueOf(iCompPosY + 23), + IStep, + Short.valueOf(curtabindex++), + Integer.valueOf(nValueWidth) }); + +// ControlElements[6] = CurUnoDialog.insertListBox((new StringBuilder()).append("lstBoolean").append(sCompSuffix).toString(), SO_BOOLEANLIST[Index], null, new ItemListenerImpl(), new String[] { +// "Enabled", +// "Dropdown", +// "Height", +// "HelpURL", +// "LineCount", +// "PositionX", "PositionY", +// "Step", +// "StringItemList", +// "TabIndex", +// "Width" +// }, new Object[] { +// new Boolean(bEnabled), +// Boolean.TRUE, +// new Integer(13), +// "HID:" + _firstRowHelpID++, +// new Short((short) 2), +// new Integer(nPosX3 + 44), new Integer(iCompPosY + 23), +// IStep, +// FilterComponent.sBooleanValues, +// new Short(curtabindex++), +// new Integer(nValueWidth) +// }); } catch (Exception exception) { @@ -631,15 +866,35 @@ public class FilterComponent } } - boolean isComplete() + /** + * @returns true if the current condition is complete, all needed fields are filled with values. + * So we can enable the next. + */ + boolean isConditionComplete() { try { short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTFIELDNAME]), "SelectedItems")); if (SelFields.length > 0) { - short[] SelOperator = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems")); - if (SelOperator.length > 0) + int nSelOperator = getSelectedOperator(); + // short[] SelOperator = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems")); + if (nSelOperator == com.sun.star.sdb.SQLFilterOperator.SQLNULL || /* is null */ + nSelOperator == com.sun.star.sdb.SQLFilterOperator.NOT_SQLNULL) /* is not null */ + { + // disable value field + Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[2]), "Enabled", Boolean.FALSE); + Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "Enabled", Boolean.FALSE); + + return true; + } + else + { + // enable value field + Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[2]), "Enabled", Boolean.TRUE); + Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "Enabled", Boolean.TRUE); + } + if (nSelOperator != -1) { Object oValue = Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "EffectiveValue"); if (!AnyConverter.isVoid(oValue)) @@ -647,6 +902,13 @@ public class FilterComponent String sValue = (String.valueOf(oValue)); return (!sValue.equals("")); } +// String sBoolValue=""; +// short aSelectedBoolValue[] = (short[])Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[6]), "SelectedItems"); +// if (aSelectedBoolValue.length > 0) +// { +// sBoolValue = String.valueOf(aSelectedBoolValue[0] == 1); +// return !sBoolValue.equals(""); +// } } } return false; @@ -658,7 +920,7 @@ public class FilterComponent } } - public void fieldnamechanged(ItemEvent EventObject) + private void fieldnamechanged(ItemEvent EventObject) { int i = 0; } @@ -718,28 +980,27 @@ public class FilterComponent protected boolean isEnabled() { - return bEnabled; + return m_bEnabled; } - protected void settovoid() + private void settovoid() { CurUnoDialog.deselectListBox(ControlElements[SOLSTFIELDNAME]); CurUnoDialog.deselectListBox(ControlElements[SOLSTOPERATOR]); Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "EffectiveValue", com.sun.star.uno.Any.VOID); } - protected void setEnabled(boolean _bEnabled) + private void setEnabled(boolean _bEnabled) { + // enable all Controls Fieldname, operator, value for (int i = 0; i < ControlElements.length; i++) { - Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[i]), "Enabled", new Boolean(_bEnabled)); + Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[i]), "Enabled", Boolean.valueOf(_bEnabled)); } - bEnabled = _bEnabled; - if (bEnabled) + m_bEnabled = _bEnabled; + if (isEnabled()) { - short[] iselected = new short[] - { - }; + short[] iselected = new short[] {}; try { iselected = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems")); @@ -750,13 +1011,10 @@ public class FilterComponent } if ((iselected.length) == 0) { - Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems", new short[] - { - 0 - }); + Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems", new short[] { 0 }); } } - else if (!isComplete()) + else if (!isConditionComplete()) { CurUnoDialog.deselectListBox(ControlElements[SOLSTOPERATOR]); } @@ -777,12 +1035,37 @@ public class FilterComponent } // TODO: check if it is really useful to match the indices of the listbox the API constants + // =, <>, <, >, <=, >=, like, !like, is null, !is null protected short getSelectedOperator() { try { short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems")); - return SelFields[0]; + switch (SelFields[0]) + { + case 0: + return com.sun.star.sdb.SQLFilterOperator.EQUAL; + case 1: + return com.sun.star.sdb.SQLFilterOperator.NOT_EQUAL; + case 2: + return com.sun.star.sdb.SQLFilterOperator.LESS; + case 3: + return com.sun.star.sdb.SQLFilterOperator.GREATER; + case 4: + return com.sun.star.sdb.SQLFilterOperator.LESS_EQUAL; + case 5: + return com.sun.star.sdb.SQLFilterOperator.GREATER_EQUAL; + case 6: + return com.sun.star.sdb.SQLFilterOperator.LIKE; + case 7: + return com.sun.star.sdb.SQLFilterOperator.NOT_LIKE; + case 8: + return com.sun.star.sdb.SQLFilterOperator.SQLNULL; + case 9: + return com.sun.star.sdb.SQLFilterOperator.NOT_SQLNULL; + default: + return -1; + } } catch (Exception exception) { @@ -833,7 +1116,8 @@ public class FilterComponent } } } -}// com.sun.star.sdb.SQLFilterOperator.EQUAL +} +// com.sun.star.sdb.SQLFilterOperator.EQUAL // com.sun.star.sdb.SQLFilterOperator.NOT_EQUAL // com.sun.star.sdb.SQLFilterOperator.LESS // com.sun.star.sdb.SQLFilterOperator.GREATER diff --git a/wizards/com/sun/star/wizards/ui/ImageList.java b/wizards/com/sun/star/wizards/ui/ImageList.java index a400c34d3054..fd93a3192d8a 100644 --- a/wizards/com/sun/star/wizards/ui/ImageList.java +++ b/wizards/com/sun/star/wizards/ui/ImageList.java @@ -29,12 +29,24 @@ ************************************************************************/ package com.sun.star.wizards.ui; -import com.sun.star.awt.*; +// import com.sun.star.awt.*; + +import com.sun.star.awt.Key; +import com.sun.star.awt.KeyEvent; +import com.sun.star.awt.MouseEvent; +import com.sun.star.awt.Size; +import com.sun.star.awt.XButton; +import com.sun.star.awt.XControl; +import com.sun.star.awt.XFixedText; +import com.sun.star.awt.XItemEventBroadcaster; +import com.sun.star.awt.XItemListener; +import com.sun.star.awt.XKeyListener; +import com.sun.star.awt.XMouseListener; +import com.sun.star.awt.XWindow; import com.sun.star.lang.EventObject; -import com.sun.star.uno.AnyConverter; import com.sun.star.uno.UnoRuntime; import com.sun.star.wizards.common.Helper; -import com.sun.star.wizards.common.Renderer; +import com.sun.star.wizards.common.IRenderer; import com.sun.star.wizards.ui.event.*; @@ -53,13 +65,13 @@ import javax.swing.event.ListDataListener; public class ImageList implements XItemEventBroadcaster, ListDataListener { - private XControl imgContainer; + // private XControl imgContainer; private XFixedText lblImageText; private XFixedText grbxSelectedImage; private XButton btnBack; private XButton btnNext; private XFixedText lblCounter; - private XControl images[]; + private XControl m_aImages[]; private boolean benabled = true; private UnoDialog2 oUnoDialog; private Size gap = new Size(4, 4); @@ -81,9 +93,9 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener private int pageStart = 0; public int helpURL = 0; private CommonListener uiEventListener = new CommonListener(); - private ImageRenderer renderer; + private IImageRenderer renderer; private ListModel listModel; - public Renderer counterRenderer = new SimpleCounterRenderer(); + public IRenderer counterRenderer = new SimpleCounterRenderer(); private Object dialogModel; private ImageKeyListener imageKeyListener; private static final Integer BACKGROUND_COLOR = new Integer(16777216); //new Integer(SystemColor.window.getRGB() + 16777216); @@ -111,6 +123,32 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener this.imageSize = imageSize; } + class OMouseListener implements XMouseListener + { + public OMouseListener() + {} + public void mousePressed(MouseEvent arg0) + { + focus(getImageIndexFor(getSelected())); + } + + public void mouseReleased(MouseEvent arg0) + { + } + + public void mouseEntered(MouseEvent arg0) + { + } + + public void mouseExited(MouseEvent arg0) + { + } + + public void disposing(EventObject arg0) + { + } + } + public void create(UnoDialog2 dialog) { oUnoDialog = dialog; @@ -122,12 +160,26 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener MOVE_SELECTION_VALS[2] = step; - imgContainer = dialog.insertImage(name + "lblContainer", new String[] + XControl imgContainer = dialog.insertImage(name + "lblContainer", + new String[] { - "BackgroundColor", "Border", "Height", "PositionX", "PositionY", "Step", "Width" - }, new Object[] + "BackgroundColor", + "Border", + "Height", + "PositionX", + "PositionY", + "Step", + "Width" + }, + new Object[] { - BACKGROUND_COLOR, new Short((short) 1), new Integer((imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1), new Integer(pos.Width), new Integer(pos.Height), step, new Integer((imageSize.Width + gap.Width) * cols + gap.Width) + BACKGROUND_COLOR, + new Short((short) 1), + new Integer((imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1), + new Integer(pos.Width), + new Integer(pos.Height), + step, + new Integer((imageSize.Width + gap.Width) * cols + gap.Width) }); opeerConfig.setPeerProperties(imgContainer, new String[] @@ -144,74 +196,99 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener uiEventListener.add(dName,EventNames.EVENT_WINDOW_SHOWN,"disableContainerMouseEvents",this); */ - int selectionWidth = rowSelect ? (imageSize.Width + gap.Width) * cols - gap.Width + (selectionGap.Width * 2) : imageSize.Width + (selectionGap.Width * 2); + int selectionWidth = rowSelect ? + (imageSize.Width + gap.Width) * cols - gap.Width + (selectionGap.Width * 2) : + imageSize.Width + (selectionGap.Width * 2); grbxSelectedImage = dialog.insertLabel(name + "_grbxSelected", new String[] { - "BackgroundColor", "Border", "Height", "PositionX", "PositionY", "Step", "Tabstop", "Width" + "BackgroundColor", + "Border", + "Height", + "PositionX", + "PositionY", + "Step", + "Tabstop", + "Width" }, new Object[] { - TRANSPARENT, new Short((short) 1), new Integer(imageSize.Height + (selectionGap.Height * 2)), //height + TRANSPARENT, + new Short((short) 1), + new Integer(imageSize.Height + (selectionGap.Height * 2)), + //height new Integer(0), //posx new Integer(0), //posy - step, Boolean.TRUE, new Integer(selectionWidth) + step, + Boolean.TRUE, + new Integer(selectionWidth) }); XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, grbxSelectedImage); - xWindow.addMouseListener(new XMouseListener() - { - - public void mousePressed(MouseEvent arg0) - { - focus(getImageIndexFor(getSelected())); - } - - public void mouseReleased(MouseEvent arg0) - { - } - - public void mouseEntered(MouseEvent arg0) - { - } - - public void mouseExited(MouseEvent arg0) - { - } - - public void disposing(EventObject arg0) - { - } - }); - + xWindow.addMouseListener(new OMouseListener()); final String[] pNames1 = new String[] { - "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Tabstop", "Width" + "Height", + "HelpURL", + "PositionX", + "PositionY", + "Step", + "TabIndex", + "Tabstop", + "Width" }; lblImageText = dialog.insertLabel(name + "_imageText", pNames1, new Object[] { - new Integer(imageTextHeight), "", new Integer(pos.Width + 1), new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height), step, new Short((short) 0), Boolean.FALSE, new Integer(cols * (imageSize.Width + gap.Width) + gap.Width - 2) + new Integer(imageTextHeight), + "", + new Integer(pos.Width + 1), + new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height), + step, + new Short((short) 0), + Boolean.FALSE, + new Integer(cols * (imageSize.Width + gap.Width) + gap.Width - 2) }); - final Integer btnSize = new Integer(14); if (showButtons) { + final Integer btnSize = new Integer(14); btnBack = dialog.insertButton(name + "_btnBack", "prevPage", this, pNames1, new Object[] { - btnSize, "HID:" + helpURL++, new Integer(pos.Width), new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1), step, new Short((short) (tabIndex + 1)), Boolean.TRUE, btnSize + btnSize, + "HID:" + helpURL++, + new Integer(pos.Width), + new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1), + step, + new Short((short) (tabIndex + 1)), + Boolean.TRUE, + btnSize }); btnNext = dialog.insertButton(name + "_btnNext", "nextPage", this, pNames1, new Object[] { - btnSize, "HID:" + helpURL++, new Integer(pos.Width + (imageSize.Width + gap.Width) * cols + gap.Width - btnSize.intValue() + 1), new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1), step, new Short((short) (tabIndex + 2)), Boolean.TRUE, btnSize + btnSize, + "HID:" + helpURL++, + new Integer(pos.Width + (imageSize.Width + gap.Width) * cols + gap.Width - btnSize.intValue() + 1), + new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1), + step, + new Short((short) (tabIndex + 2)), + Boolean.TRUE, + btnSize }); lblCounter = dialog.insertLabel(name + "_lblCounter", pNames1, new Object[] { - new Integer(LINE_HEIGHT), "", new Integer(pos.Width + btnSize.intValue() + 1), new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + ((btnSize.intValue() - LINE_HEIGHT) / 2)), step, new Short((short) 0), Boolean.FALSE, new Integer(cols * (imageSize.Width + gap.Width) + gap.Width - 2 * btnSize.intValue() - 1) + new Integer(LINE_HEIGHT), + "", + new Integer(pos.Width + btnSize.intValue() + 1), + new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + ((btnSize.intValue() - LINE_HEIGHT) / 2)), + step, + new Short((short) 0), + Boolean.FALSE, + new Integer(cols * (imageSize.Width + gap.Width) + gap.Width - 2 * btnSize.intValue() - 1) }); Helper.setUnoPropertyValue(getModel(lblCounter), "Align", new Short((short) 1)); @@ -222,9 +299,9 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener } imageKeyListener = new ImageKeyListener(); - tabIndex_ = new Short((short) tabIndex); + m_tabIndex = new Short((short) tabIndex); - images = new XControl[rows * cols]; + m_aImages = new XControl[rows * cols]; try { @@ -237,14 +314,14 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener e.printStackTrace(); } - _imageHeight = new Integer(imageSize.Height); - _imageWidth = new Integer(imageSize.Width); + m_imageHeight = new Integer(imageSize.Height); + m_imageWidth = new Integer(imageSize.Width); for (int r = 0; r < rows; r++) { for (int c = 0; c < cols; c++) { - images[r * cols + c] = createImage(dialog, r, c); + m_aImages[r * cols + c] = createImage(dialog, r, c); } } refreshImages(); @@ -252,20 +329,42 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener listModel.addListDataListener(this); } - private Integer _imageHeight, _imageWidth; + private Integer m_imageHeight, m_imageWidth; private final static String[] IMAGE_PROPS = new String[] { - "Border", "BackgroundColor", "Height", "HelpURL", "PositionX", "PositionY", "ScaleImage", "Step", "TabIndex", "Tabstop", "Width" + "Border", + "BackgroundColor", + "Height", + "HelpURL", + "PositionX", + "PositionY", + "ScaleImage", + "Step", + "TabIndex", + "Tabstop", + "Width" }; //used for optimization - private Short tabIndex_; + private Short m_tabIndex; - private XControl createImage(UnoDialog2 dialog, int row, int col) - { - String imageName = name + "_image" + (row * cols + col); - XControl image = dialog.insertImage(imageName, IMAGE_PROPS, new Object[] + private XControl createImage(UnoDialog2 dialog, int _row, int _col) + { + String imageName = name + "_image" + (_row * cols + _col); + XControl image = dialog.insertImage(imageName, + IMAGE_PROPS, + new Object[] { - NO_BORDER, BACKGROUND_COLOR, _imageHeight, "HID:" + helpURL++, new Integer(imagePosX(col)), new Integer(imagePosY(row)), scaleImages, step, tabIndex_, Boolean.FALSE, _imageWidth + NO_BORDER, + BACKGROUND_COLOR, + m_imageHeight, + "HID:" + helpURL++, + new Integer(getImagePosX(_col)), + new Integer(getImagePosY(_row)), + scaleImages, + step, + m_tabIndex, + Boolean.FALSE, + m_imageWidth }); XWindow win = (XWindow) UnoRuntime.queryInterface(XWindow.class, image); @@ -278,12 +377,12 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener return image; } - private int imagePosX(int col) + private int getImagePosX(int col) { return pos.Width + col * (imageSize.Width + gap.Width) + gap.Width; } - private int imagePosY(int row) + private int getImagePosY(int row) { return pos.Height + row * (imageSize.Height + gap.Height) + gap.Height; } @@ -297,29 +396,29 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener hideSelection(); if (refreshOverNull) { - for (int i = 0; i < images.length; i++) + for (int i = 0; i < m_aImages.length; i++) { - setVisible(images[i], false); + setVisible(m_aImages[i], false); } } boolean focusable = true; - for (int i = 0; i < images.length; i++) + for (int i = 0; i < m_aImages.length; i++) { Object[] oResources = renderer.getImageUrls(getObjectFor(i)); if (oResources != null) { if (oResources.length == 1) { - Helper.setUnoPropertyValue(images[i].getModel(), "ImageURL", (String) oResources[0]); + Helper.setUnoPropertyValue(m_aImages[i].getModel(), "ImageURL", (String) oResources[0]); } else if (oResources.length == 2) { - oUnoDialog.getPeerConfiguration().setImageUrl(images[i].getModel(), oResources[0], oResources[1]); + oUnoDialog.getPeerConfiguration().setImageUrl(m_aImages[i].getModel(), oResources[0], oResources[1]); } - Helper.setUnoPropertyValue(images[i].getModel(), "Tabstop", focusable ? Boolean.TRUE : Boolean.FALSE); + Helper.setUnoPropertyValue(m_aImages[i].getModel(), "Tabstop", focusable ? Boolean.TRUE : Boolean.FALSE); if (refreshOverNull) { - setVisible(images[i], true); + setVisible(m_aImages[i], true); } focusable = false; } @@ -378,8 +477,8 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener int row = image / cols; int col = rowSelect ? 0 : image - (row * cols); - MOVE_SELECTION_VALS[0] = new Integer(imagePosX(col) - selectionGap.Width); - MOVE_SELECTION_VALS[1] = new Integer(imagePosY(row) - selectionGap.Height); + MOVE_SELECTION_VALS[0] = new Integer(getImagePosX(col) - selectionGap.Width); + MOVE_SELECTION_VALS[1] = new Integer(getImagePosY(row) - selectionGap.Height); Helper.setUnoPropertyValues(getModel(grbxSelectedImage), MOVE_SELECTION, MOVE_SELECTION_VALS); @@ -387,7 +486,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener { setVisible(grbxSelectedImage, true); //now focus... } - for (int i = 0; i < images.length; i++) + for (int i = 0; i < m_aImages.length; i++) { if (i != image) { @@ -395,7 +494,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener } else { - Helper.setUnoPropertyValue(images[image].getModel(), "Tabstop", Boolean.TRUE); + Helper.setUnoPropertyValue(m_aImages[image].getModel(), "Tabstop", Boolean.TRUE); } } } @@ -570,7 +669,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener /** * @return */ - public ImageRenderer getRenderer() + public IImageRenderer getRenderer() { return renderer; } @@ -664,7 +763,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener /** * @param renderer */ - public void setRenderer(ImageRenderer renderer) + public void setRenderer(IImageRenderer renderer) { this.renderer = renderer; } @@ -783,7 +882,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener int i = getImageFromEvent(event); //TODO what is when the image does not display an image? if (getIndexFor(i) != selected) - setBorder(images[i],imageBorderMO); + setBorder(m_aImages[i],imageBorderMO); } public void mouseExitImage(Object event) { @@ -791,7 +890,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener int i = getImageFromEvent(event); //TODO what is when the image does not display an image? if (getIndexFor(i) != selected) - setBorder(images[i],imageBorder); + setBorder(m_aImages[i],imageBorder); } */ private void setBorder(Object control, Short border) @@ -830,7 +929,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener /** */ - public static interface ImageRenderer extends Renderer + public static interface IImageRenderer extends IRenderer { /** @@ -842,7 +941,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener public Object[] getImageUrls(Object listItem); } - private static class SimpleCounterRenderer implements Renderer + private static class SimpleCounterRenderer implements IRenderer { public String render(Object counter) @@ -878,7 +977,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener } else { - pageStart = (selected / images.length) * images.length; + pageStart = (selected / m_aImages.length) * m_aImages.length; } if (oldPageStart != pageStart) { @@ -981,15 +1080,15 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener private final void focus(int image) { - Helper.setUnoPropertyValue(images[image].getModel(), "Tabstop", + Helper.setUnoPropertyValue(m_aImages[image].getModel(), "Tabstop", Boolean.TRUE); - XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, images[image]); + XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, m_aImages[image]); xWindow.setFocus(); } private final void defocus(int image) { - Helper.setUnoPropertyValue(UnoDialog.getModel(images[image]), "Tabstop", + Helper.setUnoPropertyValue(UnoDialog.getModel(m_aImages[image]), "Tabstop", Boolean.FALSE); } @@ -1020,9 +1119,9 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener public void setenabled(boolean b) { - for (int i = 0; i < images.length; i++) + for (int i = 0; i < m_aImages.length; i++) { - UnoDialog2.setEnabled(images[i], b); + UnoDialog2.setEnabled(m_aImages[i], b); } UnoDialog2.setEnabled(grbxSelectedImage, b); UnoDialog2.setEnabled(lblImageText, b); diff --git a/wizards/com/sun/star/wizards/ui/SortingComponent.java b/wizards/com/sun/star/wizards/ui/SortingComponent.java index e3091d6c9599..f7fd075d6b4c 100644 --- a/wizards/com/sun/star/wizards/ui/SortingComponent.java +++ b/wizards/com/sun/star/wizards/ui/SortingComponent.java @@ -114,7 +114,7 @@ public class SortingComponent "Dropdown", "Enabled", "Height", "HelpURL", "LineCount", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width" }, new Object[] { - new Boolean(true), new Boolean(bDoEnable), new Integer(12), HIDString, new Short("7"), "lstSort" + new Integer(i + 1), IListBoxPosX, new Integer(iCurPosY + 14), IStep, new Short(curtabindex++), IListBoxWidth + new Boolean(true), new Boolean(bDoEnable), new Integer(12), HIDString, new Short(UnoDialog.getListBoxLineCount()), "lstSort" + new Integer(i + 1), IListBoxPosX, new Integer(iCurPosY + 14), IStep, new Short(curtabindex++), IListBoxWidth }); //new Short((short) (17+i*4)) HIDString = "HID:" + Integer.toString(FirstHelpIndex + 1); diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.java b/wizards/com/sun/star/wizards/ui/UnoDialog.java index 1425c3eadb53..120b26367c8d 100644 --- a/wizards/com/sun/star/wizards/ui/UnoDialog.java +++ b/wizards/com/sun/star/wizards/ui/UnoDialog.java @@ -57,7 +57,7 @@ public class UnoDialog implements EventNames public XMultiServiceFactory MSFDialogModel; public XNameContainer xDlgNames; public XControlContainer xDlgContainer; - public XNameAccess xDlgNameAccess; + private XNameAccess m_xDlgNameAccess; public XControl xControl; public XDialog xDialog; public XReschedule xReschedule; @@ -95,7 +95,7 @@ public class UnoDialog implements EventNames xPSetDlg = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xDialogModel); xDlgContainer = (XControlContainer) UnoRuntime.queryInterface(XControlContainer.class, xUnoDialog); xDlgNames = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, xDialogModel); - xDlgNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xDialogModel); + // xDlgNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xDialogModel); xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xUnoDialog); xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xUnoDialog); @@ -141,17 +141,25 @@ public class UnoDialog implements EventNames return m_oPeerConfig; } + XNameAccess getDlgNameAccess() + { + if (m_xDlgNameAccess == null) + { + m_xDlgNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xDialogModel); + } + return m_xDlgNameAccess; + } public void setControlProperty(String ControlName, String PropertyName, Object PropertyValue) { try { if (PropertyValue != null) { - if (xDlgNameAccess.hasByName(ControlName) == false) + if (getDlgNameAccess().hasByName(ControlName) == false) { return; } - Object xControlModel = xDlgNameAccess.getByName(ControlName); + Object xControlModel = getDlgNameAccess().getByName(ControlName); XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlModel); if (AnyConverter.isArray(PropertyValue)) { @@ -182,11 +190,11 @@ public class UnoDialog implements EventNames { if (PropertyValues != null) { - if (xDlgNameAccess.hasByName(ControlName) == false) + if (getDlgNameAccess().hasByName(ControlName) == false) { return; } - Object xControlModel = xDlgNameAccess.getByName(ControlName); + Object xControlModel = getDlgNameAccess().getByName(ControlName); XMultiPropertySet xMultiPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, xControlModel); xMultiPSet.setPropertyValues(PropertyNames, PropertyValues); } @@ -201,7 +209,7 @@ public class UnoDialog implements EventNames { try { - Object xControlModel = xDlgNameAccess.getByName(ControlName); + Object xControlModel = getDlgNameAccess().getByName(ControlName); XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlModel); Object oPropValue = xPSet.getPropertyValue(PropertyName); // if (AnyConverter.isArray(oPropValue)) @@ -220,12 +228,13 @@ public class UnoDialog implements EventNames { try { - Object xControlModel = xDlgNameAccess.getByName(ControlName); + Object xControlModel = getDlgNameAccess().getByName(ControlName); XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlModel); Property[] allProps = xPSet.getPropertySetInfo().getProperties(); for (int i = 0; i < allProps.length; i++) { - System.out.println(allProps[i].Name); + String sName = allProps[i].Name; + System.out.println(sName); } } catch (com.sun.star.uno.Exception exception) @@ -268,7 +277,10 @@ public class UnoDialog implements EventNames public static int getListBoxItemCount(XListBox _xListBox) { - String[] fieldnames = (String[]) Helper.getUnoPropertyValue(getModel(_xListBox), "StringItemList"); + // This function may look ugly, but this is the only way to check the count + // of values in the model,which is always right. + // the control is only a view and could be right or not. + final String[] fieldnames = (String[]) Helper.getUnoPropertyValue(getModel(_xListBox), "StringItemList"); return fieldnames.length; } @@ -685,7 +697,7 @@ public class UnoDialog implements EventNames * * @param _xBasisListBox */ - public void deselectListBox(XInterface _xBasisListBox) + public static void deselectListBox(XInterface _xBasisListBox) { Object oListBoxModel = getModel(_xBasisListBox); Object sList = Helper.getUnoPropertyValue(oListBoxModel, "StringItemList"); @@ -823,6 +835,7 @@ public class UnoDialog implements EventNames } XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class, tk); xReschedule = (XReschedule) UnoRuntime.queryInterface(XReschedule.class, xToolkit); + // TEUER! xControl.createPeer(xToolkit, parentPeer); xWindowPeer = xControl.getPeer(); return xControl.getPeer(); @@ -870,7 +883,9 @@ public class UnoDialog implements EventNames public static Object getModel(Object control) { - return ((XControl) UnoRuntime.queryInterface(XControl.class, control)).getModel(); + XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, control); + XControlModel xModel = xControl.getModel(); + return xModel; } public static void setEnabled(Object control, boolean enabled) @@ -1128,4 +1143,9 @@ public class UnoDialog implements EventNames return _surl; } } + + public static short getListBoxLineCount() + { + return (short)20; + } } diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog2.java b/wizards/com/sun/star/wizards/ui/UnoDialog2.java index d8194c085626..236233ecf8a8 100644 --- a/wizards/com/sun/star/wizards/ui/UnoDialog2.java +++ b/wizards/com/sun/star/wizards/ui/UnoDialog2.java @@ -51,6 +51,7 @@ public class UnoDialog2 extends UnoDialog implements EventNames /** * Override this method to return another listener. + * @return */ protected AbstractListener createListener() { @@ -85,6 +86,23 @@ public class UnoDialog2 extends UnoDialog implements EventNames return insertButton(sName, actionPerformed, this, sPropNames, oPropValues); } + public XButton insertImageButton(String sName, com.sun.star.awt.XActionListener actionPerformed, Object eventTarget, String[] sPropNames, Object[] oPropValues) + { + + XButton xButton = (XButton) insertControlModel2("com.sun.star.awt.UnoControlButtonModel", sName, sPropNames, oPropValues, XButton.class); + + if (actionPerformed != null) + { + xButton.addActionListener(actionPerformed); + } + return xButton; + } + + public XButton insertImageButton(String sName, com.sun.star.awt.XActionListener actionPerformed, String[] sPropNames, Object[] oPropValues) + { + return insertImageButton(sName, actionPerformed, this, sPropNames, oPropValues); + } + public XCheckBox insertCheckBox(String sName, String itemChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) { @@ -190,7 +208,7 @@ public class UnoDialog2 extends UnoDialog implements EventNames public XControl insertInfoImage(int _posx, int _posy, int _iStep) { - XControl xImgControl = insertImage(Desktop.getUniqueName(xDlgNameAccess, "imgHint"), + XControl xImgControl = insertImage(Desktop.getUniqueName(getDlgNameAccess(), "imgHint"), new String[] { "Border", "Height", "ImageURL", "PositionX", "PositionY", "ScaleImage", "Step", "Width" @@ -199,7 +217,7 @@ public class UnoDialog2 extends UnoDialog implements EventNames { new Short((short) 0), new Integer(10), UIConsts.INFOIMAGEURL, new Integer(_posx), new Integer(_posy), Boolean.FALSE, new Integer(_iStep), new Integer(10) }); - super.getPeerConfiguration().setImageUrl(super.getModel(xImgControl), UIConsts.INFOIMAGEURL, UIConsts.INFOIMAGEURL_HC); + super.getPeerConfiguration().setImageUrl(getModel(xImgControl), UIConsts.INFOIMAGEURL, UIConsts.INFOIMAGEURL_HC); return xImgControl; } @@ -331,8 +349,8 @@ public class UnoDialog2 extends UnoDialog implements EventNames { ex.printStackTrace(); } - - return xDlgContainer.getControl(componentName); + final Object aObj = xDlgContainer.getControl(componentName); + return aObj; } private void setControlPropertiesDebug(Object model, String[] names, Object[] values) diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.java b/wizards/com/sun/star/wizards/ui/WizardDialog.java index 4fe94c5e3456..2e101ff3398a 100644 --- a/wizards/com/sun/star/wizards/ui/WizardDialog.java +++ b/wizards/com/sun/star/wizards/ui/WizardDialog.java @@ -35,7 +35,7 @@ import com.sun.star.wizards.ui.event.CommonListener; import com.sun.star.wizards.ui.event.EventNames; import com.sun.star.wizards.ui.event.MethodInvocation; import com.sun.star.uno.UnoRuntime; -import com.sun.star.awt.XItemEventBroadcaster; +// import com.sun.star.awt.XItemEventBroadcaster; import com.sun.star.awt.*; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.XInterface; @@ -85,6 +85,8 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL * "HID:(hid+3)" - the next button * "HID:(hid+4)" - the create button * "HID:(hid+5)" - the cancel button + * @param xMSF + * @param hid_ */ public WizardDialog(XMultiServiceFactory xMSF, int hid_) { @@ -96,6 +98,10 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL //new Resource(xMSF,"Common","com"); } + /** + * + * @return + */ public Resource getResource() { return oWizardResource; @@ -378,6 +384,11 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL /* (non-Javadoc) * @see com.sun.star.wizards.ui.XCompletion#iscompleted(int) */ + /** + * + * @param _ndialogpage + * @return + */ public boolean iscompleted(int _ndialogpage) { return false; @@ -386,6 +397,11 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL * @see com.sun.star.wizards.ui.XCompletion#ismodified(int) */ + /** + * + * @param _ndialogpage + * @return + */ public boolean ismodified(int _ndialogpage) { return false; @@ -394,6 +410,11 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL * @see com.sun.star.wizards.ui.XCompletion#setcompleted(int, boolean) */ + /** + * + * @param _ndialogpage + * @param _biscompleted + */ public void setcompleted(int _ndialogpage, boolean _biscompleted) { } @@ -401,6 +422,12 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL * @see com.sun.star.wizards.ui.XCompletion#setmodified(int, java.lang.Object, java.lang.Object) */ + /** + * + * @param _ndialogpage + * @param ooldValue + * @param onewValue + */ public void setmodified(int _ndialogpage, Object ooldValue, Object onewValue) { } @@ -645,8 +672,12 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL public abstract void finishWizard(); + /** + * This function will call if the finish button is pressed on the UI. + */ public void finishWizard_1() { + enableFinishButton(false); finishWizard(); removeTerminateListener(); } diff --git a/wizards/com/sun/star/wizards/ui/event/DataAware.java b/wizards/com/sun/star/wizards/ui/event/DataAware.java index 0beea52edf48..5e18f931fa34 100644 --- a/wizards/com/sun/star/wizards/ui/event/DataAware.java +++ b/wizards/com/sun/star/wizards/ui/event/DataAware.java @@ -51,7 +51,6 @@ import java.util.Iterator; * Data Object. */ public abstract class DataAware { - protected static Class[] EMPTY_ARRAY = new Class[0]; /** * this is the data object. @@ -294,11 +293,18 @@ public abstract class DataAware { * @param obj the object which contains the property. * @return the get method reflection object. */ - protected Method createGetMethod(String propName, Object obj) { + private static Class[] EMPTY_ARRAY = new Class[0]; + + protected Method createGetMethod(String propName, Object obj) + { Method m = null; - try { //try to get a "get" method. + try + { //try to get a "get" method. + m = obj.getClass().getMethod("get" + propName, EMPTY_ARRAY); - } catch (NoSuchMethodException ex1) { + } + catch (NoSuchMethodException ex1) + { throw new IllegalArgumentException("get" + propName + "() method does not exist on " + obj.getClass().getName()); } return m; diff --git a/wizards/com/sun/star/wizards/web/BackgroundsDialog.java b/wizards/com/sun/star/wizards/web/BackgroundsDialog.java index 0f42d4be15c0..0d50664b9efe 100644 --- a/wizards/com/sun/star/wizards/web/BackgroundsDialog.java +++ b/wizards/com/sun/star/wizards/web/BackgroundsDialog.java @@ -151,7 +151,7 @@ public class BackgroundsDialog extends ImageListDialog * @author rpiterman * */ - private class BGRenderer implements ImageList.ImageRenderer + private class BGRenderer implements ImageList.IImageRenderer { private int cut; diff --git a/wizards/com/sun/star/wizards/web/IconsDialog.java b/wizards/com/sun/star/wizards/web/IconsDialog.java index 38cb11826b0c..92702b978eec 100644 --- a/wizards/com/sun/star/wizards/web/IconsDialog.java +++ b/wizards/com/sun/star/wizards/web/IconsDialog.java @@ -29,7 +29,6 @@ ************************************************************************/ package com.sun.star.wizards.web; -import com.sun.star.wizards.ui.UIConsts; import javax.swing.ListModel; import com.sun.star.awt.Size; @@ -47,7 +46,7 @@ import com.sun.star.wizards.web.data.CGIconSet; * It also implements the ImageList.ImageRenderer interface, to handle * its own objects. */ -public class IconsDialog extends ImageListDialog implements ImageList.ImageRenderer, ListModel +public class IconsDialog extends ImageListDialog implements ImageList.IImageRenderer, ListModel { private ConfigSet set; diff --git a/wizards/com/sun/star/wizards/web/ImageListDialog.java b/wizards/com/sun/star/wizards/web/ImageListDialog.java index 8414068481b9..4fbf832f32ff 100644 --- a/wizards/com/sun/star/wizards/web/ImageListDialog.java +++ b/wizards/com/sun/star/wizards/web/ImageListDialog.java @@ -36,7 +36,7 @@ import com.sun.star.awt.XFixedText; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.wizards.common.Helper; import com.sun.star.wizards.common.JavaTools; -import com.sun.star.wizards.common.Renderer; +import com.sun.star.wizards.common.IRenderer; import com.sun.star.wizards.ui.ImageList; import com.sun.star.wizards.ui.UIConsts; import com.sun.star.wizards.ui.UnoDialog2; @@ -259,7 +259,7 @@ public abstract class ImageListDialog extends UnoDialog2 implements UIConsts * @author rpiterman * */ - public static class ARenderer implements Renderer + public static class ARenderer implements IRenderer { String template; diff --git a/wizards/com/sun/star/wizards/web/ProcessStatusRenderer.java b/wizards/com/sun/star/wizards/web/ProcessStatusRenderer.java index a688ffb7fdd6..6caa4dfda3c6 100644 --- a/wizards/com/sun/star/wizards/web/ProcessStatusRenderer.java +++ b/wizards/com/sun/star/wizards/web/ProcessStatusRenderer.java @@ -32,7 +32,7 @@ package com.sun.star.wizards.web; import java.util.Hashtable; import java.util.Map; -import com.sun.star.wizards.common.Renderer; +import com.sun.star.wizards.common.IRenderer; /** * @author rpiterman @@ -42,7 +42,7 @@ import com.sun.star.wizards.common.Renderer; * display the current task status. * (renders the state to resource strings) */ -public class ProcessStatusRenderer implements Renderer, WebWizardConst +public class ProcessStatusRenderer implements IRenderer, WebWizardConst { Map strings = new Hashtable(12); diff --git a/wizards/com/sun/star/wizards/web/StatusDialog.java b/wizards/com/sun/star/wizards/web/StatusDialog.java index bf8c57ad2b6a..4f478c97aa21 100644 --- a/wizards/com/sun/star/wizards/web/StatusDialog.java +++ b/wizards/com/sun/star/wizards/web/StatusDialog.java @@ -32,10 +32,9 @@ package com.sun.star.wizards.web; import com.sun.star.awt.XButton; import com.sun.star.awt.XFixedText; import com.sun.star.awt.XProgressBar; -import com.sun.star.awt.XWindowListener; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.wizards.common.Helper; -import com.sun.star.wizards.common.Renderer; +import com.sun.star.wizards.common.IRenderer; import com.sun.star.wizards.ui.UnoDialog; import com.sun.star.wizards.ui.UnoDialog2; import com.sun.star.wizards.ui.event.MethodInvocation; @@ -59,7 +58,7 @@ public class StatusDialog extends UnoDialog2 implements TaskListener private XFixedText lblCounter; private XButton btnCancel; private String[] res; - private Renderer renderer; + private IRenderer renderer; private boolean enableBreak = false; private boolean closeOnFinish = true; private MethodInvocation finishedMethod; @@ -285,7 +284,7 @@ public class StatusDialog extends UnoDialog2 implements TaskListener /** * @return the subTask renderer object */ - public Renderer getRenderer() + public IRenderer getRenderer() { return renderer; } @@ -293,7 +292,7 @@ public class StatusDialog extends UnoDialog2 implements TaskListener /** * @param renderer */ - public void setRenderer(Renderer renderer) + public void setRenderer(IRenderer renderer) { this.renderer = renderer; } diff --git a/wizards/com/sun/star/wizards/web/TOCPreview.java b/wizards/com/sun/star/wizards/web/TOCPreview.java index f12079d6f764..a73790fb68d0 100644 --- a/wizards/com/sun/star/wizards/web/TOCPreview.java +++ b/wizards/com/sun/star/wizards/web/TOCPreview.java @@ -32,20 +32,13 @@ package com.sun.star.wizards.web; import org.w3c.dom.Document; import com.sun.star.beans.PropertyValue; -import com.sun.star.frame.FrameSearchFlag; import com.sun.star.frame.XDispatch; -import com.sun.star.frame.XDispatchProvider; import com.sun.star.frame.XFrame; -import com.sun.star.frame.XTerminateListener; import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.UnoRuntime; import com.sun.star.util.URL; -import com.sun.star.util.XURLTransformer; import com.sun.star.wizards.common.Desktop; import com.sun.star.wizards.common.FileAccess; -import com.sun.star.wizards.common.Properties; import com.sun.star.wizards.common.UCB; -import com.sun.star.wizards.document.OfficeDocument; import com.sun.star.wizards.ui.event.Task; import com.sun.star.wizards.web.data.CGLayout; import com.sun.star.wizards.web.data.CGSettings; diff --git a/wizards/com/sun/star/wizards/web/WWD_Events.java b/wizards/com/sun/star/wizards/web/WWD_Events.java index 1bc654b67b51..e396a46ddd30 100644 --- a/wizards/com/sun/star/wizards/web/WWD_Events.java +++ b/wizards/com/sun/star/wizards/web/WWD_Events.java @@ -48,7 +48,6 @@ import com.sun.star.wizards.common.SystemDialog; import com.sun.star.wizards.ui.UnoDialog; import com.sun.star.wizards.ui.event.DataAware; import com.sun.star.wizards.ui.event.ListModelBinder; -import com.sun.star.wizards.ui.event.MethodInvocation; import com.sun.star.wizards.ui.event.Task; import com.sun.star.wizards.web.data.CGDocument; import com.sun.star.wizards.web.data.CGPublish; diff --git a/wizards/com/sun/star/wizards/web/WWD_Startup.java b/wizards/com/sun/star/wizards/web/WWD_Startup.java index d4b91b638a39..b0dd726ace90 100644 --- a/wizards/com/sun/star/wizards/web/WWD_Startup.java +++ b/wizards/com/sun/star/wizards/web/WWD_Startup.java @@ -37,22 +37,16 @@ import java.util.List; import java.util.Vector; import com.sun.star.awt.VclWindowPeerAttribute; -import com.sun.star.awt.WindowClass; -import com.sun.star.awt.WindowDescriptor; import com.sun.star.awt.XControl; import com.sun.star.awt.XItemListener; -import com.sun.star.awt.XListBox; import com.sun.star.awt.XWindow; import com.sun.star.awt.XWindowPeer; import com.sun.star.frame.XDesktop; import com.sun.star.frame.XFrame; import com.sun.star.frame.XModel; import com.sun.star.lang.EventObject; -import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; -import com.sun.star.util.CloseVetoException; -import com.sun.star.util.XCloseable; import com.sun.star.wizards.common.ConfigSet; import com.sun.star.wizards.common.Configuration; import com.sun.star.wizards.common.Desktop; @@ -61,7 +55,6 @@ import com.sun.star.wizards.common.Helper; import com.sun.star.wizards.common.JavaTools; import com.sun.star.wizards.common.SystemDialog; import com.sun.star.wizards.document.OfficeDocument; -import com.sun.star.wizards.text.TextDocument; import com.sun.star.wizards.ui.DocumentPreview; import com.sun.star.wizards.ui.event.DataAware; import com.sun.star.wizards.ui.event.ListModelBinder; diff --git a/wizards/com/sun/star/wizards/web/WebWizard.java b/wizards/com/sun/star/wizards/web/WebWizard.java index b9b968dcdc14..6913369991b4 100644 --- a/wizards/com/sun/star/wizards/web/WebWizard.java +++ b/wizards/com/sun/star/wizards/web/WebWizard.java @@ -36,9 +36,7 @@ */ package com.sun.star.wizards.web; -import com.sun.star.awt.XTopWindow; import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.UnoRuntime; import com.sun.star.wizards.common.Desktop; /** @@ -80,4 +78,4 @@ public class WebWizard extends WWD_Events exception.printStackTrace(System.out); } } -}
\ No newline at end of file +} diff --git a/wizards/com/sun/star/wizards/web/WebWizardDialog.java b/wizards/com/sun/star/wizards/web/WebWizardDialog.java index 089122bea457..ce06a065868f 100644 --- a/wizards/com/sun/star/wizards/web/WebWizardDialog.java +++ b/wizards/com/sun/star/wizards/web/WebWizardDialog.java @@ -42,7 +42,6 @@ import com.sun.star.awt.XRadioButton; import com.sun.star.awt.XTextComponent; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.wizards.common.Helper; -import com.sun.star.wizards.common.Resource; import com.sun.star.wizards.ui.ImageList; import com.sun.star.wizards.ui.UIConsts; import com.sun.star.wizards.ui.WizardDialog; @@ -290,7 +289,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC }, new Object[] { - Boolean.TRUE, INTEGER_12, "HID:" + HID1_LST_SESSIONS, new Short((short) 7), "lstLoadSettings", new Integer(97), new Integer(165), INTEGERS[1], new Short(tabIndex++), new Integer(173) + Boolean.TRUE, INTEGER_12, "HID:" + HID1_LST_SESSIONS, new Short((short) 14), "lstLoadSettings", new Integer(97), new Integer(165), INTEGERS[1], new Short(tabIndex++), new Integer(173) }); btnDelSession = insertButton("btnDelSession", BTNDELSESSION_ACTION_PERFORMED, new String[] @@ -372,7 +371,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC }, new Object[] { - Boolean.TRUE, INTEGER_12, "HID:" + HID2_LST_DOC_EXPORT, new Short((short) 7), "lstDocTargetType", new Integer(235), new Integer(38), INTEGERS[2], new Short(tabIndex++), new Integer(89) + Boolean.TRUE, INTEGER_12, "HID:" + HID2_LST_DOC_EXPORT, new Short((short) 14), "lstDocTargetType", new Integer(235), new Integer(38), INTEGERS[2], new Short(tabIndex++), new Integer(89) }); @@ -561,7 +560,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC }, new Object[] { - Boolean.TRUE, INTEGER_12, "HID:" + HID5_LST_STYLES, new Short((short) 7), "lstStyles", new Integer(179), new Integer(26), INTEGERS[5], new Short((short) 52), new Integer(145) + Boolean.TRUE, INTEGER_12, "HID:" + HID5_LST_STYLES, new Short((short) 14), "lstStyles", new Integer(179), new Integer(26), INTEGERS[5], new Short((short) 52), new Integer(145) }); insertLabel("lblBackground", PROPNAMES_LBL, @@ -876,7 +875,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC }, new Object[] { - Boolean.TRUE, Boolean.TRUE, INTEGER_12, "HID:" + HID7_TXT_SAVE, new Short((short) 7), "txtSaveSettings", new Integer(179), new Integer(167), INTEGERS[7], new Short(tabIndex++), new Integer(145) + Boolean.TRUE, Boolean.TRUE, INTEGER_12, "HID:" + HID7_TXT_SAVE, new Short((short) 14), "txtSaveSettings", new Integer(179), new Integer(167), INTEGERS[7], new Short(tabIndex++), new Integer(145) }); } @@ -913,7 +912,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC * @author rpiterman */ - private class LayoutRenderer implements ImageList.ImageRenderer + private class LayoutRenderer implements ImageList.IImageRenderer { public Object[] getImageUrls(Object listItem) diff --git a/wizards/com/sun/star/wizards/web/WebWizardDialogResources.java b/wizards/com/sun/star/wizards/web/WebWizardDialogResources.java index f6087fca4edf..484174533fa9 100644 --- a/wizards/com/sun/star/wizards/web/WebWizardDialogResources.java +++ b/wizards/com/sun/star/wizards/web/WebWizardDialogResources.java @@ -33,7 +33,6 @@ package com.sun.star.wizards.web; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.wizards.common.Configuration; -import com.sun.star.wizards.common.JavaTools; import com.sun.star.wizards.common.Properties; import com.sun.star.wizards.common.Resource; import com.sun.star.wizards.document.OfficeDocument; diff --git a/wizards/com/sun/star/wizards/web/data/CGDocument.java b/wizards/com/sun/star/wizards/web/data/CGDocument.java index 81beb4a05bfc..eeb009ce0283 100644 --- a/wizards/com/sun/star/wizards/web/data/CGDocument.java +++ b/wizards/com/sun/star/wizards/web/data/CGDocument.java @@ -34,7 +34,6 @@ import java.io.FileNotFoundException; import org.w3c.dom.Node; -import com.sun.star.beans.Property; import com.sun.star.beans.PropertyValue; import com.sun.star.document.MacroExecMode; import com.sun.star.document.UpdateDocMode; @@ -48,7 +47,6 @@ import com.sun.star.uno.UnoRuntime; import com.sun.star.util.DateTime; import com.sun.star.wizards.common.Desktop; import com.sun.star.wizards.common.FileAccess; -import com.sun.star.wizards.common.Helper; import com.sun.star.wizards.common.JavaTools; import com.sun.star.wizards.common.Properties; import com.sun.star.wizards.common.XMLHelper; diff --git a/wizards/com/sun/star/wizards/web/data/CGPublish.java b/wizards/com/sun/star/wizards/web/data/CGPublish.java index eaca60259399..d93f21e0bbdc 100644 --- a/wizards/com/sun/star/wizards/web/data/CGPublish.java +++ b/wizards/com/sun/star/wizards/web/data/CGPublish.java @@ -30,7 +30,6 @@ package com.sun.star.wizards.web.data; import com.sun.star.wizards.common.ConfigGroup; -import com.sun.star.wizards.common.JavaTools; /** * diff --git a/wizards/com/sun/star/wizards/web/data/CGSettings.java b/wizards/com/sun/star/wizards/web/data/CGSettings.java index 2364f3ae653c..d6381ee41d13 100644 --- a/wizards/com/sun/star/wizards/web/data/CGSettings.java +++ b/wizards/com/sun/star/wizards/web/data/CGSettings.java @@ -37,7 +37,6 @@ */ package com.sun.star.wizards.web.data; -import java.util.Calendar; import java.util.Hashtable; import java.util.Map; import java.util.Vector; @@ -46,13 +45,10 @@ import com.sun.star.beans.PropertyValue; import com.sun.star.container.NoSuchElementException; import com.sun.star.container.XNameAccess; import com.sun.star.i18n.NumberFormatIndex; -import com.sun.star.lang.Locale; import com.sun.star.lang.WrappedTargetException; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; import com.sun.star.util.DateTime; -import com.sun.star.util.XNumberFormatsSupplier; -import com.sun.star.util.XNumberFormatter; import com.sun.star.wizards.common.*; import com.sun.star.wizards.common.Helper.DateUtils; diff --git a/wizards/com/sun/star/wizards/web/export/AbstractExporter.java b/wizards/com/sun/star/wizards/web/export/AbstractExporter.java index 71c214a272e6..d09043cc68e2 100644 --- a/wizards/com/sun/star/wizards/web/export/AbstractExporter.java +++ b/wizards/com/sun/star/wizards/web/export/AbstractExporter.java @@ -43,7 +43,6 @@ import com.sun.star.frame.XComponentLoader; import com.sun.star.frame.XDesktop; import com.sun.star.frame.XStorable; import com.sun.star.io.IOException; -import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; import com.sun.star.util.XCloseable; diff --git a/wizards/source/formwizard/dbwizres.src b/wizards/source/formwizard/dbwizres.src index e0a563f81db2..d3b04cd8593d 100644 --- a/wizards/source/formwizard/dbwizres.src +++ b/wizards/source/formwizard/dbwizres.src @@ -777,7 +777,9 @@ String RID_DB_QUERY_WIZARD_START + 25 Text [ en-US] = "Value"; }; - +// -------------------------------------- +// don't change anything to the next 10 values +// they are list elements and need to be as follows String RID_DB_QUERY_WIZARD_START + 26 { Text [ en-US] = "is equal to"; @@ -799,7 +801,6 @@ String RID_DB_QUERY_WIZARD_START + 29 Text [ en-US] = "is greater than"; }; - String RID_DB_QUERY_WIZARD_START + 30 { Text [ en-US] = "is equal or less than "; @@ -817,11 +818,37 @@ String RID_DB_QUERY_WIZARD_START + 32 String RID_DB_QUERY_WIZARD_START + 33 { - Text [ en-US] = "and"; + Text [ en-US] = "not like"; }; String RID_DB_QUERY_WIZARD_START + 34 { + Text [ en-US] = "is null"; +}; + +String RID_DB_QUERY_WIZARD_START + 35 +{ + Text [ en-US] = "is not null"; +}; +// -------------------------------------- + +String RID_DB_QUERY_WIZARD_START + 36 +{ + Text [ en-US] = "true"; +}; + +String RID_DB_QUERY_WIZARD_START + 37 +{ + Text [ en-US] = "false"; +}; + +String RID_DB_QUERY_WIZARD_START + 38 +{ + Text [ en-US] = "and"; +}; + +String RID_DB_QUERY_WIZARD_START + 39 +{ Text [ en-US] = "or"; }; diff --git a/xmlsecurity/util/makefile.mk b/xmlsecurity/util/makefile.mk index e3ea9a9011c7..e3f78a45592f 100644 --- a/xmlsecurity/util/makefile.mk +++ b/xmlsecurity/util/makefile.mk @@ -92,7 +92,6 @@ SHL2STDLIBS += \ $(CPPULIB) \ $(CPPUHELPERLIB) \ $(SALLIB) \ - $(UNOTOOLSLIB) \ $(SVLLIB) \ $(TOOLSLIB) \ $(COMPHELPERLIB) \ @@ -151,10 +150,7 @@ SHL4STDLIBS=\ $(TOOLSLIB) \ $(SVTOOLLIB) \ $(SALLIB) \ - $(VOSLIB) \ - $(SOTLIB) \ $(SVLLIB) \ - $(SFXLIB) \ $(XMLOFFLIB) \ $(SVXLIB) |