diff options
Diffstat (limited to 'svx/source/inc')
79 files changed, 15076 insertions, 0 deletions
diff --git a/svx/source/inc/AccessibleFrameSelector.hxx b/svx/source/inc/AccessibleFrameSelector.hxx new file mode 100644 index 000000000000..8dff4b33f567 --- /dev/null +++ b/svx/source/inc/AccessibleFrameSelector.hxx @@ -0,0 +1,152 @@ +/************************************************************************* + * + * 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: AccessibleFrameSelector.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 SVX_ACCESSIBLEFRAMESELECTOR_HXX +#define SVX_ACCESSIBLEFRAMESELECTOR_HXX + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/beans/XPropertyChangeListener.hpp> +#include <com/sun/star/awt/XFocusListener.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/XAccessibleContext.hpp> +#include <com/sun/star/accessibility/XAccessibleComponent.hpp> +#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> +#include <tools/resary.hxx> +#include <cppuhelper/implbase5.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/accessibleeventnotifier.hxx> +#include <svx/framebordertype.hxx> + +class VclSimpleEvent; +class VclWindowEvent; + +namespace svx { + +class FrameSelector; + +namespace a11y { + +// ============================================================================ + +class AccFrameSelector : + public ::cppu::WeakImplHelper5< + ::com::sun::star::accessibility::XAccessible, + ::com::sun::star::accessibility::XAccessibleContext, + ::com::sun::star::accessibility::XAccessibleComponent, + ::com::sun::star::accessibility::XAccessibleEventBroadcaster, + ::com::sun::star::lang::XServiceInfo + >, + public Resource +{ +public: + explicit AccFrameSelector( FrameSelector& rFrameSel, FrameBorderType eBorder ); + + virtual ~AccFrameSelector(); + + //XAccessible + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); + + //XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + + //XAccessibleComponent + virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isShowing( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isVisible( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isFocusTraversable( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleEventBroadcaster + virtual void SAL_CALL addEventListener ( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener ( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener) throw (::com::sun::star::uno::RuntimeException); + + //XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); + + void Invalidate(); + void NotifyFocusListeners(sal_Bool bGetFocus); + +protected: + DECL_LINK( WindowEventListener, VclSimpleEvent* ); + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); + + void NotifyAccessibleEvent( const sal_Int16 _nEventId, + const ::com::sun::star::uno::Any& _rOldValue, + const ::com::sun::star::uno::Any& _rNewValue ); + +private: + void IsValid() throw (::com::sun::star::uno::RuntimeException); + + FrameSelector* mpFrameSel; + ::osl::Mutex maFocusMutex; + ::osl::Mutex maPropertyMutex; + + FrameBorderType meBorder; + + ::cppu::OInterfaceContainerHelper maFocusListeners; + ::cppu::OInterfaceContainerHelper maPropertyListeners; + + ResStringArray maNames; + ResStringArray maDescriptions; + + ::comphelper::AccessibleEventNotifier::TClientId mnClientId; +}; + +// ============================================================================ + +} // namespace a11y +} // namespace svx + +#endif + diff --git a/svx/source/inc/AccessibleStringWrap.hxx b/svx/source/inc/AccessibleStringWrap.hxx new file mode 100644 index 000000000000..e85e36b7b8ac --- /dev/null +++ b/svx/source/inc/AccessibleStringWrap.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * 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: AccessibleStringWrap.hxx,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. + * + ************************************************************************/ + +#ifndef _ACCESSIBLESTRINGWRAP_HXX +#define _ACCESSIBLESTRINGWRAP_HXX + +#include <sal/types.h> +#include <tools/string.hxx> + +#include <svx/svxdllapi.h> + +class OutputDevice; +class SvxFont; +class Rectangle; +class Point; + +//------------------------------------------------------------------------ +// +// AccessibleStringWrap declaration +// +//------------------------------------------------------------------------ + +class AccessibleStringWrap +{ +public: + + SVX_DLLPUBLIC AccessibleStringWrap( OutputDevice& rDev, SvxFont& rFont, const String& rText ); + + SVX_DLLPUBLIC sal_Bool GetCharacterBounds( sal_Int32 nIndex, Rectangle& rRect ); + SVX_DLLPUBLIC sal_Int32 GetIndexAtPoint( const Point& rPoint ); + +private: + + OutputDevice& mrDev; + SvxFont& mrFont; + String maText; +}; + +#endif /* _ACCESSIBLESTRINGWRAP_HXX */ diff --git a/svx/source/inc/DGColorNameLookUp.hxx b/svx/source/inc/DGColorNameLookUp.hxx new file mode 100644 index 000000000000..91550d66b429 --- /dev/null +++ b/svx/source/inc/DGColorNameLookUp.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * 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: DGColorNameLookUp.hxx,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. + * + ************************************************************************/ + +#ifndef _SVX_ACCESSIBILITY_DG_COLOR_NAME_LOOK_UP_HXX +#define _SVX_ACCESSIBILITY_DG_COLOR_NAME_LOOK_UP_HXX + +#include <rtl/ustrbuf.hxx> +#include <hash_map> + +namespace accessibility { + +/** This is a color name lookup targeted to be used by the accessibility + <type>DescriptionGenerator</type> class (hence the DG prefix). It + encapsulates a <type>com.sun.star.drawing.ColorTable</type> and provides + an inverse look up of color names for given a numerical color + descriptions--the RGB values encoded as integer. + + <p>The class itself is designed as singleton so that the + <type>com.sun.star.drawing.ColorTable</type> object needs to be created + only once.</p> + + <p>The singleton instance of this class lives at the moment until the + application terminates. However, the color table from which it takes + its values may change during this time. Reacting to these changes + remains a task for the future.</p> +*/ +class DGColorNameLookUp +{ +public: + /** Return the single instance of this class. Use this to look up + color names with the <member>LookUpColor()</member> method. + */ + static DGColorNameLookUp& Instance (void); + + /** Return the color name of the color expressed by the given integer. + @param nColor + This integer is the sum of the 8 Bit red value shifted left 16 + Bits, the green value shifted left 8 Bits, and the unshifted + blue value. + @return + The returned string is either the color name of the specified + color or, when no name exists, a string of the form "#RRGGBB" + with two hexadecimal digits for each color component. + */ + ::rtl::OUString LookUpColor (long int nColor) const; + +private: + /// Define hash map type to convert numerical color values to names. + typedef std::hash_map<long int, ::rtl::OUString> + tColorValueToNameMap; + + /// This ma translates from numerical color values to names. + tColorValueToNameMap maColorValueToNameMap; + + /** The pointer to the only instance of this class. It is NULL until + the <member>Instance</member> is called for the first time. + */ + static DGColorNameLookUp* mpInstance; + + /// Create a new (the only) instance of this class. + DGColorNameLookUp (void); + + /// The destructor is never called. + ~DGColorNameLookUp (void); + + /// The copy constructor is not implemented. + DGColorNameLookUp (const DGColorNameLookUp&); + + /// The assignment operator is not implemented. + DGColorNameLookUp& operator= (const DGColorNameLookUp&); +}; + +} // end of namespace accessibility + +#endif diff --git a/svx/source/inc/GraphCtlAccessibleContext.hxx b/svx/source/inc/GraphCtlAccessibleContext.hxx new file mode 100644 index 000000000000..0b862e1be691 --- /dev/null +++ b/svx/source/inc/GraphCtlAccessibleContext.hxx @@ -0,0 +1,284 @@ +/************************************************************************* + * + * 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: GraphCtlAccessibleContext.hxx,v $ + * $Revision: 1.14 $ + * + * 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 _SVXGRAPHACCESSIBLECONTEXT_HXX +#define _SVXGRAPHACCESSIBLECONTEXT_HXX + +#ifndef _CPPUHELPER_IMPLBASE7_HXX_ +#include <cppuhelper/compbase7.hxx> +#endif +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/XAccessibleComponent.hpp> +#include <com/sun/star/accessibility/XAccessibleContext.hpp> +#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> +#ifndef _COM_SUN_STAR_ACCESSIBILITY_IllegalAccessibleComponentStateException_HPP_ +#include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp> +#endif +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> +#include <com/sun/star/beans/XPropertyChangeListener.hpp> +#include <cppuhelper/weak.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XServiceName.hpp> +#include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <vos/mutex.hxx> +#include <comphelper/broadcasthelper.hxx> +#include <svtools/lstner.hxx> + +#include <set> +#include <map> + +#include <comphelper/servicehelper.hxx> +#include <svx/rectenum.hxx> +#include <svx/AccessibleShapeTreeInfo.hxx> +#include <svx/IAccessibleViewForwarder.hxx> +#include <svx/AccessibleShape.hxx> + +namespace com { namespace sun { namespace star { namespace awt { + struct Point; + struct Rectangle; + struct Size; + class XFocusListener; +} } } } + +class Rectangle; +class GraphCtrl; +class Window; +class SdrObject; +class SdrModel; +class SdrPage; +class SdrView; + +/** @descr + This base class provides an implementation of the + <code>AccessibleContext</code> service. +*/ + +typedef ::cppu::WeakAggComponentImplHelper7< + ::com::sun::star::accessibility::XAccessible, + ::com::sun::star::accessibility::XAccessibleComponent, + ::com::sun::star::accessibility::XAccessibleContext, + ::com::sun::star::accessibility::XAccessibleEventBroadcaster, + ::com::sun::star::accessibility::XAccessibleSelection, + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::lang::XServiceName > + SvxGraphCtrlAccessibleContext_Base; + +class SvxGraphCtrlAccessibleContext : public SvxGraphCtrlAccessibleContext_Base, ::comphelper::OBaseMutex, SfxListener, ::accessibility::IAccessibleViewForwarder +{ +public: + friend class GraphCtrl; + + //===== internal ======================================================== + SvxGraphCtrlAccessibleContext( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>& rxParent, + GraphCtrl& rRepresentation, + const ::rtl::OUString* pName = NULL, + const ::rtl::OUString* pDescription = NULL ); + + void Notify( SfxBroadcaster& aBC, const SfxHint& aHint ); + +protected: + virtual ~SvxGraphCtrlAccessibleContext(); +public: + //===== XAccessible ===================================================== + + /// Return the XAccessibleContext. + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL + getAccessibleContext (void) throw (::com::sun::star::uno::RuntimeException); + + //===== XAccessibleComponent ============================================ + + virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& rPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Point SAL_CALL getLocation() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Size SAL_CALL getSize() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL grabFocus() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding() throw (::com::sun::star::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL getForeground (void) + throw (::com::sun::star::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL getBackground (void) + throw (::com::sun::star::uno::RuntimeException); + + + //===== XAccessibleContext ============================================== + + virtual sal_Int32 SAL_CALL getAccessibleChildCount (void) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL getAccessibleChild (sal_Int32 nIndex) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL getAccessibleParent (void) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent (void) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getAccessibleRole (void) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleDescription (void) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL getAccessibleRelationSet (void) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL getAccessibleStateSet (void) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::lang::Locale SAL_CALL getLocale (void) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::accessibility::IllegalAccessibleComponentStateException); +// virtual void SAL_CALL addPropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) {} +// virtual void SAL_CALL removePropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) {} + + //===== XComponent ======================================================== + + using ::cppu::WeakAggComponentImplHelperBase::addEventListener; + using ::cppu::WeakAggComponentImplHelperBase::removeEventListener; + + //===== XAccessibleEventBroadcaster ===================================== + + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener>& xListener) throw (com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener>& xListener) throw (com::sun::star::uno::RuntimeException); + + //===== XServiceInfo ==================================================== + + virtual ::rtl::OUString SAL_CALL getImplementationName (void) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService (const ::rtl::OUString& sServiceName) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames (void) throw (::com::sun::star::uno::RuntimeException); + + //===== XTypeProvider =================================================== + + virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId (void) throw (::com::sun::star::uno::RuntimeException); + + //===== XServiceName ==================================================== + + virtual ::rtl::OUString SAL_CALL getServiceName (void) throw (::com::sun::star::uno::RuntimeException); + + //===== XAccessibleSelection ============================================= + + virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL clearAccessibleSelection() throw (::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL selectAllAccessibleChildren() throw (::com::sun::star::uno::RuntimeException ); + virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException ); + + //===== IAccessibleViewforwarder ======================================== + + virtual BOOL IsValid (void) const; + virtual Rectangle GetVisibleArea() const; + virtual Point LogicToPixel (const Point& rPoint) const; + virtual Size LogicToPixel (const Size& rSize) const; + virtual Point PixelToLogic (const Point& rPoint) const; + virtual Size PixelToLogic (const Size& rSize) const; + +protected: + //===== internals ======================================================== + + void checkChildIndex( long nIndexOfChild ) throw (::com::sun::star::lang::IndexOutOfBoundsException ); + void checkChildIndexOnSelection( long nIndexOfChild ) throw (::com::sun::star::lang::IndexOutOfBoundsException ); + +public: + + /// Sets the name + void setName( const ::rtl::OUString& rName ); + + /// Sets the description + void setDescription( const ::rtl::OUString& rDescr ); + + /** This method is used by the graph control to tell the + accessibility object about a new model and view. + */ + void setModelAndView (SdrModel* pModel, SdrView* pView); + +private: + static ::com::sun::star::uno::Sequence< sal_Int8 > getUniqueId( void ); +protected: + + /** Return the object's current bounding box relative to the desktop, + i.e in absolute pixel coordinates. + @return + The returned rectangle is a bounding box of the object given in + absolute screen coordinates. + @raise DisposedException + When the object is already disposed then a + <type>DisposedException</type> is thrown. + */ + virtual Rectangle GetBoundingBoxOnScreen(void) throw (::com::sun::star::uno::RuntimeException); + + /// Return the object's current bounding box relative to the parent object. + virtual Rectangle GetBoundingBox(void) throw (::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL disposing(); + +private: + SdrObject* getSdrObject( sal_Int32 nIndex ) + throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException ); + + void CommitChange (sal_Int16 aEventId, const ::com::sun::star::uno::Any& rNewValue, const ::com::sun::star::uno::Any& rOldValue); + void FireEvent (const ::com::sun::star::accessibility::AccessibleEventObject& aEvent); + + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessible( const SdrObject* pObj ); + + accessibility::AccessibleShapeTreeInfo maTreeInfo; + + /// Reference to the parent object. + ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible> mxParent; + + /** Description of this object. This is not a constant because it can + be set from the outside. + */ + ::rtl::OUString msDescription; + + /** Name of this object. + */ + ::rtl::OUString msName; + + /// map of accessible shapes + struct SdrObjectCompareLess + { + bool operator()(const SdrObject* p1, const SdrObject* p2) const + { + return p1 < p2; + } + }; + typedef ::std::map< const SdrObject*, ::accessibility::AccessibleShape*, SdrObjectCompareLess > ShapesMapType; + ShapesMapType mxShapes; + + GraphCtrl* mpControl; + + SdrModel* mpModel; + SdrPage* mpPage; + SdrView* mpView; + + /// client id in the AccessibleEventNotifier queue + sal_uInt32 mnClientId; + + sal_Bool mbDisposed; +}; + +#endif + diff --git a/svx/source/inc/SpellDialog.hxx b/svx/source/inc/SpellDialog.hxx new file mode 100644 index 000000000000..e7545eaeb6e7 --- /dev/null +++ b/svx/source/inc/SpellDialog.hxx @@ -0,0 +1,261 @@ +/************************************************************************* + * + * 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: SpellDialog.hxx,v $ + * $Revision: 1.9 $ + * + * 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 _SVX_SPELLDDIALOG_HXX +#define _SVX_SPELLDDIALOG_HXX + +// include --------------------------------------------------------------- + +#include <sfx2/basedlgs.hxx> +#include <vcl/fixed.hxx> +#include <vcl/edit.hxx> +#include <vcl/lstbox.hxx> +#include <svtools/stdctrl.hxx> +#include <vcl/button.hxx> +#include <vcl/menubtn.hxx> +#include <vcl/group.hxx> +#include <vcl/decoview.hxx> +#include <vcl/image.hxx> +#include <com/sun/star/uno/Reference.hxx> + + +#include <svx/svxbox.hxx> +#include <svx/langbox.hxx> +#include <memory> +#include <svtools/svmedit.hxx> +#include <svtools/lstner.hxx> +#include <svtools/xtextedt.hxx> +#include <svx/SpellPortions.hxx> + +class ScrollBar; +class TextEngine; +class ExtTextView; +namespace svx{ class SpellUndoAction_Impl;} + +// forward --------------------------------------------------------------- + +struct SpellDialog_Impl; + +namespace com{namespace sun{namespace star{ +namespace linguistic2{ + class XSpellChecker1; +}}}} +namespace svx{ +class SpellDialog; +struct SpellErrorDescription; +// ------------------------------------------------------------------ +class SentenceEditWindow_Impl : public MultiLineEdit/*, public SfxListener*/ +{ + using MultiLineEdit::SetText; + +private: + USHORT m_nErrorStart; + USHORT m_nErrorEnd; + bool m_bIsUndoEditMode; + + Link m_aModifyLink; + + void CallModifyLink() {m_aModifyLink.Call(this);} + + SpellDialog* GetSpellDialog() const {return (SpellDialog*)GetParent();} +protected: + virtual long PreNotify( NotifyEvent& rNEvt ); + +public: + SentenceEditWindow_Impl( SpellDialog* pParent, const ResId& rResId ); + ~SentenceEditWindow_Impl(); + + void SetModifyHdl(const Link& rLink) { m_aModifyLink = rLink;} + + void SetAttrib( const TextAttrib& rAttr, ULONG nPara, USHORT nStart, USHORT nEnd ); + void SetText( const String& rStr ); + + bool MarkNextError(); + void ChangeMarkedWord(const String& rNewWord, LanguageType eLanguage); + void MoveErrorMarkTo(USHORT nErrorStart, USHORT nErrorEnd, bool bGrammar); + String GetErrorText() const; + void RestoreCurrentError(); + + void SetAlternatives( + com::sun::star::uno::Reference<com::sun::star::linguistic2::XSpellAlternatives> ); + + const SpellErrorDescription* GetAlternatives(); + + + void ResetModified() { GetTextEngine()->SetModified(FALSE); m_bIsUndoEditMode = false;} + BOOL IsModified() const { return GetTextEngine()->IsModified(); } + + bool IsUndoEditMode() const { return m_bIsUndoEditMode;} + void SetUndoEditMode(bool bSet); + + svx::SpellPortions CreateSpellPortions( bool bSetIgnoreFlag ) const; + + void ResetUndo(); + void Undo(); + void AddUndoAction( SfxUndoAction *pAction, BOOL bTryMerg=FALSE ); + USHORT GetUndoActionCount(); + void UndoActionStart( USHORT nId ); + void UndoActionEnd( USHORT nId ); + + void MoveErrorEnd(long nOffset); +}; + + +// class SvxSpellDialog --------------------------------------------- +class SpellDialogChildWindow; +class ExplainButton : public PushButton +{ + String m_sExplanation; + + virtual void RequestHelp( const HelpEvent& rHEvt ); + virtual void Click(); +public: + ExplainButton( Window* pParent, const ResId& rResId ) : PushButton( pParent, rResId ){} + ~ExplainButton(); + void SetExplanation( const String& rText ) {m_sExplanation = rText;} + bool HasExplanation() { return m_sExplanation.Len() > 0;} + +}; + +class SpellDialog : public SfxModelessDialog +{ + using Window::Invalidate; + + friend class SentenceEditWindow_Impl; +private: + + FixedImage aVendorImageFI; + + FixedText aLanguageFT; + SvxLanguageBox aLanguageLB; + + FixedText aNotInDictFT; + SentenceEditWindow_Impl aSentenceED; + + FixedText aSuggestionFT; + ListBox aSuggestionLB; + + PushButton aIgnorePB; + PushButton aIgnoreAllPB; + PushButton aIgnoreRulePB; + MenuButton aAddToDictMB; + + PushButton aChangePB; + PushButton aChangeAllPB; + ExplainButton aExplainPB; + PushButton aAutoCorrPB; + + CheckBox aCheckGrammarCB; + + HelpButton aHelpPB; + PushButton aOptionsPB; + PushButton aUndoPB; + PushButton aClosePB; + + GroupBox aBackgroundGB; + + Image aVendorImage; + Image aVendorImageHC; + + String aResumeST; + String aIgnoreOnceST; + String aNoSuggestionsST; + + const String m_sTitleSpelling; + const String m_sTitleSpellingGrammar; + const String m_sTitleSpellingGrammarVendor; + + Size aOldWordEDSize; + Link aDialogUndoLink; + + bool bModified; + bool bFocusLocked; + + svx::SpellDialogChildWindow& rParent; + svx::SpellPortions m_aSavedSentence; + + SpellDialog_Impl* pImpl; + ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XSpellChecker1 > xSpell; + LanguageType nOldLang; + + DECL_LINK( ChangeHdl, Button * ); + DECL_LINK( ChangeAllHdl, Button * ); + DECL_LINK( IgnoreAllHdl, Button * ); + DECL_LINK( IgnoreHdl, Button * ); + DECL_LINK( CheckGrammarHdl, CheckBox* ); + DECL_LINK( ExtClickHdl, Button * ); + DECL_LINK( CancelHdl, Button * ); + DECL_LINK( ModifyHdl, SentenceEditWindow_Impl *); + DECL_LINK( UndoHdl, Button * ); + DECL_LINK( AddToDictionaryHdl, MenuButton* ); + DECL_LINK( LanguageSelectHdl, SvxLanguageBox* ); + DECL_LINK( DialogUndoHdl, SpellUndoAction_Impl* ); + + DECL_STATIC_LINK( SpellDialog, InitHdl, SpellDialog * ); + + void StartSpellOptDlg_Impl(); + void InitUserDicts(); + void UpdateBoxes_Impl(); + void Init_Impl(); + void SpellContinue_Impl(bool UseSavedSentence = false); + void LockFocusChanges( bool bLock ) {bFocusLocked = bLock;} + void Impl_Restore(); + + void SetSelectedLang_Impl( LanguageType nLang ); + LanguageType GetSelectedLang_Impl() const; + + /** Retrieves the next sentence. + */ + bool GetNextSentence_Impl(bool bUseSavedSentence); + /** Corrects all errors that have been selected to be changed always + */ + bool ApplyChangeAllList_Impl(SpellPortions& rSentence, bool& bHasReplaced); + void SetTitle_Impl(LanguageType nLang); + +protected: + virtual void Paint( const Rectangle& rRect ); + virtual long Notify( NotifyEvent& rNEvt ); + +public: + SpellDialog( + svx::SpellDialogChildWindow* pChildWindow, + Window * pParent, + SfxBindings* pBindings); + ~SpellDialog(); + + void SetLanguage( sal_uInt16 nLang ); + virtual sal_Bool Close(); + + void InvalidateDialog(); +}; +} //namespace svx + +#endif + diff --git a/svx/source/inc/charmapacc.hxx b/svx/source/inc/charmapacc.hxx new file mode 100644 index 000000000000..01b037f1944a --- /dev/null +++ b/svx/source/inc/charmapacc.hxx @@ -0,0 +1,281 @@ +/************************************************************************* + * + * 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: charmapacc.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. + * + ************************************************************************/ + +#include <vos/mutex.hxx> +#include <tools/list.hxx> +#include <tools/color.hxx> +#include <tools/string.hxx> +#ifndef _IMAGE_HXX +#include <vcl/image.hxx> +#endif +#include <rtl/uuid.h> +#include <comphelper/accessibleselectionhelper.hxx> +#include <com/sun/star/accessibility/XAccessibleTable.hpp> + +#include <vector> +class SvxShowCharSet; + +namespace svx +{ + typedef ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessible + > OAccessibleHelper_Base_2; + + class SvxShowCharSetAcc; + /** The class SvxShowCharSetVirtualAcc is used as a virtual class which contains the table and the scrollbar. + In the vcl control, the table and the scrollbar exists in one class. This is not feasible for the accessibility api. + */ + class SvxShowCharSetVirtualAcc : public ::comphelper::OAccessibleComponentHelper, + public OAccessibleHelper_Base_2 + { + SvxShowCharSet* mpParent; // the vcl control + SvxShowCharSetAcc* m_pTable; // the table, which holds the characters shown by the vcl control + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xAcc; // the ref to the table + protected: + virtual ~SvxShowCharSetVirtualAcc(); + + virtual void SAL_CALL disposing(); + + virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); + public: + SvxShowCharSetVirtualAcc( SvxShowCharSet* pParent ); + + // XInterface + DECLARE_XINTERFACE( ) + DECLARE_XTYPEPROVIDER( ) + + // XAccessibleComponent + virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + //OAccessibleContextHelper + // XAccessibleContext - still waiting to be overwritten + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException) { return this; } + virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); + + + // call the fireEvent method from the table when it exists. + void SAL_CALL fireEvent( + const sal_Int16 _nEventId, + const ::com::sun::star::uno::Any& _rOldValue, + const ::com::sun::star::uno::Any& _rNewValue + ); + + // simple access methods + inline SvxShowCharSetAcc* getTable() const { return m_pTable; } + inline SvxShowCharSet* getCharSetControl() const { return mpParent; } + }; + + + class SvxShowCharSetItemAcc; + // ---------------- + // - SvxShowCharSetItem - + // ---------------- + /** Simple struct to hold some information about the single items of the table. + */ + struct SvxShowCharSetItem + { + SvxShowCharSet& mrParent; + USHORT mnId; + XubString maText; + Rectangle maRect; + SvxShowCharSetItemAcc* m_pItem; + SvxShowCharSetAcc* m_pParent; + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xAcc; + + SvxShowCharSetItem( SvxShowCharSet& rParent,SvxShowCharSetAcc* _pParent,USHORT _nPos ); + ~SvxShowCharSetItem(); + + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetAccessible(); + void ClearAccessible(); + }; + + // ----------------------------------------------------------------------------- + + typedef ::cppu::ImplHelper2 < ::com::sun::star::accessibility::XAccessible, + ::com::sun::star::accessibility::XAccessibleTable + > OAccessibleHelper_Base; + // --------------- + // - SvxShowCharSetAcc - + // --------------- + /** The table implemtentation of the vcl control. + */ + + class SvxShowCharSetAcc : public ::comphelper::OAccessibleSelectionHelper, + public OAccessibleHelper_Base + { + ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > m_aChildren; + SvxShowCharSetVirtualAcc* m_pParent; // the virtual parent + protected: + virtual void SAL_CALL disposing(); + public: + SvxShowCharSetAcc( SvxShowCharSetVirtualAcc* _pParent ); + + DECLARE_XINTERFACE( ) + DECLARE_XTYPEPROVIDER( ) + + // XAccessibleComponent + virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + + //OAccessibleContextHelper + // XAccessibleContext - still waiting to be overwritten + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException) { return this; } + virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleTable + virtual sal_Int32 SAL_CALL getAccessibleRowCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getAccessibleColumnCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleRowDescription( sal_Int32 nRow ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleColumnDescription( sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL getAccessibleRowHeaders( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL getAccessibleColumnHeaders( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleRows( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleColumns( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleCaption( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleSummary( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getAccessibleRow( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + + inline void SAL_CALL fireEvent( + const sal_Int16 _nEventId, + const ::com::sun::star::uno::Any& _rOldValue, + const ::com::sun::star::uno::Any& _rNewValue + ) + { + NotifyAccessibleEvent(_nEventId,_rOldValue,_rNewValue); + } + protected: + + virtual ~SvxShowCharSetAcc(); + + // OCommonAccessibleSelection + // return if the specified child is visible => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx) + virtual sal_Bool + implIsSelected( sal_Int32 nAccessibleChildIndex ) + throw (::com::sun::star::uno::RuntimeException); + + // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx) + virtual void + implSelect( sal_Int32 nAccessibleChildIndex, sal_Bool bSelect ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + // OCommonAccessibleComponent + /// implements the calculation of the bounding rectangle - still waiting to be overwritten + virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); + }; + + // ---------------- + // - SvxShowCharSetItemAcc - + // ---------------- + /** The child implementation of the table. + */ + class SvxShowCharSetItemAcc : public ::comphelper::OAccessibleComponentHelper, + public OAccessibleHelper_Base_2 + { + private: + SvxShowCharSetItem* mpParent; + protected: + virtual ~SvxShowCharSetItemAcc(); + + // OCommonAccessibleComponent + /// implements the calculation of the bounding rectangle - still waiting to be overwritten + virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); + public: + + // XInterface + DECLARE_XINTERFACE( ) + DECLARE_XTYPEPROVIDER( ) + + SvxShowCharSetItemAcc( SvxShowCharSetItem* pParent ); + + void ParentDestroyed(); + + // XAccessibleComponent + virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + + //OAccessibleContextHelper + // XAccessibleContext - still waiting to be overwritten + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException) { return this; } + + virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException) { return mpParent->m_pParent->getForeground(); } + virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException) { return mpParent->m_pParent->getBackground(); } + + inline void SAL_CALL fireEvent( + const sal_Int16 _nEventId, + const ::com::sun::star::uno::Any& _rOldValue, + const ::com::sun::star::uno::Any& _rNewValue + ) + { + NotifyAccessibleEvent(_nEventId,_rOldValue,_rNewValue); + } + }; +} + + diff --git a/svx/source/inc/clonelist.hxx b/svx/source/inc/clonelist.hxx new file mode 100644 index 000000000000..b4d81ae52fd2 --- /dev/null +++ b/svx/source/inc/clonelist.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * 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: clonelist.hxx,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. + * + ************************************************************************/ +#ifndef _CLONELIST_HXX_ +#define _CLONELIST_HXX_ + +#include <sal/types.h> +#include <tools/list.hxx> + +// predeclarations +class SdrObject; + +// #i13033# +// New mechanism to hold a ist of all original and cloned objects for later +// re-creating the connections for contained connectors +class CloneList +{ + List maOriginalList; + List maCloneList; + +public: + CloneList(); + ~CloneList(); + + void AddPair(const SdrObject* pOriginal, SdrObject* pClone); + sal_uInt32 Count() const; + + const SdrObject* GetOriginal(sal_uInt32 nIndex) const; + SdrObject* GetClone(sal_uInt32 nIndex) const; + + void CopyConnections() const; +}; + +#endif // _CLONELIST_HXX_ diff --git a/svx/source/inc/confirmdelete.hxx b/svx/source/inc/confirmdelete.hxx new file mode 100644 index 000000000000..a06e297a8748 --- /dev/null +++ b/svx/source/inc/confirmdelete.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * 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: confirmdelete.hxx,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. + * + ************************************************************************/ + +#ifndef SVX_FORM_CONFIRMDELETE_HXX +#define SVX_FORM_CONFIRMDELETE_HXX + +#include <vcl/btndlg.hxx> +#include <vcl/fixed.hxx> + +//........................................................................ +namespace svxform +{ +//........................................................................ + + //==================================================================== + //= class ConfirmDeleteDialog + //==================================================================== + class ConfirmDeleteDialog : public ButtonDialog + { + FixedImage m_aInfoImage; + FixedText m_aTitle; + FixedText m_aMessage; + + public: + ConfirmDeleteDialog(Window* pParent, const String& _rTitle); + ~ConfirmDeleteDialog(); + }; + +//........................................................................ +} // namespace svxform +//........................................................................ + +#endif // SVX_FORM_CONFIRMDELETE_HXX + + diff --git a/svx/source/inc/datalistener.hxx b/svx/source/inc/datalistener.hxx new file mode 100644 index 000000000000..ec283652bc62 --- /dev/null +++ b/svx/source/inc/datalistener.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * 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: datalistener.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 _SVX_DATALISTENER_HXX +#define _SVX_DATALISTENER_HXX + +#include <cppuhelper/implbase3.hxx> +#include <com/sun/star/container/XContainerListener.hpp> +#include <com/sun/star/frame/XFrameActionListener.hpp> +#include <com/sun/star/xml/dom/events/XEventListener.hpp> + +//............................................................................ +namespace svxform +{ +//............................................................................ + + class DataNavigatorWindow; + + typedef cppu::WeakImplHelper3< + com::sun::star::container::XContainerListener, + com::sun::star::frame::XFrameActionListener, + com::sun::star::xml::dom::events::XEventListener > DataListener_t; + + class DataListener : public DataListener_t + { + private: + DataNavigatorWindow* m_pNaviWin; + + public: + DataListener( DataNavigatorWindow* pNaviWin ); + + protected: + ~DataListener(); + + public: + // XContainerListener + virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + + // XFrameActionListener + virtual void SAL_CALL frameAction( const ::com::sun::star::frame::FrameActionEvent& Action ) throw (::com::sun::star::uno::RuntimeException); + + // xml::dom::events::XEventListener + virtual void SAL_CALL handleEvent( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::dom::events::XEvent >& evt ) throw (::com::sun::star::uno::RuntimeException); + + // lang::XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); + }; + +//............................................................................ +} // namespace svxform +//............................................................................ + +#endif // #ifndef _SVX_DATALISTENER_HXX + diff --git a/svx/source/inc/datanavi.hrc b/svx/source/inc/datanavi.hrc new file mode 100644 index 000000000000..0ffbc8785fe3 --- /dev/null +++ b/svx/source/inc/datanavi.hrc @@ -0,0 +1,183 @@ +/************************************************************************* + * + * 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: datanavi.hrc,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 _SVX_DATANAVI_HRC +#define _SVX_DATANAVI_HRC + +// global +#define FL_DATANAV_BTN 100 +#define BTN_DATANAV_OK 101 +#define BTN_DATANAV_ESC 102 +#define BTN_DATANAV_HELP 103 + +// class XFormsInstancePage +// Controls +#define TB_ITEMS 10 +#define LB_ITEMS 11 +// Menu items +#define MID_INSERT_CONTROL 100 +// ToolBox items +#define TBI_ITEM_ADD 10 +#define TBI_ITEM_ADD_ELEMENT 11 +#define TBI_ITEM_ADD_ATTRIBUTE 12 +#define TBI_ITEM_EDIT 13 +#define TBI_ITEM_REMOVE 14 +// ImageLists +#define IL_TBX_BMPS 20 +#define IL_TBX_BMPS_HC 21 +// ImageIndexes +#define IID_ITEM_ADD 1 +#define IID_ITEM_ADD_ELEMENT 2 +#define IID_ITEM_ADD_ATTRIBUTE 3 +#define IID_ITEM_EDIT 4 +#define IID_ITEM_REMOVE 5 + +// class DataNavigatorWindow +// Controls +#define LB_MODELS 10 +#define MB_MODELS 11 +#define TC_ITEMS 12 +#define MB_INSTANCES 13 +// MenuItems +#define MID_MODELS_ADD 10 +#define MID_MODELS_EDIT 11 +#define MID_MODELS_REMOVE 12 +#define MID_INSTANCES_ADD 20 +#define MID_INSTANCES_EDIT 21 +#define MID_INSTANCES_REMOVE 22 +#define MID_SHOW_DETAILS 30 +// TabPage Ids +#define TID_SUBMISSION 10 +#define TID_BINDINGS 11 +#define TID_INSTANCE 12 +// ImageLists +#define IL_ITEM_BMPS 30 +#define IL_ITEM_BMPS_HC 31 +// ImageIndexes +#define IID_GROUP_CLOSED 1 +#define IID_GROUP_OPEN 2 +#define IID_ELEMENT 3 +#define IID_ATTRIBUTE 4 +#define IID_TEXT 5 +#define IID_OTHER 6 + +// class AddDataItemDialog +#define FL_ITEM 10 +#define FT_NAME 11 +#define ED_NAME 12 +#define FT_DEFAULT 13 +#define ED_DEFAULT 14 +#define PB_DEFAULT 15 +#define FL_SETTINGS 16 +#define FT_DATATYPE 17 +#define LB_DATATYPE 18 +#define CB_REQUIRED 19 +#define PB_REQUIRED 20 +#define CB_RELEVANT 21 +#define PB_RELEVANT 22 +#define CB_CONSTRAINT 23 +#define PB_CONSTRAINT 24 +#define CB_READONLY 25 +#define PB_READONLY 26 +#define CB_CALCULATE 27 +#define PB_CALCULATE 28 + +#define STR_FIXEDLINE_ELEMENT 10 +#define STR_FIXEDLINE_ATTRIBUTE 11 +#define STR_FIXEDLINE_BINDING 12 +#define STR_FIXEDTEXT_BINDING 13 + +// class AddConditionDialog +#define FT_CONDITION 10 +#define ED_CONDITION 11 +#define FT_RESULT 12 +#define FT_RESULT_PREVIEW 13 +#define PB_EDIT_NAMESPACES 14 + +// class NamespaceItemDialog +#define FT_NAMESPACES 10 +#define LB_NAMESPACES 11 +#define PB_ADD_NAMESPACE 12 +#define PB_EDIT_NAMESPACE 13 +#define PB_DELETE_NAMESPACE 14 + +#define STR_HEADER_PREFIX 10 +#define STR_HEADER_URL 11 + +// class ManageNamespaceDialog +#define FT_PREFIX 10 +#define ED_PREFIX 11 +#define FT_URL 12 +#define ED_URL 13 + +#define STR_EDIT_TEXT 10 + +// class AddSubmissionDialog +#define FL_SUBMISSION 10 +#define FT_SUBMIT_NAME 11 +#define ED_SUBMIT_NAME 12 +#define FT_SUBMIT_ACTION 13 +#define ED_SUBMIT_ACTION 14 +#define FT_SUBMIT_METHOD 15 +#define LB_SUBMIT_METHOD 16 +#define FT_SUBMIT_REF 17 +#define ED_SUBMIT_REF 18 +#define PB_SUBMIT_REF 19 +#define FT_SUBMIT_BIND 20 +#define LB_SUBMIT_BIND 21 +#define FT_SUBMIT_REPLACE 22 +#define LB_SUBMIT_REPLACE 23 + +#define STR_METHOD_POST 10 +#define STR_METHOD_PUT 11 +#define STR_METHOD_GET 12 +#define STR_REPLACE_NONE 13 +#define STR_REPLACE_INST 14 +#define STR_REPLACE_DOC 15 + +// class AddModelDialog +#define FL_MODEL 10 +#define FT_MODEL_NAME 11 +#define ED_MODEL_NAME 12 + +// class AddInstanceDialog +#define FL_INSTANCE 10 +#define FT_INST_NAME 11 +#define ED_INST_NAME 12 +#define FT_INST_URL 13 +#define ED_INST_URL 14 +#define PB_FILEPICKER 15 +#define CB_INST_LINKINST 16 + +// class AddModelDialog +#define CB_MODIFIES_DOCUMENT 1 + +#endif //_SVX_DATANAVI_HRC + diff --git a/svx/source/inc/datanavi.hxx b/svx/source/inc/datanavi.hxx new file mode 100644 index 000000000000..deac560db58b --- /dev/null +++ b/svx/source/inc/datanavi.hxx @@ -0,0 +1,604 @@ +/************************************************************************* + * + * 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: datanavi.hxx,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. + * + ************************************************************************/ +#ifndef _SVX_DATANAVI_HXX +#define _SVX_DATANAVI_HXX + +#include <vcl/dialog.hxx> +#include <vcl/fixed.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/menubtn.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/tabctrl.hxx> +#include <vcl/tabpage.hxx> +#include <vcl/toolbox.hxx> +#include <svtools/inettbc.hxx> +#include <svtools/svmedit.hxx> +#include <svtools/svtreebx.hxx> +#include <sfx2/dockwin.hxx> +#include <sfx2/ctrlitem.hxx> +#include <svx/simptabl.hxx> +#include <rtl/ref.hxx> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XContainer.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/xforms/XFormsUIHelper1.hpp> +#include <com/sun/star/xforms/XModel.hpp> +#include <com/sun/star/xforms/XSubmission.hpp> +#include <com/sun/star/xml/dom/XNode.hpp> +#include <com/sun/star/xml/dom/events/XEventTarget.hpp> + +#include "datalistener.hxx" +#include <vector> + +// forward --------------------------------------------------------------- + +class FmFormShell; + +//======================================================================== +//............................................................................ +namespace svxform +{ +//............................................................................ + + enum DataGroupType + { + DGTUnknown = 0, + DGTInstance, + DGTSubmission, + DGTBinding + }; + + enum DataItemType + { + DITNone = 0, + DITText, + DITAttribute, + DITElement, + DITBinding + }; + + struct ItemNode; + class XFormsPage; + class DataNavigatorWindow; + class AddInstanceDialog; + + typedef ::com::sun::star::uno::Reference< + ::com::sun::star::xforms::XFormsUIHelper1 > XFormsUIHelper1_ref; + typedef ::com::sun::star::uno::Reference< + ::com::sun::star::xml::dom::XNode > XNode_ref; + typedef ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > XPropertySet_ref; + typedef ::com::sun::star::uno::Reference< + ::com::sun::star::xforms::XModel > XModel_ref; + typedef ::com::sun::star::uno::Reference< + ::com::sun::star::container::XContainer > XContainer_ref; + typedef ::com::sun::star::uno::Reference< + ::com::sun::star::container::XNameContainer > XNameContainer_ref; + typedef ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XFrame > XFrame_ref; + typedef ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel > XFrameModel_ref; + typedef ::com::sun::star::uno::Reference< + ::com::sun::star::xml::dom::events::XEventTarget > XEventTarget_ref; + typedef ::com::sun::star::uno::Reference< + ::com::sun::star::xforms::XSubmission > XSubmission_ref; + + typedef ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue > PropertyValue_seq; + + typedef std::vector< XContainer_ref > ContainerList; + typedef std::vector< XEventTarget_ref > EventTargetList; + + //======================================================================== + class DataTreeListBox : public SvTreeListBox + { + private: + XFormsPage* m_pXFormsPage; + DataGroupType m_eGroup; + + protected: + using SvTreeListBox::ExecuteDrop; + + public: + DataTreeListBox( XFormsPage* pPage, DataGroupType _eGroup, const ResId& rResId ); + ~DataTreeListBox(); + + virtual PopupMenu* CreateContextMenu( void ); + virtual void ExcecuteContextMenuAction( USHORT _nSelectedPopupEntry ); + virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); + virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); + virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ); + + void DeleteAndClear(); + void RemoveEntry( SvLBoxEntry* _pEntry ); + }; + + //======================================================================== + class XFormsPage : public TabPage + { + private: + ToolBox m_aToolBox; + DataTreeListBox m_aItemList; + + XFormsUIHelper1_ref m_xUIHelper; + + DataNavigatorWindow* m_pNaviWin; + bool m_bHasModel; + DataGroupType m_eGroup; + ImageList m_TbxImageList; + ImageList m_TbxHCImageList; + // these strings are not valid on the Submission and Binding Page + // mb: furthermore these are properties of an instance, thus + // it would be much better to get/set them through the UIHelper + // interface. + String m_sInstanceName; + String m_sInstanceURL; + bool m_bLinkOnce; + + DECL_LINK( TbxSelectHdl, ToolBox * ); + DECL_LINK( ItemSelectHdl, DataTreeListBox * ); + + void AddChildren( SvLBoxEntry* _pParent, + const ImageList& _rImgLst, + const XNode_ref& _xNode ); + bool DoToolBoxAction( USHORT _nToolBoxID ); + SvLBoxEntry* AddEntry( ItemNode* _pNewNode, bool _bIsElement ); + SvLBoxEntry* AddEntry( const XPropertySet_ref& _rPropSet ); + void EditEntry( const XPropertySet_ref& _rPropSet ); + bool RemoveEntry(); + + protected: + virtual long Notify( NotifyEvent& rNEvt ); + + public: + XFormsPage( Window* pParent, DataNavigatorWindow* _pNaviWin, DataGroupType _eGroup ); + ~XFormsPage(); + + virtual void Resize(); + + inline bool HasModel() const { return m_bHasModel; } + String SetModel( const XModel_ref& _xModel, USHORT _nPagePos ); + void ClearModel(); + String LoadInstance( const PropertyValue_seq& _xPropSeq, + const ImageList& _rImgLst ); + + bool DoMenuAction( USHORT _nMenuID ); + void EnableMenuItems( Menu* _pMenu ); + + inline SvLBoxEntry* GetSelectedItem() const { return m_aItemList.FirstSelected(); } + inline const String& GetInstanceName() const { return m_sInstanceName; } + inline const String& GetInstanceURL() const { return m_sInstanceURL; } + inline bool GetLinkOnce() const { return m_bLinkOnce; } + inline void SetInstanceName( const String &name ) { m_sInstanceName=name; } + inline void SetInstanceURL( const String &url ) { m_sInstanceURL=url; } + inline void SetLinkOnce( bool bLinkOnce ) { m_bLinkOnce=bLinkOnce; } + + typedef com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> XPropertySet_t; + typedef com::sun::star::uno::Reference<com::sun::star::xml::dom::XNode> XNode_t; + + inline XPropertySet_t GetBindingForNode( const XNode_t &xNode ) { return m_xUIHelper->getBindingForNode(xNode,true); } + inline String GetServiceNameForNode( const XNode_t &xNode ) { return m_xUIHelper->getDefaultServiceNameForNode(xNode); } + inline XFormsUIHelper1_ref GetXFormsHelper( void ) const { return m_xUIHelper; } + }; + + //======================================================================== + + typedef std::vector< XFormsPage* > PageList; + typedef ::rtl::Reference < DataListener > DataListener_ref; + + class DataNavigatorWindow : public Window + { + private: + + ListBox m_aModelsBox; + MenuButton m_aModelBtn; + TabControl m_aTabCtrl; + MenuButton m_aInstanceBtn; + + XFormsPage* m_pInstPage; + XFormsPage* m_pSubmissionPage; + XFormsPage* m_pBindingPage; + + long m_nMinWidth; + long m_nMinHeight; + long m_nBorderHeight; + USHORT m_nLastSelectedPos; + bool m_bShowDetails; + bool m_bIsNotifyDisabled; + Size m_a2Size; + Size m_a3Size; + ImageList m_aItemImageList; + ImageList m_aItemHCImageList; + PageList m_aPageList; + ContainerList m_aContainerList; + EventTargetList m_aEventTargetList; + Timer m_aUpdateTimer; + + DataListener_ref m_xDataListener; + XNameContainer_ref m_xDataContainer; + XFrame_ref m_xFrame; + XFrameModel_ref m_xFrameModel; + + DECL_LINK( ModelSelectHdl, ListBox * ); + DECL_LINK( MenuSelectHdl, MenuButton * ); + DECL_LINK( MenuActivateHdl, MenuButton * ); + DECL_LINK( ActivatePageHdl, TabControl* ); + DECL_LINK( UpdateHdl, Timer* ); + + XFormsPage* GetCurrentPage( USHORT& rCurId ); + void LoadModels(); + void SetPageModel(); + void ClearAllPageModels( bool bClearPages ); + void InitPages(); + void CreateInstancePage( const PropertyValue_seq& _xPropSeq ); + bool HasFirstInstancePage() const; + USHORT GetNewPageId() const; + + protected: + virtual void Resize(); + + public: + DataNavigatorWindow( Window* pParent, SfxBindings* pBindings ); + ~DataNavigatorWindow(); + + void SetDocModified(); + void NotifyChanges( bool _bLoadAll = false ); + void AddContainerBroadcaster( const XContainer_ref& xContainer ); + void AddEventBroadcaster( const XEventTarget_ref& xTarget ); + void RemoveBroadcaster(); + + inline const ImageList& GetItemImageList() const { return m_aItemImageList; } + inline const ImageList& GetItemHCImageList() const { return m_aItemHCImageList; } + inline bool IsShowDetails() const { return m_bShowDetails; } + inline void DisableNotify( bool _bDisable ) { m_bIsNotifyDisabled = _bDisable; } + }; + + //======================================================================== + class DataNavigator : public SfxDockingWindow, public SfxControllerItem + { + private: + DataNavigatorWindow m_aDataWin; + + protected: + virtual void Resize(); + virtual sal_Bool Close(); + virtual void GetFocus(); + virtual Size CalcDockingSize( SfxChildAlignment ); + virtual SfxChildAlignment CheckAlignment( SfxChildAlignment, SfxChildAlignment ); + + public: + DataNavigator( SfxBindings* pBindings, SfxChildWindow* pMgr, Window* pParent ); + virtual ~DataNavigator(); + + using Window::Update; + using SfxDockingWindow::StateChanged; + + void Update( FmFormShell* pFormShell ); + void StateChanged( sal_uInt16 nSID, SfxItemState eState, + const SfxPoolItem* pState ); + }; + + //======================================================================== + class SVX_DLLPUBLIC DataNavigatorManager : public SfxChildWindow + { + public: + SVX_DLLPRIVATE DataNavigatorManager( Window* pParent, sal_uInt16 nId, + SfxBindings* pBindings, SfxChildWinInfo* pInfo ); + SFX_DECL_CHILDWINDOW( DataNavigatorManager ); + }; + + //======================================================================== + class AddDataItemDialog : public ModalDialog + { + private: + + FixedLine m_aItemFL; + FixedText m_aNameFT; + Edit m_aNameED; + FixedText m_aDefaultFT; + Edit m_aDefaultED; + PushButton m_aDefaultBtn; + + FixedLine m_aSettingsFL; + FixedText m_aDataTypeFT; + ListBox m_aDataTypeLB; + + CheckBox m_aRequiredCB; + PushButton m_aRequiredBtn; + CheckBox m_aRelevantCB; + PushButton m_aRelevantBtn; + CheckBox m_aConstraintCB; + PushButton m_aConstraintBtn; + CheckBox m_aReadonlyCB; + PushButton m_aReadonlyBtn; + CheckBox m_aCalculateCB; + PushButton m_aCalculateBtn; + + FixedLine m_aButtonsFL; + OKButton m_aOKBtn; + CancelButton m_aEscBtn; + HelpButton m_aHelpBtn; + + XFormsUIHelper1_ref m_xUIHelper; + XPropertySet_ref m_xBinding; + XPropertySet_ref m_xTempBinding; + + ItemNode* m_pItemNode; + DataItemType m_eItemType; + String m_sFL_Element; + String m_sFL_Attribute; + String m_sFL_Binding; + String m_sFT_BindingExp; + + DECL_LINK( CheckHdl, CheckBox * ); + DECL_LINK( ConditionHdl, PushButton * ); + DECL_LINK( OKHdl, OKButton * ); + + void InitDialog(); + void InitFromNode(); + void InitDataTypeBox(); + + public: + AddDataItemDialog( + Window* pParent, ItemNode* _pNode, const XFormsUIHelper1_ref& _rUIHelper ); + ~AddDataItemDialog(); + + void InitText( DataItemType _eType ); + }; + + //======================================================================== + class AddConditionDialog : public ModalDialog + { + private: + FixedText m_aConditionFT; + MultiLineEdit m_aConditionED; + FixedText m_aResultFT; + FixedText m_aResultWin; + PushButton m_aEditNamespacesBtn; + FixedLine m_aButtonsFL; + OKButton m_aOKBtn; + CancelButton m_aEscBtn; + HelpButton m_aHelpBtn; + + Timer m_aResultTimer; + ::rtl::OUString m_sPropertyName; + + XFormsUIHelper1_ref m_xUIHelper; + XPropertySet_ref m_xBinding; + + DECL_LINK( ModifyHdl, MultiLineEdit * ); + DECL_LINK( ResultHdl, Timer * ); + DECL_LINK( EditHdl, PushButton * ); + DECL_LINK( OKHdl, OKButton * ); + + public: + AddConditionDialog( Window* pParent, + const ::rtl::OUString& _rPropertyName, const XPropertySet_ref& _rBinding ); + ~AddConditionDialog(); + + inline XFormsUIHelper1_ref GetUIHelper() const { return m_xUIHelper; } + inline String GetCondition() const { return m_aConditionED.GetText(); } + inline void SetCondition( const String& _rCondition ); + }; + + inline void AddConditionDialog::SetCondition( const String& _rCondition ) + { + m_aConditionED.SetText( _rCondition ); + m_aResultTimer.Start(); + } + + //======================================================================== + class NamespaceItemDialog : public ModalDialog + { + private: + typedef std::vector< ::rtl::OUString > PrefixList; + + FixedText m_aNamespacesFT; + SvxSimpleTable m_aNamespacesList; + PushButton m_aAddNamespaceBtn; + PushButton m_aEditNamespaceBtn; + PushButton m_aDeleteNamespaceBtn; + FixedLine m_aButtonsFL; + OKButton m_aOKBtn; + CancelButton m_aEscBtn; + HelpButton m_aHelpBtn; + + AddConditionDialog* m_pConditionDlg; + PrefixList m_aRemovedList; + + XNameContainer_ref& m_rNamespaces; + + DECL_LINK( SelectHdl, SvxSimpleTable * ); + DECL_LINK( ClickHdl, PushButton * ); + DECL_LINK( OKHdl, OKButton * ); + + void LoadNamespaces(); + + public: + NamespaceItemDialog( AddConditionDialog* pParent, XNameContainer_ref& _rContainer ); + ~NamespaceItemDialog(); + }; + + //======================================================================== + class ManageNamespaceDialog : public ModalDialog + { + private: + FixedText m_aPrefixFT; + Edit m_aPrefixED; + FixedText m_aUrlFT; + Edit m_aUrlED; + FixedLine m_aButtonsFL; + OKButton m_aOKBtn; + CancelButton m_aEscBtn; + HelpButton m_aHelpBtn; + + AddConditionDialog* m_pConditionDlg; + + DECL_LINK( OKHdl, OKButton * ); + + public: + ManageNamespaceDialog( Window* pParent, AddConditionDialog* _pCondDlg, bool _bIsEdit ); + ~ManageNamespaceDialog(); + + inline void SetNamespace( const String& _rPrefix, const String& _rURL ); + inline String GetPrefix() const { return m_aPrefixED.GetText(); } + inline String GetURL() const { return m_aUrlED.GetText(); } + }; + + void ManageNamespaceDialog::SetNamespace( const String& _rPrefix, const String& _rURL ) + { + m_aPrefixED.SetText( _rPrefix ); + m_aUrlED.SetText( _rURL ); + } + + //======================================================================== + class AddSubmissionDialog : public ModalDialog + { + private: + FixedLine m_aSubmissionFL; + FixedText m_aNameFT; + Edit m_aNameED; + FixedText m_aActionFT; + Edit m_aActionED; + FixedText m_aMethodFT; + ListBox m_aMethodLB; + FixedText m_aRefFT; + Edit m_aRefED; + PushButton m_aRefBtn; + FixedText m_aBindFT; + ListBox m_aBindLB; + FixedText m_aReplaceFT; + ListBox m_aReplaceLB; + + FixedLine m_aButtonsFL; + OKButton m_aOKBtn; + CancelButton m_aEscBtn; + HelpButton m_aHelpBtn; + + ItemNode* m_pItemNode; + + XFormsUIHelper1_ref m_xUIHelper; + XSubmission_ref m_xNewSubmission; + XPropertySet_ref m_xSubmission; + XPropertySet_ref m_xTempBinding; + XPropertySet_ref m_xCreatedBinding; + + DECL_LINK( RefHdl, PushButton * ); + DECL_LINK( OKHdl, OKButton * ); + + void FillAllBoxes(); + + public: + AddSubmissionDialog( Window* pParent, ItemNode* _pNode, + const XFormsUIHelper1_ref& _rUIHelper ); + ~AddSubmissionDialog(); + + inline const XSubmission_ref& GetNewSubmission() const { return m_xNewSubmission; } + }; + + //======================================================================== + class AddModelDialog : public ModalDialog + { + private: + FixedLine m_aModelFL; + FixedText m_aNameFT; + Edit m_aNameED; + CheckBox m_aModifyCB; + FixedLine m_aButtonsFL; + OKButton m_aOKBtn; + CancelButton m_aEscBtn; + HelpButton m_aHelpBtn; + + public: + AddModelDialog( Window* pParent, bool _bEdit ); + ~AddModelDialog(); + + inline String GetName() const { return m_aNameED.GetText(); } + inline void SetName( const String& _rName ) { m_aNameED.SetText( _rName );} + + inline bool GetModifyDoc() const { return bool( m_aModifyCB.IsChecked() ); } + inline void SetModifyDoc( const bool _bModify ) { m_aModifyCB.Check( _bModify ); } + }; + + //======================================================================== + class AddInstanceDialog : public ModalDialog + { + private: + FixedLine m_aInstanceFL; + FixedText m_aNameFT; + Edit m_aNameED; + FixedText m_aURLFT; + SvtURLBox m_aURLED; + PushButton m_aFilePickerBtn; + CheckBox m_aLinkInstanceCB; + FixedLine m_aButtonsFL; + OKButton m_aOKBtn; + CancelButton m_aEscBtn; + HelpButton m_aHelpBtn; + + String m_sAllFilterName; + + DECL_LINK( FilePickerHdl, PushButton * ); + + public: + AddInstanceDialog( Window* pParent, bool _bEdit ); + ~AddInstanceDialog(); + + inline void SetRenameMode(); + inline String GetName() const { return m_aNameED.GetText(); } + inline void SetName( const String& _rName ) { m_aNameED.SetText( _rName );} + inline String GetURL() const { return m_aURLED.GetText(); } + inline void SetURL( const String& _rURL ) { m_aURLED.SetText( _rURL );} + inline bool IsLinkInstance() const { return ( m_aLinkInstanceCB.IsChecked() != FALSE ); } + inline void SetLinkInstance( bool _bLink ) { m_aLinkInstanceCB.Check( _bLink != false ); } + }; + + inline void AddInstanceDialog::SetRenameMode() + { + m_aURLFT.Disable(); + m_aURLED.Disable(); + m_aFilePickerBtn.Disable(); + m_aLinkInstanceCB.Disable(); + } + + //======================================================================== + class LinkedInstanceWarningBox : public MessBox + { + public: + LinkedInstanceWarningBox( Window* pParent ); + }; + +//............................................................................ +} // namespace svxform +//............................................................................ + +#endif // _SVX_DATANAVI_HXX + diff --git a/svx/source/inc/delayedevent.hxx b/svx/source/inc/delayedevent.hxx new file mode 100644 index 000000000000..151b998f2f8c --- /dev/null +++ b/svx/source/inc/delayedevent.hxx @@ -0,0 +1,90 @@ +/************************************************************************* +* 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: delayedevent.hxx,v $ +* +* $Revision: 1.1.2.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. +************************************************************************/ + +#ifndef SVX_DELAYEDLINK_HXX +#define SVX_DELAYEDLINK_HXX + +#include <tools/link.hxx> + +//........................................................................ +namespace svxform +{ +//........................................................................ + + //==================================================================== + //= DelayedEvent + //==================================================================== + /** small class which encapsulates posting a Link instance as ApplicationUserEvent + + No thread safety at all here, just a little saving of code to type multiple times + */ + class DelayedEvent + { + public: + DelayedEvent( const Link& _rHandler ) + :m_aHandler( _rHandler ) + ,m_nEventId( 0 ) + { + } + + ~DelayedEvent() + { + CancelPendingCall(); + } + + /** calls the handler asynchronously + + If there's already a call pending, this previous call is cancelled. + */ + void Call( void* _pArg = NULL ); + + /** cancels a call which is currently pending + + If no call is currently pending, then this is ignored. + */ + void CancelPendingCall(); + + private: + Link m_aHandler; + ULONG m_nEventId; + + private: + DECL_LINK( OnCall, void* ); + + private: + DelayedEvent(); // never implemented + DelayedEvent( const DelayedEvent& ); // never implemented + DelayedEvent& operator=( const DelayedEvent& ); // never implemented + }; + +//........................................................................ +} // namespace svxform +//........................................................................ + +#endif // SVX_DELAYEDLINK_HXX diff --git a/svx/source/inc/docrecovery.hxx b/svx/source/inc/docrecovery.hxx new file mode 100644 index 000000000000..b8fc37a6154c --- /dev/null +++ b/svx/source/inc/docrecovery.hxx @@ -0,0 +1,976 @@ +/************************************************************************* + * + * 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: docrecovery.hxx,v $ + * $Revision: 1.16 $ + * + * 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 _SVX_DOCRECOVERY_HXX +#define _SVX_DOCRECOVERY_HXX + +#include <vcl/tabpage.hxx> +#ifndef _SV_TABDIALOG_HXX +#include <vcl/tabdlg.hxx> +#endif +#include <vcl/dialog.hxx> +#ifndef _SV_BUTTON_HXX +#include <vcl/button.hxx> +#endif +#include <vcl/fixed.hxx> +#include <svtools/svmedit2.hxx> +#include <svtools/svtreebx.hxx> +#include <svx/simptabl.hxx> + +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/implbase2.hxx> +#include <com/sun/star/task/XStatusIndicatorFactory.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/lang/XComponent.hpp> + +//=============================================== +// const + +#define RECOVERY_CMDPART_PROTOCOL ::rtl::OUString::createFromAscii("vnd.sun.star.autorecovery:") + +#define RECOVERY_CMDPART_DO_PREPARE_EMERGENCY_SAVE ::rtl::OUString::createFromAscii("/doPrepareEmergencySave" ) +#define RECOVERY_CMDPART_DO_EMERGENCY_SAVE ::rtl::OUString::createFromAscii("/doEmergencySave" ) +#define RECOVERY_CMDPART_DO_RECOVERY ::rtl::OUString::createFromAscii("/doAutoRecovery" ) +#define RECOVERY_CMDPART_DO_CRASHREPORT ::rtl::OUString::createFromAscii("/doCrashReport" ) +#define RECOVERY_CMDPART_DO_ENTRY_BACKUP ::rtl::OUString::createFromAscii("/doEntryBackup" ) +#define RECOVERY_CMDPART_DO_ENTRY_CLEANUP ::rtl::OUString::createFromAscii("/doEntryCleanUp" ) + +#define RECOVERY_CMD_DO_PREPARE_EMERGENCY_SAVE ::rtl::OUString::createFromAscii("vnd.sun.star.autorecovery:/doPrepareEmergencySave") +#define RECOVERY_CMD_DO_EMERGENCY_SAVE ::rtl::OUString::createFromAscii("vnd.sun.star.autorecovery:/doEmergencySave" ) +#define RECOVERY_CMD_DO_RECOVERY ::rtl::OUString::createFromAscii("vnd.sun.star.autorecovery:/doAutoRecovery" ) +#define RECOVERY_CMD_DO_CRASHREPORT ::rtl::OUString::createFromAscii("vnd.sun.star.autorecovery:/doCrashReport" ) +#define RECOVERY_CMD_DO_ENTRY_BACKUP ::rtl::OUString::createFromAscii("vnd.sun.star.autorecovery:/doEntryBackup" ) +#define RECOVERY_CMD_DO_ENTRY_CLEANUP ::rtl::OUString::createFromAscii("vnd.sun.star.autorecovery:/doEntryCleanUp" ) + +#define SERVICENAME_PROGRESSFACTORY ::rtl::OUString::createFromAscii("com.sun.star.task.StatusIndicatorFactory") +#define SERVICENAME_URLTRANSFORMER ::rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" ) +#define SERVICENAME_RECOVERYCORE ::rtl::OUString::createFromAscii("com.sun.star.frame.AutoRecovery" ) +#define SERVICENAME_FOLDERPICKER ::rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.FolderPicker" ) +#define SERVICENAME_DESKTOP ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop" ) + +#define PROP_PARENTWINDOW ::rtl::OUString::createFromAscii("Window" ) +#define PROP_STATUSINDICATOR ::rtl::OUString::createFromAscii("StatusIndicator" ) +#define PROP_DISPATCHASYNCHRON ::rtl::OUString::createFromAscii("DispatchAsynchron") +#define PROP_SAVEPATH ::rtl::OUString::createFromAscii("SavePath" ) +#define PROP_ENTRYID ::rtl::OUString::createFromAscii("EntryID" ) +#define PROP_ALLOWPARENTSHOW ::rtl::OUString::createFromAscii("AllowParentShow" ) + +#define STATEPROP_ID ::rtl::OUString::createFromAscii("ID" ) +#define STATEPROP_STATE ::rtl::OUString::createFromAscii("DocumentState") +#define STATEPROP_ORGURL ::rtl::OUString::createFromAscii("OriginalURL" ) +#define STATEPROP_TEMPURL ::rtl::OUString::createFromAscii("TempURL" ) +#define STATEPROP_FACTORYURL ::rtl::OUString::createFromAscii("FactoryURL" ) +#define STATEPROP_TEMPLATEURL ::rtl::OUString::createFromAscii("TemplateURL" ) +#define STATEPROP_TITLE ::rtl::OUString::createFromAscii("Title" ) +#define STATEPROP_MODULE ::rtl::OUString::createFromAscii("Module" ) + +#define RECOVERY_OPERATIONSTATE_START ::rtl::OUString::createFromAscii("start" ) +#define RECOVERY_OPERATIONSTATE_STOP ::rtl::OUString::createFromAscii("stop" ) +#define RECOVERY_OPERATIONSTATE_UPDATE ::rtl::OUString::createFromAscii("update") + +#define DLG_RET_UNKNOWN -1 +#define DLG_RET_OK 1 +#define DLG_RET_CANCEL 0 +#define DLG_RET_BACK 100 +#define DLG_RET_OK_AUTOLUNCH 101 + +//=============================================== +// namespace + +namespace svx{ + namespace DocRecovery{ + +#ifdef css +# error "Who uses css? I need it as temp. namespace alias!" +#else +# define css ::com::sun::star +#endif + +//=============================================== +enum EDocStates +{ + /* TEMP STATES */ + + /// default state, if a document was new created or loaded + E_UNKNOWN = 0, + /// modified against the original file + E_MODIFIED = 1, + /// an active document can be postponed to be saved later. + E_POSTPONED = 2, + /// was already handled during one AutoSave/Recovery session. + E_HANDLED = 4, + /** an action was started (saving/loading) ... Can be interesting later if the process may be was interrupted by an exception. */ + E_TRY_SAVE = 8, + E_TRY_LOAD_BACKUP = 16, + E_TRY_LOAD_ORIGINAL = 32, + + /* FINAL STATES */ + + /// the Auto/Emergency saved document isnt useable any longer + E_DAMAGED = 64, + /// the Auto/Emergency saved document isnt realy up-to-date (some changes can be missing) + E_INCOMPLETE = 128, + /// the Auto/Emergency saved document was processed successfully + E_SUCCEDED = 512 +}; + +//=============================================== +enum ERecoveryState +{ + E_SUCCESSFULLY_RECOVERED, + E_ORIGINAL_DOCUMENT_RECOVERED, + E_RECOVERY_FAILED, + E_RECOVERY_IS_IN_PROGRESS, + E_NOT_RECOVERED_YET +}; + +//=============================================== +struct TURLInfo +{ + public: + + /// unique ID, which is specified by the underlying autorecovery core! + sal_Int32 ID; + + /// the full qualified document URL + ::rtl::OUString OrgURL; + + /// the full qualified URL of the temp. file (if it's exists) + ::rtl::OUString TempURL; + + /// a may be existing factory URL (e.g. for untitled documents) + ::rtl::OUString FactoryURL; + + /// may be the document base on a template file !? + ::rtl::OUString TemplateURL; + + /// the pure file name, without path, disc etcpp. + ::rtl::OUString DisplayName; + + /// the application module, where this document was loaded + ::rtl::OUString Module; + + /// state info as e.g. VALID, CORRUPTED, NON EXISTING ... + sal_Int32 DocState; + + /// ui representation for DocState! + ERecoveryState RecoveryState; + + /// standard icon + Image StandardImage; + + /// high contrast icon + Image HCImage; + + public: + + TURLInfo() + : ID (-1 ) + , DocState (E_UNKNOWN ) + , RecoveryState(E_NOT_RECOVERED_YET) + {} +}; + +//=============================================== +typedef ::std::vector< TURLInfo > TURLList; + +//=============================================== +class IRecoveryUpdateListener +{ + public: + + // inform listener about changed items, which should be refreshed + virtual void updateItems() = 0; + + // inform listener about starting of the asynchronous recovery operation + virtual void start() = 0; + + // inform listener about ending of the asynchronous recovery operation + virtual void end() = 0; + + // TODO + virtual void stepNext(TURLInfo* pItem) = 0; +}; + +//=============================================== +class RecoveryCore : public ::cppu::WeakImplHelper1< css::frame::XStatusListener > +{ + //------------------------------------------- + // types, const + public: + + //------------------------------------------- + // member + private: + + /// TODO + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /// TODO + css::uno::Reference< css::frame::XDispatch > m_xRealCore; + + /// TODO + css::uno::Reference< css::task::XStatusIndicator > m_xProgress; + + /// TODO + TURLList m_lURLs; + + /// TODO + IRecoveryUpdateListener* m_pListener; + + /** @short knows the reason, why we listen on our internal m_xRealCore + member. + + @descr Because we listen for different operations + on the core dispatch implementation, we must know, + which URL we have to use for deregistration! + */ + sal_Bool m_bListenForSaving; + + //------------------------------------------- + // native interface + public: + + //--------------------------------------- + /** @short TODO */ + RecoveryCore(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + sal_Bool bUsedForSaving); + + //--------------------------------------- + /** @short TODO */ + virtual ~RecoveryCore(); + + //--------------------------------------- + /** @short TODO */ + virtual css::uno::Reference< css::lang::XMultiServiceFactory > getSMGR(); + + //--------------------------------------- + /** @short TODO */ + virtual TURLList* getURLListAccess(); + + //--------------------------------------- + /** @short TODO */ + virtual sal_Bool existsBrokenTempEntries(); + virtual sal_Bool existsNonRecoveredEntries(); + static sal_Bool isBrokenTempEntry(const TURLInfo& rInfo); + virtual void saveBrokenTempEntries(const ::rtl::OUString& sSaveDir); + virtual void saveAllTempEntries(const ::rtl::OUString& sSaveDir); + virtual void forgetBrokenTempEntries(); + virtual void forgetAllRecoveryEntries(); + void forgetBrokenRecoveryEntries(); + + //--------------------------------------- + /** @short TODO */ + virtual void setProgressHandler(const css::uno::Reference< css::task::XStatusIndicator >& xProgress); + + //--------------------------------------- + /** @short TODO */ + virtual void setUpdateListener(IRecoveryUpdateListener* pListener); + + //--------------------------------------- + /** @short TODO */ + virtual void doEmergencySavePrepare(); + virtual void doEmergencySave(); + virtual void doRecovery(); + + //--------------------------------------- + /** @short TODO */ + static ERecoveryState mapDocState2RecoverState(sal_Int32 eDocState); + + //------------------------------------------- + // uno interface + public: + + // css.frame.XStatusListener + virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& aEvent) + throw(css::uno::RuntimeException); + + // css.lang.XEventListener + virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) + throw(css::uno::RuntimeException); + + //------------------------------------------- + // helper + private: + + //--------------------------------------- + /** @short starts listening on the internal EmergencySave/AutoRecovery core. + */ + void impl_startListening(); + + //--------------------------------------- + /** @short stop listening on the internal EmergencySave/AutoRecovery core. + */ + void impl_stopListening(); + + //--------------------------------------- + /** @short TODO */ + css::util::URL impl_getParsedURL(const ::rtl::OUString& sURL); +}; + +//=============================================== +class PluginProgressWindow : public Window +{ + private: + + css::uno::Reference< css::lang::XComponent > m_xProgress; + + public: + + PluginProgressWindow( Window* pParent , + const css::uno::Reference< css::lang::XComponent >& xProgress); + ~PluginProgressWindow(); +}; + +class PluginProgress : public ::cppu::WeakImplHelper2< css::task::XStatusIndicator , + css::lang::XComponent > +{ + + //------------------------------------------- + // member + private: + + /** @short TODO */ + css::uno::Reference< css::task::XStatusIndicatorFactory > m_xProgressFactory; + + css::uno::Reference< css::task::XStatusIndicator > m_xProgress; + + PluginProgressWindow* m_pPlugProgressWindow; + + //------------------------------------------- + // native interface + public: + + //--------------------------------------- + /** @short TODO */ + PluginProgress( Window* pParent, + const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ); + + //--------------------------------------- + /** @short TODO */ + virtual ~PluginProgress(); + + //--------------------------------------- + /** @short TODO */ + Window* getPlugWindow(); + + //------------------------------------------- + // uno interface + public: + + //--------------------------------------- + // XStatusIndicator + virtual void SAL_CALL start(const ::rtl::OUString& sText , + sal_Int32 nRange) + throw(css::uno::RuntimeException); + + virtual void SAL_CALL end() + throw(css::uno::RuntimeException); + + virtual void SAL_CALL setText(const ::rtl::OUString& sText) + throw(css::uno::RuntimeException); + + virtual void SAL_CALL setValue(sal_Int32 nValue) + throw(css::uno::RuntimeException); + + virtual void SAL_CALL reset() + throw(css::uno::RuntimeException); + + //--------------------------------------- + // XComponent + virtual void SAL_CALL dispose() + throw(css::uno::RuntimeException); + + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener >& xListener) + throw(css::uno::RuntimeException); + + virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener) + throw(css::uno::RuntimeException); +}; + +//=============================================== +class IExtendedTabPage : public TabPage +{ + //------------------------------------------- + // member + protected: + + short m_nResult; + + //------------------------------------------- + // interface + public: + + IExtendedTabPage( Window* pParent, WinBits nStyle = 0 ) + : TabPage( pParent, nStyle ) + , m_nResult(DLG_RET_UNKNOWN) + {} + + IExtendedTabPage( Window* pParent, const ResId& rResId ) + : TabPage( pParent, rResId ) + , m_nResult(DLG_RET_UNKNOWN) + {} + + virtual ~IExtendedTabPage() + {} + + virtual short execute() = 0; + virtual void setDefButton() = 0; +}; + +typedef ::std::vector< IExtendedTabPage* > TTabPageList; + +//=============================================== +class TabDialog4Recovery : public TabDialog +{ + //------------------------------------------- + // member + private: + + TTabPageList m_lTabPages; + TTabPageList::iterator m_pActualPage; + + //------------------------------------------- + // interface + public: + + TabDialog4Recovery(Window* pParent); + virtual ~TabDialog4Recovery(); + + virtual void addTabPage(IExtendedTabPage* pPage); + virtual short Execute(); +}; + +//=============================================== +class SaveDialog : public IExtendedTabPage +{ + //------------------------------------------- + // member + private: + + Window m_aTitleWin; + FixedText m_aTitleFT; + FixedLine m_aTitleFL; + FixedText m_aDescrFT; + FixedText m_aFileListFT; + ListBox m_aFileListLB; + FixedLine m_aBottomFL; + OKButton m_aOkBtn; + + RecoveryCore* m_pCore; + + //------------------------------------------- + // interface + public: + + //--------------------------------------- + /** @short create all child controls of this dialog. + + @descr The dialog isnt shown nor it starts any + action by itself! + + @param pParent + can point to a parent window. + If its set to 0, the defmodal-dialog-parent + is used automaticly. + + @param pCore + provides access to the recovery core service + and the current list of open documents, + which should be shown inside this dialog. + */ + SaveDialog(Window* pParent, + RecoveryCore* pCore ); + + //--------------------------------------- + /** @short free all controls and used memory. */ + virtual ~SaveDialog(); + + //--------------------------------------- + /** @short TODO*/ + virtual short execute(); + + //--------------------------------------- + /** @short TODO*/ + virtual void setDefButton(); + + DECL_LINK(OKButtonHdl, void*); +}; + +//=============================================== +class SaveProgressDialog : public ModalDialog + , public IRecoveryUpdateListener +{ + //------------------------------------------- + // member + private: + + FixedText m_aHintFT; + FixedText m_aProgrFT; + String m_aProgrBaseTxt; + Window m_aProgrParent; + + // @short TODO + RecoveryCore* m_pCore; + + // @short TODO + css::uno::Reference< css::task::XStatusIndicator > m_xProgress; + + //------------------------------------------- + // interface + public: + + //--------------------------------------- + /** @short create all child controls of this dialog. + + @descr The dialog isnt shown nor it starts any + action by itself! + + @param pParent + can point to a parent window. + If its set to 0, the defmodal-dialog-parent + is used automaticly. + + @param pCore + used to start emegrency save. + */ + SaveProgressDialog(Window* pParent, + RecoveryCore* pCore ); + + //--------------------------------------- + /** @short free all controls and used memory. */ + virtual ~SaveProgressDialog(); + + //--------------------------------------- + /** @short start the emergency save operation. */ + virtual short Execute(); + + // IRecoveryUpdateListener + virtual void updateItems(); + virtual void stepNext(TURLInfo* pItem); + virtual void start(); + virtual void end(); +}; + +//=============================================== +class RecovDocListEntry : public SvLBoxString +{ + //------------------------------------------- + // interface + private: + + //------------------------------------------- + // interface + public: + + //--------------------------------------- + /** @short TODO */ + RecovDocListEntry( SvLBoxEntry* pEntry, + USHORT nFlags, + const String& sText ); + + //--------------------------------------- + /** @short TODO */ + virtual void Paint(const Point& aPos , + SvLBox& aDevice, + USHORT nFlags , + SvLBoxEntry* pEntry ); +}; + +//=============================================== +class RecovDocList : public SvxSimpleTable +{ + //------------------------------------------- + // member + public: + + Image m_aGreenCheckImg; + Image m_aYellowCheckImg; + Image m_aRedCrossImg; + Image m_aGreenCheckImgHC; + Image m_aYellowCheckImgHC; + Image m_aRedCrossImgHC; + + String m_aSuccessRecovStr; + String m_aOrigDocRecovStr; + String m_aRecovFailedStr; + String m_aRecovInProgrStr; + String m_aNotRecovYetStr; + + //------------------------------------------- + // interface + public: + + //--------------------------------------- + /** @short TODO */ + RecovDocList( Window* pParent, + const ResId& rResId ); + + //--------------------------------------- + /** @short TODO */ + virtual ~RecovDocList(); + + //--------------------------------------- + /** @short TODO */ + virtual void InitEntry( SvLBoxEntry* pEntry , + const XubString& sText , + const Image& aImage1, + const Image& aImage2, + SvLBoxButtonKind eButtonKind); +}; + +//=============================================== +class RecoveryDialog : public IExtendedTabPage + , public IRecoveryUpdateListener +{ + //------------------------------------------- + // member + private: + Window m_aTitleWin; + FixedText m_aTitleFT; + FixedLine m_aTitleFL; + FixedText m_aDescrFT; + FixedText m_aProgressFT; + Window m_aProgrParent; + FixedText m_aFileListFT; + RecovDocList m_aFileListLB; + FixedLine m_aBottomFL; + PushButton m_aNextBtn; + CancelButton m_aCancelBtn; + String m_aNextStr; + String m_aTitleRecoveryInProgress; + String m_aTitleRecoveryReport; + String m_aRecoveryOnlyFinish; + String m_aRecoveryOnlyFinishDescr; + + PushButton* m_pDefButton; + RecoveryCore* m_pCore; + css::uno::Reference< css::task::XStatusIndicator > m_xProgress; + enum EInternalRecoveryState + { + E_RECOVERY_PREPARED, // dialog started ... recovery prepared + E_RECOVERY_IN_PROGRESS, // recovery core still in progress + E_RECOVERY_CORE_DONE, // recovery core finished it's task + E_RECOVERY_DONE, // user clicked "next" button + E_RECOVERY_CANCELED, // user clicked "cancel" button + E_RECOVERY_CANCELED_BEFORE, // user clicked "cancel" button before recovery was started + E_RECOVERY_CANCELED_AFTERWARDS, // user clicked "cancel" button after reovery was finished + E_RECOVERY_HANDLED // the recovery wizard page was shown already ... and will be shown now again ... + }; + sal_Int32 m_eRecoveryState; + sal_Bool m_bWaitForUser; + sal_Bool m_bWaitForCore; + sal_Bool m_bUserDecideNext; + sal_Bool m_bWasRecoveryStarted; + sal_Bool m_bRecoveryOnly; + + //------------------------------------------- + // member + public: + + //--------------------------------------- + /** @short TODO */ + RecoveryDialog(Window* pParent, + RecoveryCore* pCore ); + + //--------------------------------------- + /** @short TODO */ + virtual ~RecoveryDialog(); + + //--------------------------------------- + // IRecoveryUpdateListener + virtual void updateItems(); + virtual void stepNext(TURLInfo* pItem); + virtual void start(); + virtual void end(); + + //--------------------------------------- + /** @short TODO */ + virtual short execute(); + + //--------------------------------------- + /** @short TODO*/ + virtual void setDefButton(); + + //------------------------------------------- + // helper + private: + + //--------------------------------------- + /** @short TODO */ + DECL_LINK(NextButtonHdl, void*); + DECL_LINK(CancelButtonHdl, void*); + + //--------------------------------------- + /** @short TODO */ + void impl_refreshDocList(); + + //--------------------------------------- + /** @short TODO */ + String impl_getStatusString( const TURLInfo& rInfo ) const; +}; + +//=============================================== +class BrokenRecoveryDialog : public ModalDialog +{ + //------------------------------------------- + // member + private: + FixedText m_aDescrFT; + FixedText m_aFileListFT; + ListBox m_aFileListLB; + FixedText m_aSaveDirFT; + Edit m_aSaveDirED; + PushButton m_aSaveDirBtn; + FixedLine m_aBottomFL; + OKButton m_aOkBtn; + CancelButton m_aCancelBtn; + + ::rtl::OUString m_sSavePath; + RecoveryCore* m_pCore; + sal_Bool m_bBeforeRecovery; + sal_Bool m_bExecutionNeeded; + + //------------------------------------------- + // interface + public: + + //--------------------------------------- + /** @short TODO */ + BrokenRecoveryDialog(Window* pParent , + RecoveryCore* pCore , + sal_Bool bBeforeRecovery); + + //--------------------------------------- + /** @short TODO */ + virtual ~BrokenRecoveryDialog(); + + //--------------------------------------- + /** @short TODO */ + virtual sal_Bool isExecutionNeeded(); + + //--------------------------------------- + /** @short TODO */ + virtual ::rtl::OUString getSaveDirURL(); + + //------------------------------------------- + // helper + private: + + //--------------------------------------- + /** @short TODO */ + void impl_refresh(); + + //--------------------------------------- + /** @short TODO */ + DECL_LINK(SaveButtonHdl, void*); + + //--------------------------------------- + /** @short TODO */ + DECL_LINK(OkButtonHdl, void*); + + //--------------------------------------- + /** @short TODO */ + DECL_LINK(CancelButtonHdl, void*); + + //--------------------------------------- + /** @short TODO */ + void impl_askForSavePath(); +}; + + + + class ErrorRepWelcomeDialog : public IExtendedTabPage + { + private: + Window maTitleWin; + FixedText maTitleFT; + FixedLine maTitleFL; + FixedText maDescrFT; + + FixedLine maBottomFL; + PushButton maPrevBtn; + OKButton maNextBtn; + CancelButton maCancelBtn; + + DECL_LINK( PrevBtnHdl, void* ); + DECL_LINK( NextBtnHdl, void* ); + DECL_LINK( CancelBtnHdl, void* ); + public: + ErrorRepWelcomeDialog( Window* _pParent, sal_Bool _bAllowBack = sal_True ); + virtual ~ErrorRepWelcomeDialog(); + /** @short TODO*/ + virtual short execute(); + + //--------------------------------------- + /** @short TODO*/ + virtual void setDefButton(); + }; + + struct ErrorRepParams + { + ErrorRepParams() +#ifdef WNT + : miHTTPConnectionType( 0 ) +#else + : miHTTPConnectionType( 1 ) +#endif + , mbAllowContact( false ) + {} + + String maHTTPProxyServer; + String maHTTPProxyPort; + int miHTTPConnectionType; + bool mbAllowContact; + String maReturnAddress; + String maSubject; + String maBody; + }; + + class ErrorDescriptionEdit : public MultiLineEdit + { + private: + DECL_LINK( ModifyHdl, void* ); + + public: + ErrorDescriptionEdit( Window* pParent, const ResId& rResId ); + virtual ~ErrorDescriptionEdit(); + }; + + class ErrorRepSendDialog : public IExtendedTabPage + { + private: + Window maTitleWin; + FixedText maTitleFT; + FixedLine maTitleFL; + FixedText maDescrFT; + + FixedText maDocTypeFT; + Edit maDocTypeED; + FixedText maUsingFT; + ErrorDescriptionEdit maUsingML; + PushButton maShowRepBtn; + PushButton maOptBtn; + CheckBox maContactCB; + FixedText maEMailAddrFT; + Edit maEMailAddrED; + + FixedLine maBottomFL; + PushButton maPrevBtn; + OKButton maNextBtn; + CancelButton maCancelBtn; + + ErrorRepParams maParams; + + DECL_LINK( ShowRepBtnHdl, void* ); + DECL_LINK( OptBtnHdl, void* ); + DECL_LINK( ContactCBHdl, void* ); + DECL_LINK( PrevBtnHdl, void* ); + DECL_LINK( SendBtnHdl, void* ); + DECL_LINK( CancelBtnHdl, void* ); + + void initControls(); + + public: + ErrorRepSendDialog( Window* _pParent ); + virtual ~ErrorRepSendDialog(); + + String GetDocType( void ) const; + String GetUsing( void ) const; + bool IsContactAllowed( void ) const; + String GetEMailAddress( void ) const; + + bool ReadParams(); + bool SaveParams(); + bool SendReport(); + + /** @short TODO*/ + virtual short execute(); + + //--------------------------------------- + /** @short TODO*/ + virtual void setDefButton(); + }; + + class ErrorRepOptionsDialog : public ModalDialog + { + private: + FixedLine maProxyFL; + RadioButton maSystemBtn; + RadioButton maDirectBtn; + RadioButton maManualBtn; + FixedText maProxyServerFT; + Edit maProxyServerEd; + FixedText maProxyPortFT; + Edit maProxyPortEd; + FixedText maDescriptionFT; + FixedLine maButtonsFL; + OKButton maOKBtn; + CancelButton maCancelBtn; + + ErrorRepParams& mrParams; + + DECL_LINK( CancelBtnHdl, void* ); + DECL_LINK( OKBtnHdl, void * ); + DECL_LINK( ManualBtnHdl, void * ); + + public: + ErrorRepOptionsDialog( Window* _pParent, ErrorRepParams& rParams ); + virtual ~ErrorRepOptionsDialog(); + }; + + class ErrorRepEdit : public ExtMultiLineEdit + { + public: + ErrorRepEdit( Window* pParent, const ResId& rResId ); + virtual ~ErrorRepEdit(); + }; + + class ErrorRepPreviewDialog : public ModalDialog + { + private: + ErrorRepEdit maContentML; + OKButton maOKBtn; + + long mnMinHeight; + + public: + ErrorRepPreviewDialog( Window* _pParent ); + virtual ~ErrorRepPreviewDialog(); + + virtual void Resize(); + }; + } // namespace DocRecovery +} // namespace svx + +#undef css + +#endif diff --git a/svx/source/inc/editxml.hxx b/svx/source/inc/editxml.hxx new file mode 100644 index 000000000000..d6d09382395e --- /dev/null +++ b/svx/source/inc/editxml.hxx @@ -0,0 +1,46 @@ +/************************************************************************* + * + * 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: editxml.hxx,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. + * + ************************************************************************/ + +#ifndef _SVX_EDITXML_HXX +#define _SVX_EDITXML_HXX + +class EditEngine; +class SvStream; +struct ESelection; + +/** this function exports the selected content of an edit engine into a xml stream*/ +extern void SvxWriteXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& rSel ); + +/** this function imports xml from the stream into the selected of an edit engine */ +extern void SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& rSel ); + +#endif + + diff --git a/svx/source/inc/eventdlg.hxx b/svx/source/inc/eventdlg.hxx new file mode 100644 index 000000000000..37fc58ea7639 --- /dev/null +++ b/svx/source/inc/eventdlg.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * 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: eventdlg.hxx,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. + * + ************************************************************************/ +#ifndef _EVENTDLG_HXX +#define _EVENTDLG_HXX + +#include <vcl/menubtn.hxx> + +#include <vcl/fixed.hxx> +#include <sfx2/evntconf.hxx> +#include "macropg.hxx" + +#include <com/sun/star/frame/XFrame.hpp> + +class Menu; +class SfxMacroInfoItem; +class SvxMacroItem; + +class SvxEventConfigPage : public _SvxMacroTabPage +{ + FixedText aSaveInText; + ListBox aSaveInListBox; + + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xAppEvents; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xDocumentEvents; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifiable > m_xDocumentModifiable; + + BOOL bAppConfig; + + DECL_LINK( SelectHdl_Impl, ListBox* ); + + // Forbidden and not implemented. + SvxEventConfigPage (const SvxEventConfigPage &); + SvxEventConfigPage & operator= (const SvxEventConfigPage &); + +public: + /// this is only to let callers know that there is a LateInit which *must* be called + struct EarlyInit { }; + SvxEventConfigPage( Window *pParent, const SfxItemSet& rSet, EarlyInit ); + ~SvxEventConfigPage(); + + void LateInit( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame ); + +protected: + virtual BOOL FillItemSet( SfxItemSet& ); + virtual void Reset( const SfxItemSet& ); + using _SvxMacroTabPage::Reset; + +private: + void ImplInitDocument(); +}; + + +#endif + diff --git a/svx/source/inc/filtnav.hxx b/svx/source/inc/filtnav.hxx new file mode 100644 index 000000000000..2bb298836d02 --- /dev/null +++ b/svx/source/inc/filtnav.hxx @@ -0,0 +1,363 @@ +/************************************************************************* + * + * 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: filtnav.hxx,v $ + * $Revision: 1.19.216.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. + * + ************************************************************************/ +#ifndef _SVX_FILTNAV_HXX +#define _SVX_FILTNAV_HXX + +#include <com/sun/star/awt/XTextComponent.hpp> +#include <com/sun/star/form/XForm.hpp> +#include <svtools/lstner.hxx> +#include <svtools/brdcst.hxx> +#include <vcl/window.hxx> +#include <sfx2/childwin.hxx> +#include <svtools/poolitem.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dockwin.hxx> +#include <sfx2/ctrlitem.hxx> +#include <vcl/image.hxx> +#include <svtools/svtreebx.hxx> + +#include <vcl/dialog.hxx> +#include <vcl/group.hxx> +#include <vcl/dockwin.hxx> +#include "fmtools.hxx" +#include "fmexch.hxx" +#include <connectivity/sqlparse.hxx> +#include "fmexch.hxx" +#include "sqlparserclient.hxx" + +class FmFormShell; + +//........................................................................ +namespace svxform +{ +//........................................................................ + +class FmFilterItem; +class FmFilterItems; +class FmParentData; +class FmFilterAdapter; + +//======================================================================== +// data structure for the filter model +//======================================================================== +class FmFilterData +{ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB; + FmParentData* m_pParent; + ::rtl::OUString m_aText; + +public: + TYPEINFO(); + FmFilterData(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory,FmParentData* pParent = NULL, const ::rtl::OUString& rText = ::rtl::OUString()) + :m_xORB( _rxFactory ) + ,m_pParent( pParent ) + ,m_aText( rText ) + {} + virtual ~FmFilterData(){} + + void SetText( const ::rtl::OUString& rText ){ m_aText = rText; } + ::rtl::OUString GetText() const { return m_aText; } + FmParentData* GetParent() const {return m_pParent;} + + virtual Image GetImage( BmpColorMode _eMode = BMP_COLOR_NORMAL ) const; +}; + +//======================================================================== +class FmParentData : public FmFilterData +{ +protected: + ::std::vector<FmFilterData*> m_aChilds; + + +public: + TYPEINFO(); + FmParentData(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory,FmParentData* pParent, const ::rtl::OUString& rText) + : FmFilterData(_rxFactory,pParent, rText) + {} + virtual ~FmParentData(); + + ::std::vector<FmFilterData*>& GetChilds() {return m_aChilds;} +}; + +//======================================================================== +// Item representing the forms and subforms +class FmFormItem : public FmParentData +{ + ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > m_xController; + sal_Int32 m_nCurrent; + +public: + TYPEINFO(); + FmFormItem(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory):FmParentData(_rxFactory,NULL, ::rtl::OUString()){} + FmFormItem(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory,FmParentData* _pParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > & _xController, + const ::rtl::OUString& _rText):FmParentData(_rxFactory,_pParent, _rText) + ,m_xController(_xController) + ,m_nCurrent(0){} + + const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > & GetController(){return m_xController;} + void SetCurrentPosition(sal_Int32 nCurrent){m_nCurrent = nCurrent;} + sal_Int32 GetCurrentPosition() const {return m_nCurrent;} + virtual Image GetImage( BmpColorMode _eMode = BMP_COLOR_NORMAL ) const; +}; + +//======================================================================== +class FmFilterItems : public FmParentData +{ +public: + TYPEINFO(); + FmFilterItems(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory):FmParentData(_rxFactory,NULL, ::rtl::OUString()){} + FmFilterItems(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory,FmFormItem* pParent, const ::rtl::OUString& rText ):FmParentData(_rxFactory,pParent, rText){} + + FmFilterItem* Find(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent > & xText) const; + virtual Image GetImage( BmpColorMode _eMode = BMP_COLOR_NORMAL ) const; +}; + +//======================================================================== +class FmFilterItem : public FmFilterData +{ + ::rtl::OUString m_aFieldName; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent > m_xText; + +public: + TYPEINFO(); + FmFilterItem(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory, + FmFilterItems* pParent, + const ::rtl::OUString& aFieldName, + const ::rtl::OUString& aCondition, + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent > & xText); + + const ::rtl::OUString& GetFieldName() const {return m_aFieldName;} + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent > & GetTextComponent() const {return m_xText;} + + virtual Image GetImage( BmpColorMode _eMode = BMP_COLOR_NORMAL ) const; +}; + +//======================================================================== +class FmFilterModel : public FmParentData + ,public SfxBroadcaster + ,public ::svxform::OSQLParserClient +{ + friend class FmFilterAdapter; + + ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > m_xControllers; + ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > m_xController; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB; + FmFilterAdapter* m_pAdapter; + FmFilterItems* m_pCurrentItems; + +public: + TYPEINFO(); + FmFilterModel(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory); + virtual ~FmFilterModel(); + + void Update(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > & xControllers, const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > & xCurrent); + void Clear(); + sal_Bool ValidateText(FmFilterItem* pItem, UniString& rText, UniString& rErrorMsg) const; + void Append(FmFilterItems* pItems, FmFilterItem* pFilterItem); + void SetTextForItem(FmFilterItem* pItem, const ::rtl::OUString& rText); + + FmFormItem* GetCurrentForm() const {return m_pCurrentItems ? (FmFormItem*)m_pCurrentItems->GetParent() : NULL;} + FmFilterItems* GetCurrentItems() const {return m_pCurrentItems;} + void SetCurrentItems(FmFilterItems* pCurrent); + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const { return m_xORB; } + + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > & GetControllers() const {return m_xControllers;} + const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > & GetCurrentController() const {return m_xController;} + void SetCurrentController(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > & xController); + + void Remove(FmFilterData* pFilterItem); + void AppendFilterItems(FmFormItem* pItem); + void CheckIntegrity(FmParentData* pItem); + +protected: + void Insert(const ::std::vector<FmFilterData*>::iterator& rPos, FmFilterData* pFilterItem); + void Remove(const ::std::vector<FmFilterData*>::iterator& rPos, FmFilterData* pFilterItem); + FmFormItem* Find(const ::std::vector<FmFilterData*>& rItems, const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > & xController) const; + FmFormItem* Find(const ::std::vector<FmFilterData*>& rItems, const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& xForm) const; + void Update(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > & xControllers, FmParentData* pParent); +}; + +//======================================================================== +//======================================================================== +class OFilterItemExchange : public OLocalExchange +{ + ::std::vector<FmFilterItem*> m_aDraggedEntries; + FmFormItem* m_pFormItem; // ensure that we drop on the same form + +public: + OFilterItemExchange(); + + static sal_uInt32 getFormatId( ); + inline static sal_Bool hasFormat( const DataFlavorExVector& _rFormats ); + + const ::std::vector<FmFilterItem*>& getDraggedEntries() const { return m_aDraggedEntries; } + void setDraggedEntries(const ::std::vector<FmFilterItem*>& _rList) { m_aDraggedEntries = _rList; } + FmFormItem* getFormItem() const { return m_pFormItem; } + + void setFormItem( FmFormItem* _pItem ) { m_pFormItem = _pItem; } + void addSelectedItem( FmFilterItem* _pItem) { m_aDraggedEntries.push_back(_pItem); } + +protected: + virtual void AddSupportedFormats(); +}; + +inline sal_Bool OFilterItemExchange::hasFormat( const DataFlavorExVector& _rFormats ) +{ + return OLocalExchange::hasFormat( _rFormats, getFormatId() ); +} + +//==================================================================== +//= OFilterExchangeHelper +//==================================================================== +class OFilterExchangeHelper : public OLocalExchangeHelper +{ +public: + OFilterExchangeHelper(Window* _pDragSource) : OLocalExchangeHelper(_pDragSource) { } + + OFilterItemExchange* operator->() const { return static_cast<OFilterItemExchange*>(m_pTransferable); } + +protected: + virtual OLocalExchange* createExchange() const; +}; + +//======================================================================== +class FmFilterNavigator : public SvTreeListBox, public SfxListener +{ + enum DROP_ACTION{ DA_SCROLLUP, DA_SCROLLDOWN, DA_EXPANDNODE }; + + FmFilterModel* m_pModel; + SvLBoxEntry* m_pEditingCurrently; + OFilterExchangeHelper m_aControlExchange; + + + AutoTimer m_aDropActionTimer; + unsigned short m_aTimerCounter; + Point m_aTimerTriggered; // die Position, an der der DropTimer angeschaltet wurde + DROP_ACTION m_aDropActionType; + +public: + FmFilterNavigator( Window* pParent ); + virtual ~FmFilterNavigator(); + + void UpdateContent(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > & xControllers, const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > & xCurrent); + const FmFilterModel* GetFilterModel() const {return m_pModel;} + +protected: + using Control::Notify; + + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void Command( const CommandEvent& rEvt ); + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + virtual void InitEntry(SvLBoxEntry* pEntry, const XubString& rStr, const Image& rImg1, const Image& rImg2, SvLBoxButtonKind eButtonKind); + virtual sal_Bool Select( SvLBoxEntry* pEntry, sal_Bool bSelect=sal_True ); + virtual sal_Bool EditingEntry( SvLBoxEntry* pEntry, Selection& rSelection ); + virtual sal_Bool EditedEntry( SvLBoxEntry* pEntry, const XubString& rNewText ); + + virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); + virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); + virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ); + + void DeleteSelection(); + void Clear(); + SvLBoxEntry* FindEntry(const FmFilterData* pItem) const; + void Insert(FmFilterData* pItem, sal_Int32 nPos); + void Remove(FmFilterData* pItem); + + DECL_LINK(OnRemove, SvLBoxEntry*); + DECL_LINK(OnEdited, SvLBoxEntry*); + DECL_LINK(OnDropActionTimer, void*); + +private: + /** returns the first form item and the selected FilterItems in the vector + @param _rItemList + Is filled inside. <OUT/> + @return + The first form item. + */ + FmFormItem* getSelectedFilterItems(::std::vector<FmFilterItem*>& _rItemList); + /* inserts the filter items into the tree model and creates new FilterItems if needed. + @param _rFilterList + The items which should be inserted. + @param _pTargetItems + The target where to insert the items. + @param _bCopy + If <TRUE/> the items will not be removed from the model, otherwise they will. + */ + void insertFilterItem(const ::std::vector<FmFilterItem*>& _rFilterList,FmFilterItems* _pTargetItems,sal_Bool _bCopy = sal_False); + SvLBoxEntry* getPrevEntry(SvLBoxEntry* _pStartWith = NULL); + SvLBoxEntry* getNextEntry(SvLBoxEntry* _pStartWith = NULL); + + using SvTreeListBox::Select; + using SvTreeListBox::ExecuteDrop; + using SvTreeListBox::Insert; +}; + +//======================================================================== +class FmFilterNavigatorWin : public SfxDockingWindow, public SfxControllerItem +{ +private: + FmFilterNavigator* m_pNavigator; + +protected: + virtual void Resize(); + virtual sal_Bool Close(); + virtual Size CalcDockingSize( SfxChildAlignment ); + virtual SfxChildAlignment CheckAlignment( SfxChildAlignment, SfxChildAlignment ); + +public: + FmFilterNavigatorWin( SfxBindings *pBindings, SfxChildWindow *pMgr, + Window* pParent ); + virtual ~FmFilterNavigatorWin(); + + void UpdateContent( FmFormShell* pFormShell ); + void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); + void FillInfo( SfxChildWinInfo& rInfo ) const; + + using SfxDockingWindow::StateChanged; + + virtual void GetFocus(); +}; + +//======================================================================== +class FmFilterNavigatorWinMgr : public SfxChildWindow +{ +public: + FmFilterNavigatorWinMgr( Window *pParent, sal_uInt16 nId, SfxBindings *pBindings, + SfxChildWinInfo *pInfo ); + SFX_DECL_CHILDWINDOW( FmFilterNavigatorWinMgr ); +}; + +//........................................................................ +} // namespace svxform +//........................................................................ + +#endif // _SVX_FILTNAV_HXX + diff --git a/svx/source/inc/fmPropBrw.hxx b/svx/source/inc/fmPropBrw.hxx new file mode 100644 index 000000000000..285cb90320d2 --- /dev/null +++ b/svx/source/inc/fmPropBrw.hxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * 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: fmPropBrw.hxx,v $ + * $Revision: 1.14 $ + * + * 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 SVX_FMPROPBRW_HXX +#define SVX_FMPROPBRW_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/awt/XControlContainer.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/inspection/XObjectInspectorModel.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +/** === end UNO includes === **/ +#include <sfx2/basedlgs.hxx> +#include <sfx2/ctrlitem.hxx> +#include <sfx2/childwin.hxx> +#include "fmtools.hxx" + +//======================================================================== +class FmPropBrwMgr : public SfxChildWindow +{ +public: + FmPropBrwMgr(Window *pParent, sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo *pInfo); + SFX_DECL_CHILDWINDOW(FmPropBrwMgr); +}; + +class FmPropControl; +class SfxBindings; +class FmFormShell; +//======================================================================== +class FmPropBrw : public SfxFloatingWindow, public SfxControllerItem +{ + sal_Bool m_bInitialStateChange; + bool m_bInStateChange; + ::rtl::OUString m_sLastActivePage; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + m_xInspectorContext; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > + m_xORB; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > + m_xMeAsFrame; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > + m_xLastKnownDocument; + ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorModel > + m_xInspectorModel; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > + m_xBrowserController; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > + m_xBrowserComponentWindow; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > + m_xFrameContainerWindow; + +protected: + virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState); + virtual void FillInfo( SfxChildWinInfo& rInfo ) const; + virtual sal_Bool Close(); + + DECL_LINK( OnAsyncGetFocus, void* ); + + void implSetNewSelection( const InterfaceBag& _rSelection ); + void implDetachController(); + bool implIsReadOnlyModel() const; + ::rtl::OUString getCurrentPage() const; + +public: + FmPropBrw( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB, + SfxBindings* pBindings, + SfxChildWindow* pMgr, + Window* pParent, + const SfxChildWinInfo* _pInfo + ); + virtual ~FmPropBrw(); + + using SfxFloatingWindow::StateChanged; + +protected: + virtual void Resize(); + +private: + /** creates the PropertyBrowser (aka ObjectInspector) and plugs it into our frame + + This method ensures that a new component is created every time the XModel which + we're working for changed. This is necessary since this model is part of the + ComponentContext we use to create the ObjectInspector. + */ + void impl_ensurePropertyBrowser_nothrow( FmFormShell* _pFormShell ); + + /** creates a property browser + + After this method returns, m_xBrowserController and m_xBrowserComponentWindow are + not <NULL/>. + + @precond + we don't have an ObjectInspector, yet, i.e. m_xBrowserController and m_xBrowserComponentWindow + are <NULL/>. + */ + void impl_createPropertyBrowser_throw( FmFormShell* _pFormShell ); +}; +#endif //SVX_FMPROPBRW_HXX diff --git a/svx/source/inc/fmcontrolbordermanager.hxx b/svx/source/inc/fmcontrolbordermanager.hxx new file mode 100644 index 000000000000..c08907026585 --- /dev/null +++ b/svx/source/inc/fmcontrolbordermanager.hxx @@ -0,0 +1,271 @@ +/************************************************************************* + * + * 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: fmcontrolbordermanager.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 SVX_SOURCE_INC_FMCONTROLBORDERMANAGER_HXX +#define SVX_SOURCE_INC_FMCONTROLBORDERMANAGER_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/awt/VisualEffect.hpp> +#include <com/sun/star/awt/FontUnderline.hpp> +#include <com/sun/star/awt/XControl.hpp> +#include <com/sun/star/awt/XVclWindowPeer.hpp> +/** === end UNO includes === **/ +#include <comphelper/stl_types.hxx> +#include <comphelper/stl_types.hxx> + +#include <set> + +namespace com { namespace sun { namespace star { namespace form { namespace validation { + class XValidatableFormComponent; +} } } } } + +//........................................................................ +namespace svxform +{ +//........................................................................ + + typedef sal_Int16 ControlStatus; + + #define CONTROL_STATUS_NONE 0x00 + #define CONTROL_STATUS_FOCUSED 0x01 + #define CONTROL_STATUS_MOUSE_HOVER 0x02 + #define CONTROL_STATUS_INVALID 0x04 + + //==================================================================== + //= BorderDescriptor + //==================================================================== + struct BorderDescriptor + { + sal_Int16 nBorderType; + sal_Int32 nBorderColor; + + BorderDescriptor() + :nBorderType( ::com::sun::star::awt::VisualEffect::FLAT ) + ,nBorderColor( 0x00000000 ) + { + } + inline void clear() + { + nBorderType = ::com::sun::star::awt::VisualEffect::FLAT; + nBorderColor = 0x00000000; + } + }; + + //==================================================================== + //= UnderlineDescriptor + //==================================================================== + struct UnderlineDescriptor + { + sal_Int16 nUnderlineType; + sal_Int32 nUnderlineColor; + + UnderlineDescriptor() + :nUnderlineType( ::com::sun::star::awt::FontUnderline::NONE ) + ,nUnderlineColor( 0x00000000 ) + { + } + + UnderlineDescriptor( sal_Int16 _nUnderlineType, sal_Int32 _nUnderlineColor ) + :nUnderlineType( _nUnderlineType ) + ,nUnderlineColor( _nUnderlineColor ) + { + } + + inline void clear() + { + nUnderlineType = ::com::sun::star::awt::FontUnderline::NONE; + nUnderlineColor = 0x00000000; + } + }; + + //==================================================================== + //= ControlData + //==================================================================== + struct ControlData : public BorderDescriptor, UnderlineDescriptor + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xControl; + ::rtl::OUString sOriginalHelpText; + + ControlData() : BorderDescriptor() { } + ControlData( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl ) + :xControl( _rxControl ) + { + } + void clear() + { + BorderDescriptor::clear(); + UnderlineDescriptor::clear(); + xControl.clear(); + sOriginalHelpText = ::rtl::OUString(); + } + }; + + //==================================================================== + //= ControlBorderManager + //==================================================================== + /** manages the dynamic border color for form controls + + Used by the <type>FmXFormController</type>, this class manages the dynamic changes in the + border color of form controls. For this a set of events have to be forwarded to the manager + instance, which then will switch the border color depending on the mouse and focus status + of the controls. + */ + class ControlBorderManager + { + private: + struct ControlDataCompare : public ::std::binary_function< ControlData, ControlData, bool > + { + bool operator()( const ControlData& _rLHS, const ControlData& _rRHS ) const + { + return _rLHS.xControl.get() < _rRHS.xControl.get(); + } + }; + + typedef ::std::set< ControlData, ControlDataCompare > ControlBag; + typedef ::com::sun::star::awt::XVclWindowPeer WindowPeer; + typedef ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer > WindowPeerRef; + typedef ::std::set< WindowPeerRef, ::comphelper::OInterfaceCompare< WindowPeer > > PeerBag; + + PeerBag m_aColorableControls; + PeerBag m_aNonColorableControls; + + ControlData m_aFocusControl; + ControlData m_aMouseHoverControl; + ControlBag m_aInvalidControls; + + // ---------------- + // attributes + sal_Int32 m_nFocusColor; + sal_Int32 m_nMouseHoveColor; + sal_Int32 m_nInvalidColor; + bool m_bDynamicBorderColors; + + public: + ControlBorderManager(); + ~ControlBorderManager(); + + public: + void focusGained( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxControl ) SAL_THROW(()); + void focusLost( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxControl ) SAL_THROW(()); + void mouseEntered( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxControl ) SAL_THROW(()); + void mouseExited( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxControl ) SAL_THROW(()); + + void validityChanged( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl, + const ::com::sun::star::uno::Reference< ::com::sun::star::form::validation::XValidatableFormComponent >& _rxValidatable + ) SAL_THROW(()); + + /// enables dynamic border color for the controls + void enableDynamicBorderColor( ); + /// disables dynamic border color for the controls + void disableDynamicBorderColor( ); + + /** sets a color to be used for a given status + @param _nStatus + the status which the color should be applied for. Must not be CONTROL_STATUS_NONE + @param _nColor + the color to apply for the given status + */ + void setStatusColor( ControlStatus _nStatus, sal_Int32 _nColor ); + + /** restores all colors of all controls where we possibly changed them + */ + void restoreAll(); + + private: + /** called when a control got one of the two possible stati (focused, and hovered with the mouse) + @param _rxControl + the control which gained the status + @param _rControlData + the control's status data, as a reference to our respective member + */ + void controlStatusGained( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxControl, + ControlData& _rControlData + ) SAL_THROW(()); + + /** called when a control lost one of the two possible stati (focused, and hovered with the mouse) + @param _rxControl + the control which lost the status + @param _rControlData + the control's status data, as a reference to our respective member + */ + void controlStatusLost( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxControl, ControlData& _rControlData ) SAL_THROW(()); + + /** determines whether the border of a given peer can be colored + @param _rxPeer + the peer to examine. Must not be <NULL/> + */ + bool canColorBorder( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer >& _rxPeer ); + + /** determines the status of the given control + */ + ControlStatus getControlStatus( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl ) SAL_THROW(()); + + /** retrieves the color associated with a given ControlStatus + @param _eStatus + the status of the control. Must not be <member>ControlStatus::none</member> + */ + sal_Int32 getControlColorByStatus( ControlStatus _eStatus ); + + /** sets the border color for a given control, depending on its status + @param _rxControl + the control to set the border color for. Must not be <NULL/> + @param _rxPeer + the peer of the control, to be passed herein for optimization the caller usually needs it, anyway). + Must not be <NULL/> + @param _rFallback + the color/type to use when the control has the status CONTROL_STATUS_NONE + */ + void updateBorderStyle( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl, + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer >& _rxPeer, + const BorderDescriptor& _rFallback + ) SAL_THROW(()); + + /** determines the to-be-remembered original border color and type for a control + + The method also takes into account that the control may currently have an overwritten + border style + + @param _rxControl + the control to examine. Must not be <NULL/>, and have a non-<NULL/> peer + */ + void determineOriginalBorderStyle( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl, + BorderDescriptor& _rData + ) const; + }; + +//........................................................................ +} // namespace svxform +//........................................................................ + +#endif // SVX_SOURCE_INC_FMCONTROLBORDERMANAGER_HXX diff --git a/svx/source/inc/fmcontrollayout.hxx b/svx/source/inc/fmcontrollayout.hxx new file mode 100644 index 000000000000..c5abe43f3228 --- /dev/null +++ b/svx/source/inc/fmcontrollayout.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * 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: fmcontrollayout.hxx,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. + * + ************************************************************************/ + +#ifndef SVX_SOURCE_INC_FMCONTROLLAYOUT_HXX +#define SVX_SOURCE_INC_FMCONTROLLAYOUT_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/beans/XPropertySet.hpp> +/** === end UNO includes === **/ + +#ifndef SVX_SOURCE_FORM_FMDOCUMENTCLASSIFICATION_HXX +#include "fmdocumentclassification.hxx" +#endif +#include <unotools/confignode.hxx> + +//........................................................................ +namespace svxform +{ +//........................................................................ + + //==================================================================== + //= ControlLayouter + //==================================================================== + class ControlLayouter + { + public: + /** initializes the layout of a newly created form control (model) + */ + static void initializeControlLayout( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel, + DocumentType _eDocType + ); + + /** determines whether for the given document type, dynamic control border coloring is enabled + */ + static bool useDynamicBorderColor( DocumentType _eDocType ); + + /** determines whether for the given document type, form controls should use the document's reference device + for text rendering + */ + static bool useDocumentReferenceDevice( DocumentType _eDocType ); + + /** gets the "default" style in a document which can be used if some default text format is needed + + It depends on the type document type which concrete kind of style is returned, but it is expected to support + the css.style.CharacterProperties service. + + @param _rxModel + a form component. + */ + static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > + getDefaultDocumentTextStyle( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel ); + + private: + ControlLayouter(); // never implemented + + private: + static ::utl::OConfigurationNode + getLayoutSettings( + DocumentType _eDocType + ); + }; + +//........................................................................ +} // namespace svxform +//........................................................................ + +#endif // SVX_SOURCE_INC_FMCONTROLLAYOUT_HXX + diff --git a/svx/source/inc/fmctrler.hxx b/svx/source/inc/fmctrler.hxx new file mode 100644 index 000000000000..7a973e129280 --- /dev/null +++ b/svx/source/inc/fmctrler.hxx @@ -0,0 +1,617 @@ +/************************************************************************* + * + * 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: fmctrler.hxx,v $ + * $Revision: 1.24 $ + * + * 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 _SVX_FMCTRLER_HXX +#define _SVX_FMCTRLER_HXX + +#include "fmtools.hxx" +#include "formcontrolling.hxx" +#include "sqlparserclient.hxx" +#include "delayedevent.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/awt/XControl.hpp> +#include <com/sun/star/awt/XControlContainer.hpp> +#include <com/sun/star/awt/XControlModel.hpp> +#include <com/sun/star/awt/XFocusListener.hpp> +#include <com/sun/star/awt/XItemListener.hpp> +#include <com/sun/star/awt/XMouseListener.hpp> +#include <com/sun/star/awt/XTabController.hpp> +#include <com/sun/star/awt/XTabControllerModel.hpp> +#include <com/sun/star/awt/XTextComponent.hpp> +#include <com/sun/star/awt/XTextListener.hpp> +#include <com/sun/star/beans/PropertyChangeEvent.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/XPropertyChangeListener.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertySetInfo.hpp> +#include <com/sun/star/container/ContainerEvent.hpp> +#include <com/sun/star/container/XChild.hpp> +#include <com/sun/star/container/XContainer.hpp> +#include <com/sun/star/container/XContainerListener.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/form/DatabaseDeleteEvent.hpp> +#include <com/sun/star/form/DatabaseParameterEvent.hpp> +#include <com/sun/star/form/ErrorEvent.hpp> +#include <com/sun/star/form/validation/XFormComponentValidityListener.hpp> +#include <com/sun/star/form/XConfirmDeleteBroadcaster.hpp> +#include <com/sun/star/form/XConfirmDeleteListener.hpp> +#include <com/sun/star/form/XDatabaseParameterBroadcaster2.hpp> +#include <com/sun/star/form/XDatabaseParameterListener.hpp> +#include <com/sun/star/form/XFormController.hpp> +#include <com/sun/star/form/XFormControllerListener.hpp> +#include <com/sun/star/form/XGridControlListener.hpp> +#include <com/sun/star/form/XLoadListener.hpp> +#include <com/sun/star/form/XResetListener.hpp> +#include <com/sun/star/frame/DispatchDescriptor.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/XDispatchProviderInterception.hpp> +#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/script/XEventAttacherManager.hpp> +#include <com/sun/star/sdb/XRowSetApproveBroadcaster.hpp> +#include <com/sun/star/sdb/XRowSetApproveListener.hpp> +#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp> +#include <com/sun/star/sdb/XSQLErrorBroadcaster.hpp> +#include <com/sun/star/sdb/XSQLErrorListener.hpp> +#include <com/sun/star/sdbc/XRowSetListener.hpp> +#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/util/XModeSelector.hpp> +#include <com/sun/star/util/XModifyBroadcaster.hpp> +#include <com/sun/star/util/XModifyListener.hpp> +/** === end UNO includes === **/ + +#include <comphelper/broadcasthelper.hxx> +#include <comphelper/proparrhlp.hxx> +#include <comphelper/stl_types.hxx> +#include <connectivity/sqlparse.hxx> +#include <cppuhelper/propshlp.hxx> +#include <tools/debug.hxx> +#include <vcl/timer.hxx> + +#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_31) +#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_31 +#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 31 +#include <comphelper/implbase_var.hxx> +#endif + +struct FmXTextComponentLess : public ::std::binary_function< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent >, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent> , sal_Bool> +{ + sal_Bool operator() (const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent >& x, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent >& y) const + { + return reinterpret_cast<sal_Int64>(x.get()) < reinterpret_cast<sal_Int64>(y.get()); + } +}; + +typedef ::std::map< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent >, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >, FmXTextComponentLess> FmFilterControls; +typedef ::std::map< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent >, ::rtl::OUString, FmXTextComponentLess> FmFilterRow; +typedef ::std::vector< FmFilterRow > FmFilterRows; +typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > > FmFormControllers; + +struct FmFieldInfo; +class FmFormView; +class Window; + +namespace svxform +{ + class ControlBorderManager; +} + +typedef ::comphelper::WeakComponentImplHelper31 < ::com::sun::star::form::XFormController + , ::com::sun::star::container::XChild + , ::com::sun::star::container::XIndexAccess + , ::com::sun::star::container::XEnumerationAccess + , ::com::sun::star::awt::XFocusListener + , ::com::sun::star::form::XLoadListener + , ::com::sun::star::beans::XPropertyChangeListener + , ::com::sun::star::awt::XTextListener + , ::com::sun::star::awt::XItemListener + , ::com::sun::star::container::XContainerListener + , ::com::sun::star::util::XModifyListener + , ::com::sun::star::util::XModifyBroadcaster + , ::com::sun::star::util::XModeSelector + , ::com::sun::star::form::XConfirmDeleteListener + , ::com::sun::star::form::XConfirmDeleteBroadcaster + , ::com::sun::star::sdb::XSQLErrorListener + , ::com::sun::star::sdb::XSQLErrorBroadcaster + , ::com::sun::star::sdbc::XRowSetListener + , ::com::sun::star::sdb::XRowSetApproveListener + , ::com::sun::star::sdb::XRowSetApproveBroadcaster + , ::com::sun::star::form::XDatabaseParameterListener + , ::com::sun::star::form::XDatabaseParameterBroadcaster + , ::com::sun::star::lang::XServiceInfo + , ::com::sun::star::form::XResetListener + , ::com::sun::star::lang::XUnoTunnel + , ::com::sun::star::frame::XDispatch + , ::com::sun::star::awt::XMouseListener + , ::com::sun::star::form::validation::XFormComponentValidityListener + , ::com::sun::star::task::XInteractionHandler + , ::com::sun::star::lang::XInitialization + , ::com::sun::star::form::XGridControlListener + > FmXFormController_BASE; + +//================================================================== +// FmXFormController +//================================================================== +class ColumnInfoCache; +class SAL_DLLPRIVATE FmXFormController :public ::comphelper::OBaseMutex + ,public FmXFormController_BASE + ,public ::cppu::OPropertySetHelper + ,public FmDispatchInterceptor + ,public ::comphelper::OAggregationArrayUsageHelper< FmXFormController > + ,public ::svxform::OSQLParserClient + ,public ::svx::IControllerFeatureInvalidation +{ + typedef ::std::map < sal_Int32, + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > + > DispatcherContainer; + + friend class FmXPageViewWinRec; + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation> m_xAggregate; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController> m_xTabController; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> m_xActiveControl, m_xCurrentControl; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> m_xModelAsIndex; + ::com::sun::star::uno::Reference< ::com::sun::star::script::XEventAttacherManager> m_xModelAsManager; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xParent; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB; + // Composer used for checking filter conditions + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer > m_xComposer; + ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > m_xInteractionHandler; + + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> > m_aControls; + ::cppu::OInterfaceContainerHelper + m_aActivateListeners, + m_aModifyListeners, + m_aErrorListeners, + m_aDeleteListeners, + m_aRowSetApproveListeners, + m_aParameterListeners; + + FmFormControllers m_aChilds; + FmFilterControls m_aFilterControls; + FmFilterRows m_aFilters; + + Timer m_aTabActivationTimer; + Timer m_aFeatureInvalidationTimer; + + FmFormView* m_pView; + Window* m_pWindow; + ::svxform::ControlBorderManager* + m_pControlBorderManager; + + ::svx::ControllerFeatures m_aControllerFeatures; + DispatcherContainer m_aFeatureDispatchers; + ::std::set< sal_Int32 > m_aInvalidFeatures; // for asynchronous feature invalidation + + ::rtl::OUString m_aMode; + + ::svxform::DelayedEvent m_aLoadEvent; + ::svxform::DelayedEvent m_aToggleEvent; + ::svxform::DelayedEvent m_aActivationEvent; + ::svxform::DelayedEvent m_aDeactivationEvent; + + ::std::auto_ptr< ColumnInfoCache > + m_pColumnInfoCache; + + sal_Int32 m_nCurrentFilterPosition; // current level for filtering (or-criteria) + + sal_Bool m_bCurrentRecordModified : 1; + sal_Bool m_bCurrentRecordNew : 1; + sal_Bool m_bLocked : 1; + sal_Bool m_bDBConnection : 1; // Focuslistener nur fuer Datenbankformulare + sal_Bool m_bCycle : 1; + sal_Bool m_bCanInsert : 1; + sal_Bool m_bCanUpdate : 1; + sal_Bool m_bCommitLock : 1; // lock the committing of controls see focusGained + sal_Bool m_bModified : 1; // ist der Inhalt eines Controls modifiziert ? + sal_Bool m_bControlsSorted : 1; + sal_Bool m_bFiltering : 1; + sal_Bool m_bAttachEvents : 1; + sal_Bool m_bDetachEvents : 1; + sal_Bool m_bAttemptedHandlerCreation : 1; + + // as we want to intercept dispatches of _all_ controls we're responsible for, and an object implementing + // the ::com::sun::star::frame::XDispatchProviderInterceptor interface can intercept only _one_ objects dispatches, we need a helper class + DECLARE_STL_VECTOR(FmXDispatchInterceptorImpl*, Interceptors); + Interceptors m_aControlDispatchInterceptors; + +public: + inline const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& + getInteractionHandler() const + { + const_cast< FmXFormController* >( this )->ensureInteractionHandler(); + return m_xInteractionHandler; + } + +public: + FmXFormController(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & _rxORB, + FmFormView* _pView = NULL, Window* _pWindow = NULL ); + ~FmXFormController(); + +// XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& type) throw ( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + +// XTypeProvider + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + +// XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + SVX_DLLPUBLIC static FmXFormController* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent ); + +// XDispatch + virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& _rURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArgs ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& _rxListener, const ::com::sun::star::util::URL& _rURL ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& _rxListener, const ::com::sun::star::util::URL& _rURL ) throw (::com::sun::star::uno::RuntimeException); + +// ::com::sun::star::container::XChild + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> SAL_CALL getParent(void) throw( ::com::sun::star::uno::RuntimeException ) {return m_xParent;} + virtual void SAL_CALL setParent(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Parent) throw( ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException ) + {m_xParent = Parent;} + +// ::com::sun::star::lang::XEventListener + virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException ); + +// OComponentHelper + virtual void SAL_CALL disposing(); + +// OPropertySetHelper + 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 void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw( ::com::sun::star::uno::Exception ); + virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const; + + 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(); + + using OPropertySetHelper::getFastPropertyValue; + +// XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL hasElements(void) throw( ::com::sun::star::uno::RuntimeException ); + +// ::com::sun::star::container::XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration> SAL_CALL createEnumeration(void) throw( ::com::sun::star::uno::RuntimeException ); + +// ::com::sun::star::container::XContainerListener + virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException ); + +// XLoadListener + virtual void SAL_CALL loaded(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL unloaded(const ::com::sun::star::lang::EventObject& rEvent) 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 ); + +// XModeSelector + virtual void SAL_CALL setMode(const ::rtl::OUString& Mode) throw( ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException ); + virtual ::rtl::OUString SAL_CALL getMode(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedModes(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsMode(const ::rtl::OUString& Mode) throw( ::com::sun::star::uno::RuntimeException ); + +// ::com::sun::star::container::XIndexAccess + virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 Index) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ); + +// XModifyBroadcaster + virtual void SAL_CALL addModifyListener(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener>& l) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeModifyListener(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener>& l) throw( ::com::sun::star::uno::RuntimeException ); + +// XFocusListener + virtual void SAL_CALL focusGained(const ::com::sun::star::awt::FocusEvent& e) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL focusLost(const ::com::sun::star::awt::FocusEvent& e) throw( ::com::sun::star::uno::RuntimeException ); + +// XMouseListener + virtual void SAL_CALL mousePressed( const ::com::sun::star::awt::MouseEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL mouseReleased( const ::com::sun::star::awt::MouseEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL mouseEntered( const ::com::sun::star::awt::MouseEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL mouseExited( const ::com::sun::star::awt::MouseEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException); + +// XFormComponentValidityListener + virtual void SAL_CALL componentValidityChanged( const ::com::sun::star::lang::EventObject& _rSource ) throw (::com::sun::star::uno::RuntimeException); + +// XInteractionHandler + virtual void SAL_CALL handle( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& Request ) throw (::com::sun::star::uno::RuntimeException); + +// XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + +// XGridControlListener + virtual void SAL_CALL columnChanged( const ::com::sun::star::lang::EventObject& _event ) throw (::com::sun::star::uno::RuntimeException); + +// ::com::sun::star::beans::XPropertyChangeListener -> aenderung der stati + virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw( ::com::sun::star::uno::RuntimeException ); + +// XTextListener -> modify setzen + virtual void SAL_CALL textChanged(const ::com::sun::star::awt::TextEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException ); + +// XItemListener -> modify setzen + virtual void SAL_CALL itemStateChanged(const ::com::sun::star::awt::ItemEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException ); + +// XModifyListener -> modify setzen + virtual void SAL_CALL modified(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException ); + +// XFormController + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> SAL_CALL getCurrentControl(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL addActivateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormControllerListener>& l) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeActivateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormControllerListener>& l) throw( ::com::sun::star::uno::RuntimeException ); + +// XTabController + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> > SAL_CALL getControls(void) throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel>& Model) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel> SAL_CALL getModel() throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setContainer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer>& Container) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer> SAL_CALL getContainer() throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL autoTabOrder() throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL activateTabOrder() throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL activateFirst() throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL activateLast() throw( ::com::sun::star::uno::RuntimeException ); + +// com::sun::star::sdbc::XRowSetListener + virtual void SAL_CALL cursorMoved(const ::com::sun::star::lang::EventObject& event) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL rowChanged(const ::com::sun::star::lang::EventObject& event) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL rowSetChanged(const ::com::sun::star::lang::EventObject& event) throw( ::com::sun::star::uno::RuntimeException ); + +// XRowSetApproveListener + virtual sal_Bool SAL_CALL approveCursorMove(const ::com::sun::star::lang::EventObject& event) throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL approveRowChange(const ::com::sun::star::sdb::RowChangeEvent& event) throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL approveRowSetChange(const ::com::sun::star::lang::EventObject& event) throw( ::com::sun::star::uno::RuntimeException ); + +// XRowSetApproveBroadcaster + virtual void SAL_CALL addRowSetApproveListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetApproveListener>& listener) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeRowSetApproveListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetApproveListener>& listener) throw( ::com::sun::star::uno::RuntimeException ); + +// XSQLErrorBroadcaster + virtual void SAL_CALL errorOccured(const ::com::sun::star::sdb::SQLErrorEvent& aEvent) throw( ::com::sun::star::uno::RuntimeException ); + +// XSQLErrorListener + virtual void SAL_CALL addSQLErrorListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLErrorListener>& _rListener) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeSQLErrorListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLErrorListener>& _rListener) throw( ::com::sun::star::uno::RuntimeException ); + +// XDatabaseParameterBroadcaster2 + virtual void SAL_CALL addDatabaseParameterListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener>& aListener) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeDatabaseParameterListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener>& aListener) throw( ::com::sun::star::uno::RuntimeException ); + +// XDatabaseParameterBroadcaster + virtual void SAL_CALL addParameterListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener>& aListener) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeParameterListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener>& aListener) throw( ::com::sun::star::uno::RuntimeException ); + +// XDatabaseParameterListener + virtual sal_Bool SAL_CALL approveParameter(const ::com::sun::star::form::DatabaseParameterEvent& aEvent) throw( ::com::sun::star::uno::RuntimeException ); + +// XConfirmDeleteBroadcaster + virtual void SAL_CALL addConfirmDeleteListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XConfirmDeleteListener>& aListener) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeConfirmDeleteListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XConfirmDeleteListener>& aListener) throw( ::com::sun::star::uno::RuntimeException ); + +// XConfirmDeleteListener + virtual sal_Bool SAL_CALL confirmDelete(const ::com::sun::star::sdb::RowChangeEvent& aEvent) throw( ::com::sun::star::uno::RuntimeException ); + +// XServiceInfo + virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw(::com::sun::star::uno::RuntimeException); + +// XResetListener + virtual sal_Bool SAL_CALL approveReset(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL resetted(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException ); + +// method for registration + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void); + + // comphelper::OPropertyArrayUsageHelper + 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; + +// access to the controls for filtering + const FmFilterControls& getFilterControls() const {return m_aFilterControls;} + +// access to the current filter rows + const FmFilterRows& getFilterRows() const {return m_aFilters;} + FmFilterRows& getFilterRows() {return m_aFilters;} + + // just decr. the positions no notifications for the view + void decrementCurrentFilterPosition() + { + DBG_ASSERT(m_nCurrentFilterPosition, "Invalid Position"); + --m_nCurrentFilterPosition; + } + + SVX_DLLPUBLIC void setCurrentFilterPosition(sal_Int32 nPos); + sal_Int32 getCurrentFilterPosition() const {return m_nCurrentFilterPosition;} + +protected: + // FmDispatchInterceptor + virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch> + interceptedQueryDispatch(sal_uInt16 _nId,const ::com::sun::star::util::URL& aURL, + const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags) + throw( ::com::sun::star::uno::RuntimeException ); + + // IControllerFeatureInvalidation + virtual void invalidateFeatures( const ::std::vector< sal_Int32 >& _rFeatures ); + + virtual ::osl::Mutex* getInterceptorMutex() { return &m_aMutex; } + + /// update all our dispatchers + void updateAllDispatchers() const; + + /** disposes all dispatchers in m_aFeatureDispatchers, empties m_aFeatureDispatchers, + and disposes m_aControllerFeatures + */ + void disposeAllFeaturesAndDispatchers() SAL_THROW(()); + + void startFiltering(); + void stopFiltering(); + void setFilter(::std::vector<FmFieldInfo>&); + void startListening(); + void stopListening(); + + /** ensures that we have an interaction handler, if possible + + If an interaction handler was provided at creation time (<member>initialize</member>), this + one will be used. Else, an attempt is made to create an <type scope="com::sun::star::sdb">InteractionHandler</type> + is made. + + @return <TRUE/> + if and only if <member>m_xInteractionHandler</member> is valid when the method returns + */ + bool ensureInteractionHandler(); + + /** replaces one of our controls with another one + + Upon successful replacing, the old control will be disposed. Also, internal members pointing + to the current or active control will be adjusted. Yet more, if the replaced control was + the active control, the new control will be made active. + + @param _rxExistentControl + The control to replace. Must be one of the controls in our ControlContainer. + @param _rxNewControl + The control which should replace the existent control. + @return + <TRUE/> if and only if the control was successfully replaced + */ + bool replaceControl( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxExistentControl, + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxNewControl + ); + + // we're listening at all bound controls for modifications + void startControlModifyListening(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl); + void stopControlModifyListening(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl); + + void setLocks(); + void setControlLock(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl); + void addToEventAttacher(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl); + void removeFromEventAttacher(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl); + void toggleAutoFields(sal_Bool bAutoFields); + void unload() throw( ::com::sun::star::uno::RuntimeException ); + void removeBoundFieldListener(); + + void startFormListening( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxForm, sal_Bool _bPropertiesOnly ); + void stopFormListening( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxForm, sal_Bool _bPropertiesOnly ); + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> findControl( ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> >& rCtrls, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel>& rxCtrlModel, sal_Bool _bRemove, sal_Bool _bOverWrite ) const; + + void insertControl(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl); + void removeControl(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl); + + /// called when a new control is to be handled by the controller + void implControlInserted( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& _rxControl, bool _bAddToEventAttacher ); + /// called when a control is not to be handled by the controller anymore + void implControlRemoved( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& _rxControl, bool _bRemoveFromEventAttacher ); + + /** sets m_xCurrentControl, plus does administrative tasks depending on it + */ + void implSetCurrentControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl ); + + /** invalidates the FormFeatures which depend on the current control + */ + void implInvalidateCurrentControlDependentFeatures(); + + bool impl_isDisposed_nofail() const { return FmXFormController_BASE::rBHelper.bDisposed; } + + void impl_onModify(); + + sal_Bool isLocked() const {return m_bLocked;} + sal_Bool determineLockState() const; + + Window* getDialogParentWindow(); + // returns m_pWindow or - if m_pWindow is NULL - the window of the currently set container + + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor> createInterceptor(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception>& _xInterception); + // create a new interceptor, register it on the given object + void deleteInterceptor(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception>& _xInterception); + // if createInterceptor was called for the given object the according interceptor will be removed + // from the objects interceptor chain and released + + /** checks all form controls belonging to our form for validity + + If a form control supports the XValidatableFormComponent interface, this is used to determine + the validity of the control. If the interface is not supported, the control is supposed to be + valid. + + @param _rFirstInvalidityExplanation + if the method returns <FALSE/> (i.e. if there is an invalid control), this string contains + the explanation for the invalidity, as obtained from the validator. + + @param _rxFirstInvalidModel + if the method returns <FALSE/> (i.e. if there is an invalid control), this contains + the control model + + @return + <TRUE/> if and only if all controls belonging to our form are valid + */ + bool checkFormComponentValidity( + ::rtl::OUString& /* [out] */ _rFirstInvalidityExplanation, + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& /* [out] */ _rxFirstInvalidModel + ) SAL_THROW(()); + + /** locates the control which belongs to a given model + */ + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > + locateControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxModel ) SAL_THROW(()); + + // set the text for all filters + void impl_setTextOnAllFilter_throw(); + + // in filter mode we do not listen for changes + sal_Bool isListeningForChanges() const {return m_bDBConnection && !m_bFiltering && !isLocked();} + void addChild(FmXFormController* pChild); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> isInList(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& xPeer) const; + + DECL_LINK( OnActivateTabOrder, void* ); + DECL_LINK( OnInvalidateFeatures, void* ); + DECL_LINK( OnLoad, void* ); + DECL_LINK( OnToggleAutoFields, void* ); + DECL_LINK( OnActivated, void* ); + DECL_LINK( OnDeactivated, void* ); +}; + + +#endif // _SVX_FMCTRLER_HXX + diff --git a/svx/source/inc/fmdispatch.hxx b/svx/source/inc/fmdispatch.hxx new file mode 100644 index 000000000000..90480afc4609 --- /dev/null +++ b/svx/source/inc/fmdispatch.hxx @@ -0,0 +1,158 @@ +/************************************************************************* + * + * 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: fmdispatch.hxx,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. + * + ************************************************************************/ + +#ifndef SVX_FMDISPATCH_HXX +#define SVX_FMDISPATCH_HXX + +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/lang/DisposedException.hpp> + + +//........................................................................ +namespace svx +{ +//........................................................................ + + class FormControllerHelper; + + //==================================================================== + //= OSingleFeatureDispatcher + //==================================================================== + typedef ::cppu::WeakImplHelper1 < ::com::sun::star::frame::XDispatch + > OSingleFeatureDispatcher_Base; + + class OSingleFeatureDispatcher : public OSingleFeatureDispatcher_Base + { + private: + ::osl::Mutex& m_rMutex; + ::cppu::OInterfaceContainerHelper m_aStatusListeners; + const FormControllerHelper& m_rController; + const ::com::sun::star::util::URL m_aFeatureURL; + ::com::sun::star::uno::Any m_aLastKnownState; + const sal_Int32 m_nFeatureId; + sal_Bool m_bLastKnownEnabled; + sal_Bool m_bDisposed; + + public: + /** constructs the dispatcher + + @param _rFeatureURL + the URL of the feature which this instance is responsible for + + @param _nFeatureId + the feature which this instance is responsible for + + @param _rController + the controller which is responsible for providing the state of feature of this instance, + and for executing it. After disposing the dispatcher instance, the controller will + not be accessed anymore + + @see dispose + */ + OSingleFeatureDispatcher( + const ::com::sun::star::util::URL& _rFeatureURL, + sal_Int32 _nFeatureId, + const FormControllerHelper& _rController, + ::osl::Mutex& _rMutex + ); + + /** disposes the dispatcher instance + + All status listeners will, after receiving an <member scope="com::sun::star::lang">XEventListener::disposing</member> + call, be released. + + The controller provided in the in constructor will not be used anymore after returning from this call. + + No further requests to dispatch slots will be accepted. + + Multiple calls are allowed: if the object already was disposed, then subsequent calls are + silently ignored. + */ + void dispose(); + + /** notifies all our listeners of the current state + */ + void updateAllListeners(); + + protected: + // XDispatch + virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& _rURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArguments ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& _rxControl, const ::com::sun::star::util::URL& _rURL ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& _rxControl, const ::com::sun::star::util::URL& _rURL ) throw (::com::sun::star::uno::RuntimeException); + + protected: + /** notifies our current state to one or all listeners + + @param _rxListener + the listener to notify. May be NULL, in this case all our listeners will be + notified with the current state + + @param _rFreeForNotification + a guard which currently locks our mutex, and which is to be cleared + for actually doing the notification(s) + */ + void notifyStatus( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& _rxListener, + ::osl::ClearableMutexGuard& _rFreeForNotification + ); + + private: + /** checks whether our instance is alive + + If the instance already received a <member>dispose</member> call, then a + <type scope="com::sun::star::lang">DisposedException</type> is thrown. + + @precond + our Mutex is locked - else calling the method would not make sense, since + it's result could be out-of-date as soon as it's returned to the caller. + */ + void checkAlive() const SAL_THROW((::com::sun::star::lang::DisposedException)); + + /** retrieves the current status of our feature, in a format which can be used + for UNO notifications + + @precond + our mutex is locked + */ + void getUnoState( ::com::sun::star::frame::FeatureStateEvent& /* [out] */ _rState ) const; + + private: + OSingleFeatureDispatcher(); // never implemented + OSingleFeatureDispatcher( const OSingleFeatureDispatcher& ); // never implemented + OSingleFeatureDispatcher& operator=( const OSingleFeatureDispatcher& ); // never implemented + }; + +//........................................................................ +} // namespace svx +//........................................................................ + +#endif diff --git a/svx/source/inc/fmdocumentclassification.hxx b/svx/source/inc/fmdocumentclassification.hxx new file mode 100644 index 000000000000..cad1f1b91295 --- /dev/null +++ b/svx/source/inc/fmdocumentclassification.hxx @@ -0,0 +1,90 @@ +/************************************************************************* + * + * 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: fmdocumentclassification.hxx,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. + * + ************************************************************************/ + +#ifndef SVX_SOURCE_INC_FMDOCUMENTCLASSIFICATION_HXX +#define SVX_SOURCE_INC_FMDOCUMENTCLASSIFICATION_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/frame/XModel.hpp> +/** === end UNO includes === **/ + +//........................................................................ +namespace svxform +{ +//........................................................................ + + //==================================================================== + //= DocumentType + //==================================================================== + enum DocumentType + { + eTextDocument, + eWebDocument, + eSpreadsheetDocument, + eDrawingDocument, + ePresentationDocument, + eEnhancedForm, + eDatabaseForm, + eDatabaseReport, + + eUnknownDocumentType + }; + + //==================================================================== + //= DocumentClassification + //==================================================================== + class DocumentClassification + { + public: + /** classifies a document model + */ + static DocumentType classifyDocument( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxDocumentModel + ) SAL_THROW(()); + + static DocumentType classifyHostDocument( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxFormComponent + ) SAL_THROW(()); + + static DocumentType getDocumentTypeForModuleIdentifier( + const ::rtl::OUString& _rModuleIdentifier + ); + + static ::rtl::OUString getModuleIdentifierForDocumentType( + DocumentType _eType + ); + }; + +//........................................................................ +} // namespace svxform +//........................................................................ + +#endif // SVX_SOURCE_INC_FMDOCUMENTCLASSIFICATION_HXX + diff --git a/svx/source/inc/fmexch.hxx b/svx/source/inc/fmexch.hxx new file mode 100644 index 000000000000..689d02396d23 --- /dev/null +++ b/svx/source/inc/fmexch.hxx @@ -0,0 +1,286 @@ +/************************************************************************* + * + * 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: fmexch.hxx,v $ + * $Revision: 1.14 $ + * + * 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 _SVX_FMEXCH_HXX +#define _SVX_FMEXCH_HXX + +#include <comphelper/stl_types.hxx> +#include <svtools/transfer.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/container/XNameContainer.hpp> +#include <tools/link.hxx> + +#include <svx/svxdllapi.h> + +class FmFormShell; +class FmFormPage; +class SvLBoxEntry; + +//======================================================================== +// Exchange types +#define SVX_FM_FIELD_EXCH String("SvxFormFieldExch", sizeof("SvxFormFieldExch")) +#define SVX_FM_CONTROL_EXCH String("SvxFormExplCtrlExch", sizeof("SvxFormExplCtrlExch")) +#define SVX_FM_CONTROLS_AS_PATH String("SvxFormControlsAsPathExchange", sizeof("SvxFormControlsAsPathExchange")) +#define SVX_FM_HIDDEN_CONTROLS String("SvxFormHiddenControlsExchange", sizeof("SvxFormHiddenControlsExchange")) +#define SVX_FM_FILTER_FIELDS String("SvxFilterFieldExchange", sizeof("SvxFilterFieldExchange")) + +//======================================================================== +class SvTreeListBox; + +//........................................................................ +namespace svxform +{ +//........................................................................ + + //==================================================================== + + typedef ::std::set< SvLBoxEntry* > ListBoxEntrySet; + + //==================================================================== + //= OLocalExchange + //==================================================================== + class SVX_DLLPUBLIC OLocalExchange : public TransferableHelper + { + private: + Link m_aClipboardListener; + sal_Bool m_bDragging : 1; + sal_Bool m_bClipboardOwner : 1; + + public: + class GrantAccess + { + friend class OLocalExchangeHelper; + }; + + public: + OLocalExchange( ); + + sal_Bool isDragging() const { return m_bDragging; } + sal_Bool isClipboardOwner() const { return m_bClipboardOwner; } + + void startDrag( Window* pWindow, sal_Int8 nDragSourceActions, const GrantAccess& ); + void copyToClipboard( Window* _pWindow, const GrantAccess& ); + + void setClipboardListener( const Link& _rListener ) { m_aClipboardListener = _rListener; } + + void clear(); + + static sal_Bool hasFormat( const DataFlavorExVector& _rFormats, sal_uInt32 _nFormatId ); + + protected: + // XClipboardOwner + virtual void SAL_CALL lostOwnership( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& _rxClipboard, const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& _rxTrans ) throw(::com::sun::star::uno::RuntimeException); + + // TransferableHelper + virtual void DragFinished( sal_Int8 nDropAction ); + virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); + + private: + void StartDrag( Window* pWindow, sal_Int8 nDragSourceActions, sal_Int32 nDragPointer = DND_POINTER_NONE, sal_Int32 nDragImage = DND_IMAGE_NONE ) + { // don't allow this base class method to be called from outside + TransferableHelper::StartDrag(pWindow, nDragSourceActions, nDragPointer, nDragImage); + } + }; + + //==================================================================== + //= OLocalExchangeHelper + //==================================================================== + /// a helper for navigator windows (SvTreeListBox'es) which allow DnD within themself + class SVX_DLLPUBLIC OLocalExchangeHelper + { + protected: + Window* m_pDragSource; + OLocalExchange* m_pTransferable; + + public: + OLocalExchangeHelper( Window* _pDragSource ); + virtual ~OLocalExchangeHelper(); + + void prepareDrag( ); + + void startDrag( sal_Int8 nDragSourceActions ); + void copyToClipboard( ) const; + + inline sal_Bool isDragSource() const { return m_pTransferable && m_pTransferable->isDragging(); } + inline sal_Bool isClipboardOwner() const { return m_pTransferable && m_pTransferable->isClipboardOwner(); } + inline sal_Bool isDataExchangeActive( ) const { return isDragSource() || isClipboardOwner(); } + inline void clear() { if ( isDataExchangeActive() ) m_pTransferable->clear(); } + + SVX_DLLPRIVATE void setClipboardListener( const Link& _rListener ) { if ( m_pTransferable ) m_pTransferable->setClipboardListener( _rListener ); } + + protected: + SVX_DLLPRIVATE virtual OLocalExchange* createExchange() const = 0; + + protected: + SVX_DLLPRIVATE void implReset(); + }; + + //==================================================================== + //= OControlTransferData + //==================================================================== + class OControlTransferData + { + private: + typedef ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_uInt32 > > ControlPaths; + + private: + DataFlavorExVector m_aCurrentFormats; + + protected: + ListBoxEntrySet m_aSelectedEntries; + ControlPaths m_aControlPaths; + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > + m_aHiddenControlModels; + + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > + m_xFormsRoot; // the root of the forms collection where the entries we represent reside + // this uniquely identifies the page and the document + + SvLBoxEntry* m_pFocusEntry; + + protected: + // updates m_aCurrentFormats with all formats we currently could supply + void updateFormats( ); + + public: + OControlTransferData( ); + + // ctor to construct the data from an arbitrary Transferable (usually clipboard data) + OControlTransferData( + const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& _rxTransferable + ); + + inline const DataFlavorExVector& GetDataFlavorExVector() const; + + void addSelectedEntry( SvLBoxEntry* _pEntry ); + void setFocusEntry( SvLBoxEntry* _pFocusEntry ); + + /** notifies the data transfer object that a certain entry has been removed from the owning tree + + In case the removed entry is part of the transfer object's selection, the entry is removed from + the selection. + + @param _pEntry + @return the number of entries remaining in the selection. + */ + size_t onEntryRemoved( SvLBoxEntry* _pEntry ); + + void setFormsRoot( + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxFormsRoot + ) { m_xFormsRoot = _rxFormsRoot; } + + void buildPathFormat(SvTreeListBox* pTreeBox, SvLBoxEntry* pRoot); + // baut aus m_aSelectedEntries m_aControlPaths auf + // (es wird davon ausgegangen, dass die Eintraege in m_aSelectedEntries sortiert sind in Bezug auf die Nachbar-Beziehung) + + + void buildListFromPath(SvTreeListBox* pTreeBox, SvLBoxEntry* pRoot); + // der umgekehrte Weg : wirft alles aus m_aSelectedEntries weg und baut es mittels m_aControlPaths neu auf + + void addHiddenControlsFormat(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > seqInterfaces); + // fuegt ein SVX_FML_HIDDEN_CONTROLS-Format hinzu und merk sich dafuer die uebergebenen Interfaces + // (es erfolgt KEINE Ueberpruefung, ob dadurch auch tatsaechlich nur hidden Controls bezeichnet werden, dass muss der + // Aufrufer sicherstellen) + + SvLBoxEntry* focused() const { return m_pFocusEntry; } + const ListBoxEntrySet& selected() const { return m_aSelectedEntries; } + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > + hiddenControls() const { return m_aHiddenControlModels; } + + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > + getFormsRoot() const { return m_xFormsRoot; } + }; + + //==================================================================== + inline const DataFlavorExVector& OControlTransferData::GetDataFlavorExVector() const + { + const_cast< OControlTransferData* >( this )->updateFormats( ); + return m_aCurrentFormats; + } + + //==================================================================== + //= OControlExchange + //==================================================================== + class OControlExchange : public OLocalExchange, public OControlTransferData + { + public: + OControlExchange( ); + + public: + static sal_uInt32 getFieldExchangeFormatId( ); + static sal_uInt32 getControlPathFormatId( ); + static sal_uInt32 getHiddenControlModelsFormatId( ); + + inline static sal_Bool hasFieldExchangeFormat( const DataFlavorExVector& _rFormats ); + inline static sal_Bool hasControlPathFormat( const DataFlavorExVector& _rFormats ); + inline static sal_Bool hasHiddenControlModelsFormat( const DataFlavorExVector& _rFormats ); + + protected: + virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); + virtual void AddSupportedFormats(); + }; + + //==================================================================== + //= OControlExchangeHelper + //==================================================================== + class OControlExchangeHelper : public OLocalExchangeHelper + { + public: + OControlExchangeHelper(Window* _pDragSource) : OLocalExchangeHelper(_pDragSource) { } + + OControlExchange* operator->() const { return static_cast< OControlExchange* >( m_pTransferable ); } + OControlExchange& operator*() const { return *static_cast< OControlExchange* >( m_pTransferable ); } + + protected: + virtual OLocalExchange* createExchange() const; + }; + + //==================================================================== + //==================================================================== + inline sal_Bool OControlExchange::hasFieldExchangeFormat( const DataFlavorExVector& _rFormats ) + { + return hasFormat( _rFormats, getFieldExchangeFormatId() ); + } + + inline sal_Bool OControlExchange::hasControlPathFormat( const DataFlavorExVector& _rFormats ) + { + return hasFormat( _rFormats, getControlPathFormatId() ); + } + + inline sal_Bool OControlExchange::hasHiddenControlModelsFormat( const DataFlavorExVector& _rFormats ) + { + return hasFormat( _rFormats, getHiddenControlModelsFormatId() ); + } + +//........................................................................ +} // namespace svxform +//........................................................................ + +#endif + diff --git a/svx/source/inc/fmexpl.hrc b/svx/source/inc/fmexpl.hrc new file mode 100644 index 000000000000..0c59e9412e86 --- /dev/null +++ b/svx/source/inc/fmexpl.hrc @@ -0,0 +1,43 @@ +/************************************************************************* + * + * 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: fmexpl.hrc,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. + * + ************************************************************************/ + +#ifndef _SVX_FMEXPL_HRC +#define _SVX_FMEXPL_HRC + +#define FT_PATH 1 + +#define GB_PATH 1 + +#define PB_OK 1 +#define PB_CANCEL 2 +#define PB_HELP 3 + +#endif //_SVX_FMEXPL_HRC + diff --git a/svx/source/inc/fmexpl.hxx b/svx/source/inc/fmexpl.hxx new file mode 100644 index 000000000000..df60ba931739 --- /dev/null +++ b/svx/source/inc/fmexpl.hxx @@ -0,0 +1,611 @@ +/************************************************************************* + * + * 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: fmexpl.hxx,v $ + * $Revision: 1.18 $ + * + * 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 _SVX_FMEXPL_HXX +#define _SVX_FMEXPL_HXX + +#include <svtools/lstner.hxx> +#include <svtools/brdcst.hxx> +#include <vcl/window.hxx> +#include <sfx2/childwin.hxx> +#include <svtools/poolitem.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dockwin.hxx> +#include <sfx2/ctrlitem.hxx> +#include <vcl/image.hxx> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/form/XForm.hpp> +#include <com/sun/star/form/XFormComponent.hpp> +#include <com/sun/star/beans/PropertyChangeEvent.hpp> +#include <com/sun/star/container/XContainerListener.hpp> +#include <com/sun/star/container/XContainer.hpp> + +#include <svtools/svtreebx.hxx> + +#include <vcl/dialog.hxx> +#include <vcl/group.hxx> +#include <vcl/button.hxx> +#include <vcl/fixed.hxx> +#include <vcl/edit.hxx> +#include <vcl/dockwin.hxx> +#include <svx/fmview.hxx> + +#include "fmexch.hxx" +#include "fmtools.hxx" + +class SdrObjListIter; +class FmFormShell; +class SdrObject; +class FmFormModel; +class FmFormView; +class SdrMarkList; + +//======================================================================== +class FmEntryData; +class FmNavInsertedHint : public SfxHint +{ + FmEntryData* pEntryData; + sal_uInt32 nPos; + +public: + TYPEINFO(); + FmNavInsertedHint( FmEntryData* pInsertedEntryData, sal_uInt32 nRelPos ); + virtual ~FmNavInsertedHint(); + + FmEntryData* GetEntryData() const { return pEntryData; } + sal_uInt32 GetRelPos() const { return nPos; } +}; + +//======================================================================== +class FmNavModelReplacedHint : public SfxHint +{ + FmEntryData* pEntryData; // die Daten des Eintrages, der ein neues Model bekommen hat + +public: + TYPEINFO(); + FmNavModelReplacedHint( FmEntryData* pAffectedEntryData ); + virtual ~FmNavModelReplacedHint(); + + FmEntryData* GetEntryData() const { return pEntryData; } +}; + +//======================================================================== +class FmNavRemovedHint : public SfxHint +{ + FmEntryData* pEntryData; + +public: + TYPEINFO(); + FmNavRemovedHint( FmEntryData* pInsertedEntryData ); + virtual ~FmNavRemovedHint(); + + FmEntryData* GetEntryData() const { return pEntryData; } +}; + +//======================================================================== +class FmNavNameChangedHint : public SfxHint +{ + FmEntryData* pEntryData; + ::rtl::OUString aNewName; + +public: + TYPEINFO(); + FmNavNameChangedHint( FmEntryData* pData, const ::rtl::OUString& rNewName ); + virtual ~FmNavNameChangedHint(); + + FmEntryData* GetEntryData() const { return pEntryData; } + ::rtl::OUString GetNewName() const { return aNewName; } +}; + +//======================================================================== +class FmNavClearedHint : public SfxHint +{ +public: + TYPEINFO(); + FmNavClearedHint(); + virtual ~FmNavClearedHint(); +}; + +//======================================================================== +class FmNavViewMarksChanged : public SfxHint +{ + FmFormView* pView; +public: + TYPEINFO(); + FmNavViewMarksChanged(FmFormView* pWhichView) { pView = pWhichView; } + virtual ~FmNavViewMarksChanged() {} + + FmFormView* GetAffectedView() { return pView; } +}; + +//======================================================================== +class FmEntryDataList; +class FmEntryData +{ +private: + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xNormalizedIFace; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xProperties; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XChild > m_xChild; + +protected: + Image m_aNormalImage; + Image m_aHCImage; + ::rtl::OUString aText; + + FmEntryDataList* pChildList; + FmEntryData* pParent; + +protected: + void newObject( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxIFace ); + +public: + TYPEINFO(); + + FmEntryData( FmEntryData* pParentData, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rIFace ); + FmEntryData( const FmEntryData& rEntryData ); + virtual ~FmEntryData(); + + void Clear(); + void SetText( const ::rtl::OUString& rText ){ aText = rText; } + void SetParent( FmEntryData* pParentData ){ pParent = pParentData; } + + const Image& GetNormalImage() const { return m_aNormalImage; } + const Image& GetHCImage() const { return m_aHCImage; } + + ::rtl::OUString GetText() const { return aText; } + FmEntryData* GetParent() const { return pParent; } + FmEntryDataList* GetChildList() const { return pChildList; } + + virtual sal_Bool IsEqualWithoutChilds( FmEntryData* pEntryData ); + virtual FmEntryData* Clone() = 0; + + // note that the interface returned is normalized, i.e. querying the given XInterface of the object + // for XInterface must return the interface itself. + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& GetElement() const + { + return m_xNormalizedIFace; + } + + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& GetPropertySet() const + { + return m_xProperties; + } + + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XChild >& GetChildIFace() const + { + return m_xChild; + } +}; + +//======================================================================== +DECLARE_LIST( FmEntryDataBaseList, FmEntryData* ) + +class FmEntryDataList : public FmEntryDataBaseList +{ +public: + FmEntryDataList(); + virtual ~FmEntryDataList(); +}; + +//======================================================================== +// FmNavRequestSelectHint - jemand teilt dem NavigatorTree mit, dass er bestimmte Eintraege selektieren soll + +typedef FmEntryData* FmEntryDataPtr; +SV_DECL_PTRARR_SORT( FmEntryDataArray, FmEntryDataPtr, 16, 16 ) + +class FmNavRequestSelectHint : public SfxHint +{ + FmEntryDataArray m_arredToSelect; + sal_Bool m_bMixedSelection; +public: + TYPEINFO(); + FmNavRequestSelectHint() { } + virtual ~FmNavRequestSelectHint() {} + + void SetMixedSelection(sal_Bool bMixedSelection) { m_bMixedSelection = bMixedSelection; } + sal_Bool IsMixedSelection() { return m_bMixedSelection; } + void AddItem(FmEntryData* pEntry) { m_arredToSelect.Insert(pEntry); } + void ClearItems() { m_arredToSelect.Remove(sal_uInt16(0), m_arredToSelect.Count()); } + FmEntryDataArray& GetItems() { return m_arredToSelect; } +}; + +//======================================================================== +class FmFormData : public FmEntryData +{ + ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > m_xForm; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer > m_xContainer; + +public: + TYPEINFO(); + + FmFormData( + const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm, + const ImageList& _rNormalImages, + const ImageList& _rHCImages, + FmFormData* _pParent = NULL + ); + + FmFormData( const FmFormData& rFormData ); + virtual ~FmFormData(); + + void SetForm( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& xForm ) + { + m_xForm = xForm; + m_xContainer = m_xContainer.query( m_xForm ); + newObject( m_xForm ); + } + + const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& GetFormIface() const { return m_xForm; } + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer >& GetContainer() const { return m_xContainer; } + + virtual sal_Bool IsEqualWithoutChilds( FmEntryData* pEntryData ); + virtual FmEntryData* Clone(); +}; + + +//======================================================================== +class FmControlData : public FmEntryData +{ + ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > m_xFormComponent; + + Image GetImage(const ImageList& ilNavigatorImages) const; + +public: + TYPEINFO(); + + FmControlData( + const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& _rxComponent, + const ImageList& _rNormalImages, + const ImageList& _rHCImages, + FmFormData* _pParent + ); + FmControlData( const FmControlData& rControlData ); + virtual ~FmControlData(); + + const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& GetFormComponent() const { return m_xFormComponent; } + virtual sal_Bool IsEqualWithoutChilds( FmEntryData* pEntryData ); + virtual FmEntryData* Clone(); + + void ModelReplaced( + const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& _rxNew, + const ImageList& _rNormalImages, + const ImageList& _rHCImages + ); +}; + + +//======================================================================== +//............................................................................ +namespace svxform +{ +//............................................................................ + + class NavigatorTreeModel; + //======================================================================== + // class OFormComponentObserver + //======================================================================== + class OFormComponentObserver + :public ::cppu::WeakImplHelper2 < ::com::sun::star::beans::XPropertyChangeListener + , ::com::sun::star::container::XContainerListener + > + { + ::svxform::NavigatorTreeModel* m_pNavModel; + sal_uInt32 m_nLocks; + sal_Bool m_bCanUndo; + + public: + OFormComponentObserver( ::svxform::NavigatorTreeModel* pModel ); + + // XEventListenerListener + virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::beans::XPropertyChangeListener + virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::container::XContainerListener + + virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException); + + void Lock() { m_nLocks++; } + void UnLock() { m_nLocks--; } + sal_Bool IsLocked() const { return m_nLocks != 0; } + sal_Bool CanUndo() const { return m_bCanUndo; } + void ReleaseModel() { m_pNavModel = NULL; } + protected: + void Insert(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xIface, sal_Int32 nIndex); + void Remove( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement ); + }; + + //======================================================================== + //= NavigatorTreeModel + //======================================================================== + class NavigatorTreeModel : public SfxBroadcaster + ,public SfxListener + { + friend class NavigatorTree; + friend class OFormComponentObserver; + + FmEntryDataList* m_pRootList; + FmFormShell* m_pFormShell; + FmFormPage* m_pFormPage; + FmFormModel* m_pFormModel; + OFormComponentObserver* m_pPropChangeList; + + ImageList m_aNormalImages; + ImageList m_aHCImages; + + void UpdateContent( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xForms ); + FmControlData* CreateControlData( ::com::sun::star::form::XFormComponent* pFormComponent ); + + void InsertForm(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& xForm, sal_uInt32 nRelPos); + void RemoveForm(FmFormData* pFormData); + + void InsertFormComponent(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& xComp, sal_uInt32 nRelPos); + void RemoveFormComponent(FmControlData* pControlData); + void InsertSdrObj(const SdrObject* pSdrObj); + void RemoveSdrObj(const SdrObject* pSdrObj); + + void ReplaceFormComponent(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& xOld, const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& xNew); + + void BroadcastMarkedObjects(const SdrMarkList& mlMarked); + // einen RequestSelectHint mit den aktuell markierten Objekten broadcasten + sal_Bool InsertFormComponent(FmNavRequestSelectHint& rHint, SdrObject* pObject); + // ist ein Helper fuer vorherige, managet das Abteigen in SdrObjGroups + // Rueckgabe sal_True, wenn das Objekt eine FormComponent ist (oder rekursiv nur aus solchen besteht) + + public: + NavigatorTreeModel( const ImageList& _rNormalImages, const ImageList& _rHCImages ); + virtual ~NavigatorTreeModel(); + + void FillBranch( FmFormData* pParentData ); + void ClearBranch( FmFormData* pParentData ); + void UpdateContent( FmFormShell* pNewShell ); + + void Insert( FmEntryData* pEntryData, ULONG nRelPos = LIST_APPEND, + sal_Bool bAlterModel = sal_False ); + void Remove( FmEntryData* pEntryData, sal_Bool bAlterModel = sal_False ); + + sal_Bool Rename( FmEntryData* pEntryData, const ::rtl::OUString& rNewText ); + sal_Bool IsNameAlreadyDefined( const ::rtl::OUString& rName, FmFormData* pParentData ); + void Clear(); + sal_Bool CheckEntry( FmEntryData* pEntryData ); + void SetModified( sal_Bool bMod=sal_True ); + + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > GetForms() const; + FmFormShell* GetFormShell() const { return m_pFormShell; } + FmFormPage* GetFormPage() const { return m_pFormPage; } + FmEntryData* FindData( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xElement, FmEntryDataList* pDataList, sal_Bool bRecurs=sal_True ); + FmEntryData* FindData( const ::rtl::OUString& rText, FmFormData* pParentData, sal_Bool bRecurs=sal_True ); + FmEntryDataList* GetRootList() const { return m_pRootList; } + ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > GetFormComponents( FmFormData* pParentFormData ); + SdrObject* GetSdrObj( FmControlData* pControlData ); + SdrObject* Search(SdrObjListIter& rIter, const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& xComp); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + }; + + //======================================================================== + typedef SvLBoxEntry* SvLBoxEntryPtr; + SV_DECL_PTRARR_SORT( SvLBoxEntrySortedArray, SvLBoxEntryPtr, 16, 16 ) + + class NavigatorTree : public SvTreeListBox, public SfxListener + { + enum DROP_ACTION { DA_SCROLLUP, DA_SCROLLDOWN, DA_EXPANDNODE }; + enum SELDATA_ITEMS { SDI_DIRTY, SDI_ALL, SDI_NORMALIZED, SDI_NORMALIZED_FORMARK }; + + // beim Droppen will ich scrollen und Folder aufklappen koennen, dafuer : + AutoTimer m_aDropActionTimer; + Timer m_aSynchronizeTimer; + // die Meta-Daten ueber meine aktuelle Selektion + SvLBoxEntrySortedArray m_arrCurrentSelection; + // the entries which, in the view, are currently marked as "cut" (painted semi-transparent) + ListBoxEntrySet m_aCutEntries; + // die Images, die ich brauche (und an FormDatas und EntryDatas weiterreiche) + ImageList m_aNavigatorImages; + ImageList m_aNavigatorImagesHC; + + ::svxform::OControlExchangeHelper m_aControlExchange; + + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB; + NavigatorTreeModel* m_pNavModel; + SvLBoxEntry* m_pRootEntry; + SvLBoxEntry* m_pEditEntry; + + ULONG nEditEvent; + + SELDATA_ITEMS m_sdiState; + Point m_aTimerTriggered; // die Position, an der der DropTimer angeschaltet wurde + DROP_ACTION m_aDropActionType; + + sal_uInt16 m_nSelectLock; + sal_uInt16 m_nFormsSelected; + sal_uInt16 m_nControlsSelected; + sal_uInt16 m_nHiddenControls; // (die Zahl geht in m_nControlsSelected mit ein) + + unsigned short m_aTimerCounter; + + sal_Bool m_bDragDataDirty : 1; // dito + sal_Bool m_bPrevSelectionMixed : 1; + sal_Bool m_bMarkingObjects : 1; // wenn das sal_True ist, brauche ich auf die RequestSelectHints nicht reagieren + sal_Bool m_bRootSelected : 1; + sal_Bool m_bInitialUpdate : 1; // bin ich das erste Mal im UpdateContent ? + sal_Bool m_bKeyboardCut : 1; + + + void UpdateContent(); + sal_Bool IsDeleteAllowed(); + FmControlData* NewControl( const ::rtl::OUString& rServiceName, SvLBoxEntry* pParentEntry, sal_Bool bEditName = sal_True ); + void NewForm( SvLBoxEntry* pParentEntry ); + SvLBoxEntry* Insert( FmEntryData* pEntryData, ULONG nRelPos=LIST_APPEND ); + void Remove( FmEntryData* pEntryData ); + + + void CollectSelectionData(SELDATA_ITEMS sdiHow); + // sammelt in m_arrCurrentSelection die aktuell selektierten Eintraege, normalisiert die Liste wenn verlangt + // SDI_NORMALIZED bedeutet einfach, dass alle Eintraege, die schon einen selektierten Vorfahren haben, nicht mit gesammelt + // werden. + // SDI_NORMALIZED_FORMARK bedeutet, dass wie bei SDI_NORMALIZED verfahren wird, aber Eintraege, deren direktes Elter nicht + // selektiert ist, aufgenommen werden (unabhaengig vom Status weiterer Vorfahren), desgleichen Formulare, die selektiert sind, + // unabhaengig vom Status irgendwelcher Vorfahren + // Bei beiden Normalized-Modi enthalten die m_nFormsSelected, ... die richtige Anzahl, auch wenn nicht alle dieser Eintraege + // in m_arrCurrentSelection landen. + // SDI_DIRTY ist natuerlich nicht erlaubt als Parameter + + // ein einziges Interface fuer alle selektierten Eintraege zusammensetzen + void ShowSelectionProperties(sal_Bool bForce = sal_False); + // alle selektierten Elemnte loeschen + void DeleteSelection(); + + void SynchronizeSelection(FmEntryDataArray& arredToSelect); + // nach dem Aufruf dieser Methode sind genau die Eintraege selektiert, die in dem Array bezeichnet sind + void SynchronizeSelection(); + // macht das selbe, nimmt die MarkList der ::com::sun::star::sdbcx::View + void SynchronizeMarkList(); + // umgekehrte Richtung von SynchronizeMarkList : markiert in der ::com::sun::star::sdbcx::View alle der aktuellen Selektion entsprechenden Controls + + void CollectObjects(FmFormData* pFormData, sal_Bool bDeep, ::std::set< ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > >& _rObjects); + + // im Select aktualisiere ich normalerweise die Marklist der zugehoerigen ::com::sun::star::sdbcx::View, mit folgenden Funktionen + // kann ich das Locking dieses Verhaltens steuern + void LockSelectionHandling() { ++m_nSelectLock; } + void UnlockSelectionHandling() { --m_nSelectLock; } + sal_Bool IsSelectionHandlingLocked() const { return m_nSelectLock>0; } + + sal_Bool IsHiddenControl(FmEntryData* pEntryData); + + DECL_LINK( OnEdit, void* ); + DECL_LINK( OnDropActionTimer, void* ); + + DECL_LINK(OnEntrySelDesel, NavigatorTree*); + DECL_LINK(OnSynchronizeTimer, void*); + + DECL_LINK( OnClipboardAction, void* ); + + protected: + virtual void Command( const CommandEvent& rEvt ); + + virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); + virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); + virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ); + + public: + NavigatorTree(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB, Window* pParent ); + virtual ~NavigatorTree(); + + void Clear(); + void UpdateContent( FmFormShell* pFormShell ); + void MarkViewObj( FmFormData* pFormData, sal_Bool bMark, sal_Bool bDeep = sal_False ); + void MarkViewObj( FmControlData* pControlData, sal_Bool bMarkHandles, sal_Bool bMark ); + void UnmarkAllViewObj(); + + sal_Bool IsFormEntry( SvLBoxEntry* pEntry ); + sal_Bool IsFormComponentEntry( SvLBoxEntry* pEntry ); + + ::rtl::OUString GenerateName( FmEntryData* pEntryData ); + + NavigatorTreeModel* GetNavModel() const { return m_pNavModel; } + SvLBoxEntry* FindEntry( FmEntryData* pEntryData ); + + virtual sal_Bool EditedEntry( SvLBoxEntry* pEntry, const XubString& rNewText ); + virtual sal_Bool Select( SvLBoxEntry* pEntry, sal_Bool bSelect=sal_True ); + virtual sal_Bool EditingEntry( SvLBoxEntry* pEntry, Selection& ); + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + virtual void KeyInput( const KeyEvent& rKEvt ); + + virtual void ModelHasRemoved( SvListEntry* _pEntry ); + + using SvTreeListBox::Insert; + using SvTreeListBox::ExecuteDrop; + using SvTreeListBox::Select; + using SvTreeListBox::Notify; + + private: + sal_Int8 implAcceptDataTransfer( const DataFlavorExVector& _rFlavors, sal_Int8 _nAction, const Point& _rDropPos, sal_Bool _bDnD ); + sal_Int8 implAcceptDataTransfer( const DataFlavorExVector& _rFlavors, sal_Int8 _nAction, SvLBoxEntry* _pTargetEntry, sal_Bool _bDnD ); + + sal_Int8 implExecuteDataTransfer( const OControlTransferData& _rData, sal_Int8 _nAction, const Point& _rDropPos, sal_Bool _bDnD ); + sal_Int8 implExecuteDataTransfer( const OControlTransferData& _rData, sal_Int8 _nAction, SvLBoxEntry* _pTargetEntry, sal_Bool _bDnD ); + + // check if a cut, copy, or drag operation can be started in the current situation + sal_Bool implAllowExchange( sal_Int8 _nAction, sal_Bool* _pHasNonHidden = NULL ); + // check if a paste with the current clipboard content can be accepted + sal_Bool implAcceptPaste( ); + + // fills m_aControlExchange in preparation of a DnD or clipboard operation + sal_Bool implPrepareExchange( sal_Int8 _nAction ); + + void doPaste(); + void doCopy(); + void doCut(); + + sal_Bool doingKeyboardCut( ) const { return m_bKeyboardCut; } + }; + + //======================================================================== + class NavigatorFrame : public SfxDockingWindow, public SfxControllerItem + { + private: + ::svxform::NavigatorTree* m_pNavigatorTree; + + protected: + virtual void Resize(); + virtual sal_Bool Close(); + virtual void GetFocus(); + virtual Size CalcDockingSize( SfxChildAlignment ); + virtual SfxChildAlignment CheckAlignment( SfxChildAlignment, SfxChildAlignment ); + + using SfxDockingWindow::StateChanged; + + public: + NavigatorFrame( SfxBindings *pBindings, SfxChildWindow *pMgr, + Window* pParent ); + virtual ~NavigatorFrame(); + + void UpdateContent( FmFormShell* pFormShell ); + void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); + void FillInfo( SfxChildWinInfo& rInfo ) const; + }; + + //======================================================================== + class SVX_DLLPUBLIC NavigatorFrameManager : public SfxChildWindow + { + public: + SVX_DLLPRIVATE NavigatorFrameManager( Window *pParent, sal_uInt16 nId, SfxBindings *pBindings, + SfxChildWinInfo *pInfo ); + SFX_DECL_CHILDWINDOW( NavigatorFrameManager ); + }; + +//............................................................................ +} // namespace svxform +//............................................................................ + +#endif // _SVX_FMEXPL_HXX + diff --git a/svx/source/inc/fmgroup.hxx b/svx/source/inc/fmgroup.hxx new file mode 100644 index 000000000000..c51c8856a554 --- /dev/null +++ b/svx/source/inc/fmgroup.hxx @@ -0,0 +1,123 @@ +/************************************************************************* + * + * 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: fmgroup.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 _SVX_FMGROUP_HXX +#define _SVX_FMGROUP_HXX + +#ifndef _SVX_FMCPONT_HXX +#include "fmcpont.hxx" +#endif + +#ifndef __DBFORM_HXX +#include <dbform.hxx> +#endif + +DECLARE_LIST( FmCtrlModelList, XInterface* ); + +struct FmXGroupModel_Impl; + +//================================================================== +// FmXGroupModel +//================================================================== +class FmXGroupModel : public XBoundControl, + public XLoadListener, + public XPropertyChangeListener, + public XGroup, + public FmXControlModel +{ + FmFormControlMap aControlMap; + + friend Reflection* FmXGroupModel_getReflection(); + FmXGroupModel_Impl* pGroupModelData; // Properties + +public: + FmXGroupModel(); + virtual ~FmXGroupModel(); + + // UNO Anbindung + SMART_UNO_DECLARATION( FmXGroupModel, FmXControlModel ); + virtual XInterface* queryInterface(UsrUik); + virtual XIdlClassRef getIdlClass(); + + // XGroup + virtual INT32 getFormControlCount(); + virtual XFormControlRef getFormControlByName( const XubString& sName ) const; + virtual XFormControlRef getFormControlByIndex( INT32 Index ) const; + virtual void appendFormControl( const XFormControlRef& FormControl ); + virtual XFormControlRef removeFormControl( const XFormControlRef& FormControl ); + + // XFormControl + virtual void setParent( const XFormRef& Parent ); + + // XEventListener + virtual void disposing( const EventObject& Source ); + + // XPropertiesChangeListener + virtual void propertyChange( const PropertyChangeEvent& evt ); + + // XLoadListener + virtual void loaded( const EventObject& rEvent ); + virtual void unloaded( const EventObject& rEvent ); + + // XBoundControl + virtual void addBoundControlListener( const XBoundControlListenerRef& l ); + virtual void removeBoundControlListener( const XBoundControlListenerRef& l ); + + // XPersistObject + virtual XubString getServiceName( void ) const; + virtual void write( const XObjectOutputStreamRef& OutStream ); + virtual void read( const XObjectInputStreamRef& InStream ); + + // PropertySetInterface + virtual FmXPropertySetInfo* createPropertySetInfo() const; + virtual BOOL setPropertyValue( UINT16 nId, const XubString& aPropertyName, + const UsrAny& aValue, + PropertyChangeEventSequence* pSeq, + INT32 nIndex ); + virtual UsrAny getPropertyValue( UINT16 nId, const XubString& aPropertyName ) const; + virtual void addPropertyChangeListener( const XubString& aPropertyName, const XPropertyChangeListenerRef& aListener ); + virtual void removePropertyChangeListener( const XubString& aPropertyName, const XPropertyChangeListenerRef& aListener ); +}; + +//================================================================== +// FmXGroupModelInfo +// Properties: +//================================================================== +class FmXGroupModelInfo : public FmXControlModelInfo +{ + friend class FmXGroupModel; + +protected: + FmXGroupModelInfo( const FmXGroupModel* pCp ); + virtual void fillProperties( UINT32& nIndex, PropertySequence& aSeq ) const; +}; + + +#endif // _SVX_FMGROUP_HXX + diff --git a/svx/source/inc/fmhlpids.hrc b/svx/source/inc/fmhlpids.hrc new file mode 100644 index 000000000000..3528dfc72daa --- /dev/null +++ b/svx/source/inc/fmhlpids.hrc @@ -0,0 +1,39 @@ +/************************************************************************* + * + * 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: fmhlpids.hrc,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 _SVX_FMHLPIDS_HRC +#define _SVX_FMHLPIDS_HRC + +// include ----------------------------------------------------------- +#ifndef _SVX_FMHELP_HRC +#include "fmhelp.hrc" +#endif + +#endif + diff --git a/svx/source/inc/fmitems.hxx b/svx/source/inc/fmitems.hxx new file mode 100644 index 000000000000..30bdefaf1c58 --- /dev/null +++ b/svx/source/inc/fmitems.hxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * 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: fmitems.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 _SVX_FMITEMS_HXX +#define _SVX_FMITEMS_HXX + + +#include <svtools/poolitem.hxx> +#include <comphelper/uno3.hxx> +// FORWARD_DECLARE_INTERFACE(awt,XControlContainer) +FORWARD_DECLARE_INTERFACE(uno,Any) +// class ::com::sun::star::uno::Any; + +//================================================================== +class FmInterfaceItem : public SfxPoolItem +{ + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xInterface; + +public: + TYPEINFO(); + + FmInterfaceItem( const sal_uInt16 nId, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxInterface ) + :SfxPoolItem( nId ) + ,xInterface( rxInterface ) + {} + + inline FmInterfaceItem& operator=( const FmInterfaceItem &rCpy ); + + // "pure virtual Methoden" vom SfxPoolItem + virtual int operator==( const SfxPoolItem& ) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; + + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > GetInterface() const { return xInterface; } +}; + +inline FmInterfaceItem& FmInterfaceItem::operator=( const FmInterfaceItem &rCpy ) +{ + xInterface = rCpy.xInterface; + + return *this; +} + + + +#endif // _SVX_FMITEMS_HXX + diff --git a/svx/source/inc/fmobj.hxx b/svx/source/inc/fmobj.hxx new file mode 100644 index 000000000000..25f792ed7417 --- /dev/null +++ b/svx/source/inc/fmobj.hxx @@ -0,0 +1,137 @@ +/************************************************************************* + * + * 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: fmobj.hxx,v $ + * $Revision: 1.11 $ + * + * 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 _SVX_FMOBJ_HXX +#define _SVX_FMOBJ_HXX + +#include <svx/svdouno.hxx> +#include <com/sun/star/script/ScriptEventDescriptor.hpp> +#include <com/sun/star/container/XIndexContainer.hpp> + +class FmFormView; + +//================================================================== +// FmFormObj +//================================================================== +class FmXForms; +class FmFormObj: public SdrUnoObj +{ + ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor > aEvts; // events des Objects + ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor> m_aEventsHistory; + // valid if and only if m_pEnvironmentHistory != NULL, this are the events which we're set when + // m_pEnvironmentHistory was created + + FmFormView* m_pControlCreationView; + ULONG m_nControlCreationEvent; + + // Informationen fuer die Controlumgebung + // werden nur vorgehalten, wenn ein Object sich nicht in einer Objectliste befindet + ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer> m_xParent; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > m_xEnvironmentHistory; + sal_Int32 m_nPos; + sal_Int32 m_nType; + + OutputDevice* m_pLastKnownRefDevice; + // the last ref device we know, as set at the model + // only to be used for comparison with the current ref device! + +public: + SVX_DLLPUBLIC FmFormObj(const ::rtl::OUString& rModelName,sal_Int32 _nType); + SVX_DLLPUBLIC FmFormObj(sal_Int32 _nType); + + TYPEINFO(); + + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer>& + GetOriginalParent() const { return m_xParent; } + const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& + GetOriginalEvents() const { return aEvts; } + sal_Int32 + GetOriginalIndex() const { return m_nPos; } + + void SetObjEnv( + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer>& xForm, + const sal_Int32 nIdx, + const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& rEvts ); + void ClearObjEnv(); + +public: + virtual ~FmFormObj(); + virtual void SetPage(SdrPage* pNewPage); + + virtual sal_uInt32 GetObjInventor() const; + virtual sal_uInt16 GetObjIdentifier() const; + virtual void NbcReformatText(); + + virtual SdrObject* Clone() const; + // #116235# virtual SdrObject* Clone(SdrPage* pPage, SdrModel* pModel) const; + virtual void operator= (const SdrObject& rObj); + + virtual void SetModel(SdrModel* pNewModel); + + virtual void clonedFrom(const FmFormObj* _pSource); + + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> ensureModelEnv(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rSourceContainer, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer> _rTopLevelDestContainer); + + /** returns the FmFormObj behind the given SdrObject + + In case the SdrObject *is* an FmFormObject, this is a simple cast. In case the SdrObject + is a virtual object whose referenced object is an FmFormObj, then this referenced + object is returned. In all other cases, NULL is returned. + */ + static FmFormObj* GetFormObject( SdrObject* _pSdrObject ); + static const FmFormObj* GetFormObject( const SdrObject* _pSdrObject ); + + /** returns the type of this form object. See fmglob.hxx + */ + sal_Int32 getType() const; + + virtual void SetUnoControlModel( const ::com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >& _rxModel ); + +protected: + virtual FASTBOOL EndCreate( SdrDragStat& rStat, SdrCreateCmd eCmd ); + virtual void BrkCreate( SdrDragStat& rStat ); + + // #i70852# overload Layer interface to force to FormColtrol layer + virtual SdrLayerID GetLayer() const; + virtual void NbcSetLayer(SdrLayerID nLayer); + +private: + /** isolates the control model from its form component hierarchy, i.e. removes it from + its parent. + */ + void impl_isolateControlModel_nothrow(); + + /** forwards the reference device of our SdrModel to the control model + */ + void impl_checkRefDevice_nothrow( bool _force = false ); +}; + + +#endif // _FM_FMOBJ_HXX + diff --git a/svx/source/inc/fmpgeimp.hxx b/svx/source/inc/fmpgeimp.hxx new file mode 100644 index 000000000000..880ecb21d7e5 --- /dev/null +++ b/svx/source/inc/fmpgeimp.hxx @@ -0,0 +1,173 @@ +/************************************************************************* + * + * 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: fmpgeimp.hxx,v $ + * $Revision: 1.19 $ + * + * 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 _SVX_FMUNOPGE_HXX +#define _SVX_FMUNOPGE_HXX + +#include <com/sun/star/sdbc/XDataSource.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/form/XFormComponent.hpp> +#include <com/sun/star/form/XForm.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/container/XMap.hpp> + +#include <tools/list.hxx> +#include <tools/link.hxx> +#include <comphelper/uno3.hxx> +#include <cppuhelper/weakref.hxx> + +#include "svx/svxdllapi.h" +#include <map> + +class SvStream; +class FmFormObj; +class FmFormPage; +class SdrObject; + +//FORWARD_DECLARE_INTERFACE(uno,Reference) +FORWARD_DECLARE_INTERFACE(io,XObjectOutputStream) +FORWARD_DECLARE_INTERFACE(io,XObjectInputStream) +FORWARD_DECLARE_INTERFACE(container,XIndexContainer) + +class SdrObjList; + +//================================================================== +// FmFormPageImpl +// lauscht an allen Containern, um festzustellen, wann Objecte +// eingefuegt worden sind und wann diese entfernt wurden +//================================================================== + +class SVX_DLLPRIVATE FmFormPageImpl +{ + ::std::map< ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >,SdrObject* > m_aComponentMap; + ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > xCurrentForm; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xForms; + ::com::sun::star::uno::WeakReference< ::com::sun::star::container::XMap > m_aControlShapeMap; + + FmFormPage& m_rPage; + Link m_aFormsCreationHdl; + + sal_Bool m_bFirstActivation; + bool m_bAttemptedFormCreation; + bool m_bInFind; + +protected: + void Init(); + +public: + FmFormPageImpl( FmFormPage& _rPage ); + FmFormPageImpl( FmFormPage& _rPage, const FmFormPageImpl& rImpl ); + ~FmFormPageImpl(); + + // nur wichtig fuer den DesignMode + void setCurForm(::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> xForm); + ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> getDefaultForm(); + + /** finds a place in the form component hierarchy where to insert the given component + + Note that no actual insertion happens, this is the responsibility of the caller (as + the caller might decide on a suitable place where in the returned container the insertion + should happen). + */ + ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> findPlaceInFormComponentHierarchy( + const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent>& rContent, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>& rDatabase = ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>(), + const ::rtl::OUString& rDBTitle = ::rtl::OUString(), + const ::rtl::OUString& rCursorSource = ::rtl::OUString(), + sal_Int32 nCommandType = 0 + ); + + // activation handling + inline sal_Bool hasEverBeenActivated( ) const { return !m_bFirstActivation; } + inline void setHasBeenActivated( ) { m_bFirstActivation = sal_False; } + + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& getForms( bool _bForceCreate = true ); + + void SetFormsCreationHdl( const Link& _rFormsCreationHdl ) { m_aFormsCreationHdl = _rFormsCreationHdl; } + const Link& GetFormsCreationHdl() const { return m_aFormsCreationHdl; } + +protected: + /** finds a form with a given data source signature + @param rForm + the form to start the search with. This form, including all possible sub forms, + will be examined + @param rDatabase + the data source which to which the found form must be bound + @param rCommand + the desired Command property value of the sought-after form + @param nCommandType + the desired CommandType property value of the sought-after form + */ + ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> findFormForDataSource( + const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>& rForm, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>& rDatabase, + const ::rtl::OUString& rCommand, + sal_Int32 nCommandType + ); + +public: + ::rtl::OUString setUniqueName(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent>& xFormComponent, const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>& xControls); + + void formObjectInserted( const FmFormObj& _object ); + void formObjectRemoved( const FmFormObj& _object ); + + /** returns an object mapping from control models to drawing shapes. + */ + SVX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::container::XMap > getControlToShapeMap(); + +private: + /** validates whether <member>xCurrentForm</member> is still valid and to be used + + There are situations where our current form becomes invalid, without us noticing this. Thus, + every method which accesses <member>xCurrentForm</member> should beforehand validate the current + form by calling this method. + + If <member>xCurrentForm</member> is not valid anymore, it is reset to <NULL/>. + + @return + <TRUE/> if and only if xCurrentForm is valid. + + @since #i40086# + */ + bool validateCurForm(); + + ::com::sun::star::uno::Reference< ::com::sun::star::container::XMap > + impl_createControlShapeMap_nothrow(); + +private: + FmFormPageImpl(); // never implemented + FmFormPageImpl( const FmFormPageImpl& ); // never implemented + FmFormPageImpl& operator=( const FmFormPageImpl& ); // never implemented +}; + + +#endif // _SVX_FMUNOPGE_HXX + diff --git a/svx/source/inc/fmprop.hrc b/svx/source/inc/fmprop.hrc new file mode 100644 index 000000000000..34d88b325731 --- /dev/null +++ b/svx/source/inc/fmprop.hrc @@ -0,0 +1,181 @@ +/************************************************************************* + * + * 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: fmprop.hrc,v $ + * $Revision: 1.15 $ + * + * 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 _SVX_FMPROP_HRC +#define _SVX_FMPROP_HRC + +// PropertyId's, welche eine Zuordnung zu einen PropertyName haben, das koennten +// auch in Zukunft WhichIds sein -> Itemset +#define FM_ATTR_START 0 + +#define FM_ATTR_FILTER ( FM_ATTR_START + 1 ) +#define FM_ATTR_FORM_OPERATIONS ( FM_ATTR_START + 2 ) + +#define FM_PROP_NAME rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ) +#define FM_PROP_CLASSID rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ClassId" ) ) +#define FM_PROP_ALIGN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Align" ) ) +#define FM_PROP_ROWCOUNT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RowCount" ) ) +#define FM_PROP_ROWCOUNTFINAL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsRowCountFinal" ) ) +#define FM_PROP_FETCHSIZE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FetchSize" ) ) +#define FM_PROP_VALUE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Value" ) ) +#define FM_PROP_VALUEMIN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ValueMin" ) ) +#define FM_PROP_VALUEMAX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ValueMax" ) ) +#define FM_PROP_VALUESTEP rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ValueStep" ) ) +#define FM_PROP_TEXT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) ) +#define FM_PROP_LABEL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Label" ) ) +#define FM_PROP_NAVIGATION rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NavigationBarMode" ) ) +#define FM_PROP_CYCLE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cycle" ) ) +#define FM_PROP_CONTROLSOURCE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DataField" ) ) +#define FM_PROP_ENABLED rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" ) ) +#define FM_PROP_SPIN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Spin" ) ) +#define FM_PROP_READONLY rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ReadOnly" ) ) +#define FM_PROP_FILTER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Filter" ) ) +#define FM_PROP_AUTOINCREMENT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsAutoIncrement" ) ) +#define FM_PROP_WIDTH rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) +#define FM_PROP_SEARCHABLE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsSearchable" ) ) +#define FM_PROP_MULTILINE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiLine" ) ) +#define FM_PROP_TARGET_URL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetURL" ) ) +#define FM_PROP_DEFAULTCONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultControl" ) ) +#define FM_PROP_MAXTEXTLEN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxTextLen" ) ) +#define FM_PROP_DATE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Date" ) ) +#define FM_PROP_TIME rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Time" ) ) +#define FM_PROP_STATE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "State" ) ) +#define FM_PROP_TRISTATE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TriState" ) ) +#define FM_PROP_STRINGITEMLIST rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StringItemList" ) ) +#define FM_PROP_DEFAULT_TEXT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultText" ) ) +#define FM_PROP_DEFAULTCHECKED rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultState" ) ) +#define FM_PROP_DEFAULT_DATE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultDate" ) ) +#define FM_PROP_DEFAULT_TIME rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultTime" ) ) +#define FM_PROP_DEFAULT_VALUE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultValue" ) ) +#define FM_PROP_FORMATKEY rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FormatKey" ) ) +#define FM_PROP_FORMATSSUPPLIER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FormatsSupplier" ) ) +#define FM_PROP_LISTSOURCETYPE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ListSourceType" ) ) +#define FM_PROP_LISTSOURCE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ListSource" ) ) +#define FM_PROP_SELECT_SEQ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectedItems" ) ) +#define FM_PROP_VALUE_SEQ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ValueItemList" ) ) +#define FM_PROP_DEFAULT_SELECT_SEQ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultSelection" ) ) +#define FM_PROP_DECIMAL_ACCURACY rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DecimalAccuracy" ) ) +#define FM_PROP_EDITMASK rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EditMask" ) ) +#define FM_PROP_ISREADONLY rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) ) +#define FM_PROP_FIELDTYPE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Type" ) ) +#define FM_PROP_REFVALUE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RefValue" ) ) +#define FM_PROP_STRICTFORMAT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StrictFormat" ) ) +#define FM_PROP_DATASOURCE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DataSourceName" ) ) +#define FM_PROP_LITERALMASK rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LiteralMask" ) ) +#define FM_PROP_SHOWTHOUSANDSEP rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ShowThousandsSeparator" ) ) +#define FM_PROP_CURRENCYSYMBOL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CurrencySymbol" ) ) +#define FM_PROP_DATEFORMAT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateFormat" ) ) +#define FM_PROP_DATEMIN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateMin" ) ) +#define FM_PROP_DATEMAX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateMax" ) ) +#define FM_PROP_DATE_SHOW_CENTURY rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateShowCentury" ) ) +#define FM_PROP_TIMEFORMAT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TimeFormat" ) ) +#define FM_PROP_TIMEMIN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TimeMin" ) ) +#define FM_PROP_TIMEMAX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TimeMax" ) ) +#define FM_PROP_LINECOUNT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LineCount" ) ) +#define FM_PROP_BOUNDCOLUMN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BoundColumn" ) ) +#define FM_PROP_HASNAVIGATION rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HasNavigationBar" ) ) +#define FM_PROP_FONT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontDescriptor" ) ) +#define FM_PROP_BACKGROUNDCOLOR rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BackgroundColor" ) ) +#define FM_PROP_TEXTCOLOR rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextColor" ) ) +#define FM_PROP_BORDER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Border" ) ) +#define FM_PROP_DROPDOWN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Dropdown" ) ) +#define FM_PROP_ROWHEIGHT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RowHeight" ) ) +#define FM_PROP_HELPTEXT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpText" ) ) +#define FM_PROP_HELPURL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpURL" ) ) +#define FM_PROP_RECORDMARKER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HasRecordMarker" ) ) +#define FM_PROP_BOUNDFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BoundField" ) ) +#define FM_PROP_EFFECTIVE_VALUE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EffectiveValue" ) ) +#define FM_PROP_EFFECTIVE_DEFAULT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EffectiveDefault" ) ) +#define FM_PROP_EFFECTIVE_MIN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EffectiveMin" ) ) +#define FM_PROP_EFFECTIVE_MAX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EffectiveMax" ) ) +#define FM_PROP_HIDDEN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Hidden" ) ) +#define FM_PROP_FILTERPROPOSAL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseFilterValueProposal" ) ) +#define FM_PROP_FIELDSOURCE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FieldSource" ) ) +#define FM_PROP_TABLENAME rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TableName" ) ) +#define FM_PROP_FILTERSUPPLIER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterSupplier" ) ) +#define FM_PROP_CURRENTFILTER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CurrentFilter" ) ) +#define FM_PROP_SELECTED_FIELDS rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectedFields" ) ) +#define FM_PROP_SELECTED_TABLES rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectedTables" ) ) +#define FM_PROP_THREADSAFE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ThreadSafe" ) ) +#define FM_PROP_CONTROLLABEL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LabelControl" ) ) +#define FM_PROP_CURSORCOLOR rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CursorColor" ) ) +#define FM_PROP_ALWAYSSHOWCURSOR rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AlwaysShowCursor" ) ) +#define FM_PROP_DISPLAYSYNCHRON rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisplayIsSynchron" ) ) +#define FM_PROP_ISMODIFIED rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsModified" ) ) +#define FM_PROP_ISNEW rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsNew" ) ) +#define FM_PROP_PRIVILEGES rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Privileges" ) ) +#define FM_PROP_COMMAND rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Command" ) ) +#define FM_PROP_COMMANDTYPE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CommandType" ) ) +#define FM_PROP_RESULTSET_CONCURRENCY rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResultSetConcurrency" ) ) +#define FM_PROP_INSERTONLY rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IgnoreResult" ) ) +#define FM_PROP_RESULTSET_TYPE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResultSetType" ) ) +#define FM_PROP_ESCAPE_PROCESSING rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EscapeProcessing" ) ) +#define FM_PROP_APPLYFILTER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ApplyFilter" ) ) +#define FM_PROP_ISNULLABLE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsNullable" ) ) +#define FM_PROP_ACTIVECOMMAND rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ActiveCommand" ) ) +#define FM_PROP_ISCURRENCY rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsCurrency" ) ) +#define FM_PROP_URL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ) +#define FM_PROP_ACTIVE_CONNECTION rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ActiveConnection" ) ) +#define FM_PROP_SORT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Order" ) ) +#define FM_PROP_CONTROLSOURCEPROPERTY rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DataFieldProperty" ) ) +#define FM_PROP_REALNAME rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RealName" ) ) +#define FM_PROP_TEXTLINECOLOR rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextLineColor" ) ) +#define FM_PROP_FONTEMPHASISMARK rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontEmphasisMark" ) ) +#define FM_PROP_FONTRELIEF rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontRelief" ) ) +#define FM_PROP_SCROLLVALUE_MIN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ScrollValueMin" ) ) +#define FM_PROP_SCROLLVALUE_MAX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ScrollValueMax" ) ) +#define FM_PROP_DEFAULT_SCROLLVALUE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultScrollValue" ) ) +#define FM_PROP_LINEINCREMENT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LineIncrement" ) ) +#define FM_PROP_BLOCKINCREMENT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BlockIncrement" ) ) +#define FM_PROP_ORIENTATION rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Orientation" ) ) +#define FM_PROP_REPEAT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Repeat" ) ) +#define FM_PROP_REPEATDELAY rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RepeatDelay" ) ) +#define FM_PROP_SYMBOLCOLOR rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SymbolColor" ) ) +#define FM_PROP_VISIBILESIZE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VisibleSize" ) ) +#define FM_PROP_SPINVALUE_MIN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SpinValueMin" ) ) +#define FM_PROP_SPINVALUE_MAX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SpinValueMax" ) ) +#define FM_PROP_DEFAULT_SPINVALUE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultSpinValue" ) ) +#define FM_PROP_SPININCREMENT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SpinIncrement" ) ) +#define FM_PROP_LINEENDFORMAT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LineEndFormat" ) ) +#define FM_PROP_TOGGLE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Toggle" ) ) +#define FM_PROP_FOCUSONCLICK rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FocusOnClick" ) ) +#define FM_PROP_HIDEINACTIVESELECTION rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HideInactiveSelection" ) ) +#define FM_PROP_VISUALEFFECT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VisualEffect" ) ) +#define FM_PROP_BORDERCOLOR rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BorderColor" ) ) +#define FM_PROP_DYNAMIC_CONTROL_BORDER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DynamicControlBorder" ) ) +#define FM_PROP_CONTROL_BORDER_COLOR_FOCUS rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlBorderColorOnFocus" ) ) +#define FM_PROP_CONTROL_BORDER_COLOR_MOUSE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlBorderColorOnHover" ) ) +#define FM_PROP_CONTROL_BORDER_COLOR_INVALID rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlBorderColorOnInvalid" ) ) +#define FM_PROP_BUTTON_TYPE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ButtonType" ) ) +#define FM_PROP_FORM_OPERATIONS rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FormOperations" ) ) +#define FM_PROP_INPUT_REQUIRED rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InputRequired" ) ) +#define FM_PROP_WRITING_MODE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "WritingMode" ) ) +#define FM_PROP_MOUSE_WHEEL_BEHAVIOR rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MouseWheelBehavior" ) ) + +#endif // _SVX_FMPROP_HRC diff --git a/svx/source/inc/fmresids.hrc b/svx/source/inc/fmresids.hrc new file mode 100644 index 000000000000..95a478fc5aee --- /dev/null +++ b/svx/source/inc/fmresids.hrc @@ -0,0 +1,281 @@ +/************************************************************************* + * + * 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: fmresids.hrc,v $ + * $Revision: 1.29 $ + * + * 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 _SVX_FMRESIDS_HRC +#define _SVX_FMRESIDS_HRC + +// include ----------------------------------------------------------- +#include <svtools/solar.hrc> + +// unnamed ressources ------------------------------------------------------- +// sub ressources ..................... + +// ImageList-Id's ----------------------------------------------------------- +#define RID_SVXIMGLIST_FMEXPL (RID_FORMS_START + 0) +#define RID_SVXIMGLIST_FMEXPL_HC (RID_FORMS_START + 2) + +// Image-Id's ----------------------------------------------------------- +//#define SID_FMSLOTS_START (SID_SVX_START + 592) -> svxids.hrc +#define RID_SVXIMG_FORM SID_FM_CONFIG +#define RID_SVXIMG_CONTROL SID_CHOOSE_CONTROLS +#define RID_SVXIMG_COLLAPSEDNODE (RID_FORMS_START + 2) +#define RID_SVXIMG_EXPANDEDNODE (RID_FORMS_START + 3) +#define RID_SVXIMG_BUTTON SID_FM_PUSHBUTTON +#define RID_SVXIMG_RADIOBUTTON SID_FM_RADIOBUTTON +#define RID_SVXIMG_CHECKBOX SID_FM_CHECKBOX +#define RID_SVXIMG_FIXEDTEXT SID_FM_FIXEDTEXT +#define RID_SVXIMG_GROUPBOX SID_FM_GROUPBOX +#define RID_SVXIMG_EDIT SID_FM_EDIT +#define RID_SVXIMG_LISTBOX SID_FM_LISTBOX +#define RID_SVXIMG_COMBOBOX SID_FM_COMBOBOX +#define RID_SVXIMG_FORMS (RID_FORMS_START +13) +#define RID_SVXIMG_IMAGEBUTTON SID_FM_IMAGEBUTTON +#define RID_SVXIMG_IMAGECONTROL SID_FM_IMAGECONTROL +#define RID_SVXIMG_FILECONTROL SID_FM_FILECONTROL +#define RID_SVXIMG_DATEFIELD SID_FM_DATEFIELD +#define RID_SVXIMG_TIMEFIELD SID_FM_TIMEFIELD +#define RID_SVXIMG_NUMERICFIELD SID_FM_NUMERICFIELD +#define RID_SVXIMG_CURRENCYFIELD SID_FM_CURRENCYFIELD +#define RID_SVXIMG_PATTERNFIELD SID_FM_PATTERNFIELD +#define RID_SVXIMG_HIDDEN (RID_FORMS_START +22) +#define RID_SVXIMG_GRID SID_FM_DBGRID +#define RID_SVXIMG_FORMATTEDFIELD SID_FM_FORMATTEDFIELD +#define RID_SVXIMG_FILTER SID_FM_FILTERCRIT +#define RID_SVXIMG_DATE_N_TIME_FIELDS SID_FM_TWOFIELDS_DATE_N_TIME +#define RID_SVXIMG_FIELD (RID_FORMS_START +27) +#define RID_SVXIMG_SCROLLBAR SID_FM_SCROLLBAR +#define RID_SVXIMG_SPINBUTTON SID_FM_SPINBUTTON +#define RID_SVXIMG_NAVIGATIONBAR SID_FM_NAVIGATIONBAR + +// Dialog-Id's ----------------------------------------------------------- +#define RID_SVXTBX_FORM (RID_FORMS_START + 1) +#define TBX_FORM (RID_FORMS_START + 2) +#define RID_SVXDLG_ADD_TABLE (RID_FORMS_START + 3) +#define RID_SVXDLG_TAB_ORDER (RID_FORMS_START + 4) +#define RID_SVXDLG_SETFORM (RID_FORMS_START + 5) +#define RID_SVX_FMEXPLORER (RID_FORMS_START + 6) +#define RID_SVXDLG_SEARCHFORM (RID_FORMS_START + 7) +#define RID_SVXERR_SEARCH_NORECORD (RID_FORMS_START + 8) +#define RID_SVXERR_SEARCH_GENERAL_ERROR (RID_FORMS_START + 9) +#define RID_SVX_DLG_INPUTRECORDNO (RID_FORMS_START + 10) +#define RID_SVX_DLG_SHOWGRIDCOLUMNS (RID_FORMS_START + 11) +#define RID_SVXDLG_ADD_DATAITEM (RID_FORMS_START + 12) +#define RID_SVXDLG_ADD_CONDITION (RID_FORMS_START + 13) +#define RID_SVXDLG_NAMESPACE_ITEM (RID_FORMS_START + 14) +#define RID_SVXDLG_MANAGE_NAMESPACE (RID_FORMS_START + 15) +#define RID_SVXDLG_ADD_SUBMISSION (RID_FORMS_START + 16) +#define RID_SVXDLG_ADD_MODEL (RID_FORMS_START + 17) +#define RID_SVXDLG_ADD_INSTANCE (RID_FORMS_START + 18) +#define RID_SVXWIN_DATANAVIGATOR (RID_FORMS_START + 19) +#define RID_SVX_XFORMS_TABPAGES (RID_FORMS_START + 20) + +// Toolbars ------------------------------------------------------------ +#define RID_SVXTBX_FORM_NAVIGATION (RID_FORMS_START + 1) +#define RID_SVXTBX_FORM_FILTER (RID_FORMS_START + 2) +#define RID_SVXTBX_TEXT_CONTROL_ATTRIBUTES (RID_FORMS_START + 3) +#define RID_SVXTBX_CONTROLS (RID_FORMS_START + 4) +#define RID_SVXTBX_MORECONTROLS (RID_FORMS_START + 5) +#define RID_SVXTBX_FORMDESIGN (RID_FORMS_START + 6) + +// Menu-Id's ----------------------------------------------------------- +#define RID_FMEXPLORER_POPUPMENU (RID_FORMS_START + 0) +#define RID_SVXMNU_ROWS (RID_FORMS_START + 1) +#define RID_SVXMNU_COLS (RID_FORMS_START + 2) +#define RID_SVXMNU_CELL (RID_FORMS_START + 3) +#define RID_FMSHELL_CONVERSIONMENU (RID_FORMS_START + 4) +#define RID_FM_FILTER_MENU (RID_FORMS_START + 5) +#define RID_FM_TEXTATTRIBUTE_MENU (RID_FORMS_START + 6) +#define MENU_FM_TEXTATTRIBITES_STYLE (RID_FORMS_START + 7) +#define MENU_FM_TEXTATTRIBITES_ALIGNMENT (RID_FORMS_START + 8) +#define MENU_FM_TEXTATTRIBITES_SPACING (RID_FORMS_START + 9) +#define RID_MENU_DATANAVIGATOR (RID_FORMS_START + 10) + +// QueryBox-Id's ----------------------------------------------------------- +#define RID_QRY_SAVEMODIFIED (RID_FORMS_START + 1) +#define RID_QRY_REMOVE_MODEL (RID_FORMS_START + 2) +#define RID_QRY_REMOVE_INSTANCE (RID_FORMS_START + 3) +#define RID_QRY_REMOVE_ELEMENT (RID_FORMS_START + 4) +#define RID_QRY_REMOVE_ATTRIBUTE (RID_FORMS_START + 5) +#define RID_QRY_LINK_WARNING (RID_FORMS_START + 6) +#define RID_QRY_REMOVE_SUBMISSION (RID_FORMS_START + 7) +#define RID_QRY_REMOVE_BINDING (RID_FORMS_START + 8) + +// ErrorBox-Id's ----------------------------------------------------------- +#define RID_ERR_INVALID_XMLNAME (RID_FORMS_START + 1) +#define RID_ERR_INVALID_XMLPREFIX (RID_FORMS_START + 2) +#define RID_ERR_DOUBLE_MODELNAME (RID_FORMS_START + 3) +#define RID_ERR_EMPTY_SUBMISSIONNAME (RID_FORMS_START + 4) + +// String-Id's ----------------------------------------------------------- +#define RID_STR_FORMSHELL (RID_FORMS_START + 10) +#define RID_STR_STDFORMNAME (RID_FORMS_START + 11) +#define RID_STR_REC_TEXT (RID_FORMS_START + 12) +#define RID_STR_REC_FROM_TEXT (RID_FORMS_START + 13) +#define RID_STR_UNDO_PROPERTY (RID_FORMS_START + 14) +#define RID_STR_UNDO_CONTAINER_INSERT (RID_FORMS_START + 15) +#define RID_STR_UNDO_CONTAINER_REMOVE (RID_FORMS_START + 16) +#define RID_STR_UNDO_CONTAINER_REMOVE_MULTIPLE (RID_FORMS_START + 27) +#define RID_STR_UNDO_CONTAINER_REPLACE (RID_FORMS_START + 28) +#define RID_STR_UNDO_TABORDER (RID_FORMS_START + 29) +#define RID_STR_UNDO_DELETE_LOGICAL (RID_FORMS_START + 30) +#define RID_STR_UNDO_MODEL_REPLACE (RID_FORMS_START + 31) +#define RID_STR_NAVIGATIONBAR (RID_FORMS_START + 32) +#define RID_STR_DEFAULT_CONTROL (RID_FORMS_START + 33) +#define RID_STR_OVERFLOW_FORWARD (RID_FORMS_START + 34) +#define RID_STR_OVERFLOW_BACKWARD (RID_FORMS_START + 35) +#define RID_STR_FORM (RID_FORMS_START + 36) +#define RID_STR_FIELDSELECTION (RID_FORMS_START + 37) +#define RID_STR_NO_PROPERTIES (RID_FORMS_START + 38) +#define RID_STR_PROPERTIES_CONTROL (RID_FORMS_START + 39) +#define RID_STR_PROPERTIES_FORM (RID_FORMS_START + 40) +#define RID_STR_FMEXPLORER (RID_FORMS_START + 41) +#define RID_STR_FORMS (RID_FORMS_START + 42) +#define RID_STR_WRITEERROR (RID_FORMS_START + 43) +#define RID_STR_DELETECONFIRM_RECORD (RID_FORMS_START + 44) +#define RID_STR_DELETECONFIRM (RID_FORMS_START + 45) +#define RID_STR_GROUPBOX (RID_FORMS_START + 46) +#define RID_STR_NAVIGATION (RID_FORMS_START + 47) +#define RID_STR_COLUMN (RID_FORMS_START + 48) +#define RID_STR_DATE (RID_FORMS_START + 49) +#define RID_STR_TIME (RID_FORMS_START + 50) +#define RID_STR_PROPTITLE_NAVBAR (RID_FORMS_START + 51) +#define RID_STR_PROPTITLE_PUSHBUTTON (RID_FORMS_START + 52) +#define RID_STR_PROPTITLE_RADIOBUTTON (RID_FORMS_START + 53) +#define RID_STR_PROPTITLE_CHECKBOX (RID_FORMS_START + 54) +#define RID_STR_PROPTITLE_FIXEDTEXT (RID_FORMS_START + 55) +#define RID_STR_PROPTITLE_GROUPBOX (RID_FORMS_START + 56) +#define RID_STR_PROPTITLE_EDIT (RID_FORMS_START + 57) +#define RID_STR_PROPTITLE_LISTBOX (RID_FORMS_START + 58) +#define RID_STR_PROPTITLE_COMBOBOX (RID_FORMS_START + 59) +#define RID_STR_PROPTITLE_IMAGEBUTTON (RID_FORMS_START + 60) +#define RID_STR_PROPTITLE_IMAGECONTROL (RID_FORMS_START + 61) +#define RID_STR_PROPTITLE_FILECONTROL (RID_FORMS_START + 62) +#define RID_STR_PROPTITLE_DATEFIELD (RID_FORMS_START + 63) +#define RID_STR_PROPTITLE_TIMEFIELD (RID_FORMS_START + 64) +#define RID_STR_PROPTITLE_NUMERICFIELD (RID_FORMS_START + 65) +#define RID_STR_PROPTITLE_CURRENCYFIELD (RID_FORMS_START + 66) +#define RID_STR_PROPTITLE_PATTERNFIELD (RID_FORMS_START + 67) +#define RID_STR_PROPTITLE_DBGRID (RID_FORMS_START + 68) +#define RID_STR_PROPTITLE_MULTISELECT (RID_FORMS_START + 69) +#define RID_STR_DELETECONFIRM_RECORDS (RID_FORMS_START + 70) +#define RID_STR_CONTROL (RID_FORMS_START + 71) +#define RID_STR_POSTFIX_DATE (RID_FORMS_START + 72) +#define RID_STR_POSTFIX_TIME (RID_FORMS_START + 73) +#define RID_STR_FROM_TOP (RID_FORMS_START + 74) +#define RID_STR_FROM_BOTTOM (RID_FORMS_START + 75) +#define RID_STR_SEARCH_COUNTING (RID_FORMS_START + 76) +#define RID_STR_NODATACONTROLS (RID_FORMS_START + 77) +#define RID_STR_FILTER_NAVIGATOR (RID_FORMS_START + 78) +#define RID_STR_FILTER_FILTER_FOR (RID_FORMS_START + 79) +#define RID_STR_FILTER_FILTER_OR (RID_FORMS_START + 80) +#define RID_STR_PROPTITLE_FORMATTED (RID_FORMS_START + 81) +#define RID_STR_SYNTAXERROR (RID_FORMS_START + 82) +#define RID_STR_MOVING_CURSOR (RID_FORMS_START + 83) +#define RID_STR_NOCONTROLS_FOR_EXTERNALDISPLAY (RID_FORMS_START + 84) +#define RID_STR_SEARCH_ANYWHERE (RID_FORMS_START + 85) +#define RID_STR_SEARCH_BEGINNING (RID_FORMS_START + 86) +#define RID_STR_SEARCH_END (RID_FORMS_START + 87) +#define RID_STR_SEARCH_WHOLE (RID_FORMS_START + 88) +#define RID_STR_AUTOFIELD (RID_FORMS_START + 89) +#define RID_STR_SVT_SQL_SYNTAX_ERROR (RID_FORMS_START + 90) +#define RID_STR_SVT_SQL_SYNTAX_VALUE_NO_LIKE (RID_FORMS_START + 91) +#define RID_STR_SVT_SQL_SYNTAX_FIELD_NO_LIKE (RID_FORMS_START + 92) +#define RID_STR_SVT_SQL_SYNTAX_CRIT_NO_COMPARE (RID_FORMS_START + 93) +#define RID_STR_SVT_SQL_SYNTAX_INT_NO_VALID (RID_FORMS_START + 94) +#define RID_STR_SVT_SQL_SYNTAX_ACCESS_DAT_NO_VALID (RID_FORMS_START + 95) +#define RID_STR_SVT_SQL_SYNTAX_REAL_NO_VALID (RID_FORMS_START + 96) +#define RID_STR_SVT_SQL_SYNTAX_TABLE (RID_FORMS_START + 97) +#define RID_STR_SVT_SQL_SYNTAX_COLUMN (RID_FORMS_START + 98) +#define RID_STR_PROPTITLE_SCROLLBAR (RID_FORMS_START + 99) +#define RID_STR_PROPTITLE_SPINBUTTON (RID_FORMS_START + 100) +#define RID_STR_PROPTITLE_HIDDEN (RID_FORMS_START + 101) + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE + // FREE +#define RID_STR_DATANAVIGATOR (RID_FORMS_START + 124) +#define RID_STR_DATANAV_SUBM_PARENT (RID_FORMS_START + 125) +#define RID_STR_DATANAV_SUBM_ID (RID_FORMS_START + 126) +#define RID_STR_DATANAV_SUBM_ACTION (RID_FORMS_START + 127) +#define RID_STR_DATANAV_SUBM_METHOD (RID_FORMS_START + 128) +#define RID_STR_DATANAV_SUBM_REF (RID_FORMS_START + 129) +#define RID_STR_DATANAV_SUBM_BIND (RID_FORMS_START + 130) +#define RID_STR_DATANAV_SUBM_REPLACE (RID_FORMS_START + 131) +#define RID_STR_DATANAV_ADD_ELEMENT (RID_FORMS_START + 132) +#define RID_STR_DATANAV_EDIT_ELEMENT (RID_FORMS_START + 133) +#define RID_STR_DATANAV_REMOVE_ELEMENT (RID_FORMS_START + 134) +#define RID_STR_DATANAV_ADD_ATTRIBUTE (RID_FORMS_START + 135) +#define RID_STR_DATANAV_EDIT_ATTRIBUTE (RID_FORMS_START + 136) +#define RID_STR_DATANAV_REMOVE_ATTRIBUTE (RID_FORMS_START + 137) +#define RID_STR_DATANAV_ADD_BINDING (RID_FORMS_START + 138) +#define RID_STR_DATANAV_EDIT_BINDING (RID_FORMS_START + 139) +#define RID_STR_DATANAV_REMOVE_BINDING (RID_FORMS_START + 140) +#define RID_STR_DATANAV_ADD_SUBMISSION (RID_FORMS_START + 141) +#define RID_STR_DATANAV_EDIT_SUBMISSION (RID_FORMS_START + 142) +#define RID_STR_DATANAV_REMOVE_SUBMISSION (RID_FORMS_START + 143) +#define RID_STR_DATANAV_LINKWARN_BUTTON (RID_FORMS_START + 144) +#define RID_STR_SVT_SQL_SYNTAX_TABLE_OR_QUERY (RID_FORMS_START + 145) +#define RID_STR_SVT_SQL_SYNTAX_TABLE_EXISTS (RID_FORMS_START + 146) +#define RID_STR_SVT_SQL_SYNTAX_QUERY_EXISTS (RID_FORMS_START + 147) +#define RID_STR_READONLY_VIEW (RID_FORMS_START + 148) +#define RID_STR_ALREADYEXISTOVERWRITE (RID_FORMS_START + 149) +#define RID_STR_OBJECT_LABEL (RID_FORMS_START + 150) + +// Error-String-Id's ----------------------------------------------------------- +#define RID_ERR_START (RID_FORMS_START + 600) +#define RID_ERR_CONTEXT_ADDFORM (RID_ERR_START + 0) +#define RID_ERR_DUPLICATE_NAME (RID_ERR_START + 1) +#define RID_ERR_FIELDREQUIRED (RID_ERR_START + 2) +#define RID_ERR_NO_ELEMENT (RID_ERR_START + 4) + +// untyped resources ---------------------------------------------------------- + +#define RID_RSC_TABWIN_PREFIX ( RID_FORMS_START + 0 ) +#define RID_RSC_SQL_INTERNATIONAL ( RID_FORMS_START + 1 ) + +#endif // _FM_FMPAGE_HXX + diff --git a/svx/source/inc/fmscriptingenv.hxx b/svx/source/inc/fmscriptingenv.hxx new file mode 100644 index 000000000000..b018b64f3350 --- /dev/null +++ b/svx/source/inc/fmscriptingenv.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * 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: fmscriptingenv.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 SVX_FMSCRIPTINGENV_HXX +#define SVX_FMSCRIPTINGENV_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/script/XEventAttacherManager.hpp> +/** === end UNO includes === **/ +#include <rtl/ref.hxx> + +class FmFormModel; +//........................................................................ +namespace svxform +{ +//........................................................................ + + //==================================================================== + //= IFormScriptingEnvironment + //==================================================================== + /** describes the interface implemented by a component which handles scripting requirements + in a form/control environment. + */ + class SAL_NO_VTABLE IFormScriptingEnvironment : public ::rtl::IReference + { + public: + /** registers an XEventAttacherManager whose events should be monitored and handled + + @param _rxManager + the XEventAttacherManager to monitor. Must not be <NULL/>. + + @throws ::com::sun::star::lang::IllegalArgumentException + if <arg>_rxManager</arg> is <NULL/> + @throws ::com::sun::star::lang::DisposedException + if the instance is already disposed + @throws ::com::sun::star::uno::RuntimeException + if attaching as script listener to the manager fails with a RuntimeException itself + */ + virtual void registerEventAttacherManager( + const ::com::sun::star::uno::Reference< ::com::sun::star::script::XEventAttacherManager >& _rxManager ) = 0; + + /** registers an XEventAttacherManager whose events should not be monitored and handled anymore + + @param _rxManager + the XEventAttacherManager which was previously registered. Must not ne <NULL/>. + + @throws ::com::sun::star::lang::IllegalArgumentException + if <arg>_rxManager</arg> is <NULL/> + @throws ::com::sun::star::lang::DisposedException + if the instance is already disposed + @throws ::com::sun::star::uno::RuntimeException + if removing as script listener from the manager fails with a RuntimeException itself + */ + virtual void revokeEventAttacherManager( + const ::com::sun::star::uno::Reference< ::com::sun::star::script::XEventAttacherManager >& _rxManager ) = 0; + + /** disposes the scripting environment instance + */ + virtual void dispose() = 0; + + virtual ~IFormScriptingEnvironment(); + }; + typedef ::rtl::Reference< IFormScriptingEnvironment > PFormScriptingEnvironment; + + //==================================================================== + /** creates a default component implementing the IFormScriptingEnvironment interface + */ + PFormScriptingEnvironment createDefaultFormScriptingEnvironment( FmFormModel& _rFormModel ); + +//........................................................................ +} // namespace svxform +//........................................................................ + +#endif // SVX_FMSCRIPTINGENV_HXX + diff --git a/svx/source/inc/fmsearch.hrc b/svx/source/inc/fmsearch.hrc new file mode 100644 index 000000000000..c9a1de900791 --- /dev/null +++ b/svx/source/inc/fmsearch.hrc @@ -0,0 +1,72 @@ +/************************************************************************* + * + * 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: fmsearch.hrc,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 _FMSEARCH_HRC +#define _FMSEARCH_HRC + +#define FT_SEARCHTEXT 1 +#define FT_FORM 2 +#define FT_POSITION 3 +#define FT_RECORDLABEL 4 +#define FT_RECORD 5 +#define FT_HINT 6 + + +#define CMB_SEARCHTEXT 1 + +#define RB_ALLFIELDS 1 +#define RB_SINGLEFIELD 2 +#define RB_SEARCHFORTEXT 3 +#define RB_SEARCHFORNULL 4 +#define RB_SEARCHFORNOTNULL 5 + +#define LB_FORM 1 +#define LB_FIELD 2 +#define LB_POSITION 3 + +#define PB_APPROXSETTINGS 1 +#define PB_SEARCH 2 +#define PB_SOUNDSLIKESETTINGS 3 + +#define FL_SEARCHFOR 1 +#define FL_WHERE 2 +#define FL_OPTIONS 3 +#define FL_STATE 4 + +#define CB_USEFORMATTER 1 +#define CB_BACKWARD 2 +#define CB_STARTOVER 3 +#define CB_CASE 4 +#define CB_WILDCARD 5 +#define CB_REGULAR 6 +#define CB_APPROX 7 +#define CB_HALFFULLFORMS 8 +#define CB_SOUNDSLIKECJK 9 + +#endif // _FMSEARCH_HRC diff --git a/svx/source/inc/fmservs.hxx b/svx/source/inc/fmservs.hxx new file mode 100644 index 000000000000..201a5a351224 --- /dev/null +++ b/svx/source/inc/fmservs.hxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * 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: fmservs.hxx,v $ + * $Revision: 1.9 $ + * + * 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 _SVX_FMSERVS_HXX +#define _SVX_FMSERVS_HXX + +#include <svx/svxdllapi.h> + +#define FM_NUMBER_FORMATTER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.NumberFormatter" ) ) +#define FM_COMPONENT_EDIT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.Edit" ) ) +#define FM_COMPONENT_TEXTFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.TextField" ) ) +#define FM_COMPONENT_LISTBOX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.ListBox" ) ) +#define FM_COMPONENT_COMBOBOX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.ComboBox" ) ) +#define FM_COMPONENT_RADIOBUTTON rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.RadioButton" ) ) +#define FM_COMPONENT_GROUPBOX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.GroupBox" ) ) +#define FM_COMPONENT_FIXEDTEXT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.FixedText" ) ) +#define FM_COMPONENT_COMMANDBUTTON rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.CommandButton" ) ) +#define FM_COMPONENT_CHECKBOX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.CheckBox" ) ) +#define FM_COMPONENT_GRID rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.Grid" ) ) +#define FM_COMPONENT_GRIDCONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.GridControl" ) ) +#define FM_COMPONENT_IMAGEBUTTON rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.ImageButton" ) ) +#define FM_COMPONENT_FILECONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.FileControl" ) ) +#define FM_COMPONENT_TIMEFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.TimeField" ) ) +#define FM_COMPONENT_DATEFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.DateField" ) ) +#define FM_COMPONENT_NUMERICFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.NumericField" ) ) +#define FM_COMPONENT_CURRENCYFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.CurrencyField" ) ) +#define FM_COMPONENT_PATTERNFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.PatternField" ) ) +#define FM_COMPONENT_FORMATTEDFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.FormattedField" ) ) +#define FM_COMPONENT_HIDDEN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.Hidden" ) ) +#define FM_COMPONENT_HIDDENCONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.HiddenControl" ) ) +#define FM_COMPONENT_IMAGECONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.ImageControl" ) ) +#define FM_CONTROL_GRID rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.control.Grid" ) ) +#define FM_CONTROL_GRIDCONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.control.GridControl" ) ) +#define FM_FORM_CONTROLLER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.FormController" ) ) +#define SRV_SDB_CONNECTION rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.Connection" ) ) +#define SRV_SDB_INTERACTION_HANDLER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.InteractionHandler" ) ) +#define FM_SUN_COMPONENT_FORM rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.Form" ) ) +#define FM_SUN_COMPONENT_TEXTFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.TextField" ) ) +#define FM_SUN_COMPONENT_LISTBOX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.ListBox" ) ) +#define FM_SUN_COMPONENT_COMBOBOX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.ComboBox" ) ) +#define FM_SUN_COMPONENT_RADIOBUTTON rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.RadioButton" ) ) +#define FM_SUN_COMPONENT_GROUPBOX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.GroupBox" ) ) +#define FM_SUN_COMPONENT_FIXEDTEXT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.FixedText" ) ) +#define FM_SUN_COMPONENT_COMMANDBUTTON rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.CommandButton" ) ) +#define FM_SUN_COMPONENT_CHECKBOX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.CheckBox" ) ) +#define FM_SUN_COMPONENT_GRIDCONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.GridControl" ) ) +#define FM_SUN_COMPONENT_IMAGEBUTTON rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.ImageButton" ) ) +#define FM_SUN_COMPONENT_FILECONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.FileControl" ) ) +#define FM_SUN_COMPONENT_TIMEFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.TimeField" ) ) +#define FM_SUN_COMPONENT_DATEFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.DateField" ) ) +#define FM_SUN_COMPONENT_NUMERICFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.NumericField" ) ) +#define FM_SUN_COMPONENT_CURRENCYFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.CurrencyField" ) ) +#define FM_SUN_COMPONENT_PATTERNFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.PatternField" ) ) +#define FM_SUN_COMPONENT_HIDDENCONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.HiddenControl" ) ) +#define FM_SUN_COMPONENT_IMAGECONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.DatabaseImageControl" ) ) +#define FM_SUN_COMPONENT_FORMATTEDFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.FormattedField" ) ) +#define FM_SUN_COMPONENT_SCROLLBAR rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.ScrollBar" ) ) +#define FM_SUN_COMPONENT_SPINBUTTON rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.SpinButton" ) ) +#define FM_SUN_COMPONENT_NAVIGATIONBAR rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.NavigationToolBar" ) ) +#define FM_SUN_CONTROL_GRIDCONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.control.GridControl" ) ) + +namespace svxform +{ + SVX_DLLPUBLIC void ImplSmartRegisterUnoServices(); +} // namespace svxform + +#endif // _SVX_FMSERVS_HXX + diff --git a/svx/source/inc/fmshimp.hxx b/svx/source/inc/fmshimp.hxx new file mode 100644 index 000000000000..85644ea5daba --- /dev/null +++ b/svx/source/inc/fmshimp.hxx @@ -0,0 +1,772 @@ +/************************************************************************* + * + * 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: fmshimp.hxx,v $ + * $Revision: 1.41 $ + * + * 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 _SVX_FMSHIMP_HXX +#define _SVX_FMSHIMP_HXX + +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/sdbc/XResultSet.hpp> +#include <com/sun/star/sdb/XSQLQueryComposer.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/container/ContainerEvent.hpp> +#include <com/sun/star/container/XContainerListener.hpp> +#include <com/sun/star/awt/XControl.hpp> +#include <com/sun/star/awt/XControlContainer.hpp> +#include <com/sun/star/util/XModifyListener.hpp> +#include <com/sun/star/form/XForm.hpp> +#include <com/sun/star/form/XFormController.hpp> +#include <com/sun/star/form/XFormComponent.hpp> +#include <com/sun/star/form/NavigationBarMode.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/view/XSelectionChangeListener.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XFastPropertySet.hpp> +#include <com/sun/star/beans/XPropertyChangeListener.hpp> +#include <com/sun/star/beans/PropertyChangeEvent.hpp> +#include <com/sun/star/form/runtime/FeatureState.hpp> +#include <vcl/timer.hxx> +#include <sfx2/app.hxx> +#include <svx/svdmark.hxx> +#include <svx/fmsearch.hxx> +#ifndef _SVX_SVXIDS_HRC +#include <svx/svxids.hrc> +#endif +#include <svtools/svarray.hxx> +#include <svtools/lstner.hxx> + +#define _SVSTDARR_BOOLS +#define _SVSTDARR_BYTES +#define _SVSTDARR_LONGS +#define _SVSTDARR_ULONGS +#define _SVSTDARR_USHORTS +#include <svtools/svstdarr.hxx> +#include <sfx2/mnuitem.hxx> +#include "fmtools.hxx" +#include "fmsrccfg.hxx" +#include <osl/mutex.hxx> +#include <vos/thread.hxx> +#include <svtools/cancel.hxx> +#include <tools/debug.hxx> +#include <cppuhelper/component.hxx> +#include <comphelper/stl_types.hxx> +#include <comphelper/container.hxx> +#include <cppuhelper/compbase4.hxx> +#include <cppuhelper/compbase6.hxx> +#include <unotools/configitem.hxx> +#include "svx/dbtoolsclient.hxx" +#include "formcontrolling.hxx" +#include "fmdocumentclassification.hxx" + +#include <queue> +#include <set> +#include <vector> + +SV_DECL_PTRARR(SdrObjArray, SdrObject*, 32, 16) +// SV_DECL_OBJARR(FmFormArray, ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>, 32, 16); +DECLARE_STL_VECTOR( ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > ,FmFormArray); + +// catch databse exceptions if occur +#define DO_SAFE(statement) try { statement; } catch( const Exception& ) { DBG_ERROR("unhandled exception (I tried to move a cursor (or something like that).)"); } + +#define GA_DISABLE_SYNC 1 +#define GA_FORCE_SYNC 2 +#define GA_ENABLE_SYNC 3 +#define GA_SYNC_MASK 3 +#define GA_DISABLE_ROCTRLR 4 +#define GA_ENABLE_ROCTRLR 8 + + +// flags for controlling the behaviour when calling loadForms +#define FORMS_LOAD 0x0000 // default: simply load +#define FORMS_SYNC 0x0000 // default: do in synchronous + +#define FORMS_UNLOAD 0x0001 // unload +#define FORMS_ASYNC 0x0002 // do this async + +//============================================================================== +// a class iterating through all fields of a form which are bound to a field +// sub forms are ignored, grid columns (where the grid is a direct child of the form) are included +class SAL_DLLPRIVATE FmXBoundFormFieldIterator : public ::comphelper::IndexAccessIterator +{ +public: + FmXBoundFormFieldIterator(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rStartingPoint) : ::comphelper::IndexAccessIterator(_rStartingPoint) { } + +protected: + virtual sal_Bool ShouldHandleElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rElement); + virtual sal_Bool ShouldStepInto(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rContainer) const; +}; + +//======================================================================== +// I would prefer this to be a struct local to FmXFormShell but unfortunately local structs/classes +// are somewhat difficult with some of our compilers +class FmCursorActionThread; +struct SAL_DLLPRIVATE CursorActionDescription +{ + FmCursorActionThread* pThread; + ULONG nFinishedEvent; + // we want to do the cleanup of the thread in the main thread so we post an event to ourself + sal_Bool bCanceling; + // this thread is being canceled + + CursorActionDescription() : pThread(NULL), nFinishedEvent(0), bCanceling(sal_False) { } +}; + +class FmFormPage; +//======================================================================== +struct SAL_DLLPRIVATE FmLoadAction +{ + FmFormPage* pPage; + ULONG nEventId; + sal_uInt16 nFlags; + + FmLoadAction( ) : pPage( NULL ), nEventId( 0 ), nFlags( 0 ) { } + FmLoadAction( FmFormPage* _pPage, sal_uInt16 _nFlags, ULONG _nEventId ) + :pPage( _pPage ), nEventId( _nEventId ), nFlags( _nFlags ) + { + } +}; + +//======================================================================== +class SfxViewFrame; +typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::beans::XPropertyChangeListener + , ::com::sun::star::container::XContainerListener + , ::com::sun::star::view::XSelectionChangeListener + , ::com::sun::star::form::XFormControllerListener + > FmXFormShell_BD_BASE; + +//======================================================================== +class SAL_DLLPRIVATE FmXFormShell_Base_Disambiguation : public FmXFormShell_BD_BASE +{ + using ::com::sun::star::beans::XPropertyChangeListener::disposing; +protected: + FmXFormShell_Base_Disambiguation( ::osl::Mutex& _rMutex ); + virtual void SAL_CALL disposing(); +}; + +//======================================================================== +namespace svx +{ + class FmTextControlShell; +} + +//======================================================================== +typedef FmXFormShell_Base_Disambiguation FmXFormShell_BASE; +typedef ::utl::ConfigItem FmXFormShell_CFGBASE; + +struct SdrViewEvent; +class FmFormShell; +class FmFormView; +class SAL_DLLPRIVATE FmXFormShell :public FmXFormShell_BASE + ,public FmXFormShell_CFGBASE + ,public ::svxform::OStaticDataAccessTools + ,public ::svx::IControllerFeatureInvalidation +{ + friend class FmFormView; + friend class FmXFormView; + friend class WizardUsageConfigItem; + + class SuspendPropertyTracking; + friend class SuspendPropertyTracking; + + // Timer um verzoegerte Markierung vorzunehmen + Timer m_aMarkTimer; + SdrObjArray m_arrSearchedControls; + // We enable a permanent cursor for the grid we found a searched text, it's disabled in the next "found" event. + FmFormArray m_aSearchForms; + + SvUShorts m_arrInvalidSlots; + SvBytes m_arrInvalidSlots_Flags; + // we explicitly switch off the propbrw before leaving the design mode + // this flag tells us if we have to switch it on again when reentering + + typedef ::std::map< + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >, + CursorActionDescription, + ::comphelper::OInterfaceCompare< ::com::sun::star::sdbc::XResultSet > + > CursorActions; + CursorActions m_aCursorActions; + // all actions on async cursors + + ::std::vector< sal_Bool > + m_aControlLocks; + // while doing a async cursor action we have to lock all controls of the active controller. + // m_aControlLocks remembers the previous lock states to be restored afterwards. + ::osl::Mutex m_aAsyncSafety; + // secure the access to our thread related members + ::osl::Mutex m_aInvalidationSafety; + // secure the access to all our slot invalidation related members + + ::com::sun::star::form::NavigationBarMode m_eNavigate; // Art der Navigation + + // da ich beim Suchen fuer die Behandlung des "gefunden" ein SdrObject markieren will, besorge ich mir vor dem + // Hochreissen des Suchen-Dialoges alle relevanten Objekte + // (das Array ist damit auch nur waehrend des Suchvorganges gueltig) + SvLongs m_arrRelativeGridColumn; + + ::osl::Mutex m_aMutex; + ULONG m_nInvalidationEvent; + ULONG m_nActivationEvent; + ::std::queue< FmLoadAction > + m_aLoadingPages; + + FmFormShell* m_pShell; + ::svx::FmTextControlShell* m_pTextShell; + + ::svx::ControllerFeatures m_aActiveControllerFeatures; + ::svx::ControllerFeatures m_aNavControllerFeatures; + + // aktuelle Form, Controller + // nur im alive mode verfuegbar + ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController> m_xActiveController; + ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController> m_xNavigationController; + ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> m_xActiveForm; + + // Aktueller container einer Page + // nur im designmode verfuegbar + ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> m_xForms; + + // the currently selected objects, as to be displayed in the property browser + InterfaceBag m_aCurrentSelection; + /// the currently selected form, or the form which all currently selected controls belong to, or <NULL/> + ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > m_xCurrentForm; + /// the last selection/marking of controls only. Necessary to implement the "Control properties" slot + InterfaceBag m_aLastKnownMarkedControls; + + + // und das ist ebenfalls fuer's 'gefunden' : Beim Finden in GridControls brauche ich die Spalte, bekomme aber + // nur die Nummer des Feldes, die entspricht der Nummer der Spalte + <offset>, wobei der Offset von der Position + // des GridControls im Formular abhaengt. Also hier eine Umrechnung. + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel> m_xLastGridFound; + // the frame we live in + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame> m_xAttachedFrame; + // Administration of external form views (see the SID_FM_VIEW_AS_GRID-slot) + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController> m_xExternalViewController; // the controller for the external form view + ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController> m_xExtViewTriggerController; // the nav controller at the time the external display was triggered + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> m_xExternalDisplayedForm; // the form which the external view is based on + + FmXDispatchInterceptorImpl* m_pExternalViewInterceptor; + + mutable ::svxform::DocumentType + m_eDocumentType; /// the type of document we're living in + sal_Int16 m_nLockSlotInvalidation; + sal_Bool m_bHadPropertyBrowserInDesignMode : 1; + + sal_Bool m_bTrackProperties : 1; + // soll ich (bzw. der Owner diese Impl-Klasse) mich um die Aktualisierung des ::com::sun::star::beans::Property-Browsers kuemmern ? + + sal_Bool m_bUseWizards : 1; + + sal_Bool m_bDatabaseBar : 1; // Gibt es eine Datenbankleiste + sal_Bool m_bInActivate : 1; // Wird ein Controller aktiviert + sal_Bool m_bSetFocus : 1; // Darf der Focus umgesetzt werden + sal_Bool m_bFilterMode : 1; // Wird gerade ein Filter auf die Controls angesetzt + sal_Bool m_bChangingDesignMode:1; // sal_True within SetDesignMode + sal_Bool m_bPreparedClose : 1; // for the current modification state of the current form + // PrepareClose had been called and the user denied to save changes + sal_Bool m_bFirstActivation : 1; // has the shell ever been activated? + +public: + // attribute access + inline const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& + getHostFrame() const { return m_xAttachedFrame; } + inline const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& + getExternallyDisplayedForm() const { return m_xExternalDisplayedForm; } + + inline sal_Bool + didPrepareClose() const { return m_bPreparedClose; } + inline void + didPrepareClose( sal_Bool _bDid ) { m_bPreparedClose = _bDid; } + +public: + FmXFormShell(FmFormShell& _rShell, SfxViewFrame* _pViewFrame); + + // UNO Anbindung + DECLARE_UNO3_DEFAULTS(FmXFormShell, FmXFormShell_BASE); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& type) throw ( ::com::sun::star::uno::RuntimeException ); + +protected: + ~FmXFormShell(); + +// XTypeProvider + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + +// EventListener + virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException ); + +// ::com::sun::star::container::XContainerListener + virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException ); + +// XSelectionChangeListener + virtual void SAL_CALL selectionChanged(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException ); + +// ::com::sun::star::beans::XPropertyChangeListener + virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw( ::com::sun::star::uno::RuntimeException ); + +// ::com::sun::star::form::XFormControllerListener + virtual void SAL_CALL formActivated(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL formDeactivated(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException ); + +// OComponentHelper + virtual void SAL_CALL disposing(); + +public: + void EnableTrackProperties( sal_Bool bEnable) { m_bTrackProperties = bEnable; } + sal_Bool IsTrackPropertiesEnabled() {return m_bTrackProperties;} + + // activation handling + void viewActivated( FmFormView& _rCurrentView, sal_Bool _bSyncAction = sal_False ); + void viewDeactivated( FmFormView& _rCurrentView, sal_Bool _bDeactivateController = sal_True ); + + // IControllerFeatureInvalidation + virtual void invalidateFeatures( const ::std::vector< sal_Int32 >& _rFeatures ); + + void ExecuteTabOrderDialog( // execute SID_FM_TAB_DIALOG + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel >& _rxForForm + ); + + // stuff + void AddElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element); + void RemoveElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element); + + /** updates m_xForms, to be either <NULL/>, if we're in alive mode, or our current page's forms collection, + if in design mode + */ + void UpdateForms( sal_Bool _bInvalidate ); + + void ExecuteSearch(); // execute SID_FM_SEARCH + void CreateExternalView(); // execute SID_FM_VIEW_AS_GRID + + sal_Bool GetY2KState(sal_uInt16& n); + void SetY2KState(sal_uInt16 n); + +protected: + // activation handling + inline sal_Bool hasEverBeenActivated( ) const { return !m_bFirstActivation; } + inline void setHasBeenActivated( ) { m_bFirstActivation = sal_False; } + + // form handling + /// load or unload the forms on a page + void loadForms( FmFormPage* _pPage, const sal_uInt16 _nBehaviour = FORMS_LOAD | FORMS_SYNC ); + void smartControlReset( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& _rxModels ); + + + void startListening(); + void stopListening(); + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> GetControlFromModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel>& xModel); + // liefert das Control, welches das angegebene Model hat + + // sammelt in strNames die Namen aller Formulare + static void impl_collectFormSearchContexts_nothrow( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rxStartingPoint, + const ::rtl::OUString& _rCurrentLevelPrefix, + FmFormArray& _out_rForms, + ::std::vector< String >& _out_rNames ); + + /** checks whether the instance is already disposed, if so, this is reported as assertion error (debug + builds only) and <TRUE/> is returned. + */ + bool impl_checkDisposed() const; + +public: + // methode fuer nicht designmode (alive mode) + void setActiveController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController>& _xController, sal_Bool _bNoSaveOldContent = sal_False ); + const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController>& getActiveController() const {return m_xActiveController;} + const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController>& getActiveInternalController() const { return m_xActiveController == m_xExternalViewController ? m_xExtViewTriggerController : m_xActiveController; } + const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>& getActiveForm() const {return m_xActiveForm;} + const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController>& getNavController() const {return m_xNavigationController;} + + inline const ::svx::ControllerFeatures& getActiveControllerFeatures() const + { return m_aActiveControllerFeatures; } + inline const ::svx::ControllerFeatures& getNavControllerFeatures() const + { return m_aNavControllerFeatures.isAssigned() ? m_aNavControllerFeatures : m_aActiveControllerFeatures; } + + /** announces a new "current selection" + @return + <TRUE/> if and only if the to-bet-set selection was different from the previous selection + */ + bool setCurrentSelection( const InterfaceBag& _rSelection ); + + /** sets the new selection to the last known marked controls + */ + bool selectLastMarkedControls(); + + /** retrieves the current selection + */ + SVX_DLLPUBLIC void getCurrentSelection( InterfaceBag& /* [out] */ _rSelection ) const; + + /** sets a new current selection as indicated by a mark list + @return + <TRUE/> if and only if the to-bet-set selection was different from the previous selection + */ + bool setCurrentSelectionFromMark(const SdrMarkList& rMarkList); + + /// returns the currently selected form, or the form which all currently selected controls belong to, or <NULL/> + ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > + getCurrentForm() const { return m_xCurrentForm; } + void forgetCurrentForm(); + /// returns whether the last known marking contained only controls + sal_Bool onlyControlsAreMarked() const { return !m_aLastKnownMarkedControls.empty(); } + + /// determines whether the current selection consists of exactly the given object + bool isSolelySelected( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxObject + ); + + /// handles a MouseButtonDown event of the FmFormView + void handleMouseButtonDown( const SdrViewEvent& _rViewEvent ); + /// handles the request for showing the "Properties" + void handleShowPropertiesRequest(); + + sal_Bool hasForms() const {return m_xForms.is() && m_xForms->getCount() != 0;} + sal_Bool hasDatabaseBar() const {return m_bDatabaseBar;} + sal_Bool canNavigate() const {return m_xNavigationController.is();} + + void ShowSelectionProperties( sal_Bool bShow ); + sal_Bool IsPropBrwOpen() const; + + void DetermineSelection(const SdrMarkList& rMarkList); + void SetSelection(const SdrMarkList& rMarkList); + void SetSelectionDelayed(); + + void SetDesignMode(sal_Bool bDesign); + + sal_Bool GetWizardUsing() const { return m_bUseWizards; } + void SetWizardUsing(sal_Bool _bUseThem); + + // Setzen des Filtermodus + sal_Bool isInFilterMode() const {return m_bFilterMode;} + void startFiltering(); + void stopFiltering(sal_Bool bSave); + void clearFilter(); + + static PopupMenu* GetConversionMenu(); + // ein Menue, das alle ControlConversion-Eintraege enthaelt + + /// checks whethere a given control conversion slot can be applied to the current selection + bool canConvertCurrentSelectionToControl( sal_Int16 nConversionSlot ); + /// enables or disables all conversion slots in a menu, according to the current selection + void checkControlConversionSlotsForCurrentSelection( Menu& rMenu ); + /// executes a control conversion slot for a given object + bool executeControlConversionSlot( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& _rxObject, sal_uInt16 _nSlotId ); + /** executes a control conversion slot for the current selection + @precond canConvertCurrentSelectionToControl( <arg>_nSlotId</arg> ) must return <TRUE/> + */ + bool executeControlConversionSlot( sal_uInt16 _nSlotId ); + /// checks whether the given slot id denotes a control conversion slot + static bool isControlConversionSlot( sal_uInt16 _nSlotId ); + + void ExecuteTextAttribute( SfxRequest& _rReq ); + void GetTextAttributeState( SfxItemSet& _rSet ); + bool IsActiveControl( bool _bCountRichTextOnly = false ) const; + void ForgetActiveControl(); + void SetControlActivationHandler( const Link& _rHdl ); + + /// classifies our host document + ::svxform::DocumentType + getDocumentType() const; + bool isEnhancedForm() const; + + /// determines whether our host document is currently read-only + bool IsReadonlyDoc() const; + + // das Setzen des curObject/selObject/curForm erfolgt verzoegert (SetSelectionDelayed), mit den folgenden + // Funktionen laesst sich das abfragen/erzwingen + inline sal_Bool IsSelectionUpdatePending(); + void ForceUpdateSelection(sal_Bool bLockInvalidation); + + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel> getContextDocument() const; + ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> getInternalForm(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>& _xForm) const; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> getInternalForm(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xForm) const; + // if the form belongs to the controller (extern) displaying a grid, the according internal form will + // be displayed, _xForm else + +private: + DECL_LINK(OnFoundData, FmFoundRecordInformation*); + DECL_LINK(OnCanceledNotFound, FmFoundRecordInformation*); + DECL_LINK(OnSearchContextRequest, FmSearchContext*); + DECL_LINK(OnTimeOut, void*); + DECL_LINK(OnFirstTimeActivation, void*); + DECL_LINK(OnFormsCreated, FmFormPage*); + + void LoopGrids(sal_Int16 nWhat); + + // Invalidierung von Slots + void InvalidateSlot( sal_Int16 nId, sal_Bool bWithId ); + void UpdateSlot( sal_Int16 nId ); + // Locking der Invalidierung - wenn der interne Locking-Counter auf 0 geht, werden alle aufgelaufenen Slots + // (asynchron) invalidiert + void LockSlotInvalidation(sal_Bool bLock); + + DECL_LINK(OnInvalidateSlots, void*); + + void CloseExternalFormViewer(); + // closes the task-local beamer displaying a grid view for a form + + // ConfigItem related stuff + virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames); + void implAdjustConfigCache(); + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > + getControlContainerForView(); + + /** finds and sets a default for m_xCurrentForm, if it is currently NULL + */ + void impl_defaultCurrentForm_nothrow(); + + /** sets m_xCurrentForm to the provided form, and udpates everything which + depends on the current form + */ + void impl_updateCurrentForm( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxNewCurForm ); + + /** adds or removes ourself as XEventListener at m_xActiveController + */ + void impl_switchActiveControllerListening( const bool _bListen ); + + /** add an element + */ + void impl_AddElement_nothrow(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element); + + /** remove an element + */ + void impl_RemoveElement_nothrow(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element); + + // --------------------------------------------------- + // asyncronous cursor actions/navigation slot handling + + void setControlLocks(); // lock all controls of the active controller + void restoreControlLocks(); // restore the lock state of all controls of the active controller + +public: + enum CURSOR_ACTION { CA_MOVE_TO_LAST, CA_MOVE_ABSOLUTE }; + void DoAsyncCursorAction(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController>& _xController, CURSOR_ACTION _eWhat); + void DoAsyncCursorAction(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xForm, CURSOR_ACTION _eWhat); + + sal_Bool HasAnyPendingCursorAction() const; + void CancelAnyPendingCursorAction(); + + sal_Bool HasPendingCursorAction(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController>& _xController) const; + sal_Bool HasPendingCursorAction(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xForm) const; + + /** execute the given form slot + <p>Warning. Only a small set of slots implemented currently.</p> + @param _nSlot + the slot to execute + */ + void ExecuteFormSlot( sal_Int32 _nSlot ); + + /** determines whether the current form slot is currently enabled + */ + bool IsFormSlotEnabled( sal_Int32 _nSlot, ::com::sun::star::form::runtime::FeatureState* _pCompleteState = NULL ); + +protected: + DECL_LINK(OnCursorActionDone, FmCursorActionThread*); + DECL_LINK(OnCursorActionDoneMainThread, FmCursorActionThread*); + + DECL_LINK( OnLoadForms, FmFormPage* ); +}; + +//------------------------------------------------------------------------------ +inline sal_Bool FmXFormShell::IsSelectionUpdatePending() +{ + return m_aMarkTimer.IsActive(); +} + +// ======================================================================== +// = ein Iterator, der ausgehend von einem Interface ein Objekt sucht, dessen +// = ::com::sun::star::beans::Property-Set eine ControlSource- sowie eine BoundField-Eigenschaft hat, +// = wobei letztere einen Wert ungleich NULL haben muss. +// = Wenn das Interface selber diese Bedingung nicht erfuellt, wird getestet, +// = ob es ein Container ist (also ueber eine ::com::sun::star::container::XIndexAccess verfuegt), dann +// = wird dort abgestiegen und fuer jedes Element des Containers das selbe +// = versucht (wiederum eventuell mit Abstieg). +// = Wenn irgendein Objekt dabei die geforderte Eigenschaft hat, entfaellt +// = der Teil mit dem Container-Test fuer dieses Objekt. +// = + +class SAL_DLLPRIVATE SearchableControlIterator : public ::comphelper::IndexAccessIterator +{ + ::rtl::OUString m_sCurrentValue; + // der aktuelle Wert der ControlSource-::com::sun::star::beans::Property + +public: + ::rtl::OUString getCurrentValue() const { return m_sCurrentValue; } + +public: + SearchableControlIterator(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> xStartingPoint); + + virtual sal_Bool ShouldHandleElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& rElement); + virtual sal_Bool ShouldStepInto(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& xContainer) const; + virtual void Invalidate() { IndexAccessIterator::Invalidate(); m_sCurrentValue = ::rtl::OUString(); } +}; + +// ======================================================================== +SV_DECL_PTRARR_DEL(StatusForwarderArray, SfxStatusForwarder*, 16, 0) +class SVX_DLLPUBLIC ControlConversionMenuController : public SfxMenuControl +{ +protected: + StatusForwarderArray m_aStatusForwarders; + Menu* m_pMainMenu; + PopupMenu* m_pConversionMenu; + +public: + SVX_DLLPRIVATE ControlConversionMenuController(sal_uInt16 nId, Menu& rMenu, SfxBindings& rBindings); + SVX_DLLPRIVATE virtual ~ControlConversionMenuController(); + SFX_DECL_MENU_CONTROL(); + + SVX_DLLPRIVATE virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState); +}; + +//================================================================== +// FmCursorActionThread +//================================================================== + +class SAL_DLLPRIVATE FmCursorActionThread : public ::vos::OThread +{ + Link m_aTerminationHandler; // the handler to be called upon termination + ::com::sun::star::sdbc::SQLException m_aRunException; // the database exception thrown by RunImpl + ::osl::Mutex m_aAccessSafety; // for securing the multi-thread access + ::osl::Mutex m_aFinalExitControl; // see StopItWait + +protected: + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> m_xDataSource; // the cursor which we work with + +private: + + UniString m_sStopperCaption; // the caption for the ThreadStopper + sal_Bool m_bCanceled:1; // StopIt has been called ? + sal_Bool m_bDeleteMyself:1; // delete the thread upon termination (defaults to sal_False) ? + sal_Bool m_bDisposeCursor:1; // dispose the cursor upon termination (defaults to sal_False) ? + sal_Bool m_bTerminated:1; // onTerminated already called ? + sal_Bool m_bRunFailed:1; // a database execption occured in RunImpl ? + + // a ThreadStopper will be instantiated so that the open can be canceled via the UI + class ThreadStopper : protected SfxCancellable + { + FmCursorActionThread* m_pOwner; + + virtual ~ThreadStopper() { } + + public: + ThreadStopper(FmCursorActionThread* pOwner, const UniString& rTitle); + + virtual void Cancel(); + + virtual void OwnerTerminated(); + // Normally the Owner (a FmCursorActionThread) would delete the stopper when terminated. + // Unfortunally the application doesn't remove the 'red light' when a SfxCancellable is deleted + // if it (the app) can't acquire the solar mutex. The deletion is IGNORED then. So we have make + // sure that a) the stopper is deleted from inside the main thread (where the solar mutex is locked) + // and b) that in the time between the termination of the thread and the deletion of the stopper + // the latter doesn't access the former. + // The OwnerTerminated cares for both aspects. + // SO DON'T DELETE THE STOPPER EXPLICITLY ! + + protected: + // HACK HACK HACK HACK HACK : this should be private, but MSVC doesn't accept the LINK-macro then .... + DECL_LINK(OnDeleteInMainThread, ThreadStopper*); + }; + friend class FmCursorActionThread::ThreadStopper; + + +public: + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> getDataSource() const { return m_xDataSource; } + +private: + sal_Bool Terminated() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_bTerminated; } + +public: + FmCursorActionThread(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDataSource, const UniString& _rStopperCaption); + virtual ~FmCursorActionThread() {} + + // control of self-deletion + sal_Bool IsSelfDeleteEnabled() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_bDeleteMyself; } + void EnableSelfDelete(sal_Bool bEnable) { ::osl::MutexGuard aGuard(m_aAccessSafety); m_bDeleteMyself = bEnable; } + + // control of cursor-dipose + sal_Bool IsCursorDisposeEnabled() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_bDisposeCursor; } + void EnableCursorDispose(sal_Bool bEnable) { ::osl::MutexGuard aGuard(m_aAccessSafety); m_bDisposeCursor = bEnable; } + + // error-access + sal_Bool RunFailed() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_bRunFailed; } + ::com::sun::star::sdbc::SQLException GetRunException() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_aRunException; } + + /// the excution (within the method "run") was canceled ? + sal_Bool WasCanceled() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_bCanceled; } + + /// the handler will be called synchronously (the parameter is a pointer to the thread) + void SetTerminationHdl(const Link& aTermHdl) { ::osl::MutexGuard aGuard(m_aAccessSafety); m_aTerminationHandler = aTermHdl; } + + /// cancels the process. returns to the caller immediately. to be called from another thread (of course ;) + void StopIt(); + + /// cancels the process. does not return to the caller until the thread is terminated. + void StopItWait(); + +protected: + virtual void SAL_CALL run(); + virtual void SAL_CALL onTerminated(); + + /// called from within run. run itself handles (de)initialisation of the cancel handling. + virtual void RunImpl() = 0; +}; + +//------------------------------------------------------------------------------ + +#define DECL_CURSOR_ACTION_THREAD(classname) \ + \ +class SAL_DLLPRIVATE classname : public FmCursorActionThread \ +{ \ +public: \ + classname(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDataSource); \ +protected: \ + virtual void RunImpl(); \ +}; \ + + +//------------------------------------------------------------------------------ + +#define IMPL_CURSOR_ACTION_THREAD(classname, caption, action) \ + \ +classname::classname(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDataSource) \ + :FmCursorActionThread(_xDataSource, caption) \ +{ \ +} \ + \ +void classname::RunImpl() \ +{ \ + m_xDataSource->action; \ +} \ + + + +#endif // _SVX_FMSHIMP_HXX diff --git a/svx/source/inc/fmslotinvalidator.hxx b/svx/source/inc/fmslotinvalidator.hxx new file mode 100644 index 000000000000..3f07f1213fac --- /dev/null +++ b/svx/source/inc/fmslotinvalidator.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * 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: fmslotinvalidator.hxx,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. + * + ************************************************************************/ + +#ifndef SVX_SOURCE_INC_FMSLOTINVALIDATOR_HXX +#define SVX_SOURCE_INC_FMSLOTINVALIDATOR_HXX + +#include <tools/solar.h> + +//........................................................................ +namespace svx +{ +//........................................................................ + + typedef USHORT SfxSlotId; + + //==================================================================== + //= ISlotInvalidator + //==================================================================== + class ISlotInvalidator + { + public: + virtual void Invalidate( SfxSlotId _nSlot ) = 0; + }; + +//........................................................................ +} // namespace svx +//........................................................................ + +#endif // SVX_SOURCE_INC_FMSLOTINVALIDATOR_HXX + + diff --git a/svx/source/inc/fmsrccfg.hxx b/svx/source/inc/fmsrccfg.hxx new file mode 100644 index 000000000000..543f41698538 --- /dev/null +++ b/svx/source/inc/fmsrccfg.hxx @@ -0,0 +1,159 @@ +/************************************************************************* + * + * 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: fmsrccfg.hxx,v $ + * $Revision: 1.9 $ + * + * 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 _FMSRCCF_HXX_ +#define _FMSRCCF_HXX_ + +#include <tools/string.hxx> +#include <unotools/configvaluecontainer.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include "svx/svxdllapi.h" + +// =================================================================================================== + +#define MATCHING_ANYWHERE 0 +#define MATCHING_BEGINNING 1 +#define MATCHING_END 2 +#define MATCHING_WHOLETEXT 3 + +// diese Konstanten duerfen NICHT einfach geaendert werden, da der SearchDialog aus den Einstellungen seiner ListBox +// keine Umrechnungen vornimmt, sondern die einfach in die entsprechenden Methoden der SearchEngine steckt +// (wenn man also die Konstanten oder die Reihenfolge der Listbox-Eintraege im Dialog aendert, muss das jeweils andere +// angepasst werden) + + +//........................................................................ +namespace svxform +{ +//........................................................................ + + // =================================================================================================== + // = struct FmSearchParams - Parameter einer Suche + // =================================================================================================== + + struct SVX_DLLPUBLIC FmSearchParams + { + protected: + sal_Int32 nTransliterationFlags; + // they're way too sensitive for direct access .... + + public: + // no bit fields at all (want to pass the addresses to the OConfigurationValueContainer) + ::com::sun::star::uno::Sequence< ::rtl::OUString > + aHistory; + ::rtl::OUString sSingleSearchField; + + sal_Int16 nSearchForType; + sal_Int16 nPosition; + sal_Int16 nLevOther; + sal_Int16 nLevShorter; + sal_Int16 nLevLonger; + sal_Bool bLevRelaxed; + + sal_Bool bAllFields; + sal_Bool bUseFormatter; + sal_Bool bBackwards; + sal_Bool bWildcard; + sal_Bool bRegular; + sal_Bool bApproxSearch; + // the last three are mutually exclusive + + sal_Bool bSoundsLikeCJK; + + // ...................................... + FmSearchParams(); + + sal_Bool isIgnoreWidthCJK( ) const; + void setIgnoreWidthCJK( sal_Bool _bIgnore ); + + sal_Int32 getTransliterationFlags( ) const { return nTransliterationFlags; } + void setTransliterationFlags( sal_Int32 _nFlags ) { nTransliterationFlags = _nFlags; } + + sal_Bool isCaseSensitive( ) const; + void setCaseSensitive( sal_Bool _bCase ); + }; + + // =================================================================================================== + // = class FmSearchConfigItem - ein ConfigItem, dass sich Suchparameter merkt + // =================================================================================================== + + class SVX_DLLPUBLIC FmSearchConfigItem + :protected FmSearchParams + ,public ::utl::OConfigurationValueContainer + // order matters! + { + private: + ::osl::Mutex m_aMutex; + + // wrapper properties: + // some of the members of FmSearchParams are must be translated to be stored in the configuration + ::rtl::OUString m_sSearchForType; + ::rtl::OUString m_sSearchPosition; + + sal_Bool m_bIsMatchCase; + sal_Bool m_bIsMatchFullHalfWidthForms; + sal_Bool m_bIsMatchHiraganaKatakana; + sal_Bool m_bIsMatchContractions; + sal_Bool m_bIsMatchMinusDashCho_on; + sal_Bool m_bIsMatchRepeatCharMarks; + sal_Bool m_bIsMatchVariantFormKanji; + sal_Bool m_bIsMatchOldKanaForms; + sal_Bool m_bIsMatch_DiZi_DuZu; + sal_Bool m_bIsMatch_BaVa_HaFa; + sal_Bool m_bIsMatch_TsiThiChi_DhiZi; + sal_Bool m_bIsMatch_HyuIyu_ByuVyu; + sal_Bool m_bIsMatch_SeShe_ZeJe; + sal_Bool m_bIsMatch_IaIya; + sal_Bool m_bIsMatch_KiKu; + sal_Bool m_bIsIgnorePunctuation; + sal_Bool m_bIsIgnoreWhitespace; + sal_Bool m_bIsIgnoreProlongedSoundMark; + sal_Bool m_bIsIgnoreMiddleDot; + + public: + FmSearchConfigItem(); + ~FmSearchConfigItem(); + + const FmSearchParams& getParams( ) const; + void setParams( const FmSearchParams& _rParams ); + + private: + SVX_DLLPRIVATE void implTranslateFromConfig( ); + SVX_DLLPRIVATE void implTranslateToConfig( ); + }; + +//........................................................................ +} // namespace svxform +//........................................................................ + +// =================================================================================================== + +#endif // _FMSRCCF_HXX_ + diff --git a/svx/source/inc/fmsrcimp.hxx b/svx/source/inc/fmsrcimp.hxx new file mode 100644 index 000000000000..eb2475bc56e8 --- /dev/null +++ b/svx/source/inc/fmsrcimp.hxx @@ -0,0 +1,403 @@ +/************************************************************************* + * + * 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: fmsrcimp.hxx,v $ + * $Revision: 1.16 $ + * + * 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 _FMSRCIMP_HXX +#define _FMSRCIMP_HXX + +#include "fmtools.hxx" +#include <vos/thread.hxx> +#include <osl/mutex.hxx> +#include <com/sun/star/awt/XTextComponent.hpp> +#include <com/sun/star/awt/XCheckBox.hpp> +#include <com/sun/star/awt/XListBox.hpp> +#include <com/sun/star/util/XNumberFormatsSupplier.hpp> +#include <com/sun/star/util/XNumberFormatter.hpp> +#include <comphelper/stl_types.hxx> +#include <cppuhelper/implbase1.hxx> +#include <unotools/charclass.hxx> +#include <unotools/collatorwrapper.hxx> +#include "svx/svxdllapi.h" + +// =================================================================================================== +// Hilfsstrukturen + +SV_DECL_OBJARR(SvInt32Array, sal_Int32, 16, 16) + +// =================================================================================================== +// = class FmSearchThread - wie der Name schon sagt +// =================================================================================================== + +class FmSearchEngine; +class FmSearchThread : public ::vos::OThread +{ + FmSearchEngine* m_pEngine; + Link m_aTerminationHdl; + + virtual void SAL_CALL run(); + virtual void SAL_CALL onTerminated(); + +public: + FmSearchThread(FmSearchEngine* pEngine) : m_pEngine(pEngine) { } + void setTerminationHandler(Link aHdl) { m_aTerminationHdl = aHdl; } +}; + +// =================================================================================================== +// = struct FmSearchProgress - diese Struktur bekommt der Owner der SearchEngine fuer Status-Updates +// = (und am Ende der Suche) +// =================================================================================================== + +struct FmSearchProgress +{ + enum STATE { STATE_PROGRESS, STATE_PROGRESS_COUNTING, STATE_CANCELED, STATE_SUCCESSFULL, STATE_NOTHINGFOUND, STATE_ERROR }; + // (Bewegung auf neuen Datensatz; Fortschritt beim Zaehlen von Datensaetzen; abgebrochen; Datensatz gefunden; + // nichts gefunden, irgendein nicht zu handelnder Fehler) + STATE aSearchState; + + // aktueller Datensatz - immer gueltig (ist zum Beispiel bei Abbrechen auch fuer das Weitersuchen interesant) + sal_uInt32 nCurrentRecord; + // Ueberlauf - nur gueltig bei STATE_PROGRESS + sal_Bool bOverflow; + + // die Position des Such-Cursors - bei STATE_SUCCESSFULL, STATE_CANCELED und STATE_NOTHING_FOUND gueltig + ::com::sun::star::uno::Any aBookmark; + // das Feld, in dem der Text gefunden wurde - bei STATE_SUCCESSFULL gueltig + sal_Int32 nFieldIndex; +}; + +// =================================================================================================== +// = class FmRecordCountListener - Hilfsklasse fuer FmSearchEngine, lauscht an einem Cursor und teilt +// = Aenderungem im RecordCount mit +// =================================================================================================== + +class FmRecordCountListener : public ::cppu::WeakImplHelper1< ::com::sun::star::beans::XPropertyChangeListener> +{ +// Atribute + Link m_lnkWhoWantsToKnow; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xListening; + +// Attribut-Zugriff +public: + Link SetPropChangeHandler(const Link& lnk); + +// Oprationen +public: + FmRecordCountListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& dbcCursor); + // the set has to support the sdb::ResultSet service + virtual ~FmRecordCountListener(); + + // DECLARE_UNO3_AGG_DEFAULTS(FmPropertyListener, UsrObject); + // virtual sal_Bool queryInterface(::com::sun::star::uno::Uik aUik, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rOut); + +// ::com::sun::star::lang::XEventListener + virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException); + +// ::com::sun::star::beans::XPropertyChangeListener + virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException); + + void DisConnect(); + +private: + void NotifyCurrentCount(); + +}; + +// =================================================================================================== +// = class FmSearchEngine - Impl-Klasse fuer FmSearchDialog +// =================================================================================================== + +namespace svxform { + // We have three possible control types we may search in, determined by the supported interfaces : ::com::sun::star::awt::XTextComponent, ::com::sun::star::awt::XListBox, ::com::sun::star::awt::XCheckBox. + // While searching we don't want to do this distinction for every control in every round. So we need some helpers. + class ControlTextWrapper + { + // attributes + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xControl; + // attribute access + public: + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getControl() const{ return m_xControl; } + public: + ControlTextWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xControl) { m_xControl = _xControl; } + virtual ~ControlTextWrapper() { } + + virtual ::rtl::OUString getCurrentText() const = 0; + }; + class SimpleTextWrapper : public ControlTextWrapper + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent > m_xText; + public: + SimpleTextWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent >& _xText); + virtual ::rtl::OUString getCurrentText() const; + }; + class ListBoxWrapper : public ControlTextWrapper + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XListBox > m_xBox; + public: + ListBoxWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XListBox >& _xBox); + virtual ::rtl::OUString getCurrentText() const; + }; + class CheckBoxWrapper : public ControlTextWrapper + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XCheckBox > m_xBox; + public: + CheckBoxWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XCheckBox >& _xBox); + virtual ::rtl::OUString getCurrentText() const; + }; +} + +enum FMSEARCH_MODE { SM_BRUTE, SM_ALLOWSCHEDULE, SM_USETHREAD }; + +DECLARE_STL_VECTOR( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>, InterfaceArray); + +class SVX_DLLPUBLIC FmSearchEngine +{ + friend class FmSearchThread; + + enum SEARCH_RESULT { SR_FOUND, SR_NOTFOUND, SR_ERROR, SR_CANCELED }; + enum SEARCHFOR_TYPE { SEARCHFOR_STRING, SEARCHFOR_NULL, SEARCHFOR_NOTNULL }; + + // zugrundeliegende Daten + CursorWrapper m_xSearchCursor; + SvInt32Array m_arrFieldMapping; + // da der Iterator durchaus mehr Spalten haben kann, als ich eigentlich verwalte (in meiner Feld-Listbox), + // muss ich mir hier ein Mapping dieser ::com::sun::star::form-Schluessel auf die Indizies der entsprechenden Spalten im Iterator halten + + // der Formatter + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > m_xFormatSupplier; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xFormatter; + + CharClass m_aCharacterClassficator; + CollatorWrapper m_aStringCompare; + + // die Sammlung aller interesanten Felder (bzw. ihre ::com::sun::star::data::XDatabaseVariant-Interfaces und ihre FormatKeys) + struct FieldInfo + { + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn > xContents; + sal_uInt32 nFormatKey; + sal_Bool bDoubleHandling; + }; + + DECLARE_STL_VECTOR(FieldInfo, FieldCollection); + FieldCollection m_arrUsedFields; + sal_Int32 m_nCurrentFieldIndex; // der letzte Parameter von RebuildUsedFields, ermoeglicht mir Checks in FormatField + + DECLARE_STL_VECTOR(svxform::ControlTextWrapper*, ControlTextSuppliers); + ControlTextSuppliers m_aControlTexts; + + sal_Bool m_bUsingTextComponents; + CursorWrapper m_xOriginalIterator; + CursorWrapper m_xClonedIterator; + + // Daten fuer Entscheidung, in welchem Feld ich ein "Found" akzeptiere + ::com::sun::star::uno::Any m_aPreviousLocBookmark; // Position, an der ich zuletzt fuendig war + FieldCollectionIterator m_iterPreviousLocField; // dito Feld + + // Kommunikation mit dem Thread, der die eigentliche Suche durchfuehrt + ::rtl::OUString m_strSearchExpression; // Hinrichtung + SEARCHFOR_TYPE m_eSearchForType; // dito + SEARCH_RESULT m_srResult; // Rueckrichtung + + // der Link, dem ich Fortschritte und Ergebnisse mitteile + Link m_aProgressHandler; + sal_Bool m_bSearchingCurrently : 1; // laeuft gerade eine (asynchrone) Suche ? + sal_Bool m_bCancelAsynchRequest : 1; // soll abgebrochen werden ? + ::osl::Mutex m_aCancelAsynchAccess; // Zugriff auf m_bCancelAsynchRequest (eigentlich nur bei + // m_eMode == SM_USETHREAD interesant) + FMSEARCH_MODE m_eMode; //CHINA001 FmSearchDialog::SEARCH_MODE m_eMode; // der aktuelle Modus + // der aktuelle Modus + + // Parameter fuer die Suche + sal_Bool m_bFormatter : 1; // Feldformatierung benutzen + sal_Bool m_bForward : 1; // Richtung + sal_Bool m_bWildcard : 1; // Platzhalter-Suche ? + sal_Bool m_bRegular : 1; // regulaerer Ausdruck + sal_Bool m_bLevenshtein : 1; // Levenshtein-Suche + sal_Bool m_bTransliteration : 1; // Levenshtein-Suche + + sal_Bool m_bLevRelaxed : 1; // Parameter fuer Levenshtein-Suche + sal_uInt16 m_nLevOther; + sal_uInt16 m_nLevShorter; + sal_uInt16 m_nLevLonger; + + sal_uInt16 m_nPosition; // wenn nicht regulaer oder lev, dann einer der MATCHING_...-Werte + + sal_Int32 m_nTransliterationFlags; + +// ------------- +// Memberzugriff +private: + SVX_DLLPRIVATE sal_Bool CancelRequested(); // liefert eine durch m_aCancelAsynchAccess gesicherte Auswertung von m_bCancelAsynchRequest + +public: + void SetCaseSensitive(sal_Bool bSet); + sal_Bool GetCaseSensitive() const; + + void SetFormatterUsing(sal_Bool bSet); // das ist etwas umfangreicher, deshalb kein hier inline .... + sal_Bool GetFormatterUsing() const { return m_bFormatter; } + + void SetDirection(sal_Bool bForward) { m_bForward = bForward; } + sal_Bool GetDirection() const { return m_bForward; } + + void SetWildcard(sal_Bool bSet) { m_bWildcard = bSet; } + sal_Bool GetWildcard() const { return m_bWildcard; } + + void SetRegular(sal_Bool bSet) { m_bRegular = bSet; } + sal_Bool GetRegular() const { return m_bRegular; } + + void SetLevenshtein(sal_Bool bSet) { m_bLevenshtein = bSet; } + sal_Bool GetLevenshtein() const { return m_bLevenshtein; } + + void SetIgnoreWidthCJK(sal_Bool bSet); + sal_Bool GetIgnoreWidthCJK() const; + + void SetTransliteration(sal_Bool bSet) { m_bTransliteration = bSet; } + sal_Bool GetTransliteration() const { return m_bTransliteration; } + + void SetLevRelaxed(sal_Bool bSet) { m_bLevRelaxed = bSet; } + sal_Bool GetLevRelaxed() const { return m_bLevRelaxed; } + void SetLevOther(sal_uInt16 nHowMuch) { m_nLevOther = nHowMuch; } + sal_uInt16 GetLevOther() const { return m_nLevOther; } + void SetLevShorter(sal_uInt16 nHowMuch) { m_nLevShorter = nHowMuch; } + sal_uInt16 GetLevShorter() const { return m_nLevShorter; } + void SetLevLonger(sal_uInt16 nHowMuch) { m_nLevLonger = nHowMuch; } + sal_uInt16 GetLevLonger() const { return m_nLevLonger; } + // die ganzen Lev-Werte werden nur bei m_bLevenshtein==sal_True beachtet + + void SetTransliterationFlags(sal_Int32 _nFlags) { m_nTransliterationFlags = _nFlags; } + sal_Int32 GetTransliterationFlags() const { return m_nTransliterationFlags; } + + void SetPosition(sal_uInt16 nValue) { m_nPosition = nValue; } + sal_uInt16 GetPosition() const { return m_nPosition; } + // Position wird bei m_bWildCard==sal_True nicht beachtet + + FMSEARCH_MODE GetSearchMode() const { return m_eMode; } + +public: + /** zwei Constructoren, beide analog zu denen des FmSearchDialog, Erklaerung siehe also dort .... + xCursor muss jeweils den ::com::sun::star::data::DatabaseCursor-Service implementieren. + wenn eMode == SM_USETHREAD, sollte ein ProgressHandler gesetzt sein, da dann die Ergebnisuebermittlung ueber diesen + Handler erfolgt. + Ist eMode != SM_USETHREAD, kehren SearchNext und StarOver nicht zurueck, bevor die Suche (erfolgreich oder nicht) beendet + wurde, dann kann man das Ergebnis danach abfragen. Ist zusaetzlich der ProgressHandler gesetzt, wird dieser fuer jeden neuen + Datensatz sowie am Ende der Suche aufgerufen. + */ + FmSearchEngine( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& xCursor, + const ::rtl::OUString& strVisibleFields, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xFormat, + FMSEARCH_MODE eMode);//CHINA001 FmSearchDialog::SEARCH_MODE eMode); + FmSearchEngine( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& xCursor, + const ::rtl::OUString& strVisibleFields, + const InterfaceArray& arrFields, + FMSEARCH_MODE eMode); //CHINA001 FmSearchDialog::SEARCH_MODE eMode); + + virtual ~FmSearchEngine(); + + /** der Link wird fuer jeden Datensatz und nach Beendigung der Suche aufgerufen, Parameter ist ein Zeiger auf + eine FmSearchProgress-Struktur + der Handler sollte auf jeden Fall Thread-sicher sein + */ + void SetProgressHandler(Link aHdl) { m_aProgressHandler = aHdl; } + + /// das naechste Vorkommen suchen (Werte fuer nDirection siehe DIRECTION_*-defines) + void SearchNext(const ::rtl::OUString& strExpression); + /// analogous, search for "NULL" (_bSearchForNull==sal_True) or "not NULL" + void SearchNextSpecial(sal_Bool _bSearchForNull); + /// das naechste Vorkommen suchen, abhaengig von nDirection wird dabei am Anfang oder am Ende neu begonnen + void StartOver(const ::rtl::OUString& strExpression); + /// analogous, search for "NULL" (_bSearchForNull==sal_True) or "not NULL" + void StartOverSpecial(sal_Bool _bSearchForNull); + /// die Angaben ueber letzte Fundstelle invalidieren + void InvalidatePreviousLoc(); + + /** baut m_arrUsedFields neu auf (nFieldIndex==-1 bedeutet alle Felder, ansonsten gibt es den Feldindex an) + wenn bForce nicht gesetzt ist, passiert bei nFieldIndex == m_nCurrentFieldIndex nichts + (ruft InvalidatePreviousLoc auf) + */ + void RebuildUsedFields(sal_Int32 nFieldIndex, sal_Bool bForce = sal_False); + ::rtl::OUString FormatField(sal_Int32 nWhich); + + /// kehrt sofort zurueck; nachdem wirklich abgebrochen wurde, wird der ProgressHandler mit STATE_CANCELED aufgerufen + void CancelSearch(); + + /** nur gueltig, wenn nicht gerade eine (asynchrone) Suche laeuft, die naechste Suche wird dann auf dem neuen Iterator + mit den neuen Parametern durchgefuehrt + */ + sal_Bool SwitchToContext(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& xCursor, const ::rtl::OUString& strVisibleFields, const InterfaceArray& arrFields, + sal_Int32 nFieldIndex); + +protected: + void Init(const ::rtl::OUString& strVisibleFields); + + void SearchNextImpl(); + // diese Impl-Methode laeuft im SearchThread + + // start a thread-search (or call SearchNextImpl directly, depending on the search mode) + void ImplStartNextSearch(); + +private: + SVX_DLLPRIVATE void clearControlTexts(); + SVX_DLLPRIVATE void fillControlTexts(const InterfaceArray& arrFields); + + // three methods implementing a complete search loop (null/not null, wildcard, SearchText) + // (they all have some code in common, but with this solution we have do do a distinction only once per search (before + // starting the loop), not in every loop step + SVX_DLLPRIVATE SEARCH_RESULT SearchSpecial(sal_Bool _bSearchForNull, sal_Int32& nFieldPos, FieldCollectionIterator& iterFieldLoop, + const FieldCollectionIterator& iterBegin, const FieldCollectionIterator& iterEnd); + SVX_DLLPRIVATE SEARCH_RESULT SearchWildcard(const ::rtl::OUString& strExpression, sal_Int32& nFieldPos, FieldCollectionIterator& iterFieldLoop, + const FieldCollectionIterator& iterBegin, const FieldCollectionIterator& iterEnd); + SVX_DLLPRIVATE SEARCH_RESULT SearchRegularApprox(const ::rtl::OUString& strExpression, sal_Int32& nFieldPos, FieldCollectionIterator& iterFieldLoop, + const FieldCollectionIterator& iterBegin, const FieldCollectionIterator& iterEnd); + + SVX_DLLPRIVATE void PropagateProgress(sal_Bool _bDontPropagateOverflow); + // ruft den ProgressHandler mit STATE_PROGRESS und der aktuellen Position des SearchIterators auf + + // helpers, die ich mehrmals brauche + SVX_DLLPRIVATE sal_Bool MoveCursor(); + // bewegt m_xSearchIterator unter Beachtung von Richtung/Ueberlauf Cursor + SVX_DLLPRIVATE sal_Bool MoveField(sal_Int32& nPos, FieldCollectionIterator& iter, const FieldCollectionIterator& iterBegin, const FieldCollectionIterator& iterEnd); + // bewegt den Iterator unter Beachtung von Richtung/Ueberlauf Iterator/Ueberlauf Cursor + SVX_DLLPRIVATE void BuildAndInsertFieldInfo(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& xAllFields, sal_Int32 nField); + // baut eine FieldInfo zum Feld Nummer nField (in xAllFields) auf und fuegt sie zu m_arrUsedFields hinzu + // xAllFields muss den DatabaseRecord-Service unterstuetzen + SVX_DLLPRIVATE ::rtl::OUString FormatField(const FieldInfo& rField); + // formatiert das Feld mit dem NumberFormatter + + SVX_DLLPRIVATE sal_Bool HasPreviousLoc() { return m_aPreviousLocBookmark.hasValue(); } + + DECL_LINK(OnSearchTerminated, FmSearchThread*); + // wird vom SuchThread benutzt, nach Rueckkehr aus diesem Handler loescht sich der Thread selber + DECL_LINK(OnNewRecordCount, void*); +}; + +#endif // _FMSRCIMP_HXX + diff --git a/svx/source/inc/fmtextcontroldialogs.hxx b/svx/source/inc/fmtextcontroldialogs.hxx new file mode 100644 index 000000000000..1158baa78f69 --- /dev/null +++ b/svx/source/inc/fmtextcontroldialogs.hxx @@ -0,0 +1,73 @@ +/************************************************************************* + * + * 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: fmtextcontroldialogs.hxx,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. + * + ************************************************************************/ + +#ifndef SVX_SOURCE_FORM_FMTEXTCONTROLDIALOGS_HXX +#define SVX_SOURCE_FORM_FMTEXTCONTROLDIALOGS_HXX + +#include <sfx2/sfxsids.hrc> +#include <sfx2/tabdlg.hxx> +#include <flstitem.hxx> + +//........................................................................ +namespace svx +{ +//........................................................................ + + //==================================================================== + //= TextControlCharAttribDialog + //==================================================================== + class TextControlCharAttribDialog : public SfxTabDialog + { + private: + SvxFontListItem m_aFontList; + + public: + TextControlCharAttribDialog( Window* pParent, const SfxItemSet& _rCoreSet, const SvxFontListItem& _rFontList ); + ~TextControlCharAttribDialog(); + + protected: + virtual void PageCreated( USHORT _nId, SfxTabPage& _rPage ); + }; + + //==================================================================== + //= TextControlParaAttribDialog + //==================================================================== + class TextControlParaAttribDialog : public SfxTabDialog + { + public: + TextControlParaAttribDialog( Window* _pParent, const SfxItemSet& _rCoreSet ); + ~TextControlParaAttribDialog(); + }; +//........................................................................ +} // namespace svx +//........................................................................ + +#endif // SVX_SOURCE_FORM_FMTEXTCONTROLDIALOGS_HXX + diff --git a/svx/source/inc/fmtextcontrolfeature.hxx b/svx/source/inc/fmtextcontrolfeature.hxx new file mode 100644 index 000000000000..00f4758b95f8 --- /dev/null +++ b/svx/source/inc/fmtextcontrolfeature.hxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * 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: fmtextcontrolfeature.hxx,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. + * + ************************************************************************/ + +#ifndef SVX_SOURCE_INC_FMTEXTCONTROLFEATURE_HXX +#define SVX_SOURCE_INC_FMTEXTCONTROLFEATURE_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/util/URL.hpp> +/** === end UNO includes === **/ +#include <cppuhelper/implbase1.hxx> +#include "fmslotinvalidator.hxx" + +//........................................................................ +namespace svx +{ +//........................................................................ + + //==================================================================== + //= FmTextControlFeature + //==================================================================== + typedef ::cppu::WeakImplHelper1 < ::com::sun::star::frame::XStatusListener + > FmTextControlFeature_Base; + + class FmTextControlFeature : public FmTextControlFeature_Base + { + private: + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > + m_xDispatcher; + ::com::sun::star::util::URL m_aFeatureURL; + ::com::sun::star::uno::Any m_aFeatureState; + SfxSlotId m_nSlotId; + ISlotInvalidator* m_pInvalidator; + bool m_bFeatureEnabled; + + public: + /** constructs an FmTextControlFeature object + @param _rxDispatcher + the dispatcher which the instance should work with + @param _rFeatureURL + the URL which the instance should be responsible for + */ + FmTextControlFeature( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _rxDispatcher, + const ::com::sun::star::util::URL& _rFeatureURL, + SfxSlotId _nId, + ISlotInvalidator* _pInvalidator + ); + + /// determines whether the feature we're responsible for is currently enabled + inline bool isFeatureEnabled( ) const { return m_bFeatureEnabled; } + inline const ::com::sun::star::uno::Any& getFeatureState( ) const { return m_aFeatureState; } + + /** dispatches the feature URL to the dispatcher + */ + void dispatch() const SAL_THROW(()); + + /** dispatches the feature URL to the dispatcher, with passing the given arguments + */ + void dispatch( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArgs ) const SAL_THROW(()); + + /// releases any resources associated with this instance + void dispose() SAL_THROW(()); + + protected: + ~FmTextControlFeature(); + + protected: + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& State ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); + }; + +//........................................................................ +} // namespace svx +//........................................................................ + +#endif // SVX_SOURCE_INC_FMTEXTCONTROLFEATURE_HXX + diff --git a/svx/source/inc/fmtextcontrolshell.hxx b/svx/source/inc/fmtextcontrolshell.hxx new file mode 100644 index 000000000000..17ba06d5513b --- /dev/null +++ b/svx/source/inc/fmtextcontrolshell.hxx @@ -0,0 +1,227 @@ +/************************************************************************* + * + * 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: fmtextcontrolshell.hxx,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. + * + ************************************************************************/ +#ifndef SVX_SOURCE_INC_FMTEXTCONTROLSHELL_HXX +#define SVX_SOURCE_INC_FMTEXTCONTROLSHELL_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/awt/XTextComponent.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/awt/XFocusListener.hpp> +#include <com/sun/star/awt/XMouseListener.hpp> +#include <com/sun/star/form/XFormController.hpp> +#include <com/sun/star/awt/XControl.hpp> +#include <com/sun/star/util/XURLTransformer.hpp> +/** === end UNO includes === **/ +#include <comphelper/implementationreference.hxx> +#include <tools/link.hxx> +#include <vcl/timer.hxx> +#include "fmslotinvalidator.hxx" + +#include <vector> +#include <map> + +class SfxRequest; +class SfxItemSet; +class SfxAllItemSet; +class SfxBindings; +class SfxViewFrame; +class Window; +class SfxApplication; + +//........................................................................ +namespace svx +{ +//........................................................................ + + class FmFocusListenerAdapter; + class FmTextControlFeature; + class FmMouseListenerAdapter; + + //==================================================================== + //= IFocusObserver + //==================================================================== + class IFocusObserver + { + public: + virtual void focusGained( const ::com::sun::star::awt::FocusEvent& _rEvent ) = 0; + virtual void focusLost( const ::com::sun::star::awt::FocusEvent& _rEvent ) = 0; + }; + + //==================================================================== + //= IFocusObserver + //==================================================================== + class IContextRequestObserver + { + public: + virtual void contextMenuRequested( const ::com::sun::star::awt::MouseEvent& _rEvent ) = 0; + }; + + //==================================================================== + //= FmTextControlShell + //==================================================================== + class FmTextControlShell :public IFocusObserver + ,public ISlotInvalidator + ,public IContextRequestObserver + { + private: + ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > m_xActiveControl; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent > m_xActiveTextComponent; + ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > m_xActiveController; +#ifndef DONT_REMEMBER_LAST_CONTROL + // without this define, m_xActiveControl remembers the *last* active control, even + // if it, in the meantime, already lost the focus + bool m_bActiveControl; + // so we need an additional boolean flag telling whether the active cotrol + // is really focused +#endif + bool m_bActiveControlIsReadOnly; + bool m_bActiveControlIsRichText; + + // listening at all controls of the active controller for focus changes + typedef ::comphelper::ImplementationReference< FmFocusListenerAdapter, ::com::sun::star::awt::XFocusListener > + FocusListenerAdapter; + typedef ::std::vector< FocusListenerAdapter > FocusListenerAdapters; + FocusListenerAdapters m_aControlObservers; + + typedef ::comphelper::ImplementationReference< FmMouseListenerAdapter, ::com::sun::star::awt::XMouseListener > + MouseListenerAdapter; + MouseListenerAdapter m_aContextMenuObserver; + + // translating between "slots" of the framework and "features" of the active control + typedef ::comphelper::ImplementationReference< FmTextControlFeature, ::com::sun::star::frame::XStatusListener > + ControlFeature; + typedef ::std::map< SfxSlotId, ControlFeature, ::std::less< SfxSlotId > > ControlFeatures; + ControlFeatures m_aControlFeatures; + + SfxViewFrame* m_pViewFrame; + // invalidating slots + SfxBindings& m_rBindings; + Link m_aControlActivationHandler; + AutoTimer m_aClipboardInvalidation; + bool m_bNeedClipboardInvalidation; + + public: + FmTextControlShell( SfxViewFrame* _pFrame ); + virtual ~FmTextControlShell(); + + // clean up any resources associated with this instance + void dispose(); + + void ExecuteTextAttribute( SfxRequest& _rReq ); + void GetTextAttributeState( SfxItemSet& _rSet ); + bool IsActiveControl( bool _bCountRichTextOnly = false ) const; + void ForgetActiveControl(); + void SetControlActivationHandler( const Link& _rHdl ) { m_aControlActivationHandler = _rHdl; } + + /** to be called when a form in our document has been activated + */ + void formActivated( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController >& _rxController ); + /** to be called when a form in our document has been deactivated + */ + void formDeactivated( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController >& _rxController ); + + /** notifies the instance that the design mode has changed + */ + void designModeChanged( bool _bNewDesignMode ); + + protected: + // IFocusObserver + virtual void focusGained( const ::com::sun::star::awt::FocusEvent& _rEvent ); + virtual void focusLost( const ::com::sun::star::awt::FocusEvent& _rEvent ); + + // IContextRequestObserver + virtual void contextMenuRequested( const ::com::sun::star::awt::MouseEvent& _rEvent ); + + // ISlotInvalidator + virtual void Invalidate( SfxSlotId _nSlot ); + + protected: + enum AttributeSet { eCharAttribs, eParaAttribs }; + void executeAttributeDialog( AttributeSet _eSet, SfxRequest& _rReq ); + bool executeSelectAll( ); + bool executeClipboardSlot( SfxSlotId _nSlot ); + + private: + inline bool isControllerListening() const { return !m_aControlObservers.empty(); } + + FmTextControlFeature* + implGetFeatureDispatcher( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& _rxProvider, + SfxApplication* _pApplication, + SfxSlotId _nSlot + ); + + // fills the given structure with dispatchers for the given slots, for the given control + void fillFeatureDispatchers( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > _rxControl, + SfxSlotId* _pZeroTerminatedSlots, + ControlFeatures& _rDispatchers + ); + + /// creates SfxPoolItes for all features in the given set, and puts them into the given SfxAllItemSet + void transferFeatureStatesToItemSet( + ControlFeatures& _rDispatchers, + SfxAllItemSet& _rSet, + bool _bTranslateLatin = false + ); + + /// to be called when a control has been activated + void controlActivated( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl ); + /// to be called when the currently active control has been deactivated + void controlDeactivated( ); + + void implClearActiveControlRef(); + + /** starts listening at all controls of the given controller for focus events + @precond + we don't have an active controller currently + */ + void startControllerListening( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController >& _rxController ); + /** stops listening at the active controller + @precond + we have an active controller currently + */ + void stopControllerListening( ); + + /** parses the given URL's Complete member, by calling XURLTransformer::parseString + */ + void impl_parseURL_nothrow( ::com::sun::star::util::URL& _rURL ); + + DECL_LINK( OnInvalidateClipboard, void* ); + }; + +//........................................................................ +} // namespace svx +//........................................................................ + +#endif // SVX_SOURCE_INC_FMTEXTCONTROLSHELL_HXX + diff --git a/svx/source/inc/fmtools.hxx b/svx/source/inc/fmtools.hxx new file mode 100644 index 000000000000..935e84c6448e --- /dev/null +++ b/svx/source/inc/fmtools.hxx @@ -0,0 +1,383 @@ +/************************************************************************* + * + * 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: fmtools.hxx,v $ + * $Revision: 1.27 $ + * + * 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 _SVX_FMTOOLS_HXX +#define _SVX_FMTOOLS_HXX + +#include <com/sun/star/sdb/SQLContext.hpp> +#include <com/sun/star/sdb/XSQLQueryComposerFactory.hpp> +#include <com/sun/star/sdbcx/Privilege.hpp> +#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> +#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> +#include <com/sun/star/sdbc/XRowSet.hpp> +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#include <com/sun/star/sdb/XColumn.hpp> +#include <com/sun/star/sdb/XColumnUpdate.hpp> +#include <com/sun/star/sdb/SQLErrorEvent.hpp> +#include <com/sun/star/sdbc/XConnection.hpp> +#include <com/sun/star/sdbc/XResultSet.hpp> +#include <com/sun/star/sdbc/XResultSetUpdate.hpp> +#include <com/sun/star/sdbcx/XRowLocate.hpp> +#include <com/sun/star/sdbc/XDataSource.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/frame/XDispatchProviderInterception.hpp> +#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> +#include <com/sun/star/frame/XInterceptorInfo.hpp> +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/FeatureStateEvent.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/script/ScriptEventDescriptor.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XEnumeration.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/awt/XControlModel.hpp> +#include <com/sun/star/awt/XControl.hpp> +#include <com/sun/star/awt/FontSlant.hpp> +#include <com/sun/star/awt/FontDescriptor.hpp> +#include <com/sun/star/awt/FontUnderline.hpp> +#include <com/sun/star/awt/FontStrikeout.hpp> +#include <com/sun/star/util/XNumberFormatsSupplier.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <vcl/wintypes.hxx> +#include <vos/mutex.hxx> + +#ifndef _SVSTDARR_ULONGS +#define _SVSTDARR_ULONGS +#include <svtools/svstdarr.hxx> +#endif +#include <sfx2/ctrlitem.hxx> +#include <tools/link.hxx> +#include <tools/date.hxx> +#include <tools/time.hxx> +#include <tools/datetime.hxx> + +#include "fmprop.hrc" +#include <com/sun/star/sdbc/XConnection.hpp> +#include <com/sun/star/io/XObjectInputStream.hpp> +#include <com/sun/star/io/XObjectOutputStream.hpp> +#include <com/sun/star/io/XPersistObject.hpp> +#include <com/sun/star/util/XNumberFormatter.hpp> +#include <com/sun/star/util/XNumberFormats.hpp> +#include <cppuhelper/interfacecontainer.h> +#include <cppuhelper/compbase2.hxx> +#include <cppuhelper/compbase3.hxx> +#include <cppuhelper/weakref.hxx> +#include <comphelper/uno3.hxx> +#include <comphelper/stl_types.hxx> +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase3.hxx> +#include <cppuhelper/component.hxx> + +#include <svx/svxdllapi.h> + +#include <set> + +class Window; + +//================================================================== +// allgemeine Typen +//================================================================== +// displaying a database exception for the user +// display info about a simple ::com::sun::star::sdbc::SQLException +void displayException(const ::com::sun::star::sdbc::SQLException&, Window* _pParent = NULL); +void displayException(const ::com::sun::star::sdbc::SQLWarning&, Window* _pParent = NULL); +SVX_DLLPUBLIC void displayException(const ::com::sun::star::sdb::SQLContext&, Window* _pParent = NULL); +void displayException(const ::com::sun::star::sdb::SQLErrorEvent&, Window* _pParent = NULL); +void displayException(const ::com::sun::star::uno::Any&, Window* _pParent = NULL); + +#define DATA_MODE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DataMode" ) ) +#define FILTER_MODE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterMode" ) ) + +// Kopieren von Persistenten Objecten +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> cloneUsingProperties(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XPersistObject>& _xObj); + +sal_Int32 findPos(const ::rtl::OUString& aStr, const ::com::sun::star::uno::Sequence< ::rtl::OUString>& rList); + +// Suchen in einer Indexliste nach einem Element +sal_Bool searchElement(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& xCont, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& xElement); + +sal_Int32 getElementPos(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& xCont, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& xElement); +String getFormComponentAccessPath(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xElement); +String getFormComponentAccessPath(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xElement, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rTopLevelElement); +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> getElementFromAccessPath(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xParent, const String& _rRelativePath); + + +::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel> getXModel(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& xIface); + +SVX_DLLPUBLIC ::rtl::OUString getLabelName(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& xControlModel); + +// =================================================================================================== +// = class CursorWrapper - eine Hilfsklasse, die parallel mit je einem ::com::sun::star::uno::Reference<XDatabaseUpdateCursor>, +// XDatabaseBookmarkCursor und XDatabaseDirectCursor arbeitet +// =================================================================================================== + +class CursorWrapper +{ +private: + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xGeneric; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> m_xMoveOperations; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XRowLocate> m_xBookmarkOperations; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier> m_xColumnsSupplier; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xPropertyAccess; + +public: + // Construction/Destruction + CursorWrapper() { } + CursorWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxCursor, sal_Bool bUseCloned = sal_False); + SVX_DLLPUBLIC CursorWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _rxCursor, sal_Bool bUseCloned = sal_False); + // bei bUseCloned == sal_True wird der Cursor ueber das XCloneable-Interface (dass er besitzen muss) gedoubled und + // erst dann benutzt + + friend bool operator==(const CursorWrapper& lhs, const CursorWrapper& rhs) + { + return lhs.m_xGeneric.get() == rhs.m_xGeneric.get(); + } + + sal_Bool is() const { return m_xMoveOperations.is(); } + sal_Bool Is() const { return m_xMoveOperations.is(); } + + CursorWrapper* operator ->() { return this; } + operator const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& () const{ return m_xGeneric; } + + // 'Konvertierungen' + const CursorWrapper& operator=(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& xCursor); + operator const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& () const { return m_xMoveOperations; } + operator const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XRowLocate>& () const { return m_xBookmarkOperations; } + operator const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier>& () const { return m_xColumnsSupplier; } + + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& getPropertySet() const { return m_xPropertyAccess; } + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& getResultSet() const { return m_xMoveOperations; } + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XRowLocate >& getRowLocate() const { return m_xBookmarkOperations; } + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier >& getColumnsSupplier() const { return m_xColumnsSupplier; } + + // das normale queryInterface + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& type) throw ( ::com::sun::star::uno::RuntimeException ) + { return m_xMoveOperations->queryInterface(type); } + + // ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XRowLocate> + ::com::sun::star::uno::Any getBookmark(void) + throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ) + { return m_xBookmarkOperations->getBookmark(); } + sal_Bool moveToBookmark(const ::com::sun::star::uno::Any& bookmark) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ) { return m_xBookmarkOperations->moveToBookmark(bookmark); } + sal_Bool moveRelativeToBookmark(const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ) { return m_xBookmarkOperations->moveRelativeToBookmark(bookmark, rows); } + sal_Int32 compareBookmarks(const ::com::sun::star::uno::Any& lhs, const ::com::sun::star::uno::Any& rhs) const throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ) { return m_xBookmarkOperations->compareBookmarks(lhs, rhs); } + sal_Int32 hasOrderedBookmarks(void) const throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ) { return m_xBookmarkOperations->hasOrderedBookmarks(); } + sal_Int32 hashBookmark(const ::com::sun::star::uno::Any& bookmark) const throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ) { return m_xBookmarkOperations->hashBookmark(bookmark); } + + // ::com::sun::star::sdbc::XResultSet + sal_Bool isBeforeFirst() const { return m_xMoveOperations->isBeforeFirst(); } + sal_Bool isAfterLast() const { return m_xMoveOperations->isAfterLast(); } + sal_Bool isFirst() const { return m_xMoveOperations->isFirst(); } + sal_Bool isLast() const { return m_xMoveOperations->isLast(); } + void beforeFirst() { m_xMoveOperations->beforeFirst(); } + sal_Bool first() { return m_xMoveOperations->first(); } + sal_Bool last() { return m_xMoveOperations->last(); } + sal_Int32 getRow() const { return m_xMoveOperations->getRow(); } + sal_Bool absolute(sal_Int32 nPosition) { return m_xMoveOperations->absolute(nPosition); } + sal_Bool relative(sal_Int32 nCount) { return m_xMoveOperations->relative(nCount); } + sal_Bool previous() { return m_xMoveOperations->previous(); } + sal_Bool next() { return m_xMoveOperations->next(); } + void refreshRow() { m_xMoveOperations->refreshRow(); } + sal_Bool rowUpdated() { return m_xMoveOperations->rowUpdated(); } + sal_Bool rowInserted() { return m_xMoveOperations->rowInserted(); } + sal_Bool rowDeleted() { return m_xMoveOperations->rowDeleted(); } + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> getStatement() { return m_xMoveOperations->getStatement(); } + // ::com::sun::star::sdbcx::XColumnsSupplier + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> getColumns() const throw( ::com::sun::star::uno::RuntimeException ) { return m_xColumnsSupplier->getColumns(); } +private: + void ImplConstruct(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _rxCursor, sal_Bool bUseCloned); +}; + + +class FmXDisposeMultiplexer; +class FmXDisposeListener +{ + friend class FmXDisposeMultiplexer; + + FmXDisposeMultiplexer* m_pAdapter; + ::osl::Mutex& m_rMutex; + +public: + FmXDisposeListener(::osl::Mutex& _rMutex) : m_pAdapter(NULL), m_rMutex(_rMutex) { } + virtual ~FmXDisposeListener(); + + virtual void disposing(const ::com::sun::star::lang::EventObject& _rEvent, sal_Int16 _nId) throw( ::com::sun::star::uno::RuntimeException ) = 0; + +protected: + void setAdapter(FmXDisposeMultiplexer* pAdapter); +}; + +typedef ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener> FmXDisposeMultiplexer_x; +//============================================================================== + + +class FmXDisposeMultiplexer :public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener> +{ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent> m_xObject; + FmXDisposeListener* m_pListener; + sal_Int16 m_nId; + + virtual ~FmXDisposeMultiplexer(); +public: + FmXDisposeMultiplexer(FmXDisposeListener* _pListener, const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>& _rxObject, sal_Int16 _nId = -1); + +// ::com::sun::star::lang::XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); + + void dispose(); +}; + +// ================================================================== + +//======================================================================== +//= dispatch interception helper classes +//======================================================================== + +//------------------------------------------------------------------------ +//- FmDispatchInterceptor +//------------------------------------------------------------------------ +class FmDispatchInterceptor +{ +public: + FmDispatchInterceptor() { } + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch> interceptedQueryDispatch(sal_uInt16 _nId, + const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags) throw( ::com::sun::star::uno::RuntimeException ) = 0; + + virtual ::osl::Mutex* getInterceptorMutex() = 0; +}; + +//------------------------------------------------------------------------ +//- FmXDispatchInterceptorImpl +//------------------------------------------------------------------------ +typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::frame::XDispatchProviderInterceptor + , ::com::sun::star::lang::XEventListener + , ::com::sun::star::frame::XInterceptorInfo + > FmXDispatchInterceptorImpl_BASE; + +class FmXDispatchInterceptorImpl : public FmXDispatchInterceptorImpl_BASE +{ + ::osl::Mutex m_aFallback; + + // the component which's dispatches we're intercepting + ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XDispatchProviderInterception> + m_xIntercepted; + sal_Bool m_bListening; + + // the real interceptor + FmDispatchInterceptor* m_pMaster; + + // chaining + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider> m_xSlaveDispatcher; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider> m_xMasterDispatcher; + + // our id + sal_Int16 m_nId; + + ::com::sun::star::uno::Sequence< ::rtl::OUString > + m_aInterceptedURLSchemes; + + virtual ~FmXDispatchInterceptorImpl(); + +public: + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception> getIntercepted() const { return m_xIntercepted; } + +public: + FmXDispatchInterceptorImpl( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception>& _rToIntercept, + FmDispatchInterceptor* _pMaster, + sal_Int16 _nId, + ::com::sun::star::uno::Sequence< ::rtl::OUString > _rInterceptedSchemes /// if not empty, this will be used for getInterceptedURLs + ); + + // StarOne + DECLARE_UNO3_DEFAULTS(FmXDispatchInterceptorImpl, FmXDispatchInterceptorImpl_BASE); + // virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& type) throw ( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + // ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + + // ::com::sun::star::frame::XDispatchProvider + virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& aDescripts ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::frame::XDispatchProviderInterceptor + virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getSlaveDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setSlaveDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewDispatchProvider ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getMasterDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setMasterDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewSupplier ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::frame::XInterceptorInfo + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getInterceptedURLs( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); + + // OComponentHelper + virtual void SAL_CALL disposing(); + +protected: + void ImplDetach(); + + ::osl::Mutex& getAccessSafety() + { + if (m_pMaster && m_pMaster->getInterceptorMutex()) + return *m_pMaster->getInterceptorMutex(); + return m_aFallback; + } +}; + +//================================================================== +// ... +//================================================================== +::rtl::OUString getServiceNameByControlType(sal_Int16 nType); + // get a service name to create a model of the given type (OBJ_FM_...) +sal_Int16 getControlTypeByObject(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo>& _rxObject); + // get the object type (OBJ_FM_...) from the services the object supports + +void TransferEventScripts(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel>& xModel, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl, + const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor>& rTransferIfAvailable); + +sal_Int16 GridView2ModelPos(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& rColumns, sal_Int16 nViewPos); + +//================================================================== +sal_Bool isLoadable(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& xLoad); +sal_Bool isRowSetAlive(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rxRowSet); + // checks if the ::com::sun::star::sdbcx::XColumnsSupplier provided by _rxRowSet supllies any columns + +//================================================================== +typedef ::std::set < ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > + , ::comphelper::OInterfaceCompare< ::com::sun::star::uno::XInterface > + > InterfaceBag; + +#endif // _SVX_FMTOOLS_HXX + diff --git a/svx/source/inc/fmundo.hxx b/svx/source/inc/fmundo.hxx new file mode 100644 index 000000000000..596eaac0014e --- /dev/null +++ b/svx/source/inc/fmundo.hxx @@ -0,0 +1,233 @@ +/************************************************************************* + * + * 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: fmundo.hxx,v $ + * $Revision: 1.16 $ + * + * 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 _SVX_FMUNDO_HXX +#define _SVX_FMUNDO_HXX + +#include <svx/svdundo.hxx> +#include <svx/svdouno.hxx> +#include "fmscriptingenv.hxx" + + +/** === begin UNO includes === **/ +#include <com/sun/star/util/XModifyListener.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertyChangeListener.hpp> +#include <com/sun/star/beans/PropertyChangeEvent.hpp> +#include <com/sun/star/script/ScriptEvent.hpp> +#include <com/sun/star/script/ScriptEventDescriptor.hpp> +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/container/XContainerListener.hpp> +#include <com/sun/star/container/ContainerEvent.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +/** === end UNO includes === **/ +#include <cppuhelper/implbase3.hxx> + + +#include <svtools/lstner.hxx> +#include <comphelper/uno3.hxx> + +class FmFormModel; +class FmFormObj; +class SdrObject; +class FmXFormView; + +FORWARD_DECLARE_INTERFACE(awt,XControl) +FORWARD_DECLARE_INTERFACE(awt,XControlContainer) +//FORWARD_DECLARE_INTERFACE(uno,Reference) + +//================================================================== +// FmUndoPropertyAction +//================================================================== +class FmUndoPropertyAction: public SdrUndoAction +{ + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xObj; + ::rtl::OUString aPropertyName; + ::com::sun::star::uno::Any aNewValue; + ::com::sun::star::uno::Any aOldValue; + +public: + FmUndoPropertyAction(FmFormModel& rMod, const ::com::sun::star::beans::PropertyChangeEvent& evt); + + virtual void Undo(); + virtual void Redo(); + + virtual String GetComment() const; + +}; + +//================================================================== +// FmUndoContainerAction +//================================================================== +class FmUndoContainerAction: public SdrUndoAction +{ + ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > + m_xContainer; // container which the action applies to + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > + m_xElement; // object not owned by the action + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > + m_xOwnElement; // object owned by the action + sal_Int32 m_nIndex; // index of the object within it's container + ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor > + m_aEvents; // events of the object + +public: + enum Action + { + Inserted = 1, + Removed = 2 + }; + +private: + Action m_eAction; + +public: + FmUndoContainerAction(FmFormModel& rMod, + Action _eAction, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& xCont, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xElem, + sal_Int32 nIdx = -1); + ~FmUndoContainerAction(); + + virtual void Undo(); + virtual void Redo(); + + static void DisposeElement( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xElem ); + +protected: + void implReInsert( ) SAL_THROW( ( ::com::sun::star::uno::Exception ) ); + void implReRemove( ) SAL_THROW( ( ::com::sun::star::uno::Exception ) ); +}; + +//================================================================== +// FmUndoModelReplaceAction +//================================================================== +class FmUndoModelReplaceAction : public SdrUndoAction +{ + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel> m_xReplaced; + SdrUnoObj* m_pObject; + +public: + FmUndoModelReplaceAction(FmFormModel& rMod, SdrUnoObj* pObject, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel>& xReplaced); + ~FmUndoModelReplaceAction(); + + virtual void Undo(); + virtual void Redo() { Undo(); } + + virtual String GetComment() const; + + static void DisposeElement( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel>& xReplaced ); +}; + +//======================================================================== +class SVX_DLLPRIVATE FmXUndoEnvironment + : public ::cppu::WeakImplHelper3< ::com::sun::star::beans::XPropertyChangeListener + , ::com::sun::star::container::XContainerListener + , ::com::sun::star::util::XModifyListener + > + , public SfxListener + // public ::cppu::OWeakObject +{ + FmFormModel& rModel; + + void* m_pPropertySetCache; + ::svxform::PFormScriptingEnvironment m_pScriptingEnv; + oslInterlockedCount m_Locks; + ::osl::Mutex m_aMutex; + sal_Bool bReadOnly; + bool m_bDisposed; + +public: + FmXUndoEnvironment(FmFormModel& _rModel); + ~FmXUndoEnvironment(); + + // UNO Anbindung + // SMART_UNO_DECLARATION(FmXUndoEnvironment, ::cppu::OWeakObject); + // virtual sal_Bool queryInterface(UsrUik, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>&); + // virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlClass>> getIdlClasses(void); + + void Lock() { osl_incrementInterlockedCount( &m_Locks ); } + void UnLock() { osl_decrementInterlockedCount( &m_Locks ); } + sal_Bool IsLocked() const { return m_Locks != 0; } + + // access control + struct Accessor { friend class FmFormModel; private: Accessor() { } }; + + // addition and removal of form collections + void AddForms( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& rForms ); + void RemoveForms( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& rForms ); + + // readonly-ness + void SetReadOnly( sal_Bool bRead, const Accessor& ) { bReadOnly = bRead; } + sal_Bool IsReadOnly() const {return bReadOnly;} + +protected: + // XEventListener + virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException ); + + // XPropertyChangeListener + virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException); + + // XContainerListener + virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException); + + // XModifyListener + virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); + + void ModeChanged(); + void dispose(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + +private: + void AddElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element); + void RemoveElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element); + void TogglePropertyListening(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element); + + void implSetModified(); + + void switchListening( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& _rxContainer, bool _bStartListening ) SAL_THROW(()); + void switchListening( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxObject, bool _bStartListening ) SAL_THROW(()); + +public: + // Methoden zur Zuordnung von Controls zu Forms, + // werden von der Seite und der UndoUmgebung genutzt + void Inserted(SdrObject* pObj); + void Removed(SdrObject* pObj); + + void Inserted(FmFormObj* pObj); + void Removed(FmFormObj* pObj); +}; + + +#endif //_SVX_FMUNDO_HXX + diff --git a/svx/source/inc/fmurl.hxx b/svx/source/inc/fmurl.hxx new file mode 100644 index 000000000000..21030d294a10 --- /dev/null +++ b/svx/source/inc/fmurl.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * 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: fmurl.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 _SVX_FMURL_HXX +#define _SVX_FMURL_HXX + +#define FMURL_FORMSLOTS_PREFIX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/" ) ) +#define FMURL_FORM_POSITION rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/positionForm" ) ) +#define FMURL_FORM_RECORDCOUNT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/RecordCount" ) ) +#define FMURL_RECORD_MOVEFIRST rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/moveToFirst" ) ) +#define FMURL_RECORD_MOVEPREV rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/moveToPrev" ) ) +#define FMURL_RECORD_MOVENEXT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/moveToNext" ) ) +#define FMURL_RECORD_MOVELAST rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/moveToLast" ) ) +#define FMURL_RECORD_MOVETONEW rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/moveToNew" ) ) +#define FMURL_RECORD_UNDO rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/undoRecord" ) ) +#define FMURL_RECORD_SAVE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/saveRecord" ) ) +#define FMURL_RECORD_DELETE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/deleteRecord" ) ) +#define FMURL_FORM_REFRESH rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/refreshForm" ) ) +#define FMURL_FORM_REFRESH_CURRENT_CONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/refreshCurrentControl" ) ) +#define FMURL_FORM_SORT_UP rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/sortUp" ) ) +#define FMURL_FORM_SORT_DOWN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/sortDown" ) ) +#define FMURL_FORM_SORT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/sort" ) ) +#define FMURL_FORM_AUTO_FILTER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/autoFilter" ) ) +#define FMURL_FORM_FILTER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/filter" ) ) +#define FMURL_FORM_APPLY_FILTER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/applyFilter" ) ) +#define FMURL_FORM_REMOVE_FILTER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/removeFilterOrder" ) ) +#define FMURL_CONFIRM_DELETION rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormSlots/ConfirmDeletion" ) ) +#define FMURL_COMPONENT_FORMGRIDVIEW rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".component:DB/FormGridView" ) ) +#define FMURL_GRIDVIEW_CLEARVIEW rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormSlots/ClearView" ) ) +#define FMURL_GRIDVIEW_ADDCOLUMN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormSlots/AddGridColumn" ) ) +#define FMURL_GRIDVIEW_ATTACHTOFORM rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormSlots/AttachToForm" ) ) +#define FMARG_ATTACHTO_MASTERFORM rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MasterForm" ) ) +#define FMARG_ADDCOL_COLUMNTYPE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnType" ) ) +#define FMARG_ADDCOL_COLUMNPOS rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnPosition" ) ) + +#endif // _SVX_FMURL_HXX diff --git a/svx/source/inc/fmvwimp.hxx b/svx/source/inc/fmvwimp.hxx new file mode 100644 index 000000000000..12965c07ad3b --- /dev/null +++ b/svx/source/inc/fmvwimp.hxx @@ -0,0 +1,305 @@ +/************************************************************************* + * + * 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: fmvwimp.hxx,v $ + * $Revision: 1.34.260.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. + * + ************************************************************************/ +#ifndef _SVX_FMVWIMP_HXX +#define _SVX_FMVWIMP_HXX + +#include "svx/svdmark.hxx" +#include "fmdocumentclassification.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/form/XForm.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/container/XEnumeration.hpp> +#include <com/sun/star/form/XFormController.hpp> +#include <com/sun/star/container/XContainerListener.hpp> +#include <com/sun/star/container/ContainerEvent.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/awt/XFocusListener.hpp> +#include <com/sun/star/sdb/SQLErrorEvent.hpp> +#include <com/sun/star/sdbc/XDataSource.hpp> +/** === end UNO includes === **/ + +#include <comphelper/stl_types.hxx> +#include <tools/link.hxx> +#include <tools/string.hxx> +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/implbase3.hxx> +#include <comphelper/uno3.hxx> +#include <comphelper/componentcontext.hxx> + +//class SdrPageViewWinRec; +class SdrPageWindow; + +class SdrPageView; +class SdrObject; +class FmFormObj; +class FmFormModel; +class FmFormView; +class FmFormShell; +class Window; +class OutputDevice; +class SdrUnoObj; +class SdrView; + +FORWARD_DECLARE_INTERFACE(awt,XControl) +FORWARD_DECLARE_INTERFACE(awt,XWindow) +FORWARD_DECLARE_INTERFACE(beans,XPropertySet) +FORWARD_DECLARE_INTERFACE(util,XNumberFormats) + +class FmXFormController; +class FmXFormView; + +namespace svx { + class ODataAccessDescriptor; + struct OXFormsDescriptor; +} + +//================================================================== +// FmXPageViewWinRec +//================================================================== +class FmXPageViewWinRec : public ::cppu::WeakImplHelper1< ::com::sun::star::container::XIndexAccess> +{ + friend class FmXFormView; + + ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > > m_aControllerList; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > m_xControlContainer; + ::comphelper::ComponentContext m_aContext; + FmXFormView* m_pViewImpl; + Window* m_pWindow; + +public: + FmXPageViewWinRec( const ::comphelper::ComponentContext& _rContext, + const SdrPageWindow&, FmXFormView* pView); + //const SdrPageViewWinRec*, FmXFormView* pView); + ~FmXPageViewWinRec(); + +// UNO Anbindung + +// ::com::sun::star::container::XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + +// ::com::sun::star::container::XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration() throw(::com::sun::star::uno::RuntimeException); + +// ::com::sun::star::container::XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 _Index) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + const ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > >& GetList() {return m_aControllerList;} + +protected: + ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > getController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& xForm ) const; + void setController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& xForm, + FmXFormController* pParent = NULL); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > getControlContainer() const { return m_xControlContainer; } + void updateTabOrder( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm ); + void dispose(); + Window* getWindow() const {return m_pWindow;} +}; + +typedef ::std::vector<FmXPageViewWinRec*> FmWinRecList; +typedef ::std::set < ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > + , ::comphelper::OInterfaceCompare< ::com::sun::star::form::XForm > + > SetOfForms; +typedef ::std::map < ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > + , SetOfForms + , ::comphelper::OInterfaceCompare< ::com::sun::star::awt::XControlContainer > + > MapControlContainerToSetOfForms; +class SdrModel; +//================================================================== +// FmXFormView +//================================================================== +class FmXFormView : public ::cppu::WeakImplHelper3< + ::com::sun::star::form::XFormControllerListener, + ::com::sun::star::awt::XFocusListener, + ::com::sun::star::container::XContainerListener> +{ + friend class FmFormView; + friend class FmFormShell; + friend class FmXFormShell; + friend class FmXPageViewWinRec; + class ObjectRemoveListener; + friend class ObjectRemoveListener; + + ::comphelper::ComponentContext m_aContext; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> m_xWindow; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xLastCreatedControlModel; + + FmFormObj* m_pMarkedGrid; + FmFormView* m_pView; + sal_uIntPtr m_nActivationEvent; + sal_uIntPtr m_nErrorMessageEvent; // event for an asynchronous error message. See also m_aAsyncError + sal_uIntPtr m_nAutoFocusEvent; // event for asynchronously setting the focus to a control + sal_uIntPtr m_nControlWizardEvent; // event for asynchronously setting the focus to a control + + ::com::sun::star::sdb::SQLErrorEvent + m_aAsyncError; // error event which is to be displayed asyn. See m_nErrorMessageEvent. + + FmWinRecList m_aWinList; // to be filled in alive mode only + MapControlContainerToSetOfForms + m_aNeedTabOrderUpdate; + + // Liste der markierten Object, dient zur Restauration beim Umschalten von Alive in DesignMode + SdrMarkList m_aMark; + ObjectRemoveListener* m_pWatchStoredList; + + bool m_bFirstActivation; + bool m_isTabOrderUpdateSuspended; + + FmFormShell* GetFormShell() const; + + void removeGridWindowListening(); + +protected: + FmXFormView( const ::comphelper::ComponentContext& _rContext, FmFormView* _pView ); + ~FmXFormView(); + + void saveMarkList( sal_Bool _bSmartUnmark = sal_True ); + void restoreMarkList( SdrMarkList& _rRestoredMarkList ); + void stopMarkListWatching(); + void startMarkListWatching(); + + void notifyViewDying( ); + // notifies this impl class that the anti-impl instance (m_pView) is going to die + +public: + // UNO Anbindung + +// ::com::sun::star::lang::XEventListener + virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException); + +// ::com::sun::star::container::XContainerListener + virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException); + +// ::com::sun::star::form::XFormControllerListener + virtual void SAL_CALL formActivated(const ::com::sun::star::lang::EventObject& rEvent) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL formDeactivated(const ::com::sun::star::lang::EventObject& rEvent) throw(::com::sun::star::uno::RuntimeException); + + // XFocusListener + virtual void SAL_CALL focusGained( const ::com::sun::star::awt::FocusEvent& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL focusLost( const ::com::sun::star::awt::FocusEvent& e ) throw (::com::sun::star::uno::RuntimeException); + + FmFormView* getView() const {return m_pView;} + FmWinRecList::const_iterator findWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& _rxCC ) const; + const FmWinRecList& getWindowList() const {return m_aWinList;} + + ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > + getFormController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm, const OutputDevice& _rDevice ) const; + + // activation handling + inline bool hasEverBeenActivated( ) const { return !m_bFirstActivation; } + inline void setHasBeenActivated( ) { m_bFirstActivation = false; } + + void onFirstViewActivation( const FmFormModel* _pDocModel ); + + /** suspends the calls to activateTabOrder, which normally happen whenever for any ControlContainer of the view, + new controls are inserted. Cannot be nested, i.e. you need to call resumeTabOrderUpdate before calling + suspendTabOrderUpdate, again. + */ + void suspendTabOrderUpdate(); + + /** resumes calls to activateTabOrder, and also does all pending calls which were collected since the last + suspendTabOrderUpdate call. + */ + void resumeTabOrderUpdate(); + + void onCreatedFormObject( FmFormObj& _rFormObject ); + +private: + FmWinRecList::iterator findWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& _rxCC ); + //void addWindow(const SdrPageViewWinRec*); + void addWindow(const SdrPageWindow&); + void removeWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& _rxCC ); + void Activate(sal_Bool bSync = sal_False); + void Deactivate(BOOL bDeactivateController = TRUE); + + SdrObject* implCreateFieldControl( const ::svx::ODataAccessDescriptor& _rColumnDescriptor ); + SdrObject* implCreateXFormsControl( const ::svx::OXFormsDescriptor &_rDesc ); + + static bool createControlLabelPair( + const ::comphelper::ComponentContext& _rContext, + OutputDevice& _rOutDev, + sal_Int32 _nXOffsetMM, + sal_Int32 _nYOffsetMM, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats >& _rxNumberFormats, + sal_uInt16 _nControlObjectID, + const ::rtl::OUString& _rFieldPostfix, + UINT32 _nInventor, + UINT16 _nLabelObjectID, + SdrPage* _pLabelPage, + SdrPage* _pControlPage, + SdrModel* _pModel, + SdrUnoObj*& _rpLabel, + SdrUnoObj*& _rpControl + ); + + bool createControlLabelPair( + OutputDevice& _rOutDev, + sal_Int32 _nXOffsetMM, + sal_Int32 _nYOffsetMM, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats >& _rxNumberFormats, + sal_uInt16 _nControlObjectID, + const ::rtl::OUString& _rFieldPostfix, + SdrUnoObj*& _rpLabel, + SdrUnoObj*& _rpControl, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource >& _rxDataSource = NULL, + const ::rtl::OUString& _rDataSourceName = ::rtl::OUString(), + const ::rtl::OUString& _rCommand= ::rtl::OUString(), + const sal_Int32 _nCommandType = -1 + ); + + void ObjectRemovedInAliveMode(const SdrObject* pObject); + + // asynchronously displays an error message. See also OnDelayedErrorMessage. + void displayAsyncErrorMessage( const ::com::sun::star::sdb::SQLErrorEvent& _rEvent ); + + // cancels all pending async events + void cancelEvents(); + + /// the the auto focus to the first (in terms of the tab order) control + void AutoFocus( sal_Bool _bSync = sal_False ); + DECL_LINK( OnActivate, void* ); + DECL_LINK( OnAutoFocus, void* ); + DECL_LINK( OnDelayedErrorMessage, void* ); + DECL_LINK( OnStartControlWizard, void* ); + +private: + ::svxform::DocumentType impl_getDocumentType() const; +}; + + + +#endif // _SVX_FMVWIMP_HXX + diff --git a/svx/source/inc/formcontrolfactory.hxx b/svx/source/inc/formcontrolfactory.hxx new file mode 100644 index 000000000000..432ad25bdea0 --- /dev/null +++ b/svx/source/inc/formcontrolfactory.hxx @@ -0,0 +1,122 @@ + +/************************************************************************* +* 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: formcontrolfactory.hxx,v $ +* +* $Revision: 1.1.2.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. +************************************************************************/ + +#ifndef SVX_FORMCONTROLMANAGER_HXX +#define SVX_FORMCONTROLMANAGER_HXX + +#include "fmdocumentclassification.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/util/XNumberFormats.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +/** === end UNO includes === **/ + +#include <memory> + +class SdrUnoObj; +class Rectangle; + +namespace comphelper { + class ComponentContext; +} + +//........................................................................ +namespace svxform +{ +//........................................................................ + + //==================================================================== + //= FormControlFactory + //==================================================================== + struct FormControlFactory_Data; + + class FormControlFactory + { + public: + FormControlFactory( const ::comphelper::ComponentContext& _rContext ); + ~FormControlFactory(); + + /** initializes the given control model which is to be newly inserted into a document + + @param _eDocType + the type of the document which the control is to be inserted into + @param _rxControlModel + the control model to be inserted + @param _rControlBoundRect + the bound rect of the control, if applicable + @return + the class ID of the control + */ + sal_Int16 initializeControlModel( + const DocumentType _eDocType, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel, + const Rectangle& _rControlBoundRect + ); + + sal_Int16 initializeControlModel( const DocumentType _eDocType, const SdrUnoObj& _rObject ); + sal_Int16 initializeControlModel( const DocumentType _eDocType, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel ); + + void initializeTextFieldLineEnds( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel + ); + + void initializeFieldDependentProperties( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDatabaseField, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats >& _rxNumberFormats + ); + + static ::rtl::OUString getDefaultName( + const sal_Int16 nClassId, + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo >& _rxObject + ); + + static ::rtl::OUString getDefaultUniqueName_ByComponentType( + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxContainer, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject + ); + + static ::rtl::OUString getUniqueName( + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxContainer, + const ::rtl::OUString& _rBaseName + ); + + private: + ::std::auto_ptr< FormControlFactory_Data > m_pData; + }; + +//........................................................................ +} // namespace svxform +//........................................................................ + +#endif // SVX_FORMCONTROLMANAGER_HXX diff --git a/svx/source/inc/formcontrolling.hxx b/svx/source/inc/formcontrolling.hxx new file mode 100644 index 000000000000..d082bd889804 --- /dev/null +++ b/svx/source/inc/formcontrolling.hxx @@ -0,0 +1,311 @@ +/************************************************************************* + * + * 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: formcontrolling.hxx,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. + * + ************************************************************************/ + +#ifndef SVX_FORMCONTROLLING_HXX +#define SVX_FORMCONTROLLING_HXX + +#include <com/sun/star/form/XFormController.hpp> +#include <com/sun/star/form/XForm.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/form/runtime/FeatureState.hpp> +#include <com/sun/star/form/runtime/XFormOperations.hpp> +#include <com/sun/star/sdb/XSQLErrorListener.hpp> + +#include <cppuhelper/implbase2.hxx> +#include <comphelper/componentcontext.hxx> + +#include <vector> + +//........................................................................ +namespace svx +{ +//........................................................................ + + //==================================================================== + //= FeatureSlotTranslation + //==================================================================== + class FeatureSlotTranslation + { + public: + /// retrieves the feature id for a given feature URL + static sal_Int32 getControllerFeatureSlotIdForURL( const ::rtl::OUString& _rMainURL ); + + /// retrieves the feature URL for a given feature id + static ::rtl::OUString getControllerFeatureURLForSlotId( sal_Int32 _nSlotId ); + + /// determines whether the given URL is a controller feature URL + static sal_Bool isFeatureURL( const ::rtl::OUString& _rMainURL ); + + /// retrieves the css.form.runtime.FormFeature ID for a given slot ID + static sal_Int16 getFormFeatureForSlotId( sal_Int32 _nSlotId ); + + /// retrieves the slot id for a given css.form.runtime.FormFeature ID + static sal_Int32 getSlotIdForFormFeature( sal_Int16 _nFormFeature ); + }; + + //==================================================================== + //= IControllerFeatureInvalidation + //==================================================================== + class IControllerFeatureInvalidation + { + public: + /** invalidates the given features + + Invalidation means that any user interface representation (such as toolbox buttons), or + any dispatches associated with the features in question are potentially out-of-date, and + need to be updated + + @param _rFeatures + Ids of the features to be invalidated. + */ + virtual void invalidateFeatures( const ::std::vector< sal_Int32 >& _rFeatures ) = 0; + }; + + //==================================================================== + //= ControllerFeatures + //==================================================================== + class FormControllerHelper; + /** easier access to an FormControllerHelper instance + */ + class ControllerFeatures + { + protected: + ::comphelper::ComponentContext m_aContext; + IControllerFeatureInvalidation* m_pInvalidationCallback; // necessary as long as m_pImpl is not yet constructed + FormControllerHelper* m_pImpl; + + public: + /** standard ctor + + The instance is not functional until <method>assign</method> is used. + + @param _rxORB + a multi service factory for creating various needed components + + @param _pInvalidationCallback + the callback for invalidating feature states + */ + ControllerFeatures( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + IControllerFeatureInvalidation* _pInvalidationCallback + ); + + /** constructs the instance from a <type scope="com::sun::star::form">XFormController<type> instance + + @param _rxORB + a multi service factory for creating various needed components + + @param _rxController + The form controller which the helper should be responsible for. Must not + be <NULL/>, and must have a valid model (form). + + @param _pInvalidationCallback + the callback for invalidating feature states + */ + ControllerFeatures( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController >& _rxController, + IControllerFeatureInvalidation* _pInvalidationCallback + ); + + /** constructs the helper form a <type scope="com::sun::star::form">XForm<type> instance + + Any functionality which depends on a controller will not be available. + + @param _rxORB + a multi service factory for creating various needed components + + @param _rxForm + The form which the helper should be responsible for. Must not be <NULL/>. + + @param _pInvalidationCallback + the callback for invalidating feature states + */ + ControllerFeatures( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm, + IControllerFeatureInvalidation* _pInvalidationCallback + ); + + /// dtor + ~ControllerFeatures(); + + /// checks whether the instance is properly assigned to a form and/or controller + inline bool isAssigned( ) const { return m_pImpl != NULL; } + + /** assign to a controller + */ + void assign( + const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController >& _rxController + ); + + /** assign to a controller + */ + void assign( + const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm + ); + + /// clears the instance so that it cannot be used afterwards + void dispose(); + + // access to the instance which implements the functionality. Not to be used when not assigned + inline const FormControllerHelper* operator->() const { return m_pImpl; } + inline FormControllerHelper* operator->() { return m_pImpl; } + inline const FormControllerHelper& operator*() const { return *m_pImpl; } + inline FormControllerHelper& operator*() { return *m_pImpl; } + }; + + //==================================================================== + //= FormControllerHelper + //==================================================================== + typedef ::cppu::WeakImplHelper2 < ::com::sun::star::form::runtime::XFeatureInvalidation + , ::com::sun::star::sdb::XSQLErrorListener + > FormControllerHelper_Base; + /** is a helper class which manages form controller functionality (such as moveNext etc.). + + <p>The class helps implementing form controller functionality, by providing + methods to determine the state of, and execute, various common form features.<br/> + A <em>feature</em> is for instance moving the form associated with the controller + to a certain position, or reloading the form, and so on.</p> + */ + class FormControllerHelper : public FormControllerHelper_Base + { + protected: + ::comphelper::ComponentContext m_aContext; + IControllerFeatureInvalidation* m_pInvalidationCallback; + ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations > + m_xFormOperations; + + ::com::sun::star::uno::Any m_aOperationError; + + public: + /** constructs the helper from a <type scope="com::sun::star::form">XFormController<type> instance + + @param _rContext + the context the component lives in + @param _rxController + The form controller which the helper should be responsible for. Must not + be <NULL/>, and must have a valid model (form). + @param _pInvalidationCallback + the callback for invalidating feature states + */ + FormControllerHelper( + const ::comphelper::ComponentContext& _rContext, + const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController >& _rxController, + IControllerFeatureInvalidation* _pInvalidationCallback + ); + + /** constructs the helper form a <type scope="com::sun::star::form">XForm<type> instance + + Any functionality which depends on a controller will not be available. + + @param _rContext + the context the component lives in + @param _rxForm + The form which the helper should be responsible for. Must not be <NULL/>. + @param _pInvalidationCallback + the callback for invalidating feature states + */ + FormControllerHelper( + const ::comphelper::ComponentContext& _rContext, + const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm, + IControllerFeatureInvalidation* _pInvalidationCallback + ); + + // forwards to the XFormOperations implementation + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > + getCursor() const; + void getState( + sal_Int32 _nSlotId, + ::com::sun::star::form::runtime::FeatureState& _out_rState + ) const; + sal_Bool isEnabled( sal_Int32 _nSlotId ) const; + void execute( sal_Int32 _nSlotId ) const; + void execute( sal_Int32 _nSlotId, const ::rtl::OUString& _rParamName, const ::com::sun::star::uno::Any& _rParamValue ) const; + sal_Bool commitCurrentRecord() const; + sal_Bool commitCurrentControl( ) const; + sal_Bool isInsertionRow() const; + sal_Bool isModifiedRow() const; + + bool moveLeft( ) const; + bool moveRight( ) const; + + bool canDoFormFilter() const; + + /** disposes this instance. + + After this method has been called, the instance is not functional anymore + */ + void dispose(); + + const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations >& + getFormOperations() const { return m_xFormOperations; } + protected: + /// dtor + ~FormControllerHelper(); + + // XFeatureInvalidation + virtual void SAL_CALL invalidateFeatures( const ::com::sun::star::uno::Sequence< ::sal_Int16 >& Features ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL invalidateAllFeatures() throw (::com::sun::star::uno::RuntimeException); + + // XSQLErrorListener + virtual void SAL_CALL errorOccured( const ::com::sun::star::sdb::SQLErrorEvent& _Event ) 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); + + private: + enum FormOperation { EXECUTE, EXECUTE_ARGS, COMMIT_CONTROL, COMMIT_RECORD }; + + bool impl_operateForm_nothrow( + const FormOperation _eWhat, + const sal_Int16 _nFeature, /* ignore for COMMIT_* */ + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rArguments /* ignore except for EXECUTE_ARGS */ + ) const; + bool impl_operateForm_nothrow( const FormOperation _eWhat ) const + { + return impl_operateForm_nothrow( _eWhat, 0, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >() ); + } + bool impl_operateForm_nothrow( const sal_Int16 _nFeature ) const + { + return impl_operateForm_nothrow( EXECUTE, _nFeature, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >() ); + } + + private: + FormControllerHelper(); // never implemented + FormControllerHelper( const FormControllerHelper& ); // never implemented + FormControllerHelper& operator=( const FormControllerHelper& ); // never implemented + }; + +//........................................................................ +} // namespace svx +//........................................................................ + +#endif // SVX_FORMCONTROLLING_HXX diff --git a/svx/source/inc/formtoolbars.hxx b/svx/source/inc/formtoolbars.hxx new file mode 100644 index 000000000000..2090b7e6b667 --- /dev/null +++ b/svx/source/inc/formtoolbars.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * 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: formtoolbars.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 SVX_SOURCE_INC_FORMTOOLBARS_HXX +#define SVX_SOURCE_INC_FORMTOOLBARS_HXX + +#include "fmdocumentclassification.hxx" +#include <com/sun/star/frame/XLayoutManager.hpp> + +#include <tools/solar.h> + +#include <svx/svxdllapi.h> + +//........................................................................ +namespace svxform +{ +//........................................................................ + + //==================================================================== + //= FormToolboxes + //==================================================================== + class FormToolboxes + { + private: + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager > + m_xLayouter; + + public: + /** constructs an instance + @param _rxFrame + the frame to analyze + */ + SVX_DLLPUBLIC FormToolboxes( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame + ); + + public: + /** retrieves the URI for the toolbox associated with the given slot, depending + on the type of our document + */ + SVX_DLLPUBLIC ::rtl::OUString + getToolboxResourceName( USHORT _nSlotId ) const; + + /** toggles the toolbox associated with the given slot + */ + SVX_DLLPUBLIC void toggleToolbox( USHORT _nSlotId ) const; + + /** determines whether the toolbox associated with the given slot is currently visible + */ + SVX_DLLPUBLIC bool isToolboxVisible( USHORT _nSlotId ) const; + + /** ensures that a given toolbox is visible + */ + inline void showToolbox( USHORT _SlotId ) const + { + if ( !isToolboxVisible( _SlotId ) ) + toggleToolbox( _SlotId ); + } + }; + +//........................................................................ +} // namespace svxform +//........................................................................ + +#endif // SVX_SOURCE_INC_FORMTOOLBARS_HXX + diff --git a/svx/source/inc/frmsel.hrc b/svx/source/inc/frmsel.hrc new file mode 100644 index 000000000000..826972870fbe --- /dev/null +++ b/svx/source/inc/frmsel.hrc @@ -0,0 +1,41 @@ +/************************************************************************* + * + * 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: frmsel.hrc,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. + * + ************************************************************************/ + +#ifndef SVX_FRMSEL_HRC +#define SVX_FRMSEL_HRC + +#define ARR_TEXTS 1 +#define ARR_DESCRIPTIONS 2 + +// image: arrows and markers +#define BMP_FRMSEL_ARROWS 3 + +#endif + diff --git a/svx/source/inc/frmselimpl.hxx b/svx/source/inc/frmselimpl.hxx new file mode 100644 index 000000000000..c7aeb0bc358b --- /dev/null +++ b/svx/source/inc/frmselimpl.hxx @@ -0,0 +1,308 @@ +/************************************************************************* + * + * 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: frmselimpl.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 SVX_FRMSELIMPL_HXX +#define SVX_FRMSELIMPL_HXX + +#include <vcl/virdev.hxx> +#include <vcl/image.hxx> +#include <svx/frmsel.hxx> +#include <svx/framelinkarray.hxx> +#include <svx/borderline.hxx> + +namespace svx { + +namespace a11y { class AccFrameSelector; } + +// ============================================================================ + +class FrameBorder +{ +public: + explicit FrameBorder( FrameBorderType eType ); + + inline FrameBorderType GetType() const { return meType; } + + inline bool IsEnabled() const { return mbEnabled; } + void Enable( FrameSelFlags nFlags ); + + inline FrameBorderState GetState() const { return meState; } + void SetState( FrameBorderState eState ); + + inline bool IsSelected() const { return mbSelected; } + inline void Select( bool bSelect ) { mbSelected = bSelect; } + + const SvxBorderLine& GetCoreStyle() const { return maCoreStyle; } + void SetCoreStyle( const SvxBorderLine* pStyle ); + + inline void SetUIColor( const Color& rColor ) {maUIStyle.SetColor( rColor ); } + inline const frame::Style& GetUIStyle() const { return maUIStyle; } + + inline void ClearFocusArea() { maFocusArea.Clear(); } + void AddFocusPolygon( const Polygon& rFocus ); + void MergeFocusToPolyPolygon( PolyPolygon& rPPoly ) const; + + inline void ClearClickArea() { maClickArea.Clear(); } + void AddClickRect( const Rectangle& rRect ); + bool ContainsClickPoint( const Point& rPos ) const; + void MergeClickAreaToPolyPolygon( PolyPolygon& rPPoly ) const; + Rectangle GetClickBoundRect() const; + + void SetKeyboardNeighbors( + FrameBorderType eLeft, FrameBorderType eRight, + FrameBorderType eTop, FrameBorderType eBottom ); + FrameBorderType GetKeyboardNeighbor( USHORT nKeyCode ) const; + +private: + const FrameBorderType meType; /// Frame border type (position in control). + FrameBorderState meState; /// Frame border state (on/off/don't care). + SvxBorderLine maCoreStyle; /// Core style from application. + frame::Style maUIStyle; /// Internal style to draw lines. + FrameBorderType meKeyLeft; /// Left neighbor for keyboard control. + FrameBorderType meKeyRight; /// Right neighbor for keyboard control. + FrameBorderType meKeyTop; /// Upper neighbor for keyboard control. + FrameBorderType meKeyBottom; /// Lower neighbor for keyboard control. + PolyPolygon maFocusArea; /// Focus drawing areas. + PolyPolygon maClickArea; /// Mouse click areas. + bool mbEnabled; /// true = Border enabled in control. + bool mbSelected; /// true = Border selected in control. +}; + +// ============================================================================ + +typedef std::vector< FrameBorder* > FrameBorderPtrVec; + +struct FrameSelectorImpl : public Resource +{ + typedef ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > XAccessibleRef; + typedef std::vector< a11y::AccFrameSelector* > AccessibleImplVec; + typedef std::vector< XAccessibleRef > XAccessibleRefVec; + + FrameSelector& mrFrameSel; /// The control itself. + VirtualDevice maVirDev; /// For all buffered drawing operations. + ImageList maILArrows; /// Arrows in current system colors. + Color maBackCol; /// Background color. + Color maArrowCol; /// Selection arrow color. + Color maMarkCol; /// Selection marker color. + Color maHCLineCol; /// High contrast line color. + Point maVirDevPos; /// Position of virtual device in the control. + Point maMousePos; /// Last mouse pointer position. + + FrameBorder maLeft; /// All data of left frame border. + FrameBorder maRight; /// All data of right frame border. + FrameBorder maTop; /// All data of top frame border. + FrameBorder maBottom; /// All data of bottom frame border. + FrameBorder maHor; /// All data of inner horizontal frame border. + FrameBorder maVer; /// All data of inner vertical frame border. + FrameBorder maTLBR; /// All data of top-left to bottom-right frame border. + FrameBorder maBLTR; /// All data of bottom-left to top-right frame border. + SvxBorderLine maCurrStyle; /// Current style and color for new borders. + frame::Array maArray; /// Frame link array to draw an array of frame borders. + + FrameSelFlags mnFlags; /// Flags for enabled frame borders. + FrameBorderPtrVec maAllBorders; /// Pointers to all frame borders. + FrameBorderPtrVec maEnabBorders; /// Pointers to enables frame borders. + Link maSelectHdl; /// Selection handler. + + long mnCtrlSize; /// Size of the control (always square). + long mnArrowSize; /// Size of an arrow image. + long mnLine1; /// Middle of left/top frame borders. + long mnLine2; /// Middle of inner frame borders. + long mnLine3; /// Middle of right/bottom frame borders. + long mnFocusOffs; /// Offset from frame border middle to draw focus. + + bool mbHor; /// true = Inner horizontal frame border enabled. + bool mbVer; /// true = Inner vertical frame border enabled. + bool mbTLBR; /// true = Top-left to bottom-right frame border enabled. + bool mbBLTR; /// true = Bottom-left to top-right frame border enabled. + bool mbFullRepaint; /// Used for repainting (false = only copy virtual device). + bool mbAutoSelect; /// true = Auto select a frame border, if focus reaches control. + bool mbClicked; /// true = The control has been clicked at least one time. + bool mbHCMode; /// true = High contrast mode. + + a11y::AccFrameSelector* mpAccess; /// Pointer to accessibility object of the control. + XAccessibleRef mxAccess; /// Reference to accessibility object of the control. + AccessibleImplVec maChildVec; /// Pointers to accessibility objects for frame borders. + XAccessibleRefVec mxChildVec; /// References to accessibility objects for frame borders. + + explicit FrameSelectorImpl( FrameSelector& rFrameSel ); + ~FrameSelectorImpl(); + + // initialization --------------------------------------------------------- + + /** Initializes the control, enables/disables frame borders according to flags. */ + void Initialize( FrameSelFlags nFlags ); + + /** Fills all color members from current style settings. */ + void InitColors(); + /** Creates the image list with selection arrows regarding current style settings. */ + void InitArrowImageList(); + /** Initializes global coordinates. */ + void InitGlobalGeometry(); + /** Initializes coordinates of all frame borders. */ + void InitBorderGeometry(); + /** Initializes click areas of all enabled frame borders. */ + void InitClickAreas(); + /** Draws the entire control into the internal virtual device. */ + void InitVirtualDevice(); + + // frame border access ---------------------------------------------------- + + /** Returns the object representing the specified frame border. */ + const FrameBorder& GetBorder( FrameBorderType eBorder ) const; + /** Returns the object representing the specified frame border (write access). */ + FrameBorder& GetBorderAccess( FrameBorderType eBorder ); + + // drawing ---------------------------------------------------------------- + + /** Draws the background of the entire control (the gray areas between borders). */ + void DrawBackground(); + + /** Draws selection arrows for the specified frame border. */ + void DrawArrows( const FrameBorder& rBorder ); + /** Draws arrows in current selection state for all enabled frame borders. */ + void DrawAllArrows(); + + /** Returns the color that has to be used to draw a frame border. */ + Color GetDrawLineColor( const Color& rColor ) const; + /** Draws all frame borders. */ + void DrawAllFrameBorders(); + + /** Draws all contents of the control. */ + void DrawVirtualDevice(); + /** Copies contents of the virtual device to the control. */ + void CopyVirDevToControl(); + + /** Draws tracking rectangles for all selected frame borders. */ + void DrawAllTrackingRects(); + + /** Converts a mouse position to the virtual device position. */ + Point GetDevPosFromMousePos( const Point& rMousePos ) const; + + /** Invalidates the control. + @param bFullRepaint true = Full repaint; false = update selection only. */ + void DoInvalidate( bool bFullRepaint ); + + // frame border state and style ------------------------------------------- + + /** Sets the state of the specified frame border. */ + void SetBorderState( FrameBorder& rBorder, FrameBorderState eState ); + /** Sets the core style of the specified frame border, or hides the frame border, if pStyle is 0. */ + void SetBorderCoreStyle( FrameBorder& rBorder, const SvxBorderLine* pStyle ); + /** Sets the color of the specified frame border. */ + void SetBorderColor( FrameBorder& rBorder, const Color& rColor ); + + /** Changes the state of a frame border after a control event (mouse/keyboard). */ + void ToggleBorderState( FrameBorder& rBorder ); + + // frame border selection ------------------------------------------------- + + /** Selects a frame border and schedules redraw. */ + void SelectBorder( FrameBorder& rBorder, bool bSelect ); + /** Grabs focus without auto-selection of a frame border, if no border selected. */ + void SilentGrabFocus(); + + /** Returns true, if all selected frame borders are equal (or if nothing is selected). */ + bool SelectedBordersEqual() const; +}; + +// ============================================================================ + +/** Dummy predicate for frame border iterators to use all borders in a container. */ +struct FrameBorderDummy_Pred +{ + inline bool operator()( const FrameBorder* ) const { return true; } +}; + +/** Predicate for frame border iterators to use only visible borders in a container. */ +struct FrameBorderVisible_Pred +{ + inline bool operator()( const FrameBorder* pBorder ) const { return pBorder->GetState() == FRAMESTATE_SHOW; } +}; + +/** Predicate for frame border iterators to use only selected borders in a container. */ +struct FrameBorderSelected_Pred +{ + inline bool operator()( const FrameBorder* pBorder ) const { return pBorder->IsSelected(); } +}; + +/** Template class for all types of frame border iterators. */ +template< typename Cont, typename Iter, typename Pred > +class FrameBorderIterBase +{ +public: + typedef Cont container_type; + typedef Iter iterator_type; + typedef Pred predicate_type; + typedef typename Cont::value_type value_type; + typedef FrameBorderIterBase< Cont, Iter, Pred > this_type; + + explicit FrameBorderIterBase( container_type& rCont ); + inline bool Is() const { return maIt != maEnd; } + this_type& operator++(); + inline value_type operator*() const { return *maIt; } + +private: + iterator_type maIt; + iterator_type maEnd; + predicate_type maPred; +}; + +/** Iterator for constant svx::FrameBorder containers, iterates over all borders. */ +typedef FrameBorderIterBase< const FrameBorderPtrVec, FrameBorderPtrVec::const_iterator, FrameBorderDummy_Pred > + FrameBorderCIter; + +/** Iterator for mutable svx::FrameBorder containers, iterates over all borders. */ +typedef FrameBorderIterBase< FrameBorderPtrVec, FrameBorderPtrVec::iterator, FrameBorderDummy_Pred > + FrameBorderIter; + +/** Iterator for constant svx::FrameBorder containers, iterates over visible borders. */ +typedef FrameBorderIterBase< const FrameBorderPtrVec, FrameBorderPtrVec::const_iterator, FrameBorderVisible_Pred > + VisFrameBorderCIter; + +/** Iterator for mutable svx::FrameBorder containers, iterates over visible borders. */ +typedef FrameBorderIterBase< FrameBorderPtrVec, FrameBorderPtrVec::iterator, FrameBorderVisible_Pred > + VisFrameBorderIter; + +/** Iterator for constant svx::FrameBorder containers, iterates over selected borders. */ +typedef FrameBorderIterBase< const FrameBorderPtrVec, FrameBorderPtrVec::const_iterator, FrameBorderSelected_Pred > + SelFrameBorderCIter; + +/** Iterator for mutable svx::FrameBorder containers, iterates over selected borders. */ +typedef FrameBorderIterBase< FrameBorderPtrVec, FrameBorderPtrVec::iterator, FrameBorderSelected_Pred > + SelFrameBorderIter; + +// ============================================================================ + +} // namespace svx + +#endif + diff --git a/svx/source/inc/gridcell.hxx b/svx/source/inc/gridcell.hxx new file mode 100644 index 000000000000..cb747e3a894c --- /dev/null +++ b/svx/source/inc/gridcell.hxx @@ -0,0 +1,1158 @@ +/************************************************************************* + * + * 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: gridcell.hxx,v $ + * $Revision: 1.24 $ + * + * 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 _SVX_GRIDCELL_HXX +#define _SVX_GRIDCELL_HXX + +#include <svx/gridctrl.hxx> + +#include "sqlparserclient.hxx" +#include "typeconversionclient.hxx" +#include "fmtools.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/sdb/XColumn.hpp> +#include <com/sun/star/form/XBoundControl.hpp> +#include <com/sun/star/awt/XTextComponent.hpp> +#include <com/sun/star/awt/XListBox.hpp> +#include <com/sun/star/awt/XComboBox.hpp> +#include <com/sun/star/awt/TextAlign.hpp> +#include <com/sun/star/awt/XControlModel.hpp> +#include <com/sun/star/awt/XControl.hpp> +#include <com/sun/star/awt/XCheckBox.hpp> +#include <com/sun/star/awt/XButton.hpp> +#include <com/sun/star/beans/XFastPropertySet.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/form/XChangeBroadcaster.hpp> +/** === end UNO includes === **/ + +#include <comphelper/propmultiplex.hxx> +#include <comphelper/componentcontext.hxx> +#include <cppuhelper/component.hxx> +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/implbase2.hxx> +#include <tools/diagnose_ex.h> +#include <tools/rtti.hxx> + +class DbCellControl; +class Edit; +class FmXGridCell; + +//================================================================== +// FmMutexHelper +//================================================================== +class FmMutexHelper +{ +protected: + ::osl::Mutex m_aMutex; +}; + +//================================================================== +// DbGridColumn, Spaltenbeschreibung +//================================================================== +class DbGridColumn +{ + friend class DbGridControl; + + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xModel; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xField; // Verbindung zum Datenbankfeld + ::svt::CellControllerRef m_xController; // Struktur zum Verwalten der Controls fuer eine Spalte + // diese wird von der DbBrowseBox auf die jeweiligen Zellen + // einer Spalte positioniert + FmXGridCell* m_pCell; + +protected: + DbGridControl& m_rParent; + +private: + sal_Int32 m_nLastVisibleWidth; // nur gueltig, wenn m_bHidden == sal_True + sal_Int32 m_nFormatKey; + sal_Int16 m_nFieldType; + sal_Int16 m_nTypeId; + sal_uInt16 m_nId; + sal_Int16 m_nFieldPos; + sal_Int16 m_nAlign; // wird mit TXT_ALIGN_LEFT .... angegeben + sal_Bool m_bReadOnly : 1; + sal_Bool m_bAutoValue : 1; + sal_Bool m_bInSave : 1; + sal_Bool m_bNumeric : 1; + sal_Bool m_bObject : 1; // Verweist die Column auf ein Object Datentyp? + sal_Bool m_bHidden : 1; + sal_Bool m_bLocked : 1; + sal_Bool m_bDateTime : 1; + + static ::svt::CellControllerRef s_xEmptyController; + // used by locked columns +public: + DbGridColumn(sal_uInt16 _nId, DbGridControl& rParent) + :m_pCell(NULL) + ,m_rParent(rParent) + ,m_nLastVisibleWidth(-1) + ,m_nFormatKey(0) + ,m_nFieldType(0) + ,m_nTypeId(0) + ,m_nId(_nId) + ,m_nFieldPos(-1) + ,m_nAlign(::com::sun::star::awt::TextAlign::LEFT) + ,m_bReadOnly(sal_False) + ,m_bAutoValue(sal_False) + ,m_bInSave(sal_False) + ,m_bNumeric(sal_False) + ,m_bObject(sal_False) + ,m_bHidden(sal_False) + ,m_bLocked(sal_False) + ,m_bDateTime(sal_False) + { + } + + ~DbGridColumn(); + + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& getModel() const { return m_xModel; } + void setModel(::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _xModel); + + + sal_uInt16 GetId() const {return m_nId;} + sal_Bool IsReadOnly() const {return m_bReadOnly;} + sal_Bool IsAutoValue() const {return m_bAutoValue;} + sal_Bool IsUpdating() const {return m_bInSave;} + sal_Int16 GetAlignment() const {return m_nAlign;} + sal_Int16 GetType() const {return m_nFieldType;} + sal_Int16 GetFieldPos() const {return m_nFieldPos; } + sal_Bool IsNumeric() const {return m_bNumeric;} + sal_Bool IsDateTime() const {return m_bDateTime;} + sal_Bool IsObject() const {return m_bObject;} + sal_Bool IsHidden() const {return m_bHidden;} + sal_Int32 GetKey() const {return m_nFormatKey;} + const ::svt::CellControllerRef& GetController() const {return m_bLocked ? s_xEmptyController : m_xController;} + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& GetField() const {return m_xField;} + DbGridControl& GetParent() const {return m_rParent;} + FmXGridCell* GetCell() const {return m_pCell;} + + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn > GetCurrentFieldValue() const; + + // Zeichnen eines Feldes an einer Position, ist ein ::com::sun::star::sdbcx::View gesetzt + // uebernimmt dieser das Zeichnen, z.B. fuer CheckBoxen + void Paint(OutputDevice& rDev, + const Rectangle& rRect, + const DbGridRow* pRow, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter); + + + // Inititialierung im alive mode + // Ist kein ColumnController gesetzt, wird eine DefaultInitialisierung + // vorgenommen + void CreateControl(sal_Int32 _nFieldPos, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xField, sal_Int32 nTypeId); + void UpdateControl() + { + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xField(m_xField); + CreateControl(m_nFieldPos, xField, m_nTypeId); + } + + // Editieren einer Zelle + void UpdateFromField(const DbGridRow* pRow, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter); + sal_Bool Commit(); + + // freigeben aller Daten, die fuer den AliveMode noetig sind + void Clear(); + + XubString GetCellText(const DbGridRow* pRow, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter) const; + XubString GetCellText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& xField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter) const; + + void SetReadOnly(sal_Bool bRead){m_bReadOnly = bRead;} + void SetObject(sal_Int16 nPos) {m_bObject = m_bReadOnly = sal_True; m_nFieldPos = nPos;} + + void ImplInitWindow( Window& rParent, const InitWindowFacet _eInitWhat ); + + // Properties, die auf den ::com::sun::star::frame::Controller durchschlagen koennen + sal_Int16 SetAlignment(sal_Int16 _nAlign); + // if _nAlign is -1, the alignment is calculated from the type of the field we are bound to + // the value really set is returned + sal_Int16 SetAlignmentFromModel(sal_Int16 nStandardAlign); + // set the alignment according to the "Align"-property of m_xModel, use the given standard + // alignment if the property if void, return the really set alignment + + // column locking + sal_Bool isLocked() const { return m_bLocked; } + void setLock(sal_Bool _bLock); + +private: + /** attaches or detaches our cell object to the SctriptEventAttacherManager implemented + by our model's parent + */ + void impl_toggleScriptManager_nothrow( bool _bAttach ); +}; + +//================================================================== +// DbCellControl, liefert die Daten fuer einen CellController +// wird in der Regel nur für komplexe Controls wie z.B ComboBoxen +// benoetigt +//================================================================== +class DbCellControl + :public ::svxform::OTypeConversionClient + ,public ::svxform::OStaticDataAccessTools + ,public FmMutexHelper // _before_ the listener, so the listener is to be destroyed first! + ,public ::comphelper::OPropertyChangeListener +{ +private: + ::comphelper::OPropertyChangeMultiplexer* m_pModelChangeBroadcaster; + +private: + sal_Bool m_bTransparent : 1; + sal_Bool m_bAlignedController : 1; + sal_Bool m_bAccessingValueProperty : 1; + + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > + m_xCursor; + +protected: + DbGridColumn& m_rColumn; + Window* m_pPainter; + Window* m_pWindow; + +protected: + // attribute access + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& getCursor() const { return m_xCursor; } + + // control transparency + inline sal_Bool isTransparent( ) const { return m_bTransparent; } + inline void setTransparent( sal_Bool _bSet ) { m_bTransparent = _bSet; } + + // control alignment + inline void setAlignedController( sal_Bool _bAlign = sal_True ) { m_bAlignedController = _bAlign; } + + + /** determined whether or not the value property is locked + @see lockValueProperty + */ + inline sal_Bool isValuePropertyLocked() const; + + /** locks the listening at the value property. + <p>This means that every subsequent change now done on the value property of the model ("Text", or "Value", + or whatever) is then ignored.<br/> + This base class uses this setting in <method>Commit</method>.</p> + @precond + Value locking can't be nested + @see unlockValueProperty + */ + inline void lockValueProperty(); + /** unlocks the listening at the value property + @see lockValueProperty + */ + inline void unlockValueProperty(); + +protected: + // adds the given property to the list of properties which we listen for + void doPropertyListening( const ::rtl::OUString& _rPropertyName ); + + // called whenever a property which affects field settings in general is called + // you should overwrite this method for every property you add yourself as listener to + // with doPropertyListening + virtual void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel ); + + // called by _propertyChanged if a property which denotes the column value has changed + void implValuePropertyChanged( ); + + +public: + TYPEINFO(); + DbCellControl(DbGridColumn& _rColumn, sal_Bool _bText = sal_True); + virtual ~DbCellControl(); + + + Window& GetWindow() const + { + ENSURE_OR_THROW( m_pWindow, "no window" ); + return *m_pWindow; + } + + // control alignment + inline sal_Bool isAlignedController() const { return m_bAlignedController; } + void AlignControl(sal_Int16 nAlignment); + + void SetTextLineColor(); + void SetTextLineColor(const Color& _rColor); + + // Initialisieren bevor ein Control angezeigt wird + virtual void Init( Window& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xCursor ); + virtual ::svt::CellControllerRef CreateController() const = 0; + + // Schreiben des Wertes in das Model + sal_Bool Commit(); + + // Formatting the field data to output text + virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL) = 0; + + virtual void Update(){} + // Refresh the control by the field data + virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter) = 0; + + // Painten eines Zellinhalts im vorgegeben Rechteck + virtual void PaintFieldToCell( OutputDevice& rDev, const Rectangle& rRect, const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter); + virtual void PaintCell( OutputDevice& _rDev, const Rectangle& _rRect ); + + void ImplInitWindow( Window& rParent, const InitWindowFacet _eInitWhat ); + + double GetValue(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter) const; + +protected: + void invalidatedController(); + + /** commits the content of the control (e.g. the text of an edit field) into the column model + (e.g. the "Text" property of the model). + <p>To be overwritten in derived classes.</p> + @see updateFromModel + */ + virtual sal_Bool commitControl( ) = 0; + + /** updates the current content of the control (e.g. the text of an edit field) from the column model + (e.g. the "Text" property of the model). + <p>To be overwritten in derived classes.</p> + @precond + NULL != _rxModel + @precond + NULL != m_pWindow + + @see commitControl + */ + virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel ) = 0; + +protected: +// OPropertyChangeListener + virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException); + +private: + void implDoPropertyListening( const ::rtl::OUString& _rPropertyName, sal_Bool _bWarnIfNotExistent = sal_True ); + + /// updates the "readonly" setting on m_pWindow, according to the respective property value in the given model + void implAdjustReadOnly( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel ); + + /// updates the "enabled" setting on m_pWindow, according to the respective property value in the given model + void implAdjustEnabled( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel ); +}; + +//================================================================== +//------------------------------------------------------------------ +inline sal_Bool DbCellControl::isValuePropertyLocked() const +{ + return m_bAccessingValueProperty; +} + +//------------------------------------------------------------------ +inline void DbCellControl::lockValueProperty() +{ + OSL_ENSURE( !isValuePropertyLocked(), "DbCellControl::lockValueProperty: not to be nested!" ); + m_bAccessingValueProperty = sal_True; +} + +//------------------------------------------------------------------ +inline void DbCellControl::unlockValueProperty() +{ + OSL_ENSURE( isValuePropertyLocked(), "DbCellControl::lockValueProperty: not locked so far!" ); + m_bAccessingValueProperty = sal_False; +} + +//================================================================== +/** a field which is bound to a column which supports the MaxTextLen property +*/ +class DbLimitedLengthField : public DbCellControl +{ +public: + TYPEINFO(); + +protected: + DbLimitedLengthField( DbGridColumn& _rColumn ); + +protected: + // DbCellControl + virtual void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel ); + +protected: + inline void implSetMaxTextLen( sal_Int16 _nMaxLen ) + { + implSetEffectiveMaxTextLen( _nMaxLen ? _nMaxLen : EDIT_NOLIMIT ); + } + virtual void implSetEffectiveMaxTextLen( sal_Int16 _nMaxLen ); +}; + +//================================================================== +class DbTextField : public DbLimitedLengthField +{ + ::svt::IEditImplementation* m_pEdit; + ::svt::IEditImplementation* m_pPainterImplementation; + sal_Int16 m_nKeyType; + sal_Bool m_bIsSimpleEdit; + +protected: + ~DbTextField( ); + +public: + TYPEINFO(); + DbTextField(DbGridColumn& _rColumn); + + ::svt::IEditImplementation* GetEditImplementation() { return m_pEdit; } + sal_Bool IsSimpleEdit() const { return m_bIsSimpleEdit; } + + virtual void Init( Window& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xCursor ); + virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL); + virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter); + virtual ::svt::CellControllerRef CreateController() const; + virtual void PaintFieldToCell( OutputDevice& _rDev, const Rectangle& _rRect, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter ); + +protected: + // DbCellControl + virtual sal_Bool commitControl( ); + virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel ); + // DbLimitedLengthField + virtual void implSetEffectiveMaxTextLen( sal_Int16 _nMaxLen ); +}; + +//================================================================== +class DbFormattedField : public DbLimitedLengthField +{ +protected: + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > m_xSupplier; + sal_Int16 m_nKeyType; + + +public: + TYPEINFO(); + DbFormattedField(DbGridColumn& _rColumn); + virtual ~DbFormattedField(); + + + virtual void Init( Window& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xCursor ); + virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL); + virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter); + virtual ::svt::CellControllerRef CreateController() const; + +protected: + // DbCellControl + virtual sal_Bool commitControl( ); + virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel ); + + // OPropertyChangeListener + virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException); +}; + +//================================================================== +class DbCheckBox : public DbCellControl +{ +public: + TYPEINFO(); + DbCheckBox(DbGridColumn& _rColumn); + + virtual void Init( Window& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xCursor ); + virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter); + virtual ::svt::CellControllerRef CreateController() const; + virtual void PaintFieldToCell(OutputDevice& rDev, const Rectangle& rRect, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter); + virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL); + +protected: + // DbCellControl + virtual sal_Bool commitControl( ); + virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel ); +}; + +//================================================================== +class DbComboBox : public DbCellControl +{ + sal_Int16 m_nKeyType; + +public: + TYPEINFO(); + DbComboBox(DbGridColumn& _rColumn); + + virtual void Init( Window& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xCursor ); + virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL); + virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter); + virtual ::svt::CellControllerRef CreateController() const; + + void SetList(const ::com::sun::star::uno::Any& rItems); + +protected: + // DbCellControl + virtual sal_Bool commitControl( ); + virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel ); + + virtual void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel ); + + // OPropertyChangeListener + virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException); +}; + +//================================================================== +class DbListBox :public DbCellControl +{ + sal_Bool m_bBound : 1; + ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aValueList; + +public: + TYPEINFO(); + DbListBox(DbGridColumn& _rColumn); + + virtual void Init( Window& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xCursor ); + virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL); + virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter); + virtual ::svt::CellControllerRef CreateController() const; + + void SetList(const ::com::sun::star::uno::Any& rItems); + +protected: + // DbCellControl + virtual sal_Bool commitControl( ); + virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel ); + + virtual void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel ); + + // OPropertyChangeListener + virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException); +}; + +//================================================================== +class DbPatternField : public DbCellControl +{ +public: + TYPEINFO(); + DbPatternField( DbGridColumn& _rColumn, const ::comphelper::ComponentContext& _rContext ); + virtual void Init( Window& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xCursor ); + virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL); + virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter); + virtual ::svt::CellControllerRef CreateController() const; + +protected: + /// DbCellControl + virtual sal_Bool commitControl( ); + virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel ); + + virtual void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel ); + +private: + String impl_formatText( const String& _rText ); + +private: + ::std::auto_ptr< ::dbtools::FormattedColumnValue > m_pValueFormatter; + ::std::auto_ptr< ::dbtools::FormattedColumnValue > m_pPaintFormatter; + ::comphelper::ComponentContext m_aContext; +}; + +//================================================================== +class DbSpinField : public DbCellControl +{ +private: + sal_Int16 m_nStandardAlign; + +public: + TYPEINFO(); + +protected: + DbSpinField( DbGridColumn& _rColumn, sal_Int16 _nStandardAlign = com::sun::star::awt::TextAlign::RIGHT ); + +public: + virtual void Init( Window& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& _rxCursor ); + virtual ::svt::CellControllerRef CreateController() const; + +protected: + virtual SpinField* createField( + Window* _pParent, + WinBits _nFieldStyle, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel + ) = 0; +}; + +//================================================================== +class DbDateField : public DbSpinField +{ +public: + TYPEINFO(); + DbDateField(DbGridColumn& _rColumn); + virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL); + virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter); + +protected: + // DbCellControl + virtual sal_Bool commitControl( ); + virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel ); + + // DbSpinField + virtual SpinField* createField( + Window* _pParent, + WinBits _nFieldStyle, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel + ); + + /// initializes everything which relates to the properties describing the numeric behaviour + virtual void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel ); +}; + +//================================================================== +class DbTimeField : public DbSpinField +{ +public: + TYPEINFO(); + DbTimeField(DbGridColumn& _rColumn); + virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL); + virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter); + +protected: + // DbCellControl + virtual sal_Bool commitControl( ); + virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel ); + + // DbSpinField + virtual SpinField* createField( + Window* _pParent, + WinBits _nFieldStyle, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel + ); + + /// initializes everything which relates to the properties describing the numeric behaviour + virtual void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel ); +}; + +//================================================================== +class DbCurrencyField : public DbSpinField +{ + sal_Int16 m_nScale; + +public: + TYPEINFO(); + DbCurrencyField(DbGridColumn& _rColumn); + virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL); + virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter); + + double GetCurrency(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter) const; + +protected: + // DbCellControl + virtual sal_Bool commitControl( ); + virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel ); + + // DbSpinField + virtual SpinField* createField( + Window* _pParent, + WinBits _nFieldStyle, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel + ); + + /// initializes everything which relates to the properties describing the numeric behaviour + virtual void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel ); +}; + +//================================================================== +class DbNumericField : public DbSpinField +{ +public: + TYPEINFO(); + DbNumericField(DbGridColumn& _rColumn); + virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL); + virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter); + +protected: + // DbCellControl + virtual sal_Bool commitControl( ); + virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel ); + + // DbSpinField + virtual SpinField* createField( + Window* _pParent, + WinBits _nFieldStyle, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel + ); + + /// initializes everything which relates to the properties describing the numeric behaviour + void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel ); +}; + +//================================================================== +class DbFilterField + :public DbCellControl + ,public ::svxform::OSQLParserClient +{ + ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aValueList; + XubString m_aText; + Link m_aCommitLink; + sal_Int16 m_nControlClass; + sal_Bool m_bFilterList : 1; + sal_Bool m_bFilterListFilled : 1; + sal_Bool m_bBound : 1; + +public: + TYPEINFO(); + DbFilterField(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,DbGridColumn& _rColumn); + virtual ~DbFilterField(); + + virtual void Init( Window& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xCursor ); + virtual ::svt::CellControllerRef CreateController() const; + virtual void PaintCell(OutputDevice& rDev, const Rectangle& rRect); + virtual void Update(); + virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL); + virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter); + + const XubString& GetText() const {return m_aText;} + void SetText(const XubString& rText); + + void SetCommitHdl( const Link& rLink ) { m_aCommitLink = rLink; } + const Link& GetCommitHdl() const { return m_aCommitLink; } + +protected: + + // DbCellControl + virtual sal_Bool commitControl( ); + virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel ); + +protected: + void SetList(const ::com::sun::star::uno::Any& rItems, sal_Bool bComboBox); + void CreateControl(Window* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xModel); + DECL_LINK( OnClick, void* ); +}; + +//================================================================== +// Base class providing the access to a grid cell +//================================================================== +typedef ::cppu::ImplHelper2 < ::com::sun::star::awt::XControl + , ::com::sun::star::form::XBoundControl + > FmXGridCell_Base; +typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XWindow + > FmXGridCell_WindowBase; +class FmXGridCell :public ::cppu::OComponentHelper + ,public FmXGridCell_Base + ,public FmXGridCell_WindowBase +{ +protected: + ::osl::Mutex m_aMutex; + DbGridColumn* m_pColumn; + DbCellControl* m_pCellControl; + +private: + ::cppu::OInterfaceContainerHelper m_aWindowListeners; + ::cppu::OInterfaceContainerHelper m_aFocusListeners; + ::cppu::OInterfaceContainerHelper m_aKeyListeners; + ::cppu::OInterfaceContainerHelper m_aMouseListeners; + ::cppu::OInterfaceContainerHelper m_aMouseMotionListeners; + +protected: + virtual ~FmXGridCell(); + +public: + TYPEINFO(); + FmXGridCell( DbGridColumn* pColumn, DbCellControl* pControl ); + void init(); + + DECLARE_UNO3_AGG_DEFAULTS(FmXGridCell, OComponentHelper); + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException); + + void SetTextLineColor(); + void SetTextLineColor(const Color& _rColor); + +// XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + +// OComponentHelper + virtual void SAL_CALL disposing(); + +// ::com::sun::star::lang::XComponent + virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException){OComponentHelper::dispose();} + virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener)throw(::com::sun::star::uno::RuntimeException) { OComponentHelper::addEventListener(aListener);} + virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener)throw(::com::sun::star::uno::RuntimeException) { OComponentHelper::removeEventListener(aListener);} + +// ::com::sun::star::awt::XControl + virtual void SAL_CALL setContext(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& /*Context*/) throw(::com::sun::star::uno::RuntimeException){} + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getContext() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL createPeer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& /*Toolkit*/, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& /*Parent*/) throw(::com::sun::star::uno::RuntimeException){} + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > SAL_CALL getPeer() throw (::com::sun::star::uno::RuntimeException) {return ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > ();} + virtual sal_Bool SAL_CALL setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& /*Model*/) throw (::com::sun::star::uno::RuntimeException) {return sal_False;} + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > SAL_CALL getModel() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView > SAL_CALL getView() throw (::com::sun::star::uno::RuntimeException) {return ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView > ();} + virtual void SAL_CALL setDesignMode(sal_Bool /*bOn*/) throw (::com::sun::star::uno::RuntimeException) {} + virtual sal_Bool SAL_CALL isDesignMode() throw (::com::sun::star::uno::RuntimeException) {return sal_False;} + virtual sal_Bool SAL_CALL isTransparent() throw (::com::sun::star::uno::RuntimeException) {return sal_False;} + +// ::com::sun::star::form::XBoundControl + virtual sal_Bool SAL_CALL getLock() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setLock(sal_Bool _bLock) throw(::com::sun::star::uno::RuntimeException); + + // XWindow + virtual void SAL_CALL setPosSize( ::sal_Int32 X, ::sal_Int32 Y, ::sal_Int32 Width, ::sal_Int32 Height, ::sal_Int16 Flags ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL getPosSize( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setVisible( ::sal_Bool Visible ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setEnable( ::sal_Bool Enable ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setFocus( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + + sal_Bool Commit() {return m_pCellControl->Commit();} + void ImplInitWindow( Window& rParent, const InitWindowFacet _eInitWhat ) + { m_pCellControl->ImplInitWindow( rParent, _eInitWhat ); } + + sal_Bool isAlignedController() const { return m_pCellControl->isAlignedController(); } + void AlignControl(sal_Int16 nAlignment) + { m_pCellControl->AlignControl(nAlignment);} + +protected: + virtual Window* getEventWindow() const; + virtual void onWindowEvent( const ULONG _nEventId, const Window& _rWindow, const void* _pEventData ); + + // default implementations call our focus listeners, don't forget to call them if you override this + virtual void onFocusGained( const ::com::sun::star::awt::FocusEvent& _rEvent ); + virtual void onFocusLost( const ::com::sun::star::awt::FocusEvent& _rEvent ); + +private: + DECL_LINK( OnWindowEvent, VclWindowEvent* ); +}; + +//================================================================== +class FmXDataCell : public FmXGridCell +{ +public: + TYPEINFO(); + FmXDataCell( DbGridColumn* pColumn, DbCellControl& _rControl ) + :FmXGridCell( pColumn, &_rControl ) + { + } + + virtual void PaintFieldToCell(OutputDevice& rDev, + const Rectangle& rRect, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& xField, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter); + + void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& xField, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter) + { m_pCellControl->UpdateFromField(xField, xFormatter); } + +protected: + void UpdateFromColumn(); +}; + +//================================================================== +class FmXTextCell : public FmXDataCell +{ +protected: + /** determines whether the text of this cell can be painted directly, without + using the painter control + + If this is <TRUE/>, the <member>PaintCell</member> method will simply use the text as returned + by <member>GetText</member>, and draw it onto the device passed to <member>PaintFieldToCell</member>, + while respecting the current alignment settings. + + If this is <FALSE/>, the <member>PaintFieldToCell</member> request will be forwarded to the painter + control (<member>m_pPainter</member>). This is more expensive, but the only option + if your painting involves more that a simple DrawText. + + This member is <TRUE/> by default, and can be modified by derived classes. + */ + sal_Bool m_bFastPaint; + +public: + TYPEINFO(); + FmXTextCell( DbGridColumn* pColumn, DbCellControl& _rControl ); + + virtual void PaintFieldToCell(OutputDevice& rDev, + const Rectangle& rRect, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& xField, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter); + + XubString GetText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, + Color** ppColor = NULL) + {return m_pCellControl->GetFormatText(_rxField, xFormatter, ppColor);} +}; + +//================================================================== +typedef ::cppu::ImplHelper2 < ::com::sun::star::awt::XTextComponent + , ::com::sun::star::form::XChangeBroadcaster + > FmXEditCell_Base; +class FmXEditCell : public FmXTextCell, + public FmXEditCell_Base +{ +private: + ::rtl::OUString m_sValueOnEnter; + +protected: + ::cppu::OInterfaceContainerHelper m_aTextListeners; + ::cppu::OInterfaceContainerHelper m_aChangeListeners; + ::svt::IEditImplementation* m_pEditImplementation; + bool m_bOwnEditImplementation; + + virtual ~FmXEditCell(); +public: + FmXEditCell( DbGridColumn* pColumn, DbCellControl& _rControl ); + + DECLARE_UNO3_AGG_DEFAULTS(FmXEditCell, FmXTextCell); + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException); + +// XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + +// OComponentHelper + virtual void SAL_CALL disposing(); + +// ::com::sun::star::awt::XTextComponent + virtual void SAL_CALL addTextListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener >& l) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeTextListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener >& l) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setText(const ::rtl::OUString& aText) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertText(const ::com::sun::star::awt::Selection& Sel, const ::rtl::OUString& Text) throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getText() throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSelectedText() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setSelection(const ::com::sun::star::awt::Selection& aSelection) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Selection SAL_CALL getSelection() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isEditable() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setEditable(sal_Bool bEditable) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setMaxTextLen(sal_Int16 nLen) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getMaxTextLen() throw(::com::sun::star::uno::RuntimeException); + + // XChangeBroadcaster + virtual void SAL_CALL addChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XChangeListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XChangeListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); + +protected: + virtual void onWindowEvent( const ULONG _nEventId, const Window& _rWindow, const void* _pEventData ); + + virtual void onFocusGained( const ::com::sun::star::awt::FocusEvent& _rEvent ); + virtual void onFocusLost( const ::com::sun::star::awt::FocusEvent& _rEvent ); + +private: + void onTextChanged(); +}; + +//================================================================== +typedef ::cppu::ImplHelper2 < ::com::sun::star::awt::XCheckBox + , ::com::sun::star::awt::XButton + > FmXCheckBoxCell_Base; +class FmXCheckBoxCell : public FmXDataCell, + public FmXCheckBoxCell_Base +{ + ::cppu::OInterfaceContainerHelper m_aItemListeners; + ::cppu::OInterfaceContainerHelper m_aActionListeners; + ::rtl::OUString m_aActionCommand; + CheckBox* m_pBox; + +protected: + virtual ~FmXCheckBoxCell(); + +public: + FmXCheckBoxCell( DbGridColumn* pColumn, DbCellControl& _rControl ); + +// UNO + DECLARE_UNO3_AGG_DEFAULTS(FmXCheckBoxCell, FmXDataCell); + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + +// OComponentHelper + virtual void SAL_CALL disposing(); + +// ::com::sun::star::awt::XCheckBox + virtual void SAL_CALL addItemListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeItemListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getState() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setState(sal_Int16 n) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setLabel(const ::rtl::OUString& Label) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL enableTriState(sal_Bool b) throw(::com::sun::star::uno::RuntimeException); + + // XButton + virtual void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw (::com::sun::star::uno::RuntimeException); + //virtual void SAL_CALL setLabel( const ::rtl::OUString& Label ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setActionCommand( const ::rtl::OUString& Command ) throw (::com::sun::star::uno::RuntimeException); + +protected: + virtual Window* getEventWindow() const; + virtual void onWindowEvent( const ULONG _nEventId, const Window& _rWindow, const void* _pEventData ); +}; + +//================================================================== +typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XListBox + > FmXListBoxCell_Base; +class FmXListBoxCell :public FmXTextCell + ,public FmXListBoxCell_Base +{ + ::cppu::OInterfaceContainerHelper m_aItemListeners, + m_aActionListeners; + ListBox* m_pBox; + +protected: + virtual ~FmXListBoxCell(); + +public: + FmXListBoxCell( DbGridColumn* pColumn, DbCellControl& _rControl ); + + DECLARE_UNO3_AGG_DEFAULTS(FmXListBoxCell, FmXTextCell); + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + +// OComponentHelper + virtual void SAL_CALL disposing(); + +// ::com::sun::star::awt::XListBox + virtual void SAL_CALL addItemListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeItemListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addActionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeActionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addItem(const ::rtl::OUString& aItem, sal_Int16 nPos) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addItems(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aItems, sal_Int16 nPos) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeItems(sal_Int16 nPos, sal_Int16 nCount) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getItemCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getItem(sal_Int16 nPos) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getItems() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getSelectedItemPos() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getSelectedItemsPos() throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSelectedItem() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSelectedItems() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL SAL_CALL selectItemPos(sal_Int16 nPos, sal_Bool bSelect) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL SAL_CALL selectItemsPos(const ::com::sun::star::uno::Sequence< sal_Int16 >& aPositions, sal_Bool bSelect) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL SAL_CALL selectItem(const ::rtl::OUString& aItem, sal_Bool bSelect) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isMutipleMode() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL SAL_CALL setMultipleMode(sal_Bool bMulti) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getDropDownLineCount() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL SAL_CALL setDropDownLineCount(sal_Int16 nLines) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL SAL_CALL makeVisible(sal_Int16 nEntry) throw(::com::sun::star::uno::RuntimeException); + +protected: + virtual void onWindowEvent( const ULONG _nEventId, const Window& _rWindow, const void* _pEventData ); + + DECL_LINK( OnDoubleClick, void* ); +}; + +//================================================================== +typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XComboBox + > FmXComboBoxCell_Base; +class FmXComboBoxCell :public FmXTextCell + ,public FmXComboBoxCell_Base +{ +private: + ::cppu::OInterfaceContainerHelper m_aItemListeners, + m_aActionListeners; + ComboBox* m_pComboBox; + +protected: + virtual ~FmXComboBoxCell(); + +public: + FmXComboBoxCell( DbGridColumn* pColumn, DbCellControl& _rControl ); + + DECLARE_UNO3_AGG_DEFAULTS(FmXListBoxCell, FmXTextCell); + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // OComponentHelper + virtual void SAL_CALL disposing(); + + // XComboBox + virtual void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& _Listener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& _Listener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& _Listener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& _Listener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addItem( const ::rtl::OUString& _Item, ::sal_Int16 _Pos ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _Items, ::sal_Int16 _Pos ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeItems( ::sal_Int16 nPos, ::sal_Int16 nCount ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL getItemCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getItem( ::sal_Int16 _Pos ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getItems( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL getDropDownLineCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDropDownLineCount( ::sal_Int16 _Lines ) throw (::com::sun::star::uno::RuntimeException); + +protected: + virtual void onWindowEvent( const ULONG _nEventId, const Window& _rWindow, const void* _pEventData ); +}; + +//================================================================== +typedef ::cppu::ImplHelper2 < ::com::sun::star::awt::XTextComponent + , ::com::sun::star::lang::XUnoTunnel + > FmXFilterCell_Base; +class FmXFilterCell :public FmXGridCell + ,public FmXFilterCell_Base +{ + ::cppu::OInterfaceContainerHelper m_aTextListeners; +protected: + virtual ~FmXFilterCell(); +public: + TYPEINFO(); + FmXFilterCell(DbGridColumn* pColumn = NULL, DbCellControl* pControl = NULL); + + + DECLARE_UNO3_AGG_DEFAULTS(FmXFilterCell, FmXGridCell); + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + +// XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + +// helpers for XUnoTunnel + static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); + static FmXFilterCell* getImplementation( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxObject); + +// painting the filter text + virtual void PaintCell(OutputDevice& rDev, const Rectangle& rRect); + void Update(){m_pCellControl->Update();} + +// OComponentHelper + virtual void SAL_CALL disposing(); + +// ::com::sun::star::awt::XTextComponent + virtual void SAL_CALL addTextListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener >& l) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeTextListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener >& l) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setText(const ::rtl::OUString& aText) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertText(const ::com::sun::star::awt::Selection& Sel, const ::rtl::OUString& Text) throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getText() throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSelectedText() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setSelection(const ::com::sun::star::awt::Selection& aSelection) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Selection SAL_CALL getSelection() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isEditable() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setEditable(sal_Bool bEditable) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setMaxTextLen(sal_Int16 nLen) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getMaxTextLen() throw(::com::sun::star::uno::RuntimeException); + +protected: + DECL_LINK( OnCommit, void* ); +}; + +#endif // _SVX_GRIDCELL_HXX + diff --git a/svx/source/inc/gridcols.hxx b/svx/source/inc/gridcols.hxx new file mode 100644 index 000000000000..3b4c3582f314 --- /dev/null +++ b/svx/source/inc/gridcols.hxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * 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: gridcols.hxx,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. + * + ************************************************************************/ +#ifndef _SVX_GRIDCOLS_HXX +#define _SVX_GRIDCOLS_HXX + +#include <sal/types.h> + +namespace rtl { class OUString; } + +#define FM_COL_TEXTFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextField" ) ) +#define FM_COL_COMBOBOX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ComboBox" ) ) +#define FM_COL_CHECKBOX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CheckBox" ) ) +#define FM_COL_TIMEFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TimeField" ) ) +#define FM_COL_DATEFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateField" ) ) +#define FM_COL_NUMERICFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NumericField" ) ) +#define FM_COL_CURRENCYFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CurrencyField" ) ) +#define FM_COL_PATTERNFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PatternField" ) ) +#define FM_COL_LISTBOX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ListBox" ) ) +#define FM_COL_FORMATTEDFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FormattedField" ) ) + +// column type ids +#define TYPE_CHECKBOX 0 +#define TYPE_COMBOBOX 1 +#define TYPE_CURRENCYFIELD 2 +#define TYPE_DATEFIELD 3 +#define TYPE_FORMATTEDFIELD 4 +#define TYPE_LISTBOX 5 +#define TYPE_NUMERICFIELD 6 +#define TYPE_PATTERNFIELD 7 +#define TYPE_TEXTFIELD 8 +#define TYPE_TIMEFIELD 9 + +//------------------------------------------------------------------------------ +sal_Int32 getColumnTypeByModelName(const ::rtl::OUString& aModelName); + + +#endif // _SVX_GRIDCOLS_HXX + diff --git a/svx/source/inc/hlmarkwn.hrc b/svx/source/inc/hlmarkwn.hrc new file mode 100644 index 000000000000..d79da8b38dd6 --- /dev/null +++ b/svx/source/inc/hlmarkwn.hrc @@ -0,0 +1,37 @@ +/************************************************************************* + * + * 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: hlmarkwn.hrc,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. + * + ************************************************************************/ + +#define BT_APPLY 1 +#define BT_CLOSE 2 +#define TLB_MARK 3 + +//#define HYPERLINK_BMP_EXPAND 301 +//#define HYPERLINK_BMP_COLLAPSE 302 + diff --git a/svx/source/inc/hlmarkwn.hxx b/svx/source/inc/hlmarkwn.hxx new file mode 100644 index 000000000000..6853eac1ccb6 --- /dev/null +++ b/svx/source/inc/hlmarkwn.hxx @@ -0,0 +1,114 @@ +/************************************************************************* + * + * 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: hlmarkwn.hxx,v $ + * $Revision: 1.7.216.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. + * + ************************************************************************/ + +#ifndef _SVX_BKWND_HYPERLINK_HXX +#define _SVX_BKWND_HYPERLINK_HXX + +#include <com/sun/star/container/XNameAccess.hpp> +#include <vcl/dialog.hxx> +#ifndef _SV_BUTTON_HXX +#include <vcl/button.hxx> +#endif +#include <svtools/svtreebx.hxx> + +#include "hlmarkwn_def.hxx" //ADD CHINA001 +class SvxHyperlinkTabPageBase; + +//######################################################################## +//# # +//# Tree-Window # +//# # +//######################################################################## + +class SvxHlinkDlgMarkWnd; + +class SvxHlmarkTreeLBox : public SvTreeListBox +{ +private: + SvxHlinkDlgMarkWnd* mpParentWnd; + +public: + SvxHlmarkTreeLBox( Window* pParent, const ResId& rResId ); + + virtual void Paint( const Rectangle& rRect ); +}; + +//######################################################################## +//# # +//# Window-Class # +//# # +//######################################################################## + +class SvxHlinkDlgMarkWnd : public ModalDialog //FloatingWindow +{ +private: + friend class SvxHlmarkTreeLBox; + + PushButton maBtApply; + PushButton maBtClose; + //SvTreeListBox maLbTree; + SvxHlmarkTreeLBox maLbTree; + + BOOL mbUserMoved; + BOOL mbFirst; + + SvxHyperlinkTabPageBase* mpParent; + + String maStrLastURL; + + USHORT mnError; + +protected: + BOOL RefreshFromDoc( ::rtl::OUString aURL ); + + SvLBoxEntry* FindEntry ( String aStrName ); + void ClearTree(); + int FillTree( ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xLinks, SvLBoxEntry* pParentEntry =NULL ); + + virtual void Move (); + + DECL_LINK (ClickApplyHdl_Impl, void * ); + DECL_LINK (ClickCloseHdl_Impl, void * ); + +public: + SvxHlinkDlgMarkWnd (SvxHyperlinkTabPageBase *pParent); + ~SvxHlinkDlgMarkWnd(); + + BOOL MoveTo ( Point aNewPos ); + void RefreshTree ( String aStrURL ); + void SelectEntry ( String aStrMark ); + + BOOL ConnectToDialog( BOOL bDoit = TRUE ); + + USHORT SetError( USHORT nError); +}; + + +#endif // _SVX_BKWND_HYPERLINK_HXX diff --git a/svx/source/inc/hyperdlg.hrc b/svx/source/inc/hyperdlg.hrc new file mode 100644 index 000000000000..69dae5d1ce57 --- /dev/null +++ b/svx/source/inc/hyperdlg.hrc @@ -0,0 +1,103 @@ +/************************************************************************* + * + * 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: hyperdlg.hrc,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. + * + ************************************************************************/ + +/* Tabpage : Hyperlink - Internet */ + +#define GRP_LINKTYPE 1 +#define RB_LINKTYP_INTERNET 2 +#define RB_LINKTYP_FTP 3 +#define RB_LINKTYP_TELNET 4 +#define FT_TARGET_HTML 5 +#define CB_TARGET_HTML 6 +#define FT_LOGIN 7 +#define ED_LOGIN 8 +#define FT_PASSWD 9 +#define ED_PASSWD 10 +#define CBX_ANONYMOUS 11 +#define BTN_BROWSE 12 +#define BTN_TARGET 13 +#define IMG_BROWSE_HC 14 +#define IMG_TARGET_HC 15 + +/* Tabpage : Hyperlink - Mail & News */ + +#define GRP_MAILNEWS 1 +#define RB_LINKTYP_MAIL 2 +#define RB_LINKTYP_NEWS 3 +#define FT_RECEIVER 4 +#define CB_RECEIVER 5 +#define FT_SUBJECT 6 +#define ED_SUBJECT 7 +#define BTN_ADRESSBOOK 8 +#define IMG_ADRESSBOOK_HC 9 + +/* Tabpage : Hyperlink - Document */ + +#define GRP_DOCUMENT 1 +#define FT_PATH_DOC 2 +#define CB_PATH_DOC 3 +#define BTN_FILEOPEN 4 +#define GRP_TARGET 5 +#define FT_TARGET_DOC 6 +#define ED_TARGET_DOC 7 +#define FT_URL 8 +#define FT_FULL_URL 9 +#define IMG_FILEOPEN_HC 10 + +/* Tabpage : Hyperlink - New document */ + +#define GRP_NEWDOCUMENT 1 +#define RB_EDITNOW 2 +#define RB_EDITLATER 3 +#define FT_PATH_NEWDOC 4 +#define ED_PATH_NEWDOC 5 +#define FT_DOCUMENT_TYPES 6 +#define LB_DOCUMENT_TYPES 7 +#define BTN_CREATE 8 +#define IMG_CREATE_HC 9 + +/* Tabpage-section : Hyperlink - more justifications */ + +#define GRP_MORE 30 +#define FT_FRAME 31 +#define CB_FRAME 32 +#define FT_FORM 33 +#define LB_FORM 34 +#define FT_INDICATION 35 +#define ED_INDICATION 36 +#define FT_TEXT 37 +#define ED_TEXT 38 +#define BTN_SCRIPT 39 +#define IMG_SCRIPT_HC 40 + +#define COL_OLD 54 +#define COL_2 63 +#define COL_DIFF (COL_2 - COL_OLD) + diff --git a/svx/source/inc/linectrl.hrc b/svx/source/inc/linectrl.hrc new file mode 100644 index 000000000000..e6ce4d19116c --- /dev/null +++ b/svx/source/inc/linectrl.hrc @@ -0,0 +1,31 @@ +/************************************************************************* + * + * 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: linectrl.hrc,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. + * + ************************************************************************/ +#define RID_SVXCTRL_LINECTRL 257 + diff --git a/svx/source/inc/macropg_impl.hxx b/svx/source/inc/macropg_impl.hxx new file mode 100644 index 000000000000..0563c2e05151 --- /dev/null +++ b/svx/source/inc/macropg_impl.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * 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: macropg_impl.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 _MACROPG_IMPL_HXX +#define _MACROPG_IMPL_HXX + +class _SvxMacroTabPage_Impl +{ +public: + _SvxMacroTabPage_Impl( const SfxItemSet& rAttrSet ); + ~_SvxMacroTabPage_Impl(); + + FixedText* pAssignFT; + PushButton* pAssignPB; + PushButton* pAssignComponentPB; + PushButton* pDeletePB; + Image* pMacroImg; + Image* pComponentImg; + Image* pMacroImg_h; + Image* pComponentImg_h; + String* pStrEvent; + String* pAssignedMacro; + _HeaderTabListBox* pEventLB; + BOOL bReadOnly; + BOOL bIDEDialogMode; +}; + +class AssignComponentDialog : public ModalDialog +{ +private: + FixedText maMethodLabel; + Edit maMethodEdit; + OKButton maOKButton; + CancelButton maCancelButton; + HelpButton maHelpButton; + + ::rtl::OUString maURL; + + DECL_LINK(ButtonHandler, Button *); + +public: + AssignComponentDialog( Window * pParent, const ::rtl::OUString& rURL ); + ~AssignComponentDialog(); + + ::rtl::OUString getURL( void ) const + { return maURL; } +}; + +#endif diff --git a/svx/source/inc/optchart.hrc b/svx/source/inc/optchart.hrc new file mode 100644 index 000000000000..ac42f857f8ea --- /dev/null +++ b/svx/source/inc/optchart.hrc @@ -0,0 +1,40 @@ +/************************************************************************* + * + * 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: optchart.hrc,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. + * + ************************************************************************/ + +// tab page for setting the default colors used for new charts + +#define FL_CHART_COLOR_LIST 1 +#define LB_CHART_COLOR_LIST 2 + +#define FL_COLOR_BOX 3 +#define CT_COLOR_BOX 4 + +#define PB_RESET_TO_DEFAULT 5 + diff --git a/svx/source/inc/optdict.hrc b/svx/source/inc/optdict.hrc new file mode 100644 index 000000000000..af9e9302d7d5 --- /dev/null +++ b/svx/source/inc/optdict.hrc @@ -0,0 +1,68 @@ +/************************************************************************* + * + * 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: optdict.hrc,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. + * + ************************************************************************/ +#ifndef _SVX_OPTDICT_HRC +#define _SVX_OPTDICT_HRC + +// defines ------------------------------------------------------------------ + +#define FT_DICTNAME 10 +#define ED_DICTNAME 11 +#define FT_DICTLANG 12 +#define LB_DICTLANG 13 +#define BTN_EXCEPT 14 +#define GB_NEWDICT 15 + +#define BTN_NEWDICT_OK 20 +#define BTN_NEWDICT_ESC 21 +#define BTN_NEWDICT_HLP 22 + +#define FT_BOOK 30 +#define FT_CONTENT 31 +#define LB_ALLDICTS 32 +#define GB_EDITDICTS 34 +#define FT_WORD 35 +#define ED_WORD 36 +#define FT_REPLACE 37 +#define ED_REPLACE 38 +#define PB_NEW_REPLACE 39 +#define PB_DELETE_REPLACE 40 +#define TLB_REPLACE 41 +#define STR_MODIFY 42 + +#define BTN_EDITCLOSE 50 +#define BTN_EDITNEW 51 +#define BTN_EDITCHANGE 52 +#define BTN_EDITREMOVE 53 +#define BTN_EDITHELP 54 + + + +#endif + diff --git a/svx/source/inc/recoveryui.hxx b/svx/source/inc/recoveryui.hxx new file mode 100644 index 000000000000..0daa58849d6c --- /dev/null +++ b/svx/source/inc/recoveryui.hxx @@ -0,0 +1,158 @@ +/************************************************************************* + * + * 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: recoveryui.hxx,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. + * + ************************************************************************/ + +#ifndef _RECOVERYUI_HXX +#define _RECOVERYUI_HXX + +//=============================================== +// includes + +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/frame/XSynchronousDispatch.hpp> +#include <com/sun/star/task/XStatusIndicatorFactory.hpp> +#include <cppuhelper/implbase2.hxx> +#include <vcl/window.hxx> +#include "docrecovery.hxx" + +//=============================================== +// namespace + +namespace svx +{ + +// Dont export this header ... Otherwise you have to remove this namespace alias! +namespace css = ::com::sun::star; +namespace svxdr = ::svx::DocRecovery; + +//=============================================== +// declarations + +class RecoveryUI : public ::cppu::WeakImplHelper2< css::lang::XServiceInfo , + css::frame::XSynchronousDispatch > // => XDispatch! +{ + //------------------------------------------- + // const, types, etcpp. + private: + + /** @short TODO */ + enum EJob + { + E_JOB_UNKNOWN, + E_DO_EMERGENCY_SAVE, + E_DO_RECOVERY, + E_DO_CRASHREPORT + }; + + //------------------------------------------- + // member + private: + + /** @short TODO */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /** @short TODO */ + Window* m_pParentWindow; + + /** @short TODO */ + RecoveryUI::EJob m_eJob; + + /** @short TODO */ + css::uno::Reference< css::task::XStatusIndicatorFactory > m_xProgressFactory; + + //------------------------------------------- + // interface + public: + + //--------------------------------------- + /** @short TODO */ + RecoveryUI(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + + //--------------------------------------- + /** @short TODO */ + virtual ~RecoveryUI(); + + //--------------------------------------- + // css.lang.XServiceInfo + + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& sServiceName) + throw(css::uno::RuntimeException); + + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(css::uno::RuntimeException); + + //--------------------------------------- + virtual com::sun::star::uno::Any SAL_CALL dispatchWithReturnValue(const css::util::URL& aURL, + const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) + throw(css::uno::RuntimeException); + + //--------------------------------------- + // css.frame.XDispatch + + virtual void SAL_CALL dispatch(const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments) + throw(css::uno::RuntimeException); + + virtual void SAL_CALL addStatusListener(const css::uno::Reference< css::frame::XStatusListener >& xListener, + const css::util::URL& aURL ) + throw(css::uno::RuntimeException); + virtual void SAL_CALL removeStatusListener(const css::uno::Reference< css::frame::XStatusListener >& xListener, + const css::util::URL& aURL ) + throw(css::uno::RuntimeException); + + //--------------------------------------- + // XServiceInfo helper + + static ::rtl::OUString st_getImplementationName(); + static css::uno::Sequence< ::rtl::OUString > st_getSupportedServiceNames(); + static css::uno::Reference< css::uno::XInterface > SAL_CALL st_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + + //------------------------------------------- + // helper + private: + + EJob impl_classifyJob(const css::util::URL& aURL); + + sal_Bool impl_doEmergencySave(); + + void impl_doRecovery(); + + void impl_showAllRecoveredDocs(); + + void impl_doCrashReport(); + +}; + +} // namespace svx + +#endif // _RECOVERYUI_HXX diff --git a/svx/source/inc/sdbdatacolumn.hxx b/svx/source/inc/sdbdatacolumn.hxx new file mode 100644 index 000000000000..171ed0c7e019 --- /dev/null +++ b/svx/source/inc/sdbdatacolumn.hxx @@ -0,0 +1,143 @@ +/************************************************************************* + * + * 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: sdbdatacolumn.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 SVX_FORM_SDBDATACOLUMN_HXX +#define SVX_FORM_SDBDATACOLUMN_HXX + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/sdb/XColumn.hpp> +#include <com/sun/star/sdb/XColumnUpdate.hpp> +#include <osl/diagnose.h> + +//.............................................................................. +namespace svxform +{ +//.............................................................................. + + //========================================================================== + //= DataColumn - a class wrapping an object implementing a sdb::DataColumn service + //========================================================================== + class DataColumn + { + // interfaces needed for sddb::Column + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xPropertySet; + // interfaces needed for sdb::DataColumn + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn> m_xColumn; + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumnUpdate> m_xColumnUpdate; + + public: + DataColumn() { }; + DataColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxIFace); + // if the object behind _rxIFace doesn't fully support the DataColumn service, + // (which is checked via the supported interfaces) _all_ members will be set to + // void !, even if the object has some of the needed interfaces. + + sal_Bool is() const { return m_xColumn.is(); } + sal_Bool Is() const { return m_xColumn.is(); } + sal_Bool supportsUpdate() const { return m_xColumnUpdate.is(); } + + DataColumn* operator ->() { return this; } + operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> () const{ return m_xColumn.get(); } + + // 'conversions' + inline const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& getPropertySet() const + { + return m_xPropertySet; + } + inline const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn>& getColumn() const + { + return m_xColumn; + } + inline const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumnUpdate>& getColumnUpdate() const + { + OSL_ENSURE(m_xColumnUpdate.is() , "DataColumn::getColumnUpdate: NULL!"); + return m_xColumnUpdate; + } + + // das normale queryInterface + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& type) throw ( ::com::sun::star::uno::RuntimeException ) + { return m_xColumn->queryInterface(type); } + + // ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> + inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> getPropertySetInfo() const throw( ::com::sun::star::uno::RuntimeException ); + inline void setPropertyValue(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue) 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 ); + inline ::com::sun::star::uno::Any getPropertyValue(const ::rtl::OUString& PropertyName) const throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ); + inline void addPropertyChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener>& xListener) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ); + inline void removePropertyChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener>& aListener) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ); + inline void addVetoableChangeListener(const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener>& aListener) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ); + inline void removeVetoableChangeListener(const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener>& aListener) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ); + + // ::com::sun::star::sdb::XColumn + inline sal_Bool wasNull() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline ::rtl::OUString getString() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline sal_Bool getBoolean() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline sal_Int8 getByte() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline sal_Int16 getShort() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline sal_Int32 getInt() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline sal_Int64 getLong() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline float getFloat() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline double getDouble() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline ::com::sun::star::uno::Sequence< sal_Int8 > getBytes() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline ::com::sun::star::util::Date getDate() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline ::com::sun::star::util::Time getTime() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline ::com::sun::star::util::DateTime getTimestamp() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream> getBinaryStream() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream> getCharacterStream() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline ::com::sun::star::uno::Any getObject(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& typeMap) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef> getRef() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob> getBlob() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob> getClob() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray> getArray() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + + // XColumnUpdate + inline void updateNull(void) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline void updateBoolean(sal_Bool x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline void updateByte(sal_Int8 x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline void updateShort(sal_Int16 x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline void updateInt(sal_Int32 x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline void updateLong(sal_Int64 x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline void updateFloat(float x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline void updateDouble(double x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline void updateString(const ::rtl::OUString& x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline void updateBytes(const ::com::sun::star::uno::Sequence< sal_Int8 >& x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline void updateDate(const com::sun::star::util::Date& x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline void updateTime(const ::com::sun::star::util::Time& x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline void updateTimestamp(const ::com::sun::star::util::DateTime& x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline void updateBinaryStream(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream>& x, sal_Int32 length) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline void updateCharacterStream(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream>& x, sal_Int32 length) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline void updateObject(const ::com::sun::star::uno::Any& x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + inline void updateNumericObject(const ::com::sun::star::uno::Any& x, sal_Int32 scale) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); + }; + +#endif // SVX_FORM_SDBDATACOLUMN_HXX + +//.............................................................................. +} // namespace svxform +//.............................................................................. diff --git a/svx/source/inc/sqlparserclient.hxx b/svx/source/inc/sqlparserclient.hxx new file mode 100644 index 000000000000..65f96cf80523 --- /dev/null +++ b/svx/source/inc/sqlparserclient.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * 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: sqlparserclient.hxx,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. + * + ************************************************************************/ + +#ifndef SVX_SQLPARSERCLIENT_HXX +#define SVX_SQLPARSERCLIENT_HXX + +#include "svx/dbtoolsclient.hxx" +#include "ParseContext.hxx" +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +//........................................................................ +namespace svxform +{ +//........................................................................ + + //==================================================================== + //= OSQLParserClient + //==================================================================== + class SVX_DLLPUBLIC OSQLParserClient : public ODbtoolsClient + ,public ::svxform::OParseContextClient + { + private: + //add by BerryJia for fixing Bug97420 Time:2002-9-12-11:00(PRC time) + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB; + + protected: + mutable ::rtl::Reference< ::connectivity::simple::ISQLParser > m_xParser; + + protected: + OSQLParserClient( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB); + virtual bool ensureLoaded() const; + + protected: + inline ::rtl::Reference< ::connectivity::simple::ISQLParseNode > predicateTree( + ::rtl::OUString& _rErrorMessage, + const ::rtl::OUString& _rStatement, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField + ) const + { + ::rtl::Reference< ::connectivity::simple::ISQLParseNode > xReturn; + if ( ensureLoaded() ) + xReturn = m_xParser->predicateTree(_rErrorMessage, _rStatement, _rxFormatter, _rxField); + return xReturn; + } + }; + +//........................................................................ +} // namespace svxform +//........................................................................ + +#endif // SVX_SQLPARSERCLIENT_HXX + + diff --git a/svx/source/inc/stringlistresource.hxx b/svx/source/inc/stringlistresource.hxx new file mode 100644 index 000000000000..76c7d1c92df7 --- /dev/null +++ b/svx/source/inc/stringlistresource.hxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * 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: stringlistresource.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 SVX_STRINGLISTRESOURCE_HXX +#define SVX_STRINGLISTRESOURCE_HXX + +#include <tools/rc.hxx> + +#include <svx/svxdllapi.h> + +#include <memory> + +//........................................................................ +namespace svx +{ +//........................................................................ + + //==================================================================== + //= StringListResource + //==================================================================== + /** loads a list of strings from a resource, where the resource is of type RSC_RESOURCE, + and has sub resources of type string, numbered from 1 to n + */ + class StringListResource : public Resource + { + public: + SVX_DLLPUBLIC StringListResource( const ResId& _rResId ); + SVX_DLLPUBLIC ~StringListResource(); + + inline void get( ::std::vector< String >& _rStrings ) + { + _rStrings = m_aStrings; + } + + + /** returns the String with a given local resource id + + @param _nResId + The resource id. It will not be checked if this id exists. + + @return String + The string. + */ + String getString( USHORT _nResId ) + { + return String( ResId( _nResId, *m_pResMgr ) ); + } + + size_t size() const { return m_aStrings.size(); } + bool empty() const { return m_aStrings.empty(); } + + const String& operator[]( size_t _index ) const { return m_aStrings[ _index ]; } + + private: + ::std::vector< String > m_aStrings; + }; + +//........................................................................ +} // namespace svx +//........................................................................ + +#endif // SVX_STRINGLISTRESOURCE_HXX diff --git a/svx/source/inc/svdoimp.hxx b/svx/source/inc/svdoimp.hxx new file mode 100644 index 000000000000..2b16060bbb4e --- /dev/null +++ b/svx/source/inc/svdoimp.hxx @@ -0,0 +1,114 @@ +/************************************************************************* + * + * 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: svdoimp.hxx,v $ + * $Revision: 1.15 $ + * + * 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 _SVX_SVDOIMP_HXX +#define _SVX_SVDOIMP_HXX + +#include <vcl/mapmod.hxx> + +//#include <svtools/lstner.hxx> +//#include <vcl/timer.hxx> +//#include <svx/svdsob.hxx> +//#include <svx/svdtypes.hxx> // fuer SdrLayerID +//#include <svx/svdglue.hxx> // Klebepunkte +//#include <svx/xdash.hxx> +//#include <svx/xpoly.hxx> +//#include <svx/xenum.hxx> +//#include <basegfx/vector/b2dvector.hxx> +#include <svx/rectenum.hxx> +//#include <basegfx/polygon/b2dpolypolygon.hxx> + +class Bitmap; + +/////////////////////////////////////////////////////////////////////////////// + +// #104609# Extracted from old XOutDev's ImpCalcBmpFillStartValues + +/** Calc offset and size for bitmap fill + + This method calculates the size and the offset from the left, top + position of a shape in logical coordinates + + @param rStartOffset + The offset from the left, top position of the output rectangle is returned + + @param rBmpOutputSize + The output size of the bitmap is returned herein + + @param rOutputRect + Specifies the output rectangle into which the bitmap should be tiled into + + @param rOutputMapMode + Specifies the logical coordinate system the output rectangle is in + + @param rFillBitmap + Specifies the bitmap to fill with + + @param rBmpSize + The desired destination bitmap size. If null, size is taken from the bitmap + + @param rBmpPerCent + Percentage of bitmap size, relative to the output rectangle + + @param rBmpOffPerCent + Offset for bitmap tiling, in percentage relative to bitmap output size + + @param bBmpLogSize + True when using the preferred bitmap size, False when using the percentage value + + @param bBmpTile + True for tiling. False only paints one instance of the bitmap + + @param bBmpStretch + True if bitmap should be stretched to output rect dimension + + @param eBmpRectPoint + Position of the start point relative to the bitmap + + */ +void ImpCalcBmpFillSizes( Size& rStartOffset, + Size& rBmpOutputSize, + const Rectangle& rOutputRect, + const MapMode& rOutputMapMode, + const Bitmap& rFillBitmap, + const Size& rBmpSize, + const Size& rBmpPerCent, + const Size& rBmpOffPerCent, + BOOL bBmpLogSize, + BOOL bBmpTile, + BOOL bBmpStretch, + RECT_POINT eBmpRectPoint ); + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +#endif // _SVX_SVDOIMP_HXX + +// eof diff --git a/svx/source/inc/svdoutlinercache.hxx b/svx/source/inc/svdoutlinercache.hxx new file mode 100644 index 000000000000..5bb81d0db3c8 --- /dev/null +++ b/svx/source/inc/svdoutlinercache.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * 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: svdoutlinercache.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 _SVX_SDROUTLINER_HXX +#define _SVX_SDROUTLINER_HXX + +#include <sal/types.h> + +class SdrModel; +class SdrOutliner; + + +class SdrOutlinerCache +{ +private: + SdrModel* mpModel; + + SdrOutliner* mpModeOutline; + SdrOutliner* mpModeText; +public: + SdrOutlinerCache( SdrModel* pModel ); + ~SdrOutlinerCache(); + + SdrOutliner* createOutliner( sal_uInt16 nOutlinerMode ); + void disposeOutliner( SdrOutliner* pOutliner ); +}; + +#endif + + diff --git a/svx/source/inc/svxrectctaccessiblecontext.hxx b/svx/source/inc/svxrectctaccessiblecontext.hxx new file mode 100644 index 000000000000..9479ed15cfc4 --- /dev/null +++ b/svx/source/inc/svxrectctaccessiblecontext.hxx @@ -0,0 +1,569 @@ +/************************************************************************* + * + * 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: svxrectctaccessiblecontext.hxx,v $ + * $Revision: 1.14 $ + * + * 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 _SVXRECTACCESSIBLECONTEXT_HXX +#define _SVXRECTACCESSIBLECONTEXT_HXX + +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/XAccessibleComponent.hpp> +#include <com/sun/star/accessibility/XAccessibleContext.hpp> +#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> +#include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp> +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> +#include <com/sun/star/accessibility/XAccessibleValue.hpp> +#include <com/sun/star/beans/XPropertyChangeListener.hpp> +#include <com/sun/star/uno/Reference.hxx> +#include <cppuhelper/weak.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XServiceName.hpp> +#include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +#include <vos/mutex.hxx> +#include <cppuhelper/interfacecontainer.h> +#include <cppuhelper/compbase6.hxx> +//#ifndef _CPPUHELPER_COMPBASE7_HXX_ +//#include <cppuhelper/compbase7.hxx> +//#endif +#include <comphelper/broadcasthelper.hxx> +#include <cppuhelper/implbase6.hxx> +#include <comphelper/servicehelper.hxx> +#include <svx/rectenum.hxx> + +namespace com { namespace sun { namespace star { namespace awt { + struct Point; + struct Rectangle; + struct Size; + class XFocusListener; +} } } } + +class Rectangle; +class SvxRectCtl; +class SvxRectCtlChildAccessibleContext; +class Window; + + +typedef ::cppu::WeakAggComponentImplHelper6< + ::com::sun::star::accessibility::XAccessible, + ::com::sun::star::accessibility::XAccessibleComponent, + ::com::sun::star::accessibility::XAccessibleContext, + ::com::sun::star::accessibility::XAccessibleEventBroadcaster, + ::com::sun::star::accessibility::XAccessibleSelection, + ::com::sun::star::lang::XServiceInfo > + SvxRectCtlAccessibleContext_Base; + +class SvxRectCtlAccessibleContext : public ::comphelper::OBaseMutex, public SvxRectCtlAccessibleContext_Base +{ +public: + //===== internal ======================================================== + SvxRectCtlAccessibleContext( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>& rxParent, + SvxRectCtl& rRepresentation, + const ::rtl::OUString* pName = NULL, + const ::rtl::OUString* pDescription = NULL ); +protected: + virtual ~SvxRectCtlAccessibleContext(); +public: + //===== XAccessible ===================================================== + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL + getAccessibleContext( void ) throw( ::com::sun::star::uno::RuntimeException ); + + //===== XAccessibleComponent ============================================ + + virtual sal_Bool SAL_CALL + containsPoint( const ::com::sun::star::awt::Point& rPoint ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::awt::Rectangle SAL_CALL + getBounds() throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::awt::Point SAL_CALL + getLocation() throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::awt::Point SAL_CALL + getLocationOnScreen() throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::awt::Size SAL_CALL + getSize() throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL + isShowing() throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL + isVisible() throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL + isFocusTraversable() throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL + addFocusListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL + removeFocusListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL + grabFocus() throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Any SAL_CALL + getAccessibleKeyBinding() throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Int32 SAL_CALL + getForeground( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL + getBackground( ) throw (::com::sun::star::uno::RuntimeException); + + //===== XAccessibleContext ============================================== + + virtual sal_Int32 SAL_CALL + getAccessibleChildCount( void ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL + getAccessibleChild( sal_Int32 nIndex ) + throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL + getAccessibleParent( void ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Int32 SAL_CALL + getAccessibleIndexInParent( void ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Int16 SAL_CALL + getAccessibleRole( void ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::rtl::OUString SAL_CALL + getAccessibleDescription( void ) throw (::com::sun::star::uno::RuntimeException); + + virtual ::rtl::OUString SAL_CALL + getAccessibleName( void ) throw (::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL + getAccessibleRelationSet( void ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL + getAccessibleStateSet( void ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::lang::Locale SAL_CALL + getLocale( void ) + throw( ::com::sun::star::uno::RuntimeException, + ::com::sun::star::accessibility::IllegalAccessibleComponentStateException ); + + //===== XComponent ===================================================== + + using ::cppu::WeakAggComponentImplHelperBase::addEventListener; + using ::cppu::WeakAggComponentImplHelperBase::removeEventListener; + + //===== XAccessibleEventBroadcaster ===================================== + + virtual void SAL_CALL + addEventListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) + throw( com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL + removeEventListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) + throw( com::sun::star::uno::RuntimeException ); + + //===== XServiceInfo ==================================================== + + virtual ::rtl::OUString SAL_CALL + getImplementationName( void ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL + supportsService( const ::rtl::OUString& sServiceName ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL + getSupportedServiceNames( void ) throw( ::com::sun::star::uno::RuntimeException ); + + //===== XTypeProvider =================================================== + + virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL + getImplementationId( void ) throw( ::com::sun::star::uno::RuntimeException ); + + //===== XAccessibleSelection ============================================= + + virtual void SAL_CALL + selectAccessibleChild( sal_Int32 nChildIndex ) + throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL + isAccessibleChildSelected( sal_Int32 nChildIndex ) + throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL + clearAccessibleSelection() throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL + selectAllAccessibleChildren() throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Int32 SAL_CALL + getSelectedAccessibleChildCount() throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL + getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) + throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL + deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) + throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException ); + + +protected: + //===== internals ======================================================== + + void checkChildIndex( long nIndexOfChild ) throw( ::com::sun::star::lang::IndexOutOfBoundsException ); + + void checkChildIndexOnSelection( long nIndexOfChild ) throw( ::com::sun::star::lang::IndexOutOfBoundsException ); + + /** Selects a new child by index. + + <p>If the child was not selected before, the state of the child will + be updated. If the index is invalid, the index will internaly set to NOCHILDSELECTED</p> + + @param nIndexOfChild + Index of the new child which should be selected. + */ + void selectChild( long nIndexOfChild ); + +public: + /** Selects a new child by point. + + <p>If the child was not selected before, the state of the child will + be updated. If the point is not invalid, the index will internaly set to NOCHILDSELECTED</p> + + @param eButton + Button which belongs to the child which should be selected. + */ + void selectChild( RECT_POINT ePoint ); + + /// Sets the name + void setName( const ::rtl::OUString& rName ); + + /// Sets the description + void setDescription( const ::rtl::OUString& rDescr ); +private: + static ::com::sun::star::uno::Sequence< sal_Int8 > getUniqueId( void ); +protected: + + /// @Return the object's current bounding box relative to the desktop. + virtual Rectangle GetBoundingBoxOnScreen( void ) throw( ::com::sun::star::uno::RuntimeException ); + + /// @Return the object's current bounding box relative to the parent object. + virtual Rectangle GetBoundingBox( void ) throw( ::com::sun::star::uno::RuntimeException ); + + /// Calls all Listener to tell they the change. + void CommitChange( const com::sun::star::accessibility::AccessibleEventObject& rEvent ); + + virtual void SAL_CALL disposing(); + + /// @returns true if it's disposed or in disposing + inline sal_Bool IsAlive( void ) const; + + /// @returns true if it's not disposed and no in disposing + inline sal_Bool IsNotAlive( void ) const; + + /// throws the exception DisposedException if it's not alive + void ThrowExceptionIfNotAlive( void ) throw( ::com::sun::star::lang::DisposedException ); + +private: + /** Description of this object. This is not a constant because it can + be set from the outside. + */ + ::rtl::OUString msDescription; + + /** Name of this object. + */ + ::rtl::OUString msName; + + /// Reference to the parent object. + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + mxParent; + + /// pointer to internal representation + SvxRectCtl* mpRepr; + + /// array for all possible childs + SvxRectCtlChildAccessibleContext** mpChilds; + + /// client id in the AccessibleEventNotifier queue + sal_uInt32 mnClientId; + + /// actual selected child + long mnSelectedChild; + + /// mode of control (true -> 8 points, false -> 9 points) + sal_Bool mbAngleMode; +}; + +inline sal_Bool SvxRectCtlAccessibleContext::IsAlive( void ) const +{ + return !rBHelper.bDisposed && !rBHelper.bInDispose; +} + +inline sal_Bool SvxRectCtlAccessibleContext::IsNotAlive( void ) const +{ + return rBHelper.bDisposed || rBHelper.bInDispose; +} + + +typedef ::cppu::WeakAggComponentImplHelper6< + ::com::sun::star::accessibility::XAccessible, + ::com::sun::star::accessibility::XAccessibleComponent, + ::com::sun::star::accessibility::XAccessibleContext, + ::com::sun::star::accessibility::XAccessibleEventBroadcaster, + ::com::sun::star::accessibility::XAccessibleValue, + ::com::sun::star::lang::XServiceInfo > + SvxRectCtlChildAccessibleContext_Base; + + +class SvxRectCtlChildAccessibleContext : public SvxRectCtlChildAccessibleContext_Base +{ +public: + SvxRectCtlChildAccessibleContext( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>& rxParent, + const Window& rParentWindow, + const ::rtl::OUString& rName, const ::rtl::OUString& rDescription, + const Rectangle& rBoundingBox, + long nIndexInParent ); +protected: + virtual ~SvxRectCtlChildAccessibleContext(); +public: + //===== XAccessible ===================================================== + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL + getAccessibleContext( void ) throw( ::com::sun::star::uno::RuntimeException ); + + //===== XAccessibleComponent ============================================ + + virtual sal_Bool SAL_CALL + containsPoint( const ::com::sun::star::awt::Point& rPoint ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::awt::Rectangle SAL_CALL + getBounds() throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::awt::Point SAL_CALL + getLocation() throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::awt::Point SAL_CALL + getLocationOnScreen() throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::awt::Size SAL_CALL + getSize() throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL + isShowing() throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL + isVisible() throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL + isFocusTraversable() throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL + addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL + removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) + throw (::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL + grabFocus() throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Any SAL_CALL + getAccessibleKeyBinding() throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Int32 SAL_CALL + getForeground( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL + getBackground( ) throw (::com::sun::star::uno::RuntimeException); + + //===== XAccessibleContext ============================================== + + virtual sal_Int32 SAL_CALL + getAccessibleChildCount( void ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleChild( sal_Int32 nIndex ) + throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleParent( void ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Int32 SAL_CALL + getAccessibleIndexInParent( void ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Int16 SAL_CALL + getAccessibleRole( void ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::rtl::OUString SAL_CALL + getAccessibleDescription( void ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::rtl::OUString SAL_CALL + getAccessibleName( void ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL + getAccessibleRelationSet( void ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL + getAccessibleStateSet( void ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::lang::Locale SAL_CALL + getLocale( void ) + throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::accessibility::IllegalAccessibleComponentStateException ); + + //===== XComponent ===================================================== + + using ::cppu::WeakAggComponentImplHelperBase::addEventListener; + using ::cppu::WeakAggComponentImplHelperBase::removeEventListener; + + //===== XAccessibleEventBroadcaster ===================================== + + virtual void SAL_CALL + addEventListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL + removeEventListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) + throw( com::sun::star::uno::RuntimeException ); + + //===== XAccessibleValue ================================================ + + virtual ::com::sun::star::uno::Any SAL_CALL + getCurrentValue() throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL + setCurrentValue( const ::com::sun::star::uno::Any& aNumber ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Any SAL_CALL + getMaximumValue() throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Any SAL_CALL + getMinimumValue() throw( ::com::sun::star::uno::RuntimeException ); + + //===== XServiceInfo ==================================================== + + virtual ::rtl::OUString SAL_CALL + getImplementationName( void ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL + supportsService( const ::rtl::OUString& sServiceName ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL + getSupportedServiceNames( void ) throw( ::com::sun::star::uno::RuntimeException ); + + + //===== XTypeProvider =================================================== + + virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL + getImplementationId( void ) throw( ::com::sun::star::uno::RuntimeException ); + + //===== internal ========================================================== + + /// Sets the checked status + void setStateChecked( sal_Bool bChecked ); + +protected: + virtual Rectangle GetBoundingBoxOnScreen( void ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual Rectangle GetBoundingBox( void ) throw( ::com::sun::star::uno::RuntimeException ); + + void CommitChange( const com::sun::star::accessibility::AccessibleEventObject& rEvent ); + + virtual void SAL_CALL disposing(); + + /// @returns true if it's disposed or in disposing + inline sal_Bool IsAlive( void ) const; + + /// @returns true if it's not disposed and no in disposing + inline sal_Bool IsNotAlive( void ) const; + + /// throws the exception DisposedException if it's not alive + void ThrowExceptionIfNotAlive( void ) throw( ::com::sun::star::lang::DisposedException ); + + /// Mutex guarding this object. + ::osl::Mutex maMutex; + +private: + + /** Description of this object. This is not a constant because it can + be set from the outside. Furthermore, it changes according the the + draw page's display mode. + */ + ::rtl::OUString msDescription; + + /** Name of this object. It changes according the the draw page's + display mode. + */ + ::rtl::OUString msName; + + /// Reference to the parent object. + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + mxParent; + + /// Bounding box + Rectangle* mpBoundingBox; + + /// window of parent + const Window& mrParentWindow; + + /// client id in the AccessibleEventNotifier queue + sal_uInt32 mnClientId; + + /// index of child in parent + long mnIndexInParent; + + /// Indicates, if object is checked + sal_Bool mbIsChecked; +}; + +inline sal_Bool SvxRectCtlChildAccessibleContext::IsAlive( void ) const +{ + return !rBHelper.bDisposed && !rBHelper.bInDispose; +} + +inline sal_Bool SvxRectCtlChildAccessibleContext::IsNotAlive( void ) const +{ + return rBHelper.bDisposed || rBHelper.bInDispose; +} + + +#endif diff --git a/svx/source/inc/tabwin.hxx b/svx/source/inc/tabwin.hxx new file mode 100644 index 000000000000..be46c05a58d5 --- /dev/null +++ b/svx/source/inc/tabwin.hxx @@ -0,0 +1,147 @@ +/************************************************************************* + * + * 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: tabwin.hxx,v $ + * $Revision: 1.13 $ + * + * 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 _SVX_TABWIN_HXX +#define _SVX_TABWIN_HXX + +#include <svtools/svtreebx.hxx> +#include <vcl/floatwin.hxx> +#include <sfx2/basedlgs.hxx> +#include <sfx2/childwin.hxx> +#include <sfx2/ctrlitem.hxx> +#include <com/sun/star/form/XForm.hpp> + +//#ifndef _SVX_FMTOOLS_HXX +//#include "fmtools.hxx" +//#endif +#include <comphelper/propmultiplex.hxx> +#include <svtools/transfer.hxx> +#include "svx/dbtoolsclient.hxx" + +//================================================================== +class FmFieldWin; +class SAL_DLLPRIVATE FmFieldWinListBox + :public SvTreeListBox +{ + FmFieldWin* pTabWin; + +protected: +// virtual void Command( const CommandEvent& rEvt ); + +public: + FmFieldWinListBox( FmFieldWin* pParent ); + virtual ~FmFieldWinListBox(); + + sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); + sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); + +protected: + // DragSourceHelper + virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ); + + // SvLBox + virtual BOOL DoubleClickHdl(); + + using SvLBox::ExecuteDrop; +}; + +//======================================================================== +class FmFormShell; +class SAL_DLLPRIVATE FmFieldWinData +{ +public: + FmFieldWinData(); + ~FmFieldWinData(); +}; + +//======================================================================== +class SAL_DLLPRIVATE FmFieldWin :public SfxFloatingWindow + ,public SfxControllerItem + ,public ::comphelper::OPropertyChangeListener + ,public ::svxform::OStaticDataAccessTools +{ + ::osl::Mutex m_aMutex; + FmFieldWinListBox* pListBox; + FmFieldWinData* pData; + ::svxform::SharedConnection + m_aConnection; + ::rtl::OUString m_aDatabaseName, + m_aObjectName; + sal_Int32 m_nObjectType; + + ::comphelper::OPropertyChangeMultiplexer* m_pChangeListener; + +public: + FmFieldWin(SfxBindings *pBindings, + SfxChildWindow *pMgr, Window* pParent); + + virtual ~FmFieldWin(); + virtual void Resize(); + virtual sal_Bool Close(); + virtual void GetFocus(); + virtual long PreNotify( NotifyEvent& _rNEvt ); + virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, + const SfxPoolItem* pState); + + FmFieldWinData* GetData() const {return pData;} + + void UpdateContent(FmFormShell*); + void UpdateContent(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > &); + void FillInfo( SfxChildWinInfo& rInfo ) const; + + const ::rtl::OUString& GetDatabaseName() const { return m_aDatabaseName; } + ::svxform::SharedConnection GetConnection() const { return m_aConnection; } + const ::rtl::OUString& GetObjectName() const { return m_aObjectName; } + sal_Int32 GetObjectType() const { return m_nObjectType; } + + sal_Bool createSelectionControls( ); + +protected: + // FmXChangeListener + virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw( ::com::sun::star::uno::RuntimeException ); + +protected: + inline SfxBindings& GetBindings() { return SfxControllerItem::GetBindings(); } + inline const SfxBindings& GetBindings() const { return SfxControllerItem::GetBindings(); } + + using SfxFloatingWindow::StateChanged; +}; + +//======================================================================== +class SAL_DLLPRIVATE FmFieldWinMgr : public SfxChildWindow +{ +public: + FmFieldWinMgr(Window *pParent, sal_uInt16 nId, + SfxBindings *pBindings, SfxChildWinInfo *pInfo); + SFX_DECL_CHILDWINDOW(FmFieldWinMgr); +}; + + +#endif + diff --git a/svx/source/inc/tbxform.hxx b/svx/source/inc/tbxform.hxx new file mode 100644 index 000000000000..9847b20fcdb0 --- /dev/null +++ b/svx/source/inc/tbxform.hxx @@ -0,0 +1,169 @@ +/************************************************************************* + * + * 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: tbxform.hxx,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. + * + ************************************************************************/ +#ifndef _SVX_TBXFORM_HXX +#define _SVX_TBXFORM_HXX + +#include <sfx2/tbxctrl.hxx> +#include <vcl/field.hxx> +#include <vcl/dialog.hxx> + +#ifndef _SV_BUTTON_HXX //autogen +#include <vcl/button.hxx> +#endif + +//======================================================================== +class SvxFmAbsRecWin : public NumericField +{ + SfxToolBoxControl* m_pController; + // for invalidating our content whe losing the focus +public: + SvxFmAbsRecWin( Window* _pParent, SfxToolBoxControl* _pController ); + ~SvxFmAbsRecWin(); + + virtual void KeyInput( const KeyEvent& rKeyEvt ); + virtual void LoseFocus(); + +protected: + virtual void FirePosition( sal_Bool _bForce ); +}; + + +//======================================================================== +class SvxFmConfigWin : public SfxPopupWindow +{ +private: + DECL_LINK( TbxSelectHdl, ToolBox* ); + +public: + SvxFmConfigWin( USHORT nId, ResId aRIdWin, ResId aRIdTbx ); + ~SvxFmConfigWin(); + + void Update(); + virtual void PopupModeEnd(); +}; + + +//======================================================================== +class SvxFmTbxCtlConfig : public SfxToolBoxControl +{ +private: + UINT16 nLastSlot; + +protected: + using SfxToolBoxControl::Select; + +public: + SFX_DECL_TOOLBOX_CONTROL(); + + SvxFmTbxCtlConfig( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); + ~SvxFmTbxCtlConfig() {} + + virtual void Select( USHORT nModifier ); + virtual void StateChanged( USHORT nSID, SfxItemState eState, + const SfxPoolItem* pState ); + virtual SfxPopupWindowType GetPopupWindowType() const; + virtual SfxPopupWindow* CreatePopupWindow(); +}; + +//======================================================================== +class FixedText; +class SvxFmTbxCtlAbsRec : public SfxToolBoxControl +{ +public: + SFX_DECL_TOOLBOX_CONTROL(); + + SvxFmTbxCtlAbsRec( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); + ~SvxFmTbxCtlAbsRec(); + + virtual Window* CreateItemWindow( Window* pParent ); + + virtual void StateChanged( USHORT nSID, SfxItemState eState, + const SfxPoolItem* pState ); +}; + +//======================================================================== +class SvxFmTbxCtlRecText : public SfxToolBoxControl +{ +public: + SFX_DECL_TOOLBOX_CONTROL(); + + SvxFmTbxCtlRecText( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); + ~SvxFmTbxCtlRecText(); + + virtual Window* CreateItemWindow( Window* pParent ); +}; + +//======================================================================== +class SvxFmTbxCtlRecFromText : public SfxToolBoxControl +{ +public: + SFX_DECL_TOOLBOX_CONTROL(); + + SvxFmTbxCtlRecFromText( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); + ~SvxFmTbxCtlRecFromText(); + + virtual Window* CreateItemWindow( Window* pParent ); +}; + +//======================================================================== +class SvxFmTbxCtlRecTotal : public SfxToolBoxControl +{ + FixedText* pFixedText; + +public: + SFX_DECL_TOOLBOX_CONTROL(); + + SvxFmTbxCtlRecTotal( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); + ~SvxFmTbxCtlRecTotal(); + + virtual Window* CreateItemWindow( Window* pParent ); + virtual void StateChanged( USHORT nSID, SfxItemState eState, + const SfxPoolItem* pState ); +}; + +//======================================================================== +class SvxFmTbxNextRec : public SfxToolBoxControl +{ +public: + SFX_DECL_TOOLBOX_CONTROL(); + SvxFmTbxNextRec( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); +}; + +//======================================================================== +class SvxFmTbxPrevRec : public SfxToolBoxControl +{ +public: + SFX_DECL_TOOLBOX_CONTROL(); + SvxFmTbxPrevRec( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); +}; + + +#endif + diff --git a/svx/source/inc/trace.hxx b/svx/source/inc/trace.hxx new file mode 100644 index 000000000000..f4543d68877d --- /dev/null +++ b/svx/source/inc/trace.hxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * 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: trace.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 _TRACE_HXX_ +#define _TRACE_HXX_ + +#if defined(DBG_UTIL) + +#include <tools/string.hxx> +#include <vos/thread.hxx> +#include <vos/mutex.hxx> +#include <comphelper/stl_types.hxx> + + +class Tracer +{ + ByteString m_sBlockDescription; + + DECLARE_STL_STDKEY_MAP( ::vos::OThread::TThreadIdentifier, sal_Int32, MapThreadId2Int ); + static MapThreadId2Int s_aThreadIndents; + + static ::vos::OMutex s_aMapSafety; + +public: + Tracer(const char* _pBlockDescription); + ~Tracer(); + + void TraceString(const char* _pMessage); + void TraceString1StringParam(const char* _pMessage, const char* _pParam); +}; + + +#define TRACE_RANGE(range_description) Tracer aTrace(range_description); +#define TRACE_RANGE_MESSAGE(message) { aTrace.TraceString(message); } +#define TRACE_RANGE_MESSAGE1(message, param) { aTrace.TraceString1StringParam(message, param); } + +#else + +#define TRACE_RANGE(range_description) ; +#define TRACE_RANGE_MESSAGE(message) ; +#define TRACE_RANGE_MESSAGE1(message, param) ; + +#endif + +#endif // _TRACE_HXX_ diff --git a/svx/source/inc/treevisitor.hxx b/svx/source/inc/treevisitor.hxx new file mode 100644 index 000000000000..ac66dcb2d1c6 --- /dev/null +++ b/svx/source/inc/treevisitor.hxx @@ -0,0 +1,112 @@ +/************************************************************************* +* 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 SVX_TREE_VISITOR_HXX +#define SVX_TREE_VISITOR_HXX + +#include <stack> + +template< class ELEMENT, class NODEINFO, class PROCESSOR > +class TreeVisitor +{ +public: + TreeVisitor( NODEINFO _nodeInfo ) + :m_visitedRoot( false ) + ,m_root() + ,m_current() + ,m_nodeInfo( _nodeInfo ) + { + } + + void process( const ELEMENT& _root, PROCESSOR& _processor ) + { + m_root = _root; + m_visitedRoot = false; + + while ( do_step() ) + _processor.process( m_current ); + } + +private: + bool do_step(); + +private: + bool m_visitedRoot; + ELEMENT m_root; + ELEMENT m_current; + const NODEINFO m_nodeInfo; + + ::std::stack< size_t > m_pathToCurrent; + ::std::stack< ELEMENT > m_currentAncestors; +}; + +template< class ELEMENT, class NODEINFO, class PROCESSOR > +bool TreeVisitor< ELEMENT, NODEINFO, PROCESSOR >::do_step() +{ + if ( !m_visitedRoot ) + { + m_current = m_root; + m_visitedRoot = true; + return true; + } + + // can we step down from the current node? + size_t childCount = m_nodeInfo.childCount( m_current ); + if ( childCount ) + { + m_currentAncestors.push( m_current ); + m_current = m_nodeInfo.getChild( m_current, 0 ); + m_pathToCurrent.push( 0 ); + return true; + } + + // is there a right sibling of the current node? + while ( !m_pathToCurrent.empty() ) + { + const ELEMENT& currentParent = m_currentAncestors.top(); + childCount = m_nodeInfo.childCount( currentParent ); + + size_t currentChildPos = m_pathToCurrent.top(); + if ( ++currentChildPos < childCount ) + { + // yes there is + m_pathToCurrent.top() = currentChildPos; + m_current = m_nodeInfo.getChild( currentParent, currentChildPos ); + return true; + } + + // no there isn't => step up + m_currentAncestors.pop(); + m_pathToCurrent.pop(); + } + + return false; +} + +#endif // SVX_TREE_VISITOR_HXX diff --git a/svx/source/inc/typeconversionclient.hxx b/svx/source/inc/typeconversionclient.hxx new file mode 100644 index 000000000000..2cfaaabe5173 --- /dev/null +++ b/svx/source/inc/typeconversionclient.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * 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: typeconversionclient.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 SVX_TYPECONVERSION_CLIENT_HXX +#define SVX_TYPECONVERSION_CLIENT_HXX + +#include "svx/dbtoolsclient.hxx" + +//........................................................................ +namespace svxform +{ +//........................................................................ + + //==================================================================== + //= OTypeConversionClient + //==================================================================== + class OTypeConversionClient : public ODbtoolsClient + { + protected: + mutable ::rtl::Reference< ::connectivity::simple::IDataAccessTypeConversion > + m_xTypeConversion; + virtual bool ensureLoaded() const; + + public: + OTypeConversionClient(); + + // -------------------------------------------------------- + inline ::com::sun::star::util::Date getStandardDate() const + { + ::com::sun::star::util::Date aReturn; + if ( ensureLoaded() ) + aReturn = m_xTypeConversion->getStandardDate(); + return aReturn; + } + + // -------------------------------------------------------- + inline double getValue( + const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn>& _rxVariant, + const ::com::sun::star::util::Date& _rNullDate, + sal_Int16 _nKeyType) const + { + double nReturn(0); + if ( ensureLoaded() ) + nReturn = m_xTypeConversion->getValue(_rxVariant, _rNullDate, _nKeyType); + return nReturn; + } + + // -------------------------------------------------------- + inline ::rtl::OUString getValue( + const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxColumn, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter, + const ::com::sun::star::util::Date& _rNullDate, + sal_Int32 _nKey, + sal_Int16 _nKeyType) const + { + ::rtl::OUString sReturn; + if ( ensureLoaded() ) + sReturn = m_xTypeConversion->getValue(_rxColumn, _rxFormatter, _rNullDate, _nKey, _nKeyType); + return sReturn; + } + }; + +//........................................................................ +} // namespace svxform +//........................................................................ + +#endif // SVX_TYPECONVERSION_CLIENT_HXX + + diff --git a/svx/source/inc/unoedprx.hxx b/svx/source/inc/unoedprx.hxx new file mode 100644 index 000000000000..4758b17dd621 --- /dev/null +++ b/svx/source/inc/unoedprx.hxx @@ -0,0 +1,177 @@ +/************************************************************************* + * + * 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: unoedprx.hxx,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. + * + ************************************************************************/ + +#ifndef _SVX_UNOEDPRX_HXX +#define _SVX_UNOEDPRX_HXX + +#include <memory> +#include <svtools/brdcst.hxx> +#include <svx/unoedsrc.hxx> + +#include <svx/editdata.hxx> + + +class SvxAccessibleTextAdapter : public SvxTextForwarder +{ +public: + SvxAccessibleTextAdapter(); + virtual ~SvxAccessibleTextAdapter(); + + virtual USHORT GetParagraphCount() const; + virtual USHORT GetTextLen( USHORT nParagraph ) const; + virtual String GetText( const ESelection& rSel ) const; + virtual SfxItemSet GetAttribs( const ESelection& rSel, BOOL bOnlyHardAttrib = 0 ) const; + virtual SfxItemSet GetParaAttribs( USHORT nPara ) const; + virtual void SetParaAttribs( USHORT nPara, const SfxItemSet& rSet ); + virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ); + virtual void GetPortions( USHORT nPara, SvUShorts& rList ) const; + + virtual USHORT GetItemState( const ESelection& rSel, USHORT nWhich ) const; + virtual USHORT GetItemState( USHORT nPara, USHORT nWhich ) const; + + virtual void QuickInsertText( const String& rText, const ESelection& rSel ); + virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ); + virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ); + virtual void QuickInsertLineBreak( const ESelection& rSel ); + + virtual SfxItemPool* GetPool() const; + + virtual XubString CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor ); + virtual BOOL IsValid() const; + + virtual LanguageType GetLanguage( USHORT, USHORT ) const; + virtual USHORT GetFieldCount( USHORT nPara ) const; + virtual EFieldInfo GetFieldInfo( USHORT nPara, USHORT nField ) const; + virtual EBulletInfo GetBulletInfo( USHORT nPara ) const; + virtual Rectangle GetCharBounds( USHORT nPara, USHORT nIndex ) const; + virtual Rectangle GetParaBounds( USHORT nPara ) const; + virtual MapMode GetMapMode() const; + virtual OutputDevice* GetRefDevice() const; + virtual sal_Bool GetIndexAtPoint( const Point&, USHORT& nPara, USHORT& nIndex ) const; + virtual sal_Bool GetWordIndices( USHORT nPara, USHORT nIndex, USHORT& nStart, USHORT& nEnd ) const; + virtual sal_Bool GetAttributeRun( USHORT& nStartIndex, USHORT& nEndIndex, USHORT nPara, USHORT nIndex ) const; + virtual USHORT GetLineCount( USHORT nPara ) const; + virtual USHORT GetLineLen( USHORT nPara, USHORT nLine ) const; + virtual void GetLineBoundaries( /*out*/USHORT &rStart, /*out*/USHORT &rEnd, USHORT nParagraph, USHORT nLine ) const; + virtual USHORT GetLineNumberAtIndex( USHORT nPara, USHORT nIndex ) const; + + virtual sal_Bool Delete( const ESelection& ); + virtual sal_Bool InsertText( const String&, const ESelection& ); + virtual sal_Bool QuickFormatDoc( BOOL bFull=FALSE ); + virtual sal_Int16 GetDepth( USHORT nPara ) const; + virtual sal_Bool SetDepth( USHORT nPara, sal_Int16 nNewDepth ); + + virtual const SfxItemSet* GetEmptyItemSetPtr(); + + // implementation functions for XParagraphAppend and XTextPortionAppend + // (not needed for accessibility, only for new import API) + virtual void AppendParagraph(); + virtual xub_StrLen AppendTextPortion( USHORT nPara, const String &rText, const SfxItemSet &rSet ); + + //XTextCopy + virtual void CopyText(const SvxTextForwarder& rSource); + + void SetForwarder( SvxTextForwarder& ); + sal_Bool HaveImageBullet( USHORT nPara ) const; + sal_Bool HaveTextBullet( USHORT nPara ) const; + + /** Query whether all text in given selection is editable + + @return sal_True if every character in the given selection can + be changed, and sal_False if e.g. a field or a bullet is + contained therein. + */ + sal_Bool IsEditable( const ESelection& rSelection ); + +private: + SvxTextForwarder* mrTextForwarder; +}; + +class SvxAccessibleTextEditViewAdapter : public SvxEditViewForwarder +{ +public: + + SvxAccessibleTextEditViewAdapter(); + virtual ~SvxAccessibleTextEditViewAdapter(); + + // SvxViewForwarder interface + virtual BOOL IsValid() const; + virtual Rectangle GetVisArea() const; + virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const; + virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const; + + // SvxEditViewForwarder interface + virtual sal_Bool GetSelection( ESelection& rSelection ) const; + virtual sal_Bool SetSelection( const ESelection& rSelection ); + virtual sal_Bool Copy(); + virtual sal_Bool Cut(); + virtual sal_Bool Paste(); + + void SetForwarder( SvxEditViewForwarder&, SvxAccessibleTextAdapter& ); + +private: + SvxEditViewForwarder* mrViewForwarder; + SvxAccessibleTextAdapter* mrTextForwarder; +}; + +class SvxEditSourceAdapter : public SvxEditSource +{ +public: + SvxEditSourceAdapter(); + ~SvxEditSourceAdapter(); + + virtual SvxEditSource* Clone() const; + virtual SvxTextForwarder* GetTextForwarder(); + SvxAccessibleTextAdapter* GetTextForwarderAdapter(); // covariant return types don't work on MSVC + virtual SvxViewForwarder* GetViewForwarder(); + virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate = sal_False ); + SvxAccessibleTextEditViewAdapter* GetEditViewForwarderAdapter( sal_Bool bCreate = sal_False ); // covariant return types don't work on MSVC + virtual void UpdateData(); + virtual SfxBroadcaster& GetBroadcaster() const; + + void SetEditSource( ::std::auto_ptr< SvxEditSource > pAdaptee ); + sal_Bool IsValid() const; + +private: + // declared, but not defined + SvxEditSourceAdapter( const SvxEditSourceAdapter& ); + SvxEditSourceAdapter& operator= ( const SvxEditSourceAdapter& ); + + ::std::auto_ptr< SvxEditSource > mpAdaptee; + + SvxAccessibleTextAdapter maTextAdapter; + SvxAccessibleTextEditViewAdapter maEditViewAdapter; + + mutable SfxBroadcaster maDummyBroadcaster; + + sal_Bool mbEditSourceValid; +}; + +#endif diff --git a/svx/source/inc/unogalthemeprovider.hxx b/svx/source/inc/unogalthemeprovider.hxx new file mode 100644 index 000000000000..555e7f380ab3 --- /dev/null +++ b/svx/source/inc/unogalthemeprovider.hxx @@ -0,0 +1,103 @@ +/************************************************************************* + * + * 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: unogalthemeprovider.hxx,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. + * + ************************************************************************/ + +#ifndef _SVX_UNOGALTHEMEPROVIDER_HXX +#define _SVX_UNOGALTHEMEPROVIDER_HXX + +#include <cppuhelper/implbase2.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/gallery/XGalleryThemeProvider.hpp> + +#include <svx/svxdllapi.h> + +class Gallery; + +namespace unogallery { + +// ------------------------- +// - some helper functions - +// ------------------------- + +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL GalleryThemeProvider_createInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr) throw( ::com::sun::star::uno::Exception ); + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL GalleryThemeProvider_getSupportedServiceNames() throw(); +::rtl::OUString SAL_CALL GalleryThemeProvider_getImplementationName() throw(); + +// ----------------- +// - GalleryThemes - +// ----------------- + +class GalleryThemeProvider : public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XInitialization, + ::com::sun::star::gallery::XGalleryThemeProvider > +{ +public: + + GalleryThemeProvider(); + ~GalleryThemeProvider(); + + SVX_DLLPUBLIC static ::rtl::OUString getImplementationName_Static() throw(); + SVX_DLLPUBLIC static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw(); + +protected: + + // XServiceInfo + virtual rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasElements() throw (::com::sun::star::uno::RuntimeException); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw ( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException ); + + // XGalleryThemeProvider + virtual ::com::sun::star::uno::Reference< ::com::sun::star::gallery::XGalleryTheme > SAL_CALL insertNewByName( const ::rtl::OUString& ThemeName ) throw (::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByName( const ::rtl::OUString& ThemeName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + +private: + + Gallery* mpGallery; + sal_Bool mbHiddenThemes; +}; + +} + +#endif diff --git a/svx/source/inc/unopolyhelper.hxx b/svx/source/inc/unopolyhelper.hxx new file mode 100644 index 000000000000..373b6ecc0f4a --- /dev/null +++ b/svx/source/inc/unopolyhelper.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * 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: unopolyhelper.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 _SVX_UNOPOLYHELPER_HXX +#define _SVX_UNOPOLYHELPER_HXX + +#include <com/sun/star/lang/IllegalArgumentException.hpp> + +#include <svx/svxdllapi.h> + +namespace com { namespace sun { namespace star { namespace drawing { + struct PolyPolygonBezierCoords; +} } } } + +namespace basegfx { + class B2DPolyPolygon; +} + +/** convert a drawing::PolyPolygonBezierCoords to a B2DPolyPolygon +*/ +basegfx::B2DPolyPolygon SvxConvertPolyPolygonBezierToB2DPolyPolygon( const com::sun::star::drawing::PolyPolygonBezierCoords* pSourcePolyPolygon) + throw( com::sun::star::lang::IllegalArgumentException ); + +/** convert a B2DPolyPolygon to a drawing::PolyPolygonBezierCoords +*/ +SVX_DLLPUBLIC void SvxConvertB2DPolyPolygonToPolyPolygonBezier( const basegfx::B2DPolyPolygon& rPolyPoly, com::sun::star::drawing::PolyPolygonBezierCoords& rRetval ); + + +#endif + + diff --git a/svx/source/inc/unopracc.hxx b/svx/source/inc/unopracc.hxx new file mode 100644 index 000000000000..139837143623 --- /dev/null +++ b/svx/source/inc/unopracc.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: unopracc.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 _SVX_UNOPRACC_HXX +#define _SVX_UNOPRACC_HXX + +#include <svx/unoshape.hxx> +#include <svx/unotext.hxx> + + +class SvxEditSource; + +/** Wraps SvxUnoTextRangeBase and provides us with the text properties + + Inherits from SvxUnoTextRangeBase and provides XPropertySet and + XMultiPropertySet interfaces. Just set the selection to the + required text range and return a reference to a XPropertySet. + */ +class SvxAccessibleTextPropertySet : public SvxUnoTextRangeBase, + public ::com::sun::star::lang::XTypeProvider, + public ::cppu::OWeakObject +{ +public: + SvxAccessibleTextPropertySet( const SvxEditSource*, const SvxItemPropertySet* ); + virtual ~SvxAccessibleTextPropertySet() throw(); + + // XTextRange + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException); + + // uno::XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // lang::XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + + // lang::XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + // XServiceName + ::rtl::OUString SAL_CALL getServiceName() throw (::com::sun::star::uno::RuntimeException); +}; + +#endif + diff --git a/svx/source/inc/xfm_addcondition.hxx b/svx/source/inc/xfm_addcondition.hxx new file mode 100644 index 000000000000..5b0e803446ab --- /dev/null +++ b/svx/source/inc/xfm_addcondition.hxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * 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: xfm_addcondition.hxx,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. + * + ************************************************************************/ + +#ifndef SVX_SOURCE_INC_XFM_ADDCONDITION_HXX +#define SVX_SOURCE_INC_XFM_ADDCONDITION_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/xforms/XModel.hpp> +/** === end UNO includes === **/ +#include <svtools/genericunodialog.hxx> +#include <comphelper/proparrhlp.hxx> + +//........................................................................ +namespace svxform +{ +//........................................................................ + + //==================================================================== + //= OAddConditionDialog + //==================================================================== + typedef ::svt::OGenericUnoDialog OAddConditionDialogBase; + class OAddConditionDialog + :public OAddConditionDialogBase + ,public ::comphelper::OPropertyArrayUsageHelper< OAddConditionDialog > + { + private: + // <properties> + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > + m_xBinding; + ::rtl::OUString m_sFacetName; + ::rtl::OUString m_sConditionValue; + ::com::sun::star::uno::Reference< ::com::sun::star::xforms::XModel > + m_xWorkModel; + // </properties> + + public: + static ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > + SAL_CALL Create( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ); + + protected: + OAddConditionDialog( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB ); + + // XTypeProvider + virtual com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) throw(com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException); + + // XPropertySet + 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(); + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + + protected: + // OGenericUnoDialog overridables + virtual Dialog* createDialog(Window* _pParent); + virtual void executedDialog(sal_Int16 _nExecutionResult); + }; + +//........................................................................ +} // namespace svxform +//........................................................................ + +#endif // SVX_SOURCE_INC_XFM_ADDCONDITION_HXX + diff --git a/svx/source/inc/xmlxtexp.hxx b/svx/source/inc/xmlxtexp.hxx new file mode 100644 index 000000000000..43486857fca8 --- /dev/null +++ b/svx/source/inc/xmlxtexp.hxx @@ -0,0 +1,73 @@ +/************************************************************************* + * + * 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: xmlxtexp.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 _SVX_XMLXTEXP_HXX +#define _SVX_XMLXTEXP_HXX + +#include "xmloff/xmlexp.hxx" + +namespace rtl { class OUString; } +namespace com { namespace sun { namespace star { + namespace frame { class XModel; } + namespace uno { template<class X> class Reference; } + namespace uno { class XInterface; } + namespace container { class XNameContainer; } + namespace document { class XGraphicObjectResolver; } + namespace xml { namespace sax { class XDocumentHandler; } } +} } } + +class SvxXMLXTableExportComponent : public SvXMLExport +{ +public: + // #110680# + SvxXMLXTableExportComponent( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + const rtl::OUString& rFileName, + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > & xHandler, + const com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > & xTable, + com::sun::star::uno::Reference< com::sun::star::document::XGraphicObjectResolver >& xGrfResolver); + + ~SvxXMLXTableExportComponent(); + + static sal_Bool save( const rtl::OUString& rURL, const com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xTable ) throw(); + + sal_Bool exportTable() throw(); + + // methods without content: + virtual void _ExportAutoStyles(); + virtual void _ExportMasterStyles(); + virtual void _ExportContent(); + +private: + const com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > & mxTable; +}; + +#endif + diff --git a/svx/source/inc/xmlxtimp.hxx b/svx/source/inc/xmlxtimp.hxx new file mode 100644 index 000000000000..23d40e5ad784 --- /dev/null +++ b/svx/source/inc/xmlxtimp.hxx @@ -0,0 +1,67 @@ +/************************************************************************* + * + * 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: xmlxtimp.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 _SVX_XMLXTIMP_HXX +#define _SVX_XMLXTIMP_HXX + +#include <xmloff/xmlimp.hxx> + +namespace rtl { class OUString; } +namespace com { namespace sun { namespace star { + namespace uno { template<class X> class Reference; } + namespace uno { class XInterface; } + namespace document { class XGraphicObjectResolver; } + namespace container { class XNameContainer; } + +} } } + +class SvxXMLXTableImport : public SvXMLImport +{ +public: + // #110680# + SvxXMLXTableImport( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & rTable, + com::sun::star::uno::Reference< com::sun::star::document::XGraphicObjectResolver >& xGrfResolver); + + virtual ~SvxXMLXTableImport() throw (); + + static sal_Bool load( const rtl::OUString& rUrl, const com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >& xTable ) throw(); +protected: + virtual SvXMLImportContext *CreateContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + +private: + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & mrTable; +}; + +#endif + |