diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2013-04-18 18:26:28 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2013-04-23 22:20:31 +0200 |
commit | b9337e22ce1dbf2eba0e8c8db294ae99f4111f91 (patch) | |
tree | 53ee1bd3dfd213815a21579151983cb997922b05 /include/editeng | |
parent | f4e1642a1761d5eab6ccdd89928869c2b2f1528a (diff) |
execute move of global headers
see https://gerrit.libreoffice.org/#/c/3367/
and Change-Id: I00c96fa77d04b33a6f8c8cd3490dfcd9bdc9e84a for details
Change-Id: I199a75bc4042af20817265d5ef85b1134a96ff5a
Diffstat (limited to 'include/editeng')
133 files changed, 17815 insertions, 0 deletions
diff --git a/include/editeng/AccessibleComponentBase.hxx b/include/editeng/AccessibleComponentBase.hxx new file mode 100644 index 000000000000..ea292e0e439c --- /dev/null +++ b/include/editeng/AccessibleComponentBase.hxx @@ -0,0 +1,141 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + + +#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_EXTENDED_COMPONENT_BASE_HXX +#define _SVX_ACCESSIBILITY_ACCESSIBLE_EXTENDED_COMPONENT_BASE_HXX + + +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp> +#include <com/sun/star/awt/XFocusListener.hpp> +#include "editeng/editengdllapi.h" + +namespace accessibility { + +/** @descr + This base class provides (will provice) a base implementation of the + <type>XAccessibleComponent</type> and the + <type>XAccessibleExtendedComponent</type> for all shapes. For + more detailed documentation about the methods refer to the interface + descriptions of <type>XAccessible</type>, + <type>XAccessibleContext</type>, <type>XInterface</type>, + <type>XServiceInfo</type>, and <type>XTypeProvider</type>. +*/ +class EDITENG_DLLPUBLIC AccessibleComponentBase + : public ::com::sun::star::accessibility::XAccessibleExtendedComponent +{ +public: + //===== internal ======================================================== + AccessibleComponentBase (void); + virtual ~AccessibleComponentBase (void); + + + //===== XAccessibleComponent ================================================ + + /** The default implementation uses the result of + <member>getBounds</member> to determine whether the given point lies + inside this object. + */ + virtual sal_Bool SAL_CALL containsPoint ( + const ::com::sun::star::awt::Point& aPoint) + throw (::com::sun::star::uno::RuntimeException); + + /** The default implementation returns an empty reference. + */ + 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); + + /** The default implementation returns an empty rectangle. + */ + virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds (void) + throw (::com::sun::star::uno::RuntimeException); + + /** The default implementation uses the result of + <member>getBounds</member> to determine the location. + */ + virtual ::com::sun::star::awt::Point SAL_CALL getLocation (void) + throw (::com::sun::star::uno::RuntimeException); + + /** The default implementation returns an empty position, i.e. the + * result of the default constructor of <type>com::sun::star::awt::Point</type>. + */ + virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen (void) + throw (::com::sun::star::uno::RuntimeException); + + /** The default implementation uses the result of + <member>getBounds</member> to determine the size. + */ + virtual ::com::sun::star::awt::Size SAL_CALL getSize (void) + throw (::com::sun::star::uno::RuntimeException); + + /** The default implementation ignores this call. + */ + virtual void SAL_CALL addFocusListener ( + const ::com::sun::star::uno::Reference< + ::com::sun::star::awt::XFocusListener >& xListener) + throw (::com::sun::star::uno::RuntimeException); + + /** The default implementation ignores this call. + */ + virtual void SAL_CALL removeFocusListener (const ::com::sun::star::uno::Reference< + ::com::sun::star::awt::XFocusListener >& xListener ) + throw (::com::sun::star::uno::RuntimeException); + + /** The default implementation does nothing. + */ + virtual void SAL_CALL grabFocus (void) + throw (::com::sun::star::uno::RuntimeException); + + /** Returns black as the default foreground color. + */ + virtual sal_Int32 SAL_CALL getForeground (void) + throw (::com::sun::star::uno::RuntimeException); + + /** Returns white as the default background color. + */ + virtual sal_Int32 SAL_CALL getBackground (void) + throw (::com::sun::star::uno::RuntimeException); + + //===== XAccessibleExtendedComponent ==================================== + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL + getFont (void) + throw (::com::sun::star::uno::RuntimeException); + virtual OUString SAL_CALL getTitledBorderText (void) + throw (::com::sun::star::uno::RuntimeException); + virtual OUString SAL_CALL getToolTipText (void) + throw (::com::sun::star::uno::RuntimeException); + + + //===== XTypeProvider =================================================== + + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL + getTypes (void) + throw (::com::sun::star::uno::RuntimeException); + +}; + +} // end of namespace accessibility + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/AccessibleContextBase.hxx b/include/editeng/AccessibleContextBase.hxx new file mode 100644 index 000000000000..574582a68ae1 --- /dev/null +++ b/include/editeng/AccessibleContextBase.hxx @@ -0,0 +1,388 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_CONTEXT_BASE_HXX +#define _SVX_ACCESSIBILITY_ACCESSIBLE_CONTEXT_BASE_HXX + +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/XAccessibleContext.hpp> +#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> +#include <com/sun/star/accessibility/XAccessibleStateSet.hpp> +#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp> +#include <com/sun/star/accessibility/AccessibleEventObject.hpp> +#include <com/sun/star/accessibility/AccessibleEventId.hpp> +#include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/lang/XComponent.hpp> +#include <cppuhelper/weak.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +#include <osl/mutex.hxx> +#include <cppuhelper/compbase4.hxx> +#include <editeng/editengdllapi.h> + + +namespace accessibility { + +struct MutexOwner {mutable ::osl::Mutex maMutex;}; + +/** @descr + This base class provides an implementation of the + <type>AccessibleContext</type> service. Appart from the + <type>XXAccessible<type> and <type>XAccessibleContextContext</type> + interfaces it supports the <type>XServiceInfo</type> interface. +*/ +class EDITENG_DLLPUBLIC AccessibleContextBase + : public MutexOwner, + public cppu::PartialWeakComponentImplHelper4< + ::com::sun::star::accessibility::XAccessible, + ::com::sun::star::accessibility::XAccessibleContext, + ::com::sun::star::accessibility::XAccessibleEventBroadcaster, + ::com::sun::star::lang::XServiceInfo + > +{ +public: + + //===== internal ======================================================== + + /** The origin of the accessible name or description. + */ + enum StringOrigin { + ManuallySet, + FromShape, + AutomaticallyCreated, + NotSet + }; + + AccessibleContextBase ( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible>& rxParent, + const sal_Int16 aRole); + virtual ~AccessibleContextBase (void); + + + /** Call all accessiblity event listeners to inform them about the + specified event. + @param aEventId + Id of the event type. + @param rNewValue + New value of the modified attribute. Pass empty structure if + not applicable. + @param rOldValue + Old value of the modified attribute. Pass empty structure if + not applicable. + */ + void CommitChange (sal_Int16 aEventId, + const ::com::sun::star::uno::Any& rNewValue, + const ::com::sun::star::uno::Any& rOldValue); + + /** Set a new description and, provided that the new name differs from + the old one, broadcast an accessibility event. + @param rsDescription + The new description. + @param eDescriptionOrigin + The origin of the description. This is used to determine + whether the given description overrules the existing one. An + origin with a lower numerical value overrides one with a higher + value. + */ + void SetAccessibleDescription ( + const OUString& rsDescription, + StringOrigin eDescriptionOrigin) + throw (::com::sun::star::uno::RuntimeException); + + /** Set a new description and, provided that the new name differs from + the old one, broadcast an accessibility event. + @param rsName + The new name. + @param eNameOrigin + The origin of the name. This is used to determine whether the + given name overrules the existing one. An origin with a lower + numerical value overrides one with a higher value. + */ + void SetAccessibleName ( + const OUString& rsName, + StringOrigin eNameOrigin) + throw (::com::sun::star::uno::RuntimeException); + + /** Set the specified state (turn it on) and send events to all + listeners to inform them of the change. + + @param aState + The state to turn on. + + @return + If the specified state changed its value due to this call + <TRUE/> is returned, otherwise <FALSE/>. + */ + virtual sal_Bool SetState (sal_Int16 aState); + + /** Reset the specified state (turn it off) and send events to all + listeners to inform them of the change. + + @param aState + The state to turn off. + + @return + If the specified state changed its value due to this call + <TRUE/> is returned, otherwise <FALSE/>. + */ + virtual sal_Bool ResetState (sal_Int16 aState); + + /** Return the state of the specified state. + + @param aState + The state for which to return its value. + + @return + A value of <TRUE/> indicates that the state is set. A <FALSE/> + value indicates an unset state. + */ + sal_Bool GetState (sal_Int16 aState); + + /** Replace the current relation set with the specified one. Send + events for relations that are not in both sets. + + @param rRelationSet + The new relation set that replaces the old one. + */ + virtual void SetRelationSet ( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleRelationSet>& rxRelationSet) + throw (::com::sun::star::uno::RuntimeException); + + + //===== 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); + + + //===== XAccessibleContext ============================================== + + /// Return the number of currently visible children. + virtual sal_Int32 SAL_CALL + getAccessibleChildCount (void) throw (::com::sun::star::uno::RuntimeException); + + /// Return the specified child or throw exception. + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL + getAccessibleChild (sal_Int32 nIndex) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + /// Return a reference to the parent. + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL + getAccessibleParent (void) + throw (::com::sun::star::uno::RuntimeException); + + /// Return this objects index among the parents children. + virtual sal_Int32 SAL_CALL + getAccessibleIndexInParent (void) + throw (::com::sun::star::uno::RuntimeException); + + /// Return this object's role. + virtual sal_Int16 SAL_CALL + getAccessibleRole (void) + throw (::com::sun::star::uno::RuntimeException); + + /// Return this object's description. + virtual OUString SAL_CALL + getAccessibleDescription (void) + throw (::com::sun::star::uno::RuntimeException); + + /// Return the object's current name. + virtual OUString SAL_CALL + getAccessibleName (void) + throw (::com::sun::star::uno::RuntimeException); + + /// Return NULL to indicate that an empty relation set. + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL + getAccessibleRelationSet (void) + throw (::com::sun::star::uno::RuntimeException); + + /// Return the set of current states. + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL + getAccessibleStateSet (void) + throw (::com::sun::star::uno::RuntimeException); + + /** Return the parents locale or throw exception if this object has no + parent yet/anymore. + */ + virtual ::com::sun::star::lang::Locale SAL_CALL + getLocale (void) + throw (::com::sun::star::uno::RuntimeException, + ::com::sun::star::accessibility::IllegalAccessibleComponentStateException); + + //===== XAccessibleEventBroadcaster ======================================== + + virtual void SAL_CALL + addAccessibleEventListener ( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleEventListener >& xListener) + throw (::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL + removeAccessibleEventListener ( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleEventListener >& xListener) + throw (::com::sun::star::uno::RuntimeException); + + + //===== XServiceInfo ==================================================== + + /** Returns an identifier for the implementation of this object. + */ + virtual OUString SAL_CALL + getImplementationName (void) + throw (::com::sun::star::uno::RuntimeException); + + /** Return whether the specified service is supported by this class. + */ + virtual sal_Bool SAL_CALL + supportsService (const OUString& sServiceName) + throw (::com::sun::star::uno::RuntimeException); + + /** Returns a list of all supported services. In this case that is just + the AccessibleContext service. + */ + virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL + getSupportedServiceNames (void) + throw (::com::sun::star::uno::RuntimeException); + + + //===== XTypeProvider =================================================== + + /** Returns a sequence of all supported interfaces. + */ + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL + getTypes (void) + throw (::com::sun::star::uno::RuntimeException); + + /** Returns a implementation id. + */ + virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL + getImplementationId (void) + throw (::com::sun::star::uno::RuntimeException); + +protected: + /** The state set. + */ + ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleStateSet> mxStateSet; + + /** The relation set. Relations can be set or removed by calling the + <member>AddRelation</member> and <member>RemoveRelation</member> methods. + */ + ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleRelationSet> mxRelationSet; + + // This method is called from the component helper base class while disposing. + virtual void SAL_CALL disposing (void); + + /** Create the accessible object's name. This method may be called more + than once for a single object. + @return + The returned string is a unique (among the accessible object's + siblings) name. + */ + virtual OUString CreateAccessibleName (void) + throw (::com::sun::star::uno::RuntimeException); + + /** Create the accessible object's descriptive string. May be called + more than once. + @return + Descriptive string. Not necessarily unique. + */ + virtual OUString + CreateAccessibleDescription (void) + throw (::com::sun::star::uno::RuntimeException); + + void FireEvent (const ::com::sun::star::accessibility::AccessibleEventObject& aEvent); + + /** Check whether or not the object has been disposed (or is in the + state of beeing disposed). If that is the case then + DisposedException is thrown to inform the (indirect) caller of the + foul deed. + */ + void ThrowIfDisposed (void) + throw (::com::sun::star::lang::DisposedException); + + /** Check whether or not the object has been disposed (or is in the + state of beeing disposed). + + @return TRUE, if the object is disposed or in the course + of being disposed. Otherwise, FALSE is returned. + */ + sal_Bool IsDisposed (void); + + /** sets the role as returned by XaccessibleContext::getAccessibleRole + + <p>Caution: This is only to be used in the construction phase (means within + the ctor or late ctor), <em>never</em> when the object is still alive and part + of an Accessibility hierarchy.</p> + */ + void SetAccessibleRole( sal_Int16 _nRole ); + +private: + /// 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. Furthermore, it changes according the the + draw page's display mode. + */ + OUString msDescription; + + /** The origin of the description is used to determine whether new + descriptions given to the SetAccessibleDescription is ignored or + whether that replaces the old value in msDescription. + */ + StringOrigin meDescriptionOrigin; + + /** Name of this object. It changes according the draw page's + display mode. + */ + OUString msName; + + /** The origin of the name is used to determine whether new + name given to the SetAccessibleName is ignored or + whether that replaces the old value in msName. + */ + StringOrigin meNameOrigin; + + /** client id in the AccessibleEventNotifier queue + */ + sal_uInt32 mnClientId; + + /** This is the role of this object. + */ + sal_Int16 maRole; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/AccessibleEditableTextPara.hxx b/include/editeng/AccessibleEditableTextPara.hxx new file mode 100644 index 000000000000..5f245d0786f5 --- /dev/null +++ b/include/editeng/AccessibleEditableTextPara.hxx @@ -0,0 +1,386 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SVX_ACCESSIBLE_EDITABLE_TEXT_PARA_HXX +#define _SVX_ACCESSIBLE_EDITABLE_TEXT_PARA_HXX + +#include <tools/gen.hxx> +#include <tools/string.hxx> +#include <cppuhelper/weakref.hxx> +#include <cppuhelper/compbase9.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <cppuhelper/interfacecontainer.hxx> + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/lang/XServiceInfo.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/XAccessibleEditableText.hpp> +#include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp> +#include <com/sun/star/accessibility/XAccessibleHypertext.hpp> +#include <com/sun/star/accessibility/XAccessibleMultiLineText.hpp> + +#include <comphelper/accessibletexthelper.hxx> +#include <comphelper/broadcasthelper.hxx> +#include "editeng/AccessibleParaManager.hxx" +#include "editeng/AccessibleImageBullet.hxx" +#include "editeng/unoedprx.hxx" +#include "editeng/editengdllapi.h" + +namespace accessibility +{ + typedef ::cppu::PartialWeakComponentImplHelper9< ::com::sun::star::accessibility::XAccessible, + ::com::sun::star::accessibility::XAccessibleContext, + ::com::sun::star::accessibility::XAccessibleComponent, + ::com::sun::star::accessibility::XAccessibleEditableText, + ::com::sun::star::accessibility::XAccessibleEventBroadcaster, + ::com::sun::star::accessibility::XAccessibleTextAttributes, + ::com::sun::star::accessibility::XAccessibleHypertext, + ::com::sun::star::accessibility::XAccessibleMultiLineText, + ::com::sun::star::lang::XServiceInfo > AccessibleTextParaInterfaceBase; + + /** This class implements the actual text paragraphs for the EditEngine/Outliner UAA + */ + class EDITENG_DLLPUBLIC AccessibleEditableTextPara : public ::comphelper::OBaseMutex, public AccessibleTextParaInterfaceBase, public ::comphelper::OCommonAccessibleText + { + + protected: + // override OCommonAccessibleText methods + virtual OUString implGetText(); + virtual ::com::sun::star::lang::Locale implGetLocale(); + virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); + virtual void implGetParagraphBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex ); + virtual void implGetLineBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex ); + + public: + /// Create accessible object for given parent + // #i27138# + // - add parameter <_pParaManager> (default value NULL) + // This has to be the instance of <AccessibleParaManager>, which + // created and manages this accessible paragraph. + AccessibleEditableTextPara ( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rParent, + const AccessibleParaManager* _pParaManager = NULL ); + + virtual ~AccessibleEditableTextPara (); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface (const ::com::sun::star::uno::Type & rType) throw (::com::sun::star::uno::RuntimeException); + + // 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::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_Int32 SAL_CALL getAccessibleIndexInParent() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getAccessibleRole() throw (::com::sun::star::uno::RuntimeException); + /// Maximal length of text returned by getAccessibleDescription() + enum { MaxDescriptionLen = 40 }; + virtual OUString SAL_CALL getAccessibleDescription() throw (::com::sun::star::uno::RuntimeException); + virtual 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); + + // XAccessibleEventBroadcaster + virtual void SAL_CALL addAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& 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 void SAL_CALL grabFocus( ) 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); + + // XAccessibleText (this comes implicitely inherited by XAccessibleEditableText AND by XAccessibleMultiLineText) + virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException); + virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine) + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine) + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine) + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + // XAccessibleEditableText + virtual sal_Bool SAL_CALL cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL pasteText( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL deleteText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL insertText( const OUString& sText, sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL replaceText( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const OUString& sReplacement ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setAttributes( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aAttributeSet ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setText( const OUString& sText ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleTextAttributes + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getDefaultAttributes( const ::com::sun::star::uno::Sequence< OUString >& RequestedAttributes ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getRunAttributes( ::sal_Int32 Index, const ::com::sun::star::uno::Sequence< OUString >& RequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + // XAccessibleHypertext + virtual ::sal_Int32 SAL_CALL getHyperLinkCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink > SAL_CALL getHyperLink( ::sal_Int32 nLinkIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getHyperLinkIndex( ::sal_Int32 nCharIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + // XAccessibleMultiLineText + virtual ::sal_Int32 SAL_CALL getLineNumberAtIndex( ::sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtLineNumber( ::sal_Int32 nLineNo ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtLineWithCaret( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getNumberOfLineWithCaret( ) throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName (void) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService (const OUString& sServiceName) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames (void) throw (::com::sun::star::uno::RuntimeException); + + // XServiceName + virtual OUString SAL_CALL getServiceName (void) throw (::com::sun::star::uno::RuntimeException); + + /** Set the current index in the accessibility parent + + @attention This method does not lock the SolarMutex, + leaving that to the calling code. This is because only + there potential deadlock situations can be resolved. Thus, + make sure SolarMutex is locked when calling this. + */ + void SetIndexInParent( sal_Int32 nIndex ); + + /** Get the current index in the accessibility parent + + @attention This method does not lock the SolarMutex, + leaving that to the calling code. This is because only + there potential deadlock situations can be resolved. Thus, + make sure SolarMutex is locked when calling this. + */ + sal_Int32 GetIndexInParent() const; + + /** Set the current paragraph number + + @attention This method does not lock the SolarMutex, + leaving that to the calling code. This is because only + there potential deadlock situations can be resolved. Thus, + make sure SolarMutex is locked when calling this. + */ + void SetParagraphIndex( sal_Int32 nIndex ); + + /** Query the current paragraph number (0 - nParas-1) + + @attention This method does not lock the SolarMutex, + leaving that to the calling code. This is because only + there potential deadlock situations can be resolved. Thus, + make sure SolarMutex is locked when calling this. + */ + sal_Int32 GetParagraphIndex() const SAL_THROW((::com::sun::star::uno::RuntimeException)); + + /** Set the edit engine offset + + @attention This method does not lock the SolarMutex, + leaving that to the calling code. This is because only + there potential deadlock situations can be resolved. Thus, + make sure SolarMutex is locked when calling this. + */ + void SetEEOffset( const Point& rOffset ); + + /** Set the EditEngine offset + + @attention This method does not lock the SolarMutex, + leaving that to the calling code. This is because only + there potential deadlock situations can be resolved. Thus, + make sure SolarMutex is locked when calling this. + */ + void SetEditSource( SvxEditSourceAdapter* pEditSource ); + + /** Dispose this object + + Notifies and deregisters the listeners, drops all references. + */ + void Dispose(); + + /// Calls all Listener objects to tell them the change. Don't hold locks when calling this! + virtual void FireEvent(const sal_Int16 nEventId, const ::com::sun::star::uno::Any& rNewValue = ::com::sun::star::uno::Any(), const ::com::sun::star::uno::Any& rOldValue = ::com::sun::star::uno::Any() ) const; + + /// Sets the given state on the internal state set and fires STATE_CHANGE event. Don't hold locks when calling this! + void SetState( const sal_Int16 nStateId ); + /// Unsets the given state on the internal state set and fires STATE_CHANGE event. Don't hold locks when calling this! + void UnSetState( const sal_Int16 nStateId ); + + static Rectangle LogicToPixel( const Rectangle& rRect, const MapMode& rMapMode, SvxViewForwarder& rForwarder ); + + SvxEditSourceAdapter& GetEditSource() const SAL_THROW((::com::sun::star::uno::RuntimeException)); + + /** Query the SvxTextForwarder for EditEngine access. + + @attention This method does not lock the SolarMutex, + leaving that to the calling code. This is because only + there potential deadlock situations can be resolved. Thus, + make sure SolarMutex is locked when calling this. + */ + SvxAccessibleTextAdapter& GetTextForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException)); + + /** Query the SvxViewForwarder for EditEngine access. + + @attention This method does not lock the SolarMutex, + leaving that to the calling code. This is because only + there potential deadlock situations can be resolved. Thus, + make sure SolarMutex is locked when calling this. + */ + SvxViewForwarder& GetViewForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException)); + + /** Query whether a GetEditViewForwarder( sal_False ) will return a forwarder + + @attention This method does not lock the SolarMutex, + leaving that to the calling code. This is because only + there potential deadlock situations can be resolved. Thus, + make sure SolarMutex is locked when calling this. + */ + sal_Bool HaveEditView() const; + + /** Query the SvxEditViewForwarder for EditEngine access. + + @attention This method does not lock the SolarMutex, + leaving that to the calling code. This is because only + there potential deadlock situations can be resolved. Thus, + make sure SolarMutex is locked when calling this. + */ + SvxAccessibleTextEditViewAdapter& GetEditViewForwarder( sal_Bool bCreate = sal_False ) const SAL_THROW((::com::sun::star::uno::RuntimeException)); + + /** Send a TEXT_CHANGED event for this paragraph + + This method internally caters for calculating text + differences, and sends the appropriate Anys in the + Accessibility::TEXT_CHANGED event + */ + void TextChanged(); + + private: + + // declared, but not defined + AccessibleEditableTextPara( const AccessibleEditableTextPara& ); + AccessibleEditableTextPara& operator= ( const AccessibleEditableTextPara& ); + + /** Calculate character range of similar attributes + + @param nStartIndex + Therein, the start of the character range with the same attributes is returned + + @param nEndIndex + Therein, the end (exclusively) of the character range with the same attributes is returned + + @param nIndex + The character index at where to look for similar character attributes + + @return sal_False, if the method was not able to determine the range + */ + sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_Int32 nIndex ); + + // syntactic sugar for FireEvent + void GotPropertyEvent( const ::com::sun::star::uno::Any& rNewValue, const sal_Int16 nEventId ) const; + void LostPropertyEvent( const ::com::sun::star::uno::Any& rOldValue, const sal_Int16 nEventId ) const; + + int getNotifierClientId() const; + + /// Do we have children? This is the case for image bullets + sal_Bool HaveChildren(); + + const Point& GetEEOffset() const; + + // Get text from forwarder + String GetTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) SAL_THROW((::com::sun::star::uno::RuntimeException)); + sal_uInt16 GetTextLen() const SAL_THROW((::com::sun::star::uno::RuntimeException)); + + /** Get the current selection of this paragraph + + @return sal_False, if nothing in this paragraph is selected + */ + sal_Bool GetSelection( sal_uInt16& nStartPos, sal_uInt16& nEndPos ) SAL_THROW((::com::sun::star::uno::RuntimeException)); + + /** create selection from Accessible selection. + + */ + ESelection MakeSelection( sal_Int32 nStartEEIndex, sal_Int32 nEndEEIndex ); + ESelection MakeSelection( sal_Int32 nEEIndex ); + ESelection MakeCursor( sal_Int32 nEEIndex ); + + // check whether index value is within permitted range + + /// Check whether 0<=nIndex<=n-1 + void CheckIndex( sal_Int32 nIndex ) SAL_THROW((::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)); + /// Check whether 0<=nIndex<=n + void CheckPosition( sal_Int32 nIndex ) SAL_THROW((::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)); + /// Check whether 0<=nStart<=n and 0<=nEnd<=n + void CheckRange( sal_Int32 nStart, sal_Int32 nEnd ) SAL_THROW((::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)); + + // the paragraph index in the edit engine (guarded by solar mutex) + sal_Int32 mnParagraphIndex; + + // our current index in the parent (guarded by solar mutex) + sal_Int32 mnIndexInParent; + + // the current edit source (guarded by solar mutex) + SvxEditSourceAdapter* mpEditSource; + + // the possible child (for image bullets, guarded by solar mutex) + typedef WeakCppRef < ::com::sun::star::accessibility::XAccessible, AccessibleImageBullet > WeakBullet; + WeakBullet maImageBullet; + + // the last string used for an Accessibility::TEXT_CHANGED event (guarded by solar mutex) + OUString maLastTextString; + + // the offset of the underlying EditEngine from the shape/cell (guarded by solar mutex) + Point maEEOffset; + + // the current state set (updated from SetState/UnSetState and guarded by solar mutex) + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > mxStateSet; + + /// The shape we're the accessible for (unguarded) + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxParent; + + /// Our listeners (guarded by maMutex) + int mnNotifierClientId; + + // Text paragraphs should provide FLOWS_TO and FLOWS_FROM relations (#i27138#) + // the paragraph manager, which created this instance - is NULL, if + // instance isn't created by AccessibleParaManager. + // Needed for method <getAccessibleRelationSet()> to retrieve predecessor + // paragraph and the successor paragraph. + const AccessibleParaManager* mpParaManager; + }; + +} // end of namespace accessibility + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/AccessibleImageBullet.hxx b/include/editeng/AccessibleImageBullet.hxx new file mode 100644 index 000000000000..9d852962e9e6 --- /dev/null +++ b/include/editeng/AccessibleImageBullet.hxx @@ -0,0 +1,219 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SVX_ACCESSIBLE_IMAGE_BULLET_HXX +#define _SVX_ACCESSIBLE_IMAGE_BULLET_HXX + +#include <tools/gen.hxx> +#include <cppuhelper/weakref.hxx> +#include <cppuhelper/implbase5.hxx> + +#include <cppuhelper/interfacecontainer.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/lang/XServiceInfo.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 "editeng/AccessibleParaManager.hxx" +#include <editeng/unoedsrc.hxx> + +namespace accessibility +{ + typedef ::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 > AccessibleImageBulletInterfaceBase; + + /** This class implements the image bullets for the EditEngine/Outliner UAA + */ + class AccessibleImageBullet : public AccessibleImageBulletInterfaceBase + { + + public: + /// Create accessible object for given parent + AccessibleImageBullet ( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rParent ); + + virtual ~AccessibleImageBullet (); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface (const ::com::sun::star::uno::Type & rType) throw (::com::sun::star::uno::RuntimeException); + + // 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::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_Int32 SAL_CALL getAccessibleIndexInParent() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getAccessibleRole() throw (::com::sun::star::uno::RuntimeException); + /// Maximal length of text returned by getAccessibleDescription() + enum { MaxDescriptionLen = 40 }; + virtual OUString SAL_CALL getAccessibleDescription() throw (::com::sun::star::uno::RuntimeException); + virtual 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); + + // XAccessibleEventBroadcaster + virtual void SAL_CALL addAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& 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 void SAL_CALL grabFocus( ) 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); + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName (void) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService (const OUString& sServiceName) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames (void) throw (::com::sun::star::uno::RuntimeException); + + // XServiceName + virtual OUString SAL_CALL getServiceName (void) throw (::com::sun::star::uno::RuntimeException); + + /** Set the current index in the accessibility parent + + @attention This method does not lock the SolarMutex, + leaving that to the calling code. This is because only + there potential deadlock situations can be resolved. Thus, + make sure SolarMutex is locked when calling this. + */ + void SetIndexInParent( sal_Int32 nIndex ); + + /** Set the edit engine offset + + @attention This method does not lock the SolarMutex, + leaving that to the calling code. This is because only + there potential deadlock situations can be resolved. Thus, + make sure SolarMutex is locked when calling this. + */ + void SetEEOffset( const Point& rOffset ); + + /** Set the EditEngine offset + + @attention This method does not lock the SolarMutex, + leaving that to the calling code. This is because only + there potential deadlock situations can be resolved. Thus, + make sure SolarMutex is locked when calling this. + */ + void SetEditSource( SvxEditSource* pEditSource ); + + /** Dispose this object + + Notifies and deregisters the listeners, drops all references. + */ + void Dispose(); + + /** Set the current paragraph number + + @attention This method does not lock the SolarMutex, + leaving that to the calling code. This is because only + there potential deadlock situations can be resolved. Thus, + make sure SolarMutex is locked when calling this. + */ + void SetParagraphIndex( sal_Int32 nIndex ); + + /** Query the current paragraph number (0 - nParas-1) + + @attention This method does not lock the SolarMutex, + leaving that to the calling code. This is because only + there potential deadlock situations can be resolved. Thus, + make sure SolarMutex is locked when calling this. + */ + sal_Int32 GetParagraphIndex() const SAL_THROW((::com::sun::star::uno::RuntimeException)); + + /// Calls all Listener objects to tell them the change. Don't hold locks when calling this! + virtual void FireEvent(const sal_Int16 nEventId, const ::com::sun::star::uno::Any& rNewValue = ::com::sun::star::uno::Any(), const ::com::sun::star::uno::Any& rOldValue = ::com::sun::star::uno::Any() ) const; + + private: + + // declared, but not defined + AccessibleImageBullet( const AccessibleImageBullet& ); + AccessibleImageBullet& operator= ( const AccessibleImageBullet& ); + + // syntactic sugar for FireEvent + void GotPropertyEvent( const ::com::sun::star::uno::Any& rNewValue, const sal_Int16 nEventId ) const; + void LostPropertyEvent( const ::com::sun::star::uno::Any& rOldValue, const sal_Int16 nEventId ) const; + + // maintain state set and send STATE_CHANGE events + void SetState( const sal_Int16 nStateId ); + void UnSetState( const sal_Int16 nStateId ); + + SvxEditSource& GetEditSource() const SAL_THROW((::com::sun::star::uno::RuntimeException)); + + int getNotifierClientId() const; + + /** Query the SvxTextForwarder for EditEngine access. + + @attention This method does not lock the SolarMutex, + leaving that to the calling code. This is because only + there potential deadlock situations can be resolved. Thus, + make sure SolarMutex is locked when calling this. + */ + SvxTextForwarder& GetTextForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException)); + + /** Query the SvxViewForwarder for EditEngine access. + + @attention This method does not lock the SolarMutex, + leaving that to the calling code. This is because only + there potential deadlock situations can be resolved. Thus, + make sure SolarMutex is locked when calling this. + */ + SvxViewForwarder& GetViewForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException)); + + const Point& GetEEOffset() const; + + // the paragraph index in the edit engine (guarded by solar mutex) + sal_Int32 mnParagraphIndex; + + // our current index in the parent (guarded by solar mutex) + sal_Int32 mnIndexInParent; + + // the current edit source (guarded by solar mutex) + SvxEditSource* mpEditSource; + + // the offset of the underlying EditEngine from the shape/cell (guarded by solar mutex) + Point maEEOffset; + + // the current state set (updated from SetState/UnSetState and guarded by solar mutex) + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > mxStateSet; + + mutable osl::Mutex maMutex; + + /// The shape we're the accessible for (unguarded) + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxParent; + + /// Our listeners (guarded by maMutex) + int mnNotifierClientId; + }; + +} // end of namespace accessibility + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/AccessibleParaManager.hxx b/include/editeng/AccessibleParaManager.hxx new file mode 100644 index 000000000000..90bc3d8a111d --- /dev/null +++ b/include/editeng/AccessibleParaManager.hxx @@ -0,0 +1,334 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SVX_ACCESSIBLE_PARA_MANAGER_HXX +#define _SVX_ACCESSIBLE_PARA_MANAGER_HXX + +#include <vector> +#include <algorithm> +#include <functional> +#include <utility> +#include <tools/gen.hxx> +#include <com/sun/star/awt/Rectangle.hpp> +#include <com/sun/star/uno/Reference.hxx> +#include <cppuhelper/weakref.hxx> +#include <com/sun/star/accessibility/XAccessibleContext.hpp> +#include "editeng/editengdllapi.h" + +class SvxEditSourceAdapter; + +namespace accessibility +{ + class AccessibleEditableTextPara; + + /** Helper class for WeakCppRef + + This class is returned by WeakChild::get() and contains a hard + reference and a reference to the c++ object. This combination + prevents the c++ object from destruction during usage. Hold + this object only as long as absolutely necessary, prevents + referenced object from vanishing otherwise + */ + template < class UnoType, class CppType > class HardCppRef + { + public: + + typedef UnoType UnoInterfaceType; + typedef CppType InterfaceType; + + HardCppRef( const ::com::sun::star::uno::WeakReference< UnoInterfaceType >& xRef, InterfaceType* rImpl ) : + mxRef( xRef ), + mpImpl( rImpl ) + { + } + + /** Query whether the reference is still valid. + + Hands off also from the implementation pointer if this + returns sal_False! + */ + sal_Bool is() const { return mxRef.is(); } + InterfaceType* operator->() const { return mpImpl; } + InterfaceType& operator*() const { return *mpImpl; } + ::com::sun::star::uno::Reference< UnoInterfaceType >& getRef() { return mxRef; } + const ::com::sun::star::uno::Reference< UnoInterfaceType >& getRef() const { return mxRef; } + + // default copy constructor and assignment will do + // HardCppRef( const HardCppRef& ); + // HardCppRef& operator= ( const HardCppRef& ); + + private: + + // the interface, hard reference to prevent object from vanishing + ::com::sun::star::uno::Reference< UnoInterfaceType > mxRef; + + // the c++ object, for our internal stuff + InterfaceType* mpImpl; + + }; + + /** Helper class for weak object references plus implementation + + This class combines a weak reference (to facilitate automatic + object disposal if user drops last reference) and hard + reference to the c++ class (for fast access and bypassing of + the UNO interface) + */ + template < class UnoType, class CppType > class WeakCppRef + { + public: + + typedef UnoType UnoInterfaceType; + typedef CppType InterfaceType; + typedef HardCppRef< UnoInterfaceType, InterfaceType > HardRefType; + + WeakCppRef() : maWeakRef(), maUnsafeRef( NULL ) {} + WeakCppRef( InterfaceType& rImpl ) : + maWeakRef( ::com::sun::star::uno::Reference< UnoInterfaceType >( rImpl, ::com::sun::star::uno::UNO_QUERY ) ), + maUnsafeRef( &rImpl ) + { + } + + WeakCppRef( HardRefType& rImpl ) : + maWeakRef( rImpl.getRef() ), + maUnsafeRef( rImpl.operator->() ) + { + } + + // get object with c++ object and hard reference (which + // prevents the c++ object from destruction during use) + HardRefType get() const { return HardRefType( maWeakRef, maUnsafeRef ); } + + // default copy constructor and assignment will do + // WeakCppRef( const WeakCppRef& ); + // WeakCppRef& operator= ( const WeakCppRef& ); + + private: + + // the interface, hold weakly + ::com::sun::star::uno::WeakReference< UnoInterfaceType > maWeakRef; + + // hard ref to c++ class, _only_ valid if maWeakRef.is() is true + InterfaceType* maUnsafeRef; + }; + + + /** This class manages the paragraphs of an AccessibleTextHelper + + To facilitate automatic deletion of paragraphs no longer used, + this class uses the WeakCppRef helper to hold the objects weakly. + */ + class EDITENG_DLLPUBLIC AccessibleParaManager + { + public: + typedef WeakCppRef < ::com::sun::star::accessibility::XAccessible, AccessibleEditableTextPara > WeakPara; + typedef ::std::pair< WeakPara, ::com::sun::star::awt::Rectangle > WeakChild; + typedef ::std::pair< ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > , ::com::sun::star::awt::Rectangle > Child; + typedef ::std::vector< WeakChild > VectorOfChildren; + typedef ::std::vector< sal_Int16 > VectorOfStates; + + AccessibleParaManager(); + ~AccessibleParaManager(); + + /** Sets a vector of additional accessible states. + + The states are passed to every created child object + (text paragraph). The state values are defined in + com::sun::star::accessibility::AccessibleStateType. + */ + void SetAdditionalChildStates( const VectorOfStates& rChildStates ); + + /** Set the number of paragraphs + + @param nNumPara + The total number of paragraphs the EditEngine currently + has (_not_ the number of currently visible children) + */ + void SetNum( sal_Int32 nNumParas ); + + /** Get the number of paragraphs currently possible */ + sal_uInt32 GetNum() const; + + // iterators + VectorOfChildren::iterator begin(); + VectorOfChildren::iterator end(); + VectorOfChildren::const_iterator begin() const; + VectorOfChildren::const_iterator end() const; + + // dealing with single paragraphs (release reference, return reference etc) + void Release( sal_uInt32 nPara ); + /// Set focus to given child + void SetFocus( sal_Int32 nChild ); + + void FireEvent( sal_uInt32 nPara, + const sal_Int16 nEventId, + const ::com::sun::star::uno::Any& rNewValue = ::com::sun::star::uno::Any(), + const ::com::sun::star::uno::Any& rOldValue = ::com::sun::star::uno::Any() ) const; + + static sal_Bool IsReferencable( WeakPara::HardRefType aChild ); + sal_Bool IsReferencable( sal_uInt32 nChild ) const; + static void ShutdownPara( const WeakChild& rChild ); + + Child CreateChild( sal_Int32 nChild, + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& xFrontEnd, + SvxEditSourceAdapter& rEditSource, + sal_uInt32 nParagraphIndex ); + + WeakChild GetChild( sal_uInt32 nParagraphIndex ) const; + + // forwarder to all paragraphs + /// Make all children active and editable (or off) + void SetActive( sal_Bool bActive = sal_True ); + /// Set state of all children + void SetState( const sal_Int16 nStateId ); + /// Unset state of all children + void UnSetState( const sal_Int16 nStateId ); + /// Set offset to edit engine for all children + void SetEEOffset ( const Point& rOffset ); + /// Dispose all living children + void Dispose (); + + // forwarder to given paragraphs + //------------------------------------------------------------------------ + /** Release the given range of paragraphs + + All ranges have the meaning [start,end), similar to STL + + @param nStartPara + Index of paragraph to start with releasing + + @param nEndPara + Index of first paragraph to stop with releasing + */ + void Release( sal_uInt32 nStartPara, sal_uInt32 nEndPara ); + + /** Fire event for the given range of paragraphs + + All ranges have the meaning [start,end), similar to STL + + @param nStartPara + Index of paragraph to start with event firing + + @param nEndPara + Index of first paragraph to stop with event firing + */ + void FireEvent( sal_uInt32 nStartPara, + sal_uInt32 nEndPara, + const sal_Int16 nEventId, + const ::com::sun::star::uno::Any& rNewValue = ::com::sun::star::uno::Any(), + const ::com::sun::star::uno::Any& rOldValue = ::com::sun::star::uno::Any() ) const; + + /** Functor adapter for ForEach template + + Adapts giving functor such that only the paragraph objects + are accessed and the fact that our children are held + weakly is hidden + + The functor must provide the following method: + void operator() ( AccessibleEditablePara& ) + + */ + template < typename Functor > class WeakChildAdapter : public ::std::unary_function< const WeakChild&, void > + { + public: + WeakChildAdapter( Functor& rFunctor ) : mrFunctor(rFunctor) {} + void operator()( const WeakChild& rPara ) + { + // retrieve hard reference from weak one + WeakPara::HardRefType aHardRef( rPara.first.get() ); + + if( aHardRef.is() ) + mrFunctor( *aHardRef ); + } + + private: + Functor& mrFunctor; + }; + + /** Adapter for unary member functions + + Since STL's binder don't work with const& arguments (and + BOOST's neither, at least on MSVC), have to provide our + own adapter for unary member functions. + + Create with pointer to member function of + AccessibleEditableTextPara and the corresponding argument. + */ + template < typename Argument > class MemFunAdapter : public ::std::unary_function< const WeakChild&, void > + { + public: + typedef void (::accessibility::AccessibleEditableTextPara::*FunctionPointer)( Argument ); + + MemFunAdapter( FunctionPointer aFunPtr, Argument aArg ) : maFunPtr(aFunPtr), maArg(aArg) {} + void operator()( const WeakChild& rPara ) + { + // retrieve hard reference from weak one + WeakPara::HardRefType aHardRef( rPara.first.get() ); + + if( aHardRef.is() ) + (*aHardRef.*maFunPtr)( maArg ); + } + + private: + FunctionPointer maFunPtr; + Argument maArg; + }; + + /** Generic algorithm on given paragraphs + + Convenience method, that already adapts the given functor with WeakChildAdapter + */ + template < typename Functor > void ForEach( Functor& rFunctor ) + { + ::std::for_each( begin(), end(), WeakChildAdapter< Functor >(rFunctor) ); + } + + private: + /// Set state on given child + void SetState( sal_Int32 nChild, const sal_Int16 nStateId ); + /// Unset state on given child + void UnSetState( sal_Int32 nChild, const sal_Int16 nStateId ); + /// Init child with default state (as stored in previous SetFocus and SetActive calls) + void InitChild( AccessibleEditableTextPara& rChild, + SvxEditSourceAdapter& rEditSource, + sal_Int32 nChild, + sal_uInt32 nParagraphIndex ) const; + + // vector the size of the paragraph number of the underlying EditEngine + VectorOfChildren maChildren; + + /// Additional states that will be set at every created child object. + VectorOfStates maChildStates; + + // cache EE offset for child creation + Point maEEOffset; + + // which child currently has the focus (-1 for none) + sal_Int32 mnFocusedChild; + + // whether children are active and editable + sal_Bool mbActive; + }; + +} // end of namespace accessibility + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/AccessibleSelectionBase.hxx b/include/editeng/AccessibleSelectionBase.hxx new file mode 100644 index 000000000000..7935d5dd1ae2 --- /dev/null +++ b/include/editeng/AccessibleSelectionBase.hxx @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_SELECTION_BASE_HXX +#define _SVX_ACCESSIBILITY_ACCESSIBLE_SELECTION_BASE_HXX + +#include <comphelper/accessibleselectionhelper.hxx> +#include "editeng/editengdllapi.h" + +namespace accessibility +{ +/** @descr + This base class provides a base implementation of the + <type>XAccessibleSelection</type> interface. + The following methods have to be implemented if this + class is used: + + <method>implGetMutex</method>, + <method>implGetAccessibleContext</method>, + <method>implIsSelected</method>, + <method>implSelect</method>, +*/ + class EDITENG_DLLPUBLIC AccessibleSelectionBase : public ::comphelper::OCommonAccessibleSelection, + public ::com::sun::star::accessibility::XAccessibleSelection + { + protected: + + virtual ::osl::Mutex& implGetMutex() = 0; + + public: + + // XAccessibleSelection - default implementations + 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); + + public: + + AccessibleSelectionBase(); + virtual ~AccessibleSelectionBase(); + }; + +} + +#endif // _SVX_ACCESSIBILITY_ACCESSIBLE_SELECTION_BASE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/AccessibleStaticTextBase.hxx b/include/editeng/AccessibleStaticTextBase.hxx new file mode 100644 index 000000000000..8ca75d7a5766 --- /dev/null +++ b/include/editeng/AccessibleStaticTextBase.hxx @@ -0,0 +1,277 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SVX_ACCESSILE_STATIC_TEXT_BASE_HXX_ +#define _SVX_ACCESSILE_STATIC_TEXT_BASE_HXX_ + +#include <memory> +#include <tools/gen.hxx> +#include <cppuhelper/implbase2.hxx> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/XAccessibleText.hpp> +#include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp> +#include <com/sun/star/accessibility/TextSegment.hpp> +#include "editeng/editengdllapi.h" + + +class SvxEditSource; +class SvxEditViewForwarder; + +namespace accessibility +{ + + class AccessibleStaticTextBase_Impl; + + typedef ::cppu::ImplHelper2< + ::com::sun::star::accessibility::XAccessibleText, + ::com::sun::star::accessibility::XAccessibleTextAttributes > AccessibleStaticTextBase_BASE; + + /** Helper class for objects containing EditEngine/Outliner text + + This class implements the XAccessibleText interface for static + text, somewhat similar to the children of the + AccessibleTextHelper class. Currently, there are no children, + i.e. the whole text is presented in one big chunk. This might + change in the future, if a need for image bullets should + arise. These, by convention, would be represented as children + of the text. + + You have to implement the SvxEditSource, SvxTextForwarder, + SvxViewForwarder and SvxEditViewForwarder interfaces in order + to enable your object to cooperate with this + class. SvxTextForwarder encapsulates the fact that text + objects do not necessarily have an EditEngine at their + disposal, SvxViewForwarder and SvxEditViewForwarder do the + same for the document and the edit view. The three mentioned + forwarder objects are not stored by the AccessibleTextHelper, + but fetched every time from the SvxEditSource. So you are best + off making your SvxEditSource::Get*Forwarder methods cache the + current forwarder. + + As this class is intended for static (i.e. non-changing) text + only, no event broadcasting is necessary. You must handle + visibility by yourself, the bounding boxes returned by + getCharacterBounds() are relative to your accessibility + object. + + @attention All public non-UNO methods (those are the uppercase + ones) must not be called with any mutex hold, except when + calling from the main thread (with holds the solar mutex), + unless stated otherwise. This is because they themselves might + need the solar mutex in addition to the object mutex, and the + ordering of the locking must be: first solar mutex, then + object mutex. Furthermore, state change events might be fired + internally. + + @derive Use this class as a base for objects containing static + edit engine text. To avoid overwriting every interface method + to intercept derived object defunc state, just set NULL as the + edit source. Every interface method will then properly throw + an exception. + */ + class EDITENG_DLLPUBLIC AccessibleStaticTextBase : public AccessibleStaticTextBase_BASE + { + + public: + /** Create accessible text object for given edit source + + @param pEditSource + The edit source to use. Object ownership is transferred + from the caller to the callee. The object listens on the + SvxEditSource for object disposal, so no provisions have + to be taken if the caller destroys the data (e.g. the + model) contained in the given SvxEditSource. + + */ + SAL_WNODEPRECATED_DECLARATIONS_PUSH + explicit AccessibleStaticTextBase( ::std::auto_ptr< SvxEditSource > pEditSource ); + SAL_WNODEPRECATED_DECLARATIONS_POP + virtual ~AccessibleStaticTextBase(); + + private: + + // declared, but not defined + EDITENG_DLLPRIVATE AccessibleStaticTextBase( const AccessibleStaticTextBase& ); + // declared, but not defined + EDITENG_DLLPRIVATE AccessibleStaticTextBase& operator= ( const AccessibleStaticTextBase& ); + + public: + /** Query the current edit source + + @attention This method returns by reference, so you are + responsible for serialization (typically, you aquired the + solar mutex when calling this method). Thus, the method + should only be called from the main office thread. + + */ + virtual const SvxEditSource& GetEditSource() const SAL_THROW((::com::sun::star::uno::RuntimeException)); + + /** Set the current edit source + + @attention You are required to have the solar mutex + locked, when calling this method. Thus, the method should + only be called from the main office thread. + + The EditSource set here is required to broadcast out the + following hints: EDITSOURCE_HINT_PARASMOVED, + EDITSOURCE_HINT_SELECTIONCHANGED, TEXT_HINT_MODIFIED, + TEXT_HINT_PARAINSERTED, TEXT_HINT_PARAREMOVED, + TEXT_HINT_TEXTHEIGHTCHANGED, + TEXT_HINT_VIEWSCROLLED. Otherwise, not all state changes + will get noticed by the accessibility object. Further + more, when the corresponding core object or the model is + dying, either the edit source must be set to NULL or it + has to broadcast a SFX_HINT_DYING hint. + + This class does not have a dispose method, since it is not + a UNO component. Nevertheless, it holds C++ references to + several core objects, so you should issue a + SetEditSource(::std::auto_ptr<SvxEditSource>(NULL)) in + your dispose() method. + + @param pEditSource + The new edit source to set. Object ownership is transferred + from the caller to the callee. + */ + SAL_WNODEPRECATED_DECLARATIONS_PUSH + virtual void SetEditSource( ::std::auto_ptr< SvxEditSource > pEditSource ) SAL_THROW((::com::sun::star::uno::RuntimeException)); + SAL_WNODEPRECATED_DECLARATIONS_POP + + /** Set the event source + + @attention When setting a reference here, you should call + Dispose() when you as the owner are disposing, since until + then this object will hold that reference + + @param rInterface + The interface that should be set as the source for + accessibility events sent by this object. + */ + virtual void SetEventSource( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rInterface ); + + /** Get the event source + + @return the interface that is set as the source for + accessibility events sent by this object. + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetEventSource() const; + + /** Set offset of EditEngine from parent + + @attention You are required to have the solar mutex + locked, when calling this method. Thus, the method should + only be called from the main office thread. + + If the origin of the underlying EditEngine does + not correspond to the upper left corner of the object + using this class, you have to specify the offset. + + @param rPoint + The offset in screen coordinates (i.e. pixel) + */ + virtual void SetOffset( const Point& rPoint ); + + /** Query offset of EditEngine from parent + + @return the offset in screen coordinates (i.e. pixel) + */ + virtual Point GetOffset() const; + + /** Update the visible children + + As this class currently does not represent any content + using children, this does nothing at the moment. + + @attention You are required to have the solar mutex + locked, when calling this method. Thus, the method should + only be called from the main office thread. + + This method reevaluates the visibility of all + children. Call this method if your visibility state has + changed somehow, e.g. if the visible area has changed and + the AccessibleStaticTextHelper isn't notified + internally. Normally, there should not be a need to call + this method. + */ + virtual void UpdateChildren() SAL_THROW((::com::sun::star::uno::RuntimeException)); + + /** Drop all references and enter disposed state + + This method drops all references to external objects (also + the event source reference set via SetEventSource()) and + sets the object into the disposed state (i.e. the methods + return default values or throw a uno::DisposedException + exception). + */ + virtual void Dispose(); + + // XAccessibleText interface implementation + virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException); + /// This will only work with a functional SvxEditViewForwarder, i.e. an EditEngine/Outliner in edit mode + virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException); + virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine) + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine) + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine) + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + /// This will only work with a functional SvxEditViewForwarder, i.e. an EditEngine/Outliner in edit mode + virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + // XAccessibleTextAttributes + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getDefaultAttributes( const ::com::sun::star::uno::Sequence< OUString >& RequestedAttributes ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getRunAttributes( sal_Int32 Index, const ::com::sun::star::uno::Sequence< OUString >& RequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + // child-related methods from 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::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + // child-related methods from XAccessibleComponent + 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); + + protected: + Rectangle GetParagraphBoundingBox() const; + + private: + + /// @dyn + SAL_WNODEPRECATED_DECLARATIONS_PUSH + const std::auto_ptr< AccessibleStaticTextBase_Impl > mpImpl; + SAL_WNODEPRECATED_DECLARATIONS_POP + + }; + +} // end of namespace accessibility + +#endif /* _SVX_ACCESSILE_STATIC_TEXT_BASE_HXX_ */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/AccessibleStringWrap.hxx b/include/editeng/AccessibleStringWrap.hxx new file mode 100644 index 000000000000..cae879f95a1a --- /dev/null +++ b/include/editeng/AccessibleStringWrap.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _ACCESSIBLESTRINGWRAP_HXX +#define _ACCESSIBLESTRINGWRAP_HXX + +#include <sal/types.h> +#include <tools/string.hxx> + +#include <editeng/editengdllapi.h> + +class OutputDevice; +class SvxFont; +class Rectangle; +class Point; + +//------------------------------------------------------------------------ +// +// AccessibleStringWrap declaration +// +//------------------------------------------------------------------------ + +class AccessibleStringWrap +{ +public: + + EDITENG_DLLPUBLIC AccessibleStringWrap( OutputDevice& rDev, SvxFont& rFont, const String& rText ); + + EDITENG_DLLPUBLIC sal_Bool GetCharacterBounds( sal_Int32 nIndex, Rectangle& rRect ); + EDITENG_DLLPUBLIC sal_Int32 GetIndexAtPoint( const Point& rPoint ); + +private: + + OutputDevice& mrDev; + SvxFont& mrFont; + String maText; +}; + +#endif /* _ACCESSIBLESTRINGWRAP_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/LatinLookupTree.hxx b/include/editeng/LatinLookupTree.hxx new file mode 100644 index 000000000000..9407780f5b80 --- /dev/null +++ b/include/editeng/LatinLookupTree.hxx @@ -0,0 +1,74 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef LATINLOOKUPTREE_HXX +#define LATINLOOKUPTREE_HXX + +#include <editeng/LookupTree.hxx> +#include <editeng/TreeHead.hxx> +#include <editeng/editengdllapi.h> + +/** + * LatinLookupTree implements a tree that is optimized for storing and looking + * up words that mainly consist of roman characters, although any other + * language can be handled, too. + */ +class EDITENG_DLLPUBLIC LatinLookupTree : public LookupTree, public TreeHead +{ +public: + + explicit LatinLookupTree(OUString sLanguage); + ~LatinLookupTree(); + + + /* =================== Implemented Virtuals From LookupTree =================== */ + void returnToRoot(); + void gotoNode(OUString sNode); + void advance(const sal_Unicode a); + void goBack(); + void insert(OUString sKey, const int nProbability = 1); + void insert(const int nProbability = 1); + void remove(OUString sKey); + OUString suggestAutoCompletion() const; + void clear(); + + /* =================== Implemented Virtuals From Node =================== */ + bool isSeparatedlyHandled(const sal_Unicode cKey) const; + Node*& getChildRef(const sal_Unicode cKey, bool bCreatePlaceholder = false); + void evaluateSeparateStorage(int& nSuggest, Node*& pSuggest) const; + void freeMemory(); + + + /* =================== Implemented Virtual From TreeHead =================== */ + Node* newNode(Node* pParent, const sal_Unicode cKey, const int nProbability = 0); + + /* =================== Member Variables =================== */ + // position of lower case letter 'a' within the selected char encoding. + static const unsigned int our_nLowerCaseA; + + // position of upper case letter 'A' within the selected char encoding. + static const unsigned int our_nUpperCaseA; + +private: + Node* m_pLeaves[52]; // handles [a-z] and [A-Z] +}; + +#endif // LATINLOOKUPTREE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/LatinTreeNode.hxx b/include/editeng/LatinTreeNode.hxx new file mode 100644 index 000000000000..5e406858697c --- /dev/null +++ b/include/editeng/LatinTreeNode.hxx @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef LATINTREENODE_HXX +#define LATINTREENODE_HXX + +#include <editeng/Node.hxx> + +/** + * LatinTreeNode represents a node within a LatinLookupTree. As en external + * caller, you should never have to do anything with this class directly. + * Use the class LatinLookupTree instead for constructing a new tree. + */ +class LatinTreeNode : public Node +{ +public: + explicit LatinTreeNode(TreeHead *pHead, Node* pParent, const sal_Unicode cKey, const int nProbability = 0); + ~LatinTreeNode(); + + /* =================== Implemented Virtuals From Node =================== */ + bool isSeparatedlyHandled(const sal_Unicode cKey) const; + Node*& getChildRef(const sal_Unicode cKey, bool bCreatePlaceholder = false); + void evaluateSeparateStorage(int& nSuggest, Node*& pSuggest) const; + void freeMemory(); + +private: + Node* m_pLeaves[26]; // handles [a-z] +}; + +#endif // LATINTREENODE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/LookupTree.hxx b/include/editeng/LookupTree.hxx new file mode 100644 index 000000000000..95abcf25d6f8 --- /dev/null +++ b/include/editeng/LookupTree.hxx @@ -0,0 +1,95 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef LOOKUPTREE_H +#define LOOKUPTREE_H + +#include <sal/types.h> +#include <rtl/ustring.hxx> +#include <editeng/editengdllapi.h> + +/** LookupTree is an interface class that allows for unified access to tree + * structures used for storing dictionnary words as well as their respective + * probabilities. + * It allows you to insert or remove words from the tree, navigate threw the + * tree along its branches and request for a suggestion for autocompletion + * according to the position within the tree. + * It also allows you to attribute a specific language to each tree so that + * it is possible to serve the correct auto completions even within a document + * that contains content in more than one language. + */ +class EDITENG_DLLPUBLIC LookupTree +{ +public: + explicit inline LookupTree(OUString sLanguage); + virtual ~LookupTree() {} + + inline OUString language() const; + + // Resets the current item to root. + virtual void returnToRoot() = 0; + + // Advances from the root position key by key towards the node keyed with + // the last char of sKey. + virtual void gotoNode(OUString sNode) = 0; + + // Advances from the current position towards the node keyed with cKey. + virtual void advance(const sal_Unicode cKey) = 0; + + // Sets the focus to the parent of the current node. Removes the current + // node if it is invalid. + virtual void goBack() = 0; + + // Inserts a complete keyword starting from the root node of the tree. + // Does not change the current position within the tree. + virtual void insert(OUString sKey, const int nProbability = 1) = 0; + + // Inserts a keyword with the given probability at the current position + // within the tree. Does not change the current position within the tree. + virtual void insert(const int nProbability = 1) = 0; + + // Removes a complete keyword starting from the root node of the tree. + // Does not change the current position within the tree. + virtual void remove(OUString sKey) = 0; + + // Returns the suggested autocompletion for the current location within + // the tree. + virtual OUString suggestAutoCompletion() const = 0; + + // Clears the tree and removes any information it contains. + virtual void clear() = 0; + + +private: + const OUString m_sLanguage; // language handled by this tree +}; + +LookupTree::LookupTree(OUString sLanguage) : + m_sLanguage( sLanguage ) +{ +} + +OUString LookupTree::language() const +{ + return m_sLanguage; +} + +#endif // LOOKUPTREE_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/Node.hxx b/include/editeng/Node.hxx new file mode 100644 index 000000000000..3159e48a99b7 --- /dev/null +++ b/include/editeng/Node.hxx @@ -0,0 +1,102 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef NODE_HXX +#define NODE_HXX + +#include <sal/types.h> +#include <rtl/ustring.hxx> +#include <list> + +class TreeHead; + +/** + * Node represents a node within a LookupTree. As en external caller, you + * should never have to do anything with this class directly. + * Use any of the classes derived from LookupTree instead for constructing a + * new tree. + */ +class Node +{ +public: + //explicit Node(TreeHead* const pHead); + explicit Node(TreeHead* const pHead, Node* const pParent = NULL, + const sal_Unicode cKey = 0, const int nProbability = 0); + + virtual ~Node(); + + // Removes the specified child from this node. Make sure you may remove it + // before doing so. + void removeChild(Node*& pChild); + + // Inserts a complete keyword starting from this node of the tree. + void insertKey(OUString sKey, const int nProbability); + // Removes a complete keyword starting from this node of the tree. + void removeKey(OUString sKey); + + // Returns the child node keyed with cKey. + Node* advanceKey(const sal_Unicode cKey); + + // Use this to inform a parent about its child having changed. + // Call this only with nProbability = 0 if you have made sure the node can + // be removed. + void childHasChanged(Node* pChild, const int nProbability, bool bAllowRemoval = false); + + // Rechose the node that is suggested for auto-completion + void reevaluateSuggestion(bool& bNodeProbabilityChanged); + + + /* =================== Virtuals =================== */ + virtual bool isSeparatedlyHandled(const sal_Unicode cKey) const = 0; + + // Returns a reference to the pointer to the child node for the requested + // char. Returns NULL if no such child could be found. + // IMPORTANT: In the latter case, you may NOT overwrite the return value, + // if you did not set bCreatePlaceholder to true. + virtual Node*& getChildRef(const sal_Unicode cKey, bool bCreatePlaceholder = false) = 0; + + // Sets nSuggest to the highest probability within the subtree and pSuggest + // to point to the (first) node with this probability. + virtual void evaluateSeparateStorage(int& nSuggest, Node*& pSuggest) const = 0; + + // Removes all child nodes and clears all memory. + virtual void freeMemory() = 0; + + /* =================== Member Variables =================== */ + const sal_Unicode m_cKey; // the char represented by this node + int m_nKeyProbability; // the number of occurrences of this key + + // the highest KeyProbability in the tree sprouting from this node + int m_nHighestProbaInSubtree; + + Node* const m_pParent; // the parent of this node + Node* m_pSuggest; // next node in chain to the suggested autocompletion + + TreeHead* const m_pHead; // head of the tree + + unsigned short m_nChildren; // the number of children of the node + std::list<Node*> m_lChildren; // all chars not handled by array + + // Allows returning a reference to a valid Null pointer. May NOT be overwritten. + static Node* our_pNodeNullPointer; +}; + +#endif // NODE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/SpellPortions.hxx b/include/editeng/SpellPortions.hxx new file mode 100644 index 000000000000..f96a14b0f557 --- /dev/null +++ b/include/editeng/SpellPortions.hxx @@ -0,0 +1,89 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SVX_SPELL_PORTIONS_HXX +#define SVX_SPELL_PORTIONS_HXX + +#include <i18nlangtag/lang.h> +#include <rtl/ustring.hxx> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/linguistic2/SingleProofreadingError.hpp> +#include <com/sun/star/linguistic2/XProofreader.hpp> +#include <vector> + +namespace com{ namespace sun{ namespace star{ namespace linguistic2{ + class XSpellAlternatives; +}}}} + +namespace svx{ +/** contains a portion of text that has the same language attributes applied + and belongs to the same script type. + */ +struct SpellPortion +{ + /** contains the text of the portion. + */ + OUString sText; + /** Marks the portion as field, footnote symbol or any other special content that + should be protected against unintentional deletion. + */ + bool bIsField; + /** Marks the portion hidden content that should not be touched by spell checking + and not be removed like redlines. The creator of the portions has to take care + for them. + */ + bool bIsHidden; + /** contains the language applied to the text. It has to match the script type. + */ + LanguageType eLanguage; + /** for wrong words this reference is filled with the error information otherwise + it's an empty reference + */ + ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellAlternatives> xAlternatives; + /** determines whether the error type is a grammar error + */ + bool bIsGrammarError; + /** contains the grammar error information + */ + com::sun::star::linguistic2::SingleProofreadingError aGrammarError; + /** provides access to the grammar checker interface + */ + ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XProofreader > xGrammarChecker; + /** marks portion as to-be-ignored. This is a return parameter. + */ + /** contains the proposed dialog title if the proof reading component provides one. + */ + OUString sDialogTitle; + + bool bIgnoreThisError; + SpellPortion() : + bIsField(false), + bIsHidden(false), + eLanguage(LANGUAGE_DONTKNOW), + bIsGrammarError(false), + bIgnoreThisError(false) + { + aGrammarError.nErrorStart = aGrammarError.nErrorLength = aGrammarError.nErrorType = 0; + } +}; +typedef std::vector<SpellPortion> SpellPortions; +}//namespace svx +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/TreeHead.hxx b/include/editeng/TreeHead.hxx new file mode 100644 index 000000000000..12c8b33c8d66 --- /dev/null +++ b/include/editeng/TreeHead.hxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef TREEHEAD_HXX +#define TREEHEAD_HXX + +#include <editeng/Node.hxx> + +/** + * Represents the root node of a LookupTree. + */ +class TreeHead : public Node +{ +public: + explicit inline TreeHead(); + virtual ~TreeHead() {} + + /* =================== Virtuals =================== */ + virtual Node* newNode(Node* pParent, const sal_Unicode cKey, const int nProbability = 0) = 0; + + /* =================== Member Variables =================== */ + Node* m_pCurrent; // current location within the tree +}; + +TreeHead::TreeHead() : + Node( this ), + m_pCurrent( this ) +{ +} + +#endif // TREEHEAD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/UnoForbiddenCharsTable.hxx b/include/editeng/UnoForbiddenCharsTable.hxx new file mode 100644 index 000000000000..9fea61b9084c --- /dev/null +++ b/include/editeng/UnoForbiddenCharsTable.hxx @@ -0,0 +1,59 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SVX_UNOFORBIDDENCHARSTABLE_HXX_ +#define _SVX_UNOFORBIDDENCHARSTABLE_HXX_ + +#include <com/sun/star/i18n/XForbiddenCharacters.hpp> +#include <com/sun/star/linguistic2/XSupportedLocales.hpp> +#include <rtl/ref.hxx> + +#include <cppuhelper/implbase2.hxx> +#include "editeng/editengdllapi.h" + +class SvxForbiddenCharactersTable; + +class EDITENG_DLLPUBLIC SvxUnoForbiddenCharsTable : public cppu::WeakImplHelper2< + com::sun::star::i18n::XForbiddenCharacters, + com::sun::star::linguistic2::XSupportedLocales> +{ +protected: + /** this virtual function is called if the forbidden characters are changed */ + virtual void onChange(); + + rtl::Reference<SvxForbiddenCharactersTable> mxForbiddenChars; + +public: + SvxUnoForbiddenCharsTable(rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars); + ~SvxUnoForbiddenCharsTable(); + + // XForbiddenCharacters + virtual com::sun::star::i18n::ForbiddenCharacters SAL_CALL getForbiddenCharacters( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::container::NoSuchElementException, com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasForbiddenCharacters( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setForbiddenCharacters( const com::sun::star::lang::Locale& rLocale, const com::sun::star::i18n::ForbiddenCharacters& rForbiddenCharacters ) throw(com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeForbiddenCharacters( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); + + // XSupportedLocales + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > SAL_CALL getLocales( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasLocale( const ::com::sun::star::lang::Locale& aLocale ) throw (::com::sun::star::uno::RuntimeException); +}; + +#endif // _SVX_UNOFORBIDDENCHARSTABLE_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/acorrcfg.hxx b/include/editeng/acorrcfg.hxx new file mode 100644 index 000000000000..3c3321ccfc2d --- /dev/null +++ b/include/editeng/acorrcfg.hxx @@ -0,0 +1,121 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVXACCFG_HXX +#define _SVXACCFG_HXX + +#include "editeng/editengdllapi.h" +#include <unotools/configitem.hxx> + +class SvxAutoCorrect; +class SvxAutoCorrCfg; +class EDITENG_DLLPUBLIC SvxBaseAutoCorrCfg : public utl::ConfigItem +{ + SvxAutoCorrCfg& rParent; + com::sun::star::uno::Sequence<OUString> GetPropertyNames(); + +public: + SvxBaseAutoCorrCfg(SvxAutoCorrCfg& rParent); + ~SvxBaseAutoCorrCfg(); + + void Load(sal_Bool bInit); + virtual void Commit(); + virtual void Notify( const com::sun::star::uno::Sequence<OUString>& aPropertyNames); + void SetModified() {ConfigItem::SetModified();} +}; + +class EDITENG_DLLPUBLIC SvxSwAutoCorrCfg : public utl::ConfigItem +{ + SvxAutoCorrCfg& rParent; + com::sun::star::uno::Sequence<OUString> GetPropertyNames(); + +public: + SvxSwAutoCorrCfg(SvxAutoCorrCfg& rParent); + ~SvxSwAutoCorrCfg(); + + void Load(sal_Bool bInit); + virtual void Commit(); + virtual void Notify( const com::sun::star::uno::Sequence<OUString>& aPropertyNames); + void SetModified() {ConfigItem::SetModified();} +}; +/*-------------------------------------------------------------------- + Description: Configuration for Auto Correction + --------------------------------------------------------------------*/ +class EDITENG_DLLPUBLIC SvxAutoCorrCfg +{ + friend class SvxBaseAutoCorrCfg; + friend class SvxSwAutoCorrCfg; + + SvxAutoCorrect* pAutoCorrect; + + SvxBaseAutoCorrCfg aBaseConfig; + SvxSwAutoCorrCfg aSwConfig; + + // Flags for Autotext: + sal_Bool bFileRel; + sal_Bool bNetRel; + // Help tip for Autotext as you type + sal_Bool bAutoTextTip; + sal_Bool bAutoTextPreview; + sal_Bool bAutoFmtByInput; + sal_Bool bSearchInAllCategories; + +public: + void SetModified() + { + aBaseConfig.SetModified(); + aSwConfig.SetModified(); + } + void Commit() + { + aBaseConfig.Commit(); + aSwConfig.Commit(); + } + + SvxAutoCorrect* GetAutoCorrect() { return pAutoCorrect; } + const SvxAutoCorrect* GetAutoCorrect() const { return pAutoCorrect; } + // the pointer is transferred to the possession of the ConfigItems! + void SetAutoCorrect( SvxAutoCorrect* ); + + sal_Bool IsAutoFmtByInput() const { return bAutoFmtByInput; } + void SetAutoFmtByInput( sal_Bool bSet ) { bAutoFmtByInput = bSet;aSwConfig.SetModified();} + + sal_Bool IsSaveRelFile() const { return bFileRel; } + void SetSaveRelFile( sal_Bool bSet ) { bFileRel = bSet; aSwConfig.SetModified(); } + + sal_Bool IsSaveRelNet() const { return bNetRel; } + void SetSaveRelNet( sal_Bool bSet ) { bNetRel = bSet; aSwConfig.SetModified();} + + sal_Bool IsAutoTextPreview() const {return bAutoTextPreview;} + void SetAutoTextPreview(sal_Bool bSet) {bAutoTextPreview = bSet; aSwConfig.SetModified();} + + sal_Bool IsAutoTextTip() const { return bAutoTextTip; } + void SetAutoTextTip(sal_Bool bSet ) { bAutoTextTip = bSet;aSwConfig.SetModified();} + + sal_Bool IsSearchInAllCategories() const { return bSearchInAllCategories;} + void SetSearchInAllCategories(sal_Bool bSet ) { bSearchInAllCategories = bSet; aSwConfig.SetModified(); } + + SvxAutoCorrCfg(); + virtual ~SvxAutoCorrCfg(); + static SvxAutoCorrCfg& Get(); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/adjustitem.hxx b/include/editeng/adjustitem.hxx new file mode 100644 index 000000000000..e19907cd1737 --- /dev/null +++ b/include/editeng/adjustitem.hxx @@ -0,0 +1,130 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_ADJITEM_HXX +#define _SVX_ADJITEM_HXX + +#include <svl/eitem.hxx> +#include <editeng/svxenum.hxx> +#include <editeng/eeitem.hxx> +#include <editeng/editengdllapi.h> + +class SvXMLUnitConverter; + +// class SvxAdjustItem --------------------------------------------------- + +/* +[Description] +This item describes the row orientation. +*/ +#define ADJUST_LASTBLOCK_VERSION ((sal_uInt16)0x0001) + +class EDITENG_DLLPUBLIC SvxAdjustItem : public SfxEnumItemInterface +{ + sal_Bool bLeft : 1; + sal_Bool bRight : 1; + sal_Bool bCenter : 1; + sal_Bool bBlock : 1; + + // only activ when bBlock + sal_Bool bOneBlock : 1; + sal_Bool bLastCenter : 1; + sal_Bool bLastBlock : 1; + + friend SvStream& operator<<( SvStream&, SvxAdjustItem& ); //$ ostream +public: + TYPEINFO(); + + SvxAdjustItem( const SvxAdjust eAdjst /*= SVX_ADJUST_LEFT*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual int operator==( const SfxPoolItem& ) const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + virtual sal_uInt16 GetValueCount() const; + virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const; + virtual sal_uInt16 GetEnumValue() const; + virtual void SetEnumValue( sal_uInt16 nNewVal ); + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; + + inline void SetOneWord( const SvxAdjust eType ) + { + bOneBlock = eType == SVX_ADJUST_BLOCK; + } + + inline void SetLastBlock( const SvxAdjust eType ) + { + bLastBlock = eType == SVX_ADJUST_BLOCK; + bLastCenter = eType == SVX_ADJUST_CENTER; + } + + inline void SetAdjust( const SvxAdjust eType ) + { + bLeft = eType == SVX_ADJUST_LEFT; + bRight = eType == SVX_ADJUST_RIGHT; + bCenter = eType == SVX_ADJUST_CENTER; + bBlock = eType == SVX_ADJUST_BLOCK; + } + + inline SvxAdjust GetLastBlock() const + { + SvxAdjust eRet = SVX_ADJUST_LEFT; + + if ( bLastBlock ) + eRet = SVX_ADJUST_BLOCK; + else if( bLastCenter ) + eRet = SVX_ADJUST_CENTER; + return eRet; + } + + inline SvxAdjust GetOneWord() const + { + SvxAdjust eRet = SVX_ADJUST_LEFT; + + if ( bBlock && bOneBlock ) + eRet = SVX_ADJUST_BLOCK; + return eRet; + } + + inline SvxAdjust GetAdjust() const + { + SvxAdjust eRet = SVX_ADJUST_LEFT; + + if ( bRight ) + eRet = SVX_ADJUST_RIGHT; + else if ( bCenter ) + eRet = SVX_ADJUST_CENTER; + else if ( bBlock ) + eRet = SVX_ADJUST_BLOCK; + return eRet; + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/autokernitem.hxx b/include/editeng/autokernitem.hxx new file mode 100644 index 000000000000..6d849dc39d23 --- /dev/null +++ b/include/editeng/autokernitem.hxx @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_AKRNITEM_HXX +#define _SVX_AKRNITEM_HXX + +#include <svl/eitem.hxx> +#include <editeng/editengdllapi.h> + +class SvXMLUnitConverter; + +// class SvxAutoKernItem ------------------------------------------------- + +/* + [Description] + Attribute for Pair-Kerning. +*/ + +class EDITENG_DLLPUBLIC SvxAutoKernItem : public SfxBoolItem +{ +public: + TYPEINFO(); + + SvxAutoKernItem( const sal_Bool bAutoKern /*= sal_False*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + inline SvxAutoKernItem& operator=(const SvxAutoKernItem& rAutoKern) + { + SetValue( rAutoKern.GetValue() ); + return *this; + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/blinkitem.hxx b/include/editeng/blinkitem.hxx new file mode 100644 index 000000000000..0d495e6e100e --- /dev/null +++ b/include/editeng/blinkitem.hxx @@ -0,0 +1,59 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_BLNKITEM_HXX +#define _SVX_BLNKITEM_HXX + +#include <svl/poolitem.hxx> +#include <svl/eitem.hxx> +#include <editeng/editengdllapi.h> + +class SvXMLUnitConverter; + +// class SvxBlinkItem ------------------------------------------------- + +/* + [Description] + This item describes, whether to flash. +*/ + +class EDITENG_DLLPUBLIC SvxBlinkItem : public SfxBoolItem +{ +public: + TYPEINFO(); + + SvxBlinkItem( const sal_Bool bBlink /*= sal_False*/, const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + inline SvxBlinkItem& operator=(const SvxBlinkItem& rBlink) { + SetValue(rBlink.GetValue()); + return *this; + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/borderline.hxx b/include/editeng/borderline.hxx new file mode 100644 index 000000000000..067e216aaa9a --- /dev/null +++ b/include/editeng/borderline.hxx @@ -0,0 +1,169 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SVX_BORDERLINE_HXX +#define SVX_BORDERLINE_HXX + +#include <com/sun/star/table/BorderLineStyle.hpp> + +#include <tools/color.hxx> +#include <svl/poolitem.hxx> +#include <editeng/editengdllapi.h> +#include <svtools/ctrlbox.hxx> + +// Line defaults in twips (former Writer defaults): + +#define DEF_LINE_WIDTH_0 1 +#define DEF_LINE_WIDTH_1 20 +#define DEF_LINE_WIDTH_2 50 +#define DEF_LINE_WIDTH_3 80 +#define DEF_LINE_WIDTH_4 100 +#define DEF_LINE_WIDTH_5 10 + +// ============================================================================ + +namespace editeng { + + // values from ::com::sun::star::table::BorderLineStyle + typedef sal_Int16 SvxBorderStyle; + + // convert border style between Word formats and LO + SvxBorderStyle EDITENG_DLLPUBLIC ConvertBorderStyleFromWord(int); + /// convert border width in twips between Word formats and LO + double EDITENG_DLLPUBLIC ConvertBorderWidthToWord(SvxBorderStyle, double); + double EDITENG_DLLPUBLIC ConvertBorderWidthFromWord(SvxBorderStyle, + double, int); + + class EDITENG_DLLPUBLIC SvxBorderLine + { + protected: + Color aColor; + + long m_nWidth; + bool m_bMirrorWidths; + BorderWidthImpl m_aWidthImpl; + long m_nMult; + long m_nDiv; + + SvxBorderStyle m_nStyle; + sal_uInt16 nOutWidth; + sal_uInt16 nInWidth; + sal_uInt16 nDistance; + + bool m_bUseLeftTop; + Color (*m_pColorOutFn)( Color ); + Color (*m_pColorInFn)( Color ); + Color (*m_pColorGapFn)( Color ); + + public: + SvxBorderLine( const Color *pCol = 0, + long nWidth = 0, SvxBorderStyle nStyle = + ::com::sun::star::table::BorderLineStyle::SOLID, + bool bUseLeftTop = false, + Color (*pColorOutFn)( Color ) = &darkColor, + Color (*pColorInFn)( Color ) = &darkColor, + Color (*pColorGapFn)( Color ) = NULL ); + SvxBorderLine( const SvxBorderLine& r ); + + SvxBorderLine& operator=( const SvxBorderLine& r ); + + const Color& GetColor() const { return aColor; } + Color GetColorOut( bool bLeftOrTop = true ) const; + Color GetColorIn( bool bLeftOrTop = true ) const; + bool HasGapColor() const { return m_pColorGapFn != NULL; } + Color GetColorGap() const; + + void SetWidth( long nWidth = 0 ) { m_nWidth = nWidth; } + /** Guess the style and width from the three lines widths values. + + When the value of nStyle is SvxBorderLine::DOUBLE, the style set will be guessed + using the three values to match the best possible style among the following: + - SvxBorderLine::DOUBLE + - SvxBorderLine::THINTHICK_SMALLGAP + - SvxBorderLine::THINTHICK_MEDIUMGAP + - SvxBorderLine::THINTHICK_LARGEGAP + - SvxBorderLine::THICKTHIN_SMALLGAP + - SvxBorderLine::THICKTHIN_MEDIUMGAP + - SvxBorderLine::THICKTHIN_LARGEGAP + + If no styles matches the width, then the width is set to 0. + + There is one known case that could fit several styles: \a nIn = \a nDist = 0.75 pt, + \a nOut = 1.5 pt. This case fits SvxBorderLine::THINTHICK_SMALLGAP and + SvxBorderLine::THINTHICK_MEDIUMGAP with a 1.5 pt width and + SvxBorderLine::THINTHICK_LARGEGAP with a 0.75 pt width. The same case happens + also for thick-thin styles. + + \param nStyle the border style used to guess the width. + \param nIn the width of the inner line in 1th pt + \param nOut the width of the outer line in 1th pt + \param nDist the width of the gap between the lines in 1th pt + */ + void GuessLinesWidths( SvxBorderStyle nStyle, sal_uInt16 nOut, sal_uInt16 nIn = 0, sal_uInt16 nDist = 0 ); + + // TODO Hacky method to mirror lines in only a few cases + void SetMirrorWidths( bool bMirror = true ) { m_bMirrorWidths = bMirror; } + long GetWidth( ) const { return m_nWidth; } + sal_uInt16 GetOutWidth() const; + sal_uInt16 GetInWidth() const; + sal_uInt16 GetDistance() const; + + SvxBorderStyle GetBorderLineStyle() const { return m_nStyle; } + + void SetColor( const Color &rColor ) { aColor = rColor; } + void SetColorOutFn( Color (*pColorOutFn)( Color ) ) { m_pColorOutFn = pColorOutFn; } + void SetColorInFn( Color (*pColorInFn)( Color ) ) { m_pColorInFn = pColorInFn; } + void SetColorGapFn( Color (*pColorGapFn)( Color ) ) { m_pColorGapFn = pColorGapFn; } + void SetUseLeftTop( bool bUseLeftTop ) { m_bUseLeftTop = bUseLeftTop; } + void SetBorderLineStyle( SvxBorderStyle nNew ); + void ScaleMetrics( long nMult, long nDiv ); + + sal_Bool operator==( const SvxBorderLine &rCmp ) const; + + String GetValueString( SfxMapUnit eSrcUnit, SfxMapUnit eDestUnit, + const IntlWrapper* pIntl, + sal_Bool bMetricStr = sal_False ) const; + + bool HasPriority( const SvxBorderLine& rOtherLine ) const; + + bool isEmpty() const { + return m_aWidthImpl.IsEmpty() + || m_nStyle == ::com::sun::star::table::BorderLineStyle::NONE + || m_nWidth == 0; + } + bool isDouble() const { return m_aWidthImpl.IsDouble(); } + sal_uInt16 GetScaledWidth() const { return GetOutWidth() + GetInWidth() + GetDistance(); } + + static Color darkColor( Color aMain ); + static Color lightColor( Color aMain ); + + static Color threeDLightColor( Color aMain ); + static Color threeDMediumColor( Color aMain ); + static Color threeDDarkColor( Color aMain ); + + static BorderWidthImpl getWidthImpl( SvxBorderStyle nStyle ); + }; + +// ============================================================================ + +} // namespace editeng + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/boxitem.hxx b/include/editeng/boxitem.hxx new file mode 100644 index 000000000000..256663c961e9 --- /dev/null +++ b/include/editeng/boxitem.hxx @@ -0,0 +1,226 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_BOXITEM_HXX +#define _SVX_BOXITEM_HXX + +#include <svl/poolitem.hxx> +#include <editeng/borderline.hxx> +#include <editeng/editengdllapi.h> +#include <com/sun/star/table/BorderLine2.hpp> + + +// class SvxBoxItem ------------------------------------------------------ + +/* [Description] + + This item describes a border attribute + (all four edges and the inward distance) +*/ + +#define BOX_LINE_TOP ((sal_uInt16)0) +#define BOX_LINE_BOTTOM ((sal_uInt16)1) +#define BOX_LINE_LEFT ((sal_uInt16)2) +#define BOX_LINE_RIGHT ((sal_uInt16)3) + +/** +This version causes SvxBoxItem to store the 4 cell spacing distances separately +when serializing to stream. +*/ +#define BOX_4DISTS_VERSION ((sal_uInt16)1) +/** +This version causes SvxBoxItem to store the styles for its border lines when +serializing to stream. +*/ +#define BOX_BORDER_STYLE_VERSION ((sal_uInt16)2) + +class EDITENG_DLLPUBLIC SvxBoxItem : public SfxPoolItem +{ + editeng::SvxBorderLine *pTop, + *pBottom, + *pLeft, + *pRight; + sal_uInt16 nTopDist, + nBottomDist, + nLeftDist, + nRightDist; + +public: + TYPEINFO(); + + explicit SvxBoxItem( const sal_uInt16 nId ); + SvxBoxItem( const SvxBoxItem &rCpy ); + ~SvxBoxItem(); + SvxBoxItem &operator=( const SvxBoxItem& rBox ); + + // "pure virtual Methods" from SfxPoolItem + virtual int operator==( const SfxPoolItem& ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; + + virtual bool ScaleMetrics( long nMult, long nDiv ); + virtual bool HasMetrics() const; + + const editeng::SvxBorderLine* GetTop() const { return pTop; } + const editeng::SvxBorderLine* GetBottom() const { return pBottom; } + const editeng::SvxBorderLine* GetLeft() const { return pLeft; } + const editeng::SvxBorderLine* GetRight() const { return pRight; } + + const editeng::SvxBorderLine* GetLine( sal_uInt16 nLine ) const; + + //The Pointers are being copied! + void SetLine( const editeng::SvxBorderLine* pNew, sal_uInt16 nLine ); + + sal_uInt16 GetDistance( sal_uInt16 nLine ) const; + sal_uInt16 GetDistance() const; + + void SetDistance( sal_uInt16 nNew, sal_uInt16 nLine ); + inline void SetDistance( sal_uInt16 nNew ); + + // Line width plus Space plus inward distance + //bIgnoreLine = TRUE -> Also return distance, when no Line is set + sal_uInt16 CalcLineSpace( sal_uInt16 nLine, sal_Bool bIgnoreLine = sal_False ) const; + static com::sun::star::table::BorderLine2 SvxLineToLine( const editeng::SvxBorderLine* pLine, sal_Bool bConvert ); + static sal_Bool LineToSvxLine(const ::com::sun::star::table::BorderLine& rLine, editeng::SvxBorderLine& rSvxLine, sal_Bool bConvert); + static sal_Bool LineToSvxLine(const ::com::sun::star::table::BorderLine2& rLine, editeng::SvxBorderLine& rSvxLine, sal_Bool bConvert); +}; + +inline void SvxBoxItem::SetDistance( sal_uInt16 nNew ) +{ + nTopDist = nBottomDist = nLeftDist = nRightDist = nNew; +} + +// class SvxBoxInfoItem -------------------------------------------------- + +/* [Description] + + Another item for the border. This item has only limited functionality. + On one hand, the general Dialog is told by the item which options it + should offer. On the other hand, this attribute may be used to + transported the borderline for the inner horizontal and vertical lines. +*/ + +#define BOXINFO_LINE_HORI ((sal_uInt16)0) +#define BOXINFO_LINE_VERT ((sal_uInt16)1) + +#define VALID_TOP 0x01 +#define VALID_BOTTOM 0x02 +#define VALID_LEFT 0x04 +#define VALID_RIGHT 0x08 +#define VALID_HORI 0x10 +#define VALID_VERT 0x20 +#define VALID_DISTANCE 0x40 +#define VALID_DISABLE 0x80 + +class EDITENG_DLLPUBLIC SvxBoxInfoItem : public SfxPoolItem +{ + editeng::SvxBorderLine* pHori; //inner horizontal Line + editeng::SvxBorderLine* pVert; //inner vertical Line + + bool mbEnableHor; /// true = Enable inner horizontal line. + bool mbEnableVer; /// true = Enable inner vertical line. + + /* + Currently only for StarWriter: distance inward from SvxBoxItem. If the + distance is requested, then the field for the distance from the dialog be + activated. nDefDist is regarded as a default value. If any line is + turned on or will be turned on it must this distance be set to default. + bMinDist indicates whether the user can go below this value or not. + With NDIST is the current distance from the app transported back and + forth to the dialogue. + */ + + sal_Bool bDist :1; // TRUE, Unlock Distance. + sal_Bool bMinDist :1; // TRUE, Going below minimum Distance is prohibited + + sal_uInt8 nValidFlags; // 0000 0000 + // ³³³³ ³³³ÀÄ VALID_TOP + // ³³³³ ³³ÀÄÄ VALID_BOTTOM + // ³³³³ ³ÀÄÄÄ VALID_LEFT + // ³³³³ ÀÄÄÄÄ VALID_RIGHT + // ³³³ÀÄÄÄÄÄÄ VALID_HORI + // ³³ÀÄÄÄÄÄÄÄ VALID_VERT + // ³ÀÄÄÄÄÄÄÄÄ VALID_DIST + // ÀÄÄÄÄÄÄÄÄÄ VALID_DISABLE + + sal_uInt16 nDefDist; // The default or minimum distance. + +public: + TYPEINFO(); + + explicit SvxBoxInfoItem( const sal_uInt16 nId ); + SvxBoxInfoItem( const SvxBoxInfoItem &rCpy ); + ~SvxBoxInfoItem(); + SvxBoxInfoItem &operator=( const SvxBoxInfoItem &rCpy ); + + // "pure virtual Methods" from SfxPoolItem + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; + virtual bool ScaleMetrics( long nMult, long nDiv ); + virtual bool HasMetrics() const; + + const editeng::SvxBorderLine* GetHori() const { return pHori; } + const editeng::SvxBorderLine* GetVert() const { return pVert; } + + //The Pointers are being copied! + void SetLine( const editeng::SvxBorderLine* pNew, sal_uInt16 nLine ); + + sal_Bool IsTable() const { return mbEnableHor && mbEnableVer; } + void SetTable( sal_Bool bNew ) { mbEnableHor = mbEnableVer = bNew; } + + inline bool IsHorEnabled() const { return mbEnableHor; } + inline void EnableHor( bool bEnable ) { mbEnableHor = bEnable; } + inline bool IsVerEnabled() const { return mbEnableVer; } + inline void EnableVer( bool bEnable ) { mbEnableVer = bEnable; } + + sal_Bool IsDist() const { return bDist; } + void SetDist( sal_Bool bNew ) { bDist = bNew; } + sal_Bool IsMinDist() const { return bMinDist; } + void SetMinDist( sal_Bool bNew ) { bMinDist = bNew; } + sal_uInt16 GetDefDist() const { return nDefDist; } + void SetDefDist( sal_uInt16 nNew ) { nDefDist = nNew; } + + sal_Bool IsValid( sal_uInt8 nValid ) const + { return ( nValidFlags & nValid ) == nValid; } + void SetValid( sal_uInt8 nValid, sal_Bool bValid = sal_True ) + { bValid ? ( nValidFlags |= nValid ) + : ( nValidFlags &= ~nValid ); } + void ResetFlags(); +}; +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/brushitem.hxx b/include/editeng/brushitem.hxx new file mode 100644 index 000000000000..069a3b7f636a --- /dev/null +++ b/include/editeng/brushitem.hxx @@ -0,0 +1,125 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_BRSHITEM_HXX +#define _SVX_BRSHITEM_HXX + +#include <svl/poolitem.hxx> +#include <vcl/wall.hxx> +#include <tools/link.hxx> +#include <editeng/editengdllapi.h> + +// class SvxBrushItem ---------------------------------------------------- + +class Graphic; +class GraphicObject; +class CntWallpaperItem; + +#define BRUSH_GRAPHIC_VERSION ((sal_uInt16)0x0001) + +enum SvxGraphicPosition +{ + GPOS_NONE, + GPOS_LT, GPOS_MT, GPOS_RT, + GPOS_LM, GPOS_MM, GPOS_RM, + GPOS_LB, GPOS_MB, GPOS_RB, + GPOS_AREA, GPOS_TILED +}; + +#define PARA_DEST_PARA 0 +#define PARA_DEST_CHAR 1 + +class SvxBrushItem_Impl; +class EDITENG_DLLPUBLIC SvxBrushItem : public SfxPoolItem +{ + Color aColor; + SvxBrushItem_Impl* pImpl; + String* pStrLink; + String* pStrFilter; + SvxGraphicPosition eGraphicPos; + sal_Bool bLoadAgain; + + void ApplyGraphicTransparency_Impl(); + DECL_STATIC_LINK( SvxBrushItem, DoneHdl_Impl, void *); + // wird nur von Create benutzt + SvxBrushItem( SvStream& rStrm, + sal_uInt16 nVersion, sal_uInt16 nWhich ); + +public: + TYPEINFO(); + + explicit SvxBrushItem( sal_uInt16 nWhich ); + SvxBrushItem( const Color& rColor, sal_uInt16 nWhich ); + + SvxBrushItem( const Graphic& rGraphic, + SvxGraphicPosition ePos, sal_uInt16 nWhich ); + SvxBrushItem( const GraphicObject& rGraphicObj, + SvxGraphicPosition ePos, sal_uInt16 nWhich ); + SvxBrushItem( const String& rLink, const String& rFilter, + SvxGraphicPosition ePos, sal_uInt16 nWhich ); + SvxBrushItem( const SvxBrushItem& ); + SvxBrushItem( const CntWallpaperItem&, sal_uInt16 nWhich ); + + ~SvxBrushItem(); + +public: + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual int operator==( const SfxPoolItem& ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nVersion ) const; + virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; + + const Color& GetColor() const { return aColor; } + Color& GetColor() { return aColor; } + void SetColor( const Color& rCol) { aColor = rCol; } + + void SetDoneLink( const Link& rLink ); + + SvxGraphicPosition GetGraphicPos() const { return eGraphicPos; } + + void PurgeMedium() const; + + const Graphic* GetGraphic() const; + const GraphicObject* GetGraphicObject() const; + const String* GetGraphicLink() const { return pStrLink; } + const String* GetGraphicFilter() const { return pStrFilter; } + + void SetGraphicPos( SvxGraphicPosition eNew ); + void SetGraphic( const Graphic& rNew ); + void SetGraphicObject( const GraphicObject& rNewObj ); + void SetGraphicLink( const String& rNew ); + void SetGraphicFilter( const String& rNew ); + + SvxBrushItem& operator=( const SvxBrushItem& rItem); + + static SvxGraphicPosition WallpaperStyle2GraphicPos( WallpaperStyle eStyle ); + static WallpaperStyle GraphicPos2WallpaperStyle( SvxGraphicPosition ePos ); +}; + +#endif // #ifndef _SVX_BRSHITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/bulletitem.hxx b/include/editeng/bulletitem.hxx new file mode 100644 index 000000000000..345cf3ff7639 --- /dev/null +++ b/include/editeng/bulletitem.hxx @@ -0,0 +1,146 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_BULITEM_HXX +#define _SVX_BULITEM_HXX + +#include "editeng/editengdllapi.h" + + +// define ---------------------------------------------------------------- + +// Styles +#define BS_ABC_BIG 0 +#define BS_ABC_SMALL 1 +#define BS_ROMAN_BIG 2 +#define BS_ROMAN_SMALL 3 +#define BS_123 4 +#define BS_NONE 5 +#define BS_BULLET 6 +#define BS_BMP 128 + +// Justification +#define BJ_HLEFT 0x01 +#define BJ_HRIGHT 0x02 +#define BJ_HCENTER 0x04 +#define BJ_VTOP 0x08 +#define BJ_VBOTTOM 0x10 +#define BJ_VCENTER 0x20 + +// Valid-Bits +// First, only the values that are changed by the dialogue ... +#define VALID_FONTCOLOR 0x0001 +#define VALID_FONTNAME 0x0002 +#define VALID_SYMBOL 0x0004 +#define VALID_BITMAP 0x0008 +#define VALID_SCALE 0x0010 +#define VALID_START 0x0020 +#define VALID_STYLE 0x0040 +#define VALID_PREVTEXT 0x0080 +#define VALID_FOLLOWTEXT 0x0100 +#include <svl/poolitem.hxx> +#include <vcl/font.hxx> +#include <svtools/grfmgr.hxx> + +// class SvxBulletItem --------------------------------------------------- + +class EDITENG_DLLPUBLIC SvxBulletItem : public SfxPoolItem +{ + Font aFont; + GraphicObject* pGraphicObject; + String aPrevText; + String aFollowText; + sal_uInt16 nStart; + sal_uInt16 nStyle; + long nWidth; + sal_uInt16 nScale; + sal_Unicode cSymbol; + sal_uInt8 nJustify; + sal_uInt16 nValidMask; // Only temporary for GetAttribs / setAttribs, + // because of the large Bullets + +#ifdef _SVX_BULITEM_CXX + void SetDefaultFont_Impl(); + void SetDefaults_Impl(); +#endif + +public: + TYPEINFO(); + + explicit SvxBulletItem( sal_uInt16 nWhich = 0 ); + explicit SvxBulletItem( SvStream& rStrm, sal_uInt16 nWhich = 0 ); + SvxBulletItem( const SvxBulletItem& ); + ~SvxBulletItem(); + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nVersion ) const; + virtual SvStream& Store( SvStream & , sal_uInt16 nItemVersion ) const; + + String GetFullText() const; + sal_Unicode GetSymbol() const { return cSymbol; } + String GetPrevText() const { return aPrevText; } + String GetFollowText() const { return aFollowText; } + + sal_uInt16 GetStart() const { return nStart; } + long GetWidth() const { return nWidth; } + sal_uInt16 GetStyle() const { return nStyle; } + sal_uInt8 GetJustification() const { return nJustify; } + Font GetFont() const { return aFont; } + sal_uInt16 GetScale() const { return nScale; } + + const GraphicObject& GetGraphicObject() const; + void SetGraphicObject( const GraphicObject& rGraphicObject ); + + void SetSymbol( sal_Unicode c) { cSymbol = c; } + void SetPrevText( const String& rStr) { aPrevText = rStr;} + void SetFollowText(const String& rStr) { aFollowText=rStr;} + + void SetStart( sal_uInt16 nNew ) { nStart = nNew; } + void SetWidth( long nNew ) { nWidth = nNew; } + void SetStyle( sal_uInt16 nNew ) { nStyle = nNew; } + void SetJustification( sal_uInt8 nNew ) { nJustify = nNew; } + void SetFont( const Font& rNew) { aFont = rNew; } + void SetScale( sal_uInt16 nNew ) { nScale = nNew; } + + virtual sal_uInt16 GetVersion(sal_uInt16 nFileVersion) const; + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + static void StoreFont( SvStream&, const Font& ); + static Font CreateFont( SvStream&, sal_uInt16 nVer ); + + sal_uInt16& GetValidMask() { return nValidMask; } + sal_uInt16 GetValidMask() const { return nValidMask; } + sal_uInt16 IsValid( sal_uInt16 nFlag ) const { return nValidMask & nFlag; } + void SetValid( sal_uInt16 nFlag, sal_Bool bValid ) + { + if ( bValid ) + nValidMask |= nFlag; + else + nValidMask &= ~nFlag; + } + void CopyValidProperties( const SvxBulletItem& rCopyFrom ); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/charhiddenitem.hxx b/include/editeng/charhiddenitem.hxx new file mode 100644 index 000000000000..651bdc240ef1 --- /dev/null +++ b/include/editeng/charhiddenitem.hxx @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_CHARHIDDENITEM_HXX +#define _SVX_CHARHIDDENITEM_HXX + +#include <svl/poolitem.hxx> +#include <svl/eitem.hxx> +#include "editeng/editengdllapi.h" + +// class SvxCharHiddenItem ------------------------------------------------- +/* [Description] + + This item marks text as hidden +*/ + +class EDITENG_DLLPUBLIC SvxCharHiddenItem : public SfxBoolItem +{ +public: + TYPEINFO(); + + SvxCharHiddenItem( const sal_Bool bHidden /*= sal_False*/, const sal_uInt16 nId ); + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + inline SvxCharHiddenItem& operator=(const SvxCharHiddenItem& rHidden) { + SetValue(rHidden.GetValue()); + return *this; + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/charreliefitem.hxx b/include/editeng/charreliefitem.hxx new file mode 100644 index 000000000000..5bc6c589d02d --- /dev/null +++ b/include/editeng/charreliefitem.hxx @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_CHARRELIEFITEM_HXX +#define _SVX_CHARRELIEFITEM_HXX + +#include <svl/eitem.hxx> +#include <vcl/fntstyle.hxx> +#include <editeng/editengdllapi.h> + +// class SvxCharRotateItem ---------------------------------------------- + +/* [Description] + + This item defines a character relief and has currently the values + emboss, relief. +*/ + +class EDITENG_DLLPUBLIC SvxCharReliefItem : public SfxEnumItem +{ +public: + TYPEINFO(); + + SvxCharReliefItem( FontRelief eValue /*= RELIEF_NONE*/, + const sal_uInt16 nId ); + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream & rStrm, sal_uInt16 nIVer) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; + + virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const; + virtual sal_uInt16 GetValueCount() const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, + const IntlWrapper * = 0 ) const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + inline SvxCharReliefItem& operator=( const SvxCharReliefItem& rItem ) + { + SetValue( rItem.GetValue() ); + return *this; + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/charrotateitem.hxx b/include/editeng/charrotateitem.hxx new file mode 100644 index 000000000000..7845ab69ccd8 --- /dev/null +++ b/include/editeng/charrotateitem.hxx @@ -0,0 +1,81 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_CHARROTATEITEM_HXX +#define _SVX_CHARROTATEITEM_HXX + +#include <svl/intitem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxCharRotateItem ---------------------------------------------- + +/* [Description] + + This item defines a character rotation value (0,1 degree). Currently + character can only be rotated 90,0 and 270,0 degrees. + The flag FitToLine defines only a UI-Information - + if true it must also create a SvxCharScaleItem. + +*/ + +class EDITENG_DLLPUBLIC SvxCharRotateItem : public SfxUInt16Item +{ + sal_Bool bFitToLine; +public: + TYPEINFO(); + + SvxCharRotateItem( sal_uInt16 nValue /*= 0*/, + sal_Bool bFitIntoLine /*= sal_False*/, + const sal_uInt16 nId ); + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream & rStrm, sal_uInt16 nIVer) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, + const IntlWrapper * = 0 ) const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + inline SvxCharRotateItem& operator=( const SvxCharRotateItem& rItem ) + { + SetValue( rItem.GetValue() ); + SetFitToLine( rItem.IsFitToLine() ); + return *this; + } + + virtual int operator==( const SfxPoolItem& ) const; + + // our currently only degree values + void SetTopToBotton() { SetValue( 2700 ); } + void SetBottomToTop() { SetValue( 900 ); } + sal_Bool IsTopToBotton() const { return 2700 == GetValue(); } + sal_Bool IsBottomToTop() const { return 900 == GetValue(); } + + sal_Bool IsFitToLine() const { return bFitToLine; } + void SetFitToLine( sal_Bool b ) { bFitToLine = b; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/charscaleitem.hxx b/include/editeng/charscaleitem.hxx new file mode 100644 index 000000000000..7d9b38761852 --- /dev/null +++ b/include/editeng/charscaleitem.hxx @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_CHARSCALEITEM_HXX +#define _SVX_CHARSCALEITEM_HXX + +#include <svl/intitem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxCharScaleItem ---------------------------------------------- + +/* [Description] + + This item defines a character scaling factor as percent value. + A value of 100 is identical to 100% and means normal width + A value of 50 is identical to 50% and means 1/2 width. + +*/ + +class EDITENG_DLLPUBLIC SvxCharScaleWidthItem : public SfxUInt16Item +{ +public: + TYPEINFO(); + + SvxCharScaleWidthItem( sal_uInt16 nValue /*= 100*/, + const sal_uInt16 nId ); + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, + const IntlWrapper * = 0 ) const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + inline SvxCharScaleWidthItem& operator=(const SvxCharScaleWidthItem& rItem ) + { + SetValue( rItem.GetValue() ); + return *this; + } + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/charsetcoloritem.hxx b/include/editeng/charsetcoloritem.hxx new file mode 100644 index 000000000000..6fc197fb1394 --- /dev/null +++ b/include/editeng/charsetcoloritem.hxx @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_CSCOITEM_HXX +#define _SVX_CSCOITEM_HXX + +#include <tools/string.hxx> +#include <editeng/colritem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxCharSetColorItem --------------------------------------------- + +/* [Description] + + Is only needed internally in the reader of Writer. +*/ + +class EDITENG_DLLPUBLIC SvxCharSetColorItem : public SvxColorItem +{ + rtl_TextEncoding eFrom; +public: + TYPEINFO(); + + explicit SvxCharSetColorItem( const sal_uInt16 nId ); + SvxCharSetColorItem( const Color& aColor, const rtl_TextEncoding eFrom, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + + inline rtl_TextEncoding& GetCharSet() { return eFrom; } + inline rtl_TextEncoding GetCharSet() const { return eFrom; } + + inline SvxCharSetColorItem& operator=(const SvxCharSetColorItem& rColor) + { + SetValue( rColor.GetValue() ); + eFrom = rColor.GetCharSet(); + return *this; + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/cmapitem.hxx b/include/editeng/cmapitem.hxx new file mode 100644 index 000000000000..f7326758befc --- /dev/null +++ b/include/editeng/cmapitem.hxx @@ -0,0 +1,76 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_CMAPITEM_HXX +#define _SVX_CMAPITEM_HXX + +#include <svl/eitem.hxx> +#include <editeng/svxenum.hxx> +#include <editeng/editengdllapi.h> + +class SvXMLUnitConverter; + +// class SvxCaseMapItem -------------------------------------------------- + +/* [Description] + + This item describe the font type (uppercase, small caps ,...). +*/ + +class EDITENG_DLLPUBLIC SvxCaseMapItem : public SfxEnumItem +{ +public: + TYPEINFO(); + + SvxCaseMapItem( const SvxCaseMap eMap /*= SVX_CASEMAP_NOT_MAPPED*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + SfxEnumItem + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const; + virtual sal_uInt16 GetValueCount() const; + + // MS VC4.0 kommt durcheinander + void SetValue( sal_uInt16 nNewVal ) + {SfxEnumItem::SetValue(nNewVal); } + + inline SvxCaseMapItem& operator=(const SvxCaseMapItem& rMap) + { + SetValue( rMap.GetValue() ); + return *this; + } + + // enum cast + SvxCaseMap GetCaseMap() const + { return (SvxCaseMap)GetValue(); } + void SetCaseMap( SvxCaseMap eNew ) + { SetValue( (sal_uInt16)eNew ); } + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/colritem.hxx b/include/editeng/colritem.hxx new file mode 100644 index 000000000000..954fcd3b6ba0 --- /dev/null +++ b/include/editeng/colritem.hxx @@ -0,0 +1,82 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_COLRITEM_HXX +#define _SVX_COLRITEM_HXX + +#include <svl/poolitem.hxx> +#include <tools/color.hxx> +#include <editeng/editengdllapi.h> + +class SvXMLUnitConverter; + +// class SvxColorItem ---------------------------------------------------- + +/* [Description] + + This item describes a color. +*/ + +#define VERSION_USEAUTOCOLOR 1 + +class EDITENG_DLLPUBLIC SvxColorItem : public SfxPoolItem +{ +private: + Color mColor; + +public: + TYPEINFO(); + + explicit SvxColorItem( const sal_uInt16 nId ); + SvxColorItem( const Color& aColor, const sal_uInt16 nId ); + SvxColorItem( SvStream& rStrm, const sal_uInt16 nId ); + SvxColorItem( const SvxColorItem& rCopy ); + ~SvxColorItem(); + + // "pure virtual Methods" from SfxPoolItem + virtual int operator==( const SfxPoolItem& ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + + inline SvxColorItem& operator=(const SvxColorItem& rColor) + { + SetValue( rColor.GetValue() ); + return *this; + } + + const Color& GetValue() const + { + return mColor; + } + void SetValue( const Color& rNewCol ); + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/contouritem.hxx b/include/editeng/contouritem.hxx new file mode 100644 index 000000000000..316f21fc774e --- /dev/null +++ b/include/editeng/contouritem.hxx @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __EDITENG_CONTOUR_ITEM_HXX__ +#define __EDITENG_CONTOUR_ITEM_HXX__ + +#include <svl/eitem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxContourItem -------------------------------------------------- + +/* [Description] + This item describes, if contour is employed. +*/ + +class EDITENG_DLLPUBLIC SvxContourItem : public SfxBoolItem +{ +public: + TYPEINFO(); + + SvxContourItem( const sal_Bool bContoured /*= sal_False*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + inline SvxContourItem& operator=(const SvxContourItem& rCont) + { + SetValue(rCont.GetValue()); + return *this; + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/crossedoutitem.hxx b/include/editeng/crossedoutitem.hxx new file mode 100644 index 000000000000..6628609e060e --- /dev/null +++ b/include/editeng/crossedoutitem.hxx @@ -0,0 +1,79 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_CRSDITEM_HXX +#define _SVX_CRSDITEM_HXX + +#include <vcl/vclenum.hxx> +#include <svl/eitem.hxx> +#include <editeng/editengdllapi.h> + +class SvXMLUnitConverter; + +// class SvxCrossedOutItem ----------------------------------------------- + +/* [Description] + This item describes, whether and how it is striked out. +*/ + +class EDITENG_DLLPUBLIC SvxCrossedOutItem : public SfxEnumItem +{ +public: + TYPEINFO(); + + SvxCrossedOutItem( const FontStrikeout eSt /*= STRIKEOUT_NONE*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const; + virtual sal_uInt16 GetValueCount() const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + // MS VC4.0 messes things up + void SetValue( sal_uInt16 nNewVal ) + {SfxEnumItem::SetValue(nNewVal); } + + virtual int HasBoolValue() const; + virtual sal_Bool GetBoolValue() const; + virtual void SetBoolValue( sal_Bool bVal ); + + inline SvxCrossedOutItem& operator=(const SvxCrossedOutItem& rCross) + { + SetValue( rCross.GetValue() ); + return *this; + } + + // enum cast + FontStrikeout GetStrikeout() const + { return (FontStrikeout)GetValue(); } + void SetStrikeout( FontStrikeout eNew ) + { SetValue( (sal_uInt16)eNew ); } +}; + +#endif // #ifndef _SVX_CRSDITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/editdata.hxx b/include/editeng/editdata.hxx new file mode 100644 index 000000000000..9b6d9e7005c3 --- /dev/null +++ b/include/editeng/editdata.hxx @@ -0,0 +1,368 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +// MyEDITDATA, wegen exportiertem EditData +#ifndef _MyEDITDATA_HXX +#define _MyEDITDATA_HXX + +#include <tools/string.hxx> +#include "editeng/editengdllapi.h" + +class SfxItemSet; +class SfxPoolItem; +class SvParser; +class SvxFieldItem; + +enum EETextFormat { EE_FORMAT_TEXT = 0x20, EE_FORMAT_RTF, EE_FORMAT_BIN = 0x31, EE_FORMAT_HTML, EE_FORMAT_XML }; +enum EEHorizontalTextDirection { EE_HTEXTDIR_DEFAULT, EE_HTEXTDIR_L2R, EE_HTEXTDIR_R2L }; +enum EESelectionMode { EE_SELMODE_STD, EE_SELMODE_TXTONLY, EE_SELMODE_HIDDEN }; + // EE_SELMODE_HIDDEN can be used to completely hide the selection. This is useful e.g. when you want show the selection + // only as long as your window (which the edit view works on) has the focus +enum EESpellState { EE_SPELL_OK, EE_SPELL_NOLANGUAGE, EE_SPELL_LANGUAGENOTINSTALLED, EE_SPELL_NOSPELLER, EE_SPELL_ERRORFOUND }; +enum EVAnchorMode { + ANCHOR_TOP_LEFT, ANCHOR_VCENTER_LEFT, ANCHOR_BOTTOM_LEFT, + ANCHOR_TOP_HCENTER, ANCHOR_VCENTER_HCENTER, ANCHOR_BOTTOM_HCENTER, + ANCHOR_TOP_RIGHT, ANCHOR_VCENTER_RIGHT, ANCHOR_BOTTOM_RIGHT }; + +#define EE_PARA_NOT_FOUND 0xFFFF +#define EE_PARA_APPEND 0xFFFF +#define EE_PARA_ALL 0xFFFF +#define EE_INDEX_NOT_FOUND 0xFFFF + +EDITENG_DLLPUBLIC extern const size_t EE_APPEND; + +// Error messages for Read / Write Method +#define EE_READWRITE_OK (SVSTREAM_OK) +#define EE_READWRITE_WRONGFORMAT (SVSTREAM_ERRBASE_USER+1) +#define EE_READWRITE_GENERALERROR (SVSTREAM_ERRBASE_USER+2) + +#define EDITUNDO_START 100 +#define EDITUNDO_REMOVECHARS 100 +#define EDITUNDO_CONNECTPARAS 101 +#define EDITUNDO_REMOVEFEATURE 102 +#define EDITUNDO_MOVEPARAGRAPHS 103 +#define EDITUNDO_INSERTFEATURE 104 +#define EDITUNDO_SPLITPARA 105 +#define EDITUNDO_INSERTCHARS 106 +#define EDITUNDO_DELCONTENT 107 +#define EDITUNDO_DELETE 108 +#define EDITUNDO_CUT 109 +#define EDITUNDO_PASTE 110 +#define EDITUNDO_INSERT 111 +#define EDITUNDO_SRCHANDREPL 112 +#define EDITUNDO_MOVEPARAS 113 +#define EDITUNDO_PARAATTRIBS 114 +#define EDITUNDO_ATTRIBS 115 +#define EDITUNDO_DRAGANDDROP 116 +#define EDITUNDO_READ 117 +#define EDITUNDO_STYLESHEET 118 +#define EDITUNDO_REPLACEALL 119 +#define EDITUNDO_STRETCH 120 +#define EDITUNDO_RESETATTRIBS 121 +#define EDITUNDO_INDENTBLOCK 122 +#define EDITUNDO_UNINDENTBLOCK 123 +#define EDITUNDO_MARKSELECTION 124 +#define EDITUNDO_TRANSLITERATE 125 +#define EDITUNDO_END 125 + +#define EDITUNDO_USER 200 + +class EditView; +class EditEngine; +class ImpEditView; +class ImpEditEngine; +class EditTextObject; +class SfxStyleSheet; + +#define RGCHK_NONE 0 // No correction of ViusArea when scrolling +#define RGCHK_NEG 1 // No negative ViusArea when scrolling +#define RGCHK_PAPERSZ1 2 // VisArea must be within paper width, Text Size + +struct EPosition +{ + sal_uInt16 nPara; + xub_StrLen nIndex; + + EPosition() : + nPara( EE_PARA_NOT_FOUND ), + nIndex( EE_INDEX_NOT_FOUND ) + { + } + + EPosition( sal_uInt16 nPara_, xub_StrLen nPos_ ) : + nPara( nPara_ ), + nIndex( nPos_ ) + { + } +}; + +struct ESelection +{ + sal_uInt16 nStartPara; + xub_StrLen nStartPos; + sal_uInt16 nEndPara; + xub_StrLen nEndPos; + + ESelection() : nStartPara( 0 ), nStartPos( 0 ), nEndPara( 0 ), nEndPos( 0 ) {} + + ESelection( sal_uInt16 nStPara, xub_StrLen nStPos, sal_uInt16 nEPara, xub_StrLen nEPos ) : + nStartPara( nStPara ), + nStartPos( nStPos ), + nEndPara( nEPara ), + nEndPos( nEPos ) + { + } + + ESelection( sal_uInt16 nPara, xub_StrLen nPos ) : + nStartPara( nPara ), + nStartPos( nPos ), + nEndPara( nPara ), + nEndPos( nPos ) + { + } + + void Adjust(); + sal_Bool IsEqual( const ESelection& rS ) const; + sal_Bool IsLess( const ESelection& rS ) const; + sal_Bool IsGreater( const ESelection& rS ) const; + sal_Bool IsZero() const; + sal_Bool HasRange() const; +}; + +inline sal_Bool ESelection::HasRange() const +{ + return ( nStartPara != nEndPara ) || ( nStartPos != nEndPos ); +} + +inline sal_Bool ESelection::IsZero() const +{ + return ( ( nStartPara == 0 ) && ( nStartPos == 0 ) && + ( nEndPara == 0 ) && ( nEndPos == 0 ) ); +} + +inline sal_Bool ESelection::IsEqual( const ESelection& rS ) const +{ + return ( ( nStartPara == rS.nStartPara ) && ( nStartPos == rS.nStartPos ) && + ( nEndPara == rS.nEndPara ) && ( nEndPos == rS.nEndPos ) ); +} + +inline sal_Bool ESelection::IsLess( const ESelection& rS ) const +{ + // The selection must be adjusted. + // => Only check if end of 'this' < Start of rS + + if ( ( nEndPara < rS.nStartPara ) || + ( ( nEndPara == rS.nStartPara ) && ( nEndPos < rS.nStartPos ) && !IsEqual( rS ) ) ) + { + return sal_True; + } + return sal_False; +} + +inline sal_Bool ESelection::IsGreater( const ESelection& rS ) const +{ + // The selection must be adjusted. + // => Only check if end of 'this' < Start of rS + + if ( ( nStartPara > rS.nEndPara ) || + ( ( nStartPara == rS.nEndPara ) && ( nStartPos > rS.nEndPos ) && !IsEqual( rS ) ) ) + { + return sal_True; + } + return sal_False; +} + +inline void ESelection::Adjust() +{ + sal_Bool bSwap = sal_False; + if ( nStartPara > nEndPara ) + bSwap = sal_True; + else if ( ( nStartPara == nEndPara ) && ( nStartPos > nEndPos ) ) + bSwap = sal_True; + + if ( bSwap ) + { + sal_uInt16 nSPar = nStartPara; sal_uInt16 nSPos = nStartPos; + nStartPara = nEndPara; nStartPos = nEndPos; + nEndPara = nSPar; nEndPos = nSPos; + } +} + +struct EDITENG_DLLPUBLIC EFieldInfo +{ + SvxFieldItem* pFieldItem; + String aCurrentText; + EPosition aPosition; + + EFieldInfo(); + EFieldInfo( const SvxFieldItem& rFieldItem, sal_uInt16 nPara, sal_uInt16 nPos ); + ~EFieldInfo(); + + EFieldInfo( const EFieldInfo& ); + EFieldInfo& operator= ( const EFieldInfo& ); +}; + +// ----------------------------------------------------------------------- + +enum ImportState { + RTFIMP_START, RTFIMP_END, // only pParser, nPara, nIndex + RTFIMP_NEXTTOKEN, RTFIMP_UNKNOWNATTR, // nToken+nTokenValue + RTFIMP_SETATTR, // pAttrs + RTFIMP_INSERTTEXT, // aText + RTFIMP_INSERTPARA, // - + HTMLIMP_START, HTMLIMP_END, // only pParser, nPara, nIndex + HTMLIMP_NEXTTOKEN, HTMLIMP_UNKNOWNATTR, // nToken + HTMLIMP_SETATTR, // pAttrs + HTMLIMP_INSERTTEXT, // aText + HTMLIMP_INSERTPARA, HTMLIMP_INSERTFIELD // - + }; + +struct ImportInfo +{ + SvParser* pParser; + ESelection aSelection; + ImportState eState; + + int nToken; + short nTokenValue; + + String aText; + + void* pAttrs; // RTF: SvxRTFItemStackType*, HTML: SfxItemSet* + + ImportInfo( ImportState eState, SvParser* pPrsrs, const ESelection& rSel ); + ~ImportInfo(); +}; + +struct ParagraphInfos +{ + ParagraphInfos() + : nParaHeight( 0 ) + , nLines( 0 ) + , nFirstLineStartX( 0 ) + , nFirstLineOffset( 0 ) + , nFirstLineHeight( 0 ) + , nFirstLineTextHeight ( 0 ) + , nFirstLineMaxAscent( 0 ) + , bValid( 0 ) + {} + sal_uInt16 nParaHeight; + sal_uInt16 nLines; + + sal_uInt16 nFirstLineStartX; + + sal_uInt16 nFirstLineOffset; + sal_uInt16 nFirstLineHeight; + sal_uInt16 nFirstLineTextHeight; + sal_uInt16 nFirstLineMaxAscent; + + sal_Bool bValid; // A query during formatting is not valid! +}; + +struct EECharAttrib +{ + const SfxPoolItem* pAttr; + + sal_uInt16 nPara; + xub_StrLen nStart; + xub_StrLen nEnd; +}; + +struct MoveParagraphsInfo +{ + sal_uInt16 nStartPara; + sal_uInt16 nEndPara; + sal_uInt16 nDestPara; + + MoveParagraphsInfo( sal_uInt16 nS, sal_uInt16 nE, sal_uInt16 nD ) + { nStartPara = nS; nEndPara = nE; nDestPara = nD; } +}; + +#define EE_ACTION_PASTE 1 +#define EE_ACTION_DROP 2 + +struct PasteOrDropInfos +{ + sal_uInt16 nAction; + sal_uInt16 nStartPara; + sal_uInt16 nEndPara; + + PasteOrDropInfos() : nAction(0), nStartPara(0xFFFF), nEndPara(0xFFFF) {} +}; + +enum EENotifyType +{ + /// EditEngine text was modified + EE_NOTIFY_TEXTMODIFIED, + + /// A paragraph was inserted into the EditEngine + EE_NOTIFY_PARAGRAPHINSERTED, + + /// A paragraph was removed from the EditEngine + EE_NOTIFY_PARAGRAPHREMOVED, + + /// Multiple paragraphs have been removed from the EditEngine + EE_NOTIFY_PARAGRAPHSMOVED, + + /// The height of at least one paragraph has changed + EE_NOTIFY_TEXTHEIGHTCHANGED, + + /// The view area of the EditEngine scrolled + EE_NOTIFY_TEXTVIEWSCROLLED, + + /// The selection and/or the cursor position has changed + EE_NOTIFY_TEXTVIEWSELECTIONCHANGED, + + /** Denotes the beginning of a collected amount of EditEngine + notification events. This event itself is not queued, but sent + immediately + */ + EE_NOTIFY_BLOCKNOTIFICATION_START, + + /** Denotes the end of a collected amount of EditEngine + notification events. After this event, the queue is empty, and + a high-level operation such as "insert paragraph" is finished + */ + EE_NOTIFY_BLOCKNOTIFICATION_END, + + /// Denotes the beginning of a high-level action triggered by a key press + EE_NOTIFY_INPUT_START, + + /// Denotes the end of a high-level action triggered by a key press + EE_NOTIFY_INPUT_END +}; + +struct EENotify +{ + EENotifyType eNotificationType; + EditEngine* pEditEngine; + EditView* pEditView; + + sal_uInt16 nParagraph; // only valid in PARAGRAPHINSERTED/EE_NOTIFY_PARAGRAPHREMOVED + + sal_uInt16 nParam1; + sal_uInt16 nParam2; + + EENotify( EENotifyType eType ) + { eNotificationType = eType; pEditEngine = NULL; pEditView = NULL; nParagraph = EE_PARA_NOT_FOUND; nParam1 = 0; nParam2 = 0; } +}; + +#endif // _MyEDITDATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx new file mode 100644 index 000000000000..83ba64342443 --- /dev/null +++ b/include/editeng/editeng.hxx @@ -0,0 +1,586 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +// MyEDITENG, due to exported EditEng +#ifndef _MyEDITENG_HXX +#define _MyEDITENG_HXX + +#include <rtl/ref.hxx> +#include <vector> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/i18n/WordType.hpp> +#include <com/sun/star/i18n/CharacterIteratorMode.hpp> + +#include <rsc/rscsfx.hxx> +#include <editeng/editdata.hxx> +#include <i18nlangtag/lang.h> +#include "editeng/editengdllapi.h" + +#include <tools/rtti.hxx> // due to typedef TypeId + +#include <editeng/eedata.hxx> + +namespace com { namespace sun { namespace star { + namespace linguistic2 { + class XSpellChecker1; + class XHyphenator; + } + namespace datatransfer { + class XTransferable; + } + namespace lang { + struct Locale; + } +}}} + +namespace svx { +struct SpellPortion; +typedef std::vector<SpellPortion> SpellPortions; +} + +namespace svl { class IUndoManager; } +namespace basegfx { class B2DPolyPolygon; } + +class ImpEditEngine; +class EditView; +class OutputDevice; +class EditUndo; +class SvxFont; +class SfxItemPool; +class SfxStyleSheet; +class String; +class SfxStyleSheetPool; +class SvxSearchItem; +class SvxFieldItem; +class SvxCharSetColorItem; +class SfxUndoAction; +class MapMode; +class Color; +class Font; +class KeyEvent; +class PolyPolygon; +class Size; +class Point; +class Rectangle; +class SvStream; +class Link; +class OutputDevice; +class Window; +class SfxPoolItem; +class SvxNumBulletItem; +class SvxBulletItem; +class SvxLRSpaceItem; +class SvKeyValueIterator; +class SvxForbiddenCharactersTable; +class SvxNumberFormat; +class FontList; +class SvxFieldData; +class ContentNode; +class ParaPortion; +class EditSelection; +class EditPaM; +class EditLine; +class InternalEditStatus; +class EditSelectionEngine; +class EditDoc; +struct PasteOrDropInfos; +class Range; +struct EPaM; +class DeletedNodeInfo; +class ParaPortionList; + +////////////////////////////////////////////////////////////////////////////// + +/** values for GetAttribs +*/ +const sal_uInt8 EditEngineAttribs_All = 0; /// returns all attributes even when theire not set +const sal_uInt8 EditEngineAttribs_HardAndPara = 1; /// returns all attributes set on paragraph and on portions +const sal_uInt8 EditEngineAttribs_OnlyHard = 2; /// returns only attributes hard set on portions + +#define GETATTRIBS_STYLESHEET (sal_uInt8)0x01 +#define GETATTRIBS_PARAATTRIBS (sal_uInt8)0x02 +#define GETATTRIBS_CHARATTRIBS (sal_uInt8)0x04 +#define GETATTRIBS_ALL (sal_uInt8)0xFF + +class EDITENG_DLLPUBLIC EditEngine +{ + friend class EditView; + friend class ImpEditView; + friend class EditDbg; + friend class Outliner; + +public: + typedef std::vector<EditView*> ViewsType; + +private: + ImpEditEngine* pImpEditEngine; + + EDITENG_DLLPRIVATE EditEngine( const EditEngine& ); + EDITENG_DLLPRIVATE EditEngine& operator=( const EditEngine& ); + EDITENG_DLLPRIVATE sal_uInt8 PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pView, Window* pFrameWin = NULL ); + + EDITENG_DLLPRIVATE void CursorMoved(ContentNode* pPrevNode); + EDITENG_DLLPRIVATE void CheckIdleFormatter(); + EDITENG_DLLPRIVATE bool IsIdleFormatterActive() const; + EDITENG_DLLPRIVATE ParaPortion* FindParaPortion(ContentNode* pNode); + EDITENG_DLLPRIVATE const ParaPortion* FindParaPortion(ContentNode* pNode) const; + EDITENG_DLLPRIVATE const ParaPortion* GetPrevVisPortion(const ParaPortion* pCurPortion) const; + + EDITENG_DLLPRIVATE com::sun::star::uno::Reference< + com::sun::star::datatransfer::XTransferable> + CreateTransferable(const EditSelection& rSelection); + + EDITENG_DLLPRIVATE EditSelection InsertText( + com::sun::star::uno::Reference<com::sun::star::datatransfer::XTransferable >& rxDataObj, + const String& rBaseURL, const EditPaM& rPaM, bool bUseSpecial); + + EDITENG_DLLPRIVATE EditPaM EndOfWord( + const EditPaM& rPaM, sal_Int16 nWordType = com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES); + + EDITENG_DLLPRIVATE EditPaM GetPaM(const Point& aDocPos, bool bSmart = true); + + EDITENG_DLLPRIVATE EditSelection SelectWord( + const EditSelection& rCurSelection, + sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES, + bool bAcceptStartOfWord = true); + + EDITENG_DLLPRIVATE long GetXPos( + const ParaPortion* pParaPortion, const EditLine* pLine, sal_uInt16 nIndex, bool bPreferPortionStart = false) const; + + EDITENG_DLLPRIVATE Range GetLineXPosStartEnd( + const ParaPortion* pParaPortion, const EditLine* pLine) const; + + EDITENG_DLLPRIVATE sal_uInt16 GetOnePixelInRef() const; + EDITENG_DLLPRIVATE InternalEditStatus& GetInternalEditStatus(); + + EDITENG_DLLPRIVATE void HandleBeginPasteOrDrop(PasteOrDropInfos& rInfos); + EDITENG_DLLPRIVATE void HandleEndPasteOrDrop(PasteOrDropInfos& rInfos); + EDITENG_DLLPRIVATE bool HasText() const; + EDITENG_DLLPRIVATE const EditSelectionEngine& GetSelectionEngine() const; + EDITENG_DLLPRIVATE void SetInSelectionMode(bool b); + +protected: + + +public: + EditEngine( SfxItemPool* pItemPool ); + virtual ~EditEngine(); + + const SfxItemSet& GetEmptyItemSet(); + + void SetDefTab( sal_uInt16 nDefTab ); + + void SetRefDevice( OutputDevice* pRefDef ); + OutputDevice* GetRefDevice() const; + + void SetRefMapMode( const MapMode& rMapMode ); + MapMode GetRefMapMode(); + + void SetUpdateMode( sal_Bool bUpdate ); + sal_Bool GetUpdateMode() const; + + void SetBackgroundColor( const Color& rColor ); + Color GetBackgroundColor() const; + Color GetAutoColor() const; + void EnableAutoColor( sal_Bool b ); + void ForceAutoColor( sal_Bool b ); + sal_Bool IsForceAutoColor() const; + + void InsertView(EditView* pEditView, size_t nIndex = EE_APPEND); + EditView* RemoveView( EditView* pEditView ); + EditView* RemoveView(size_t nIndex = EE_APPEND); + EditView* GetView(size_t nIndex = 0) const; + size_t GetViewCount() const; + sal_Bool HasView( EditView* pView ) const; + EditView* GetActiveView() const; + void SetActiveView(EditView* pView); + + void SetPaperSize( const Size& rSize ); + const Size& GetPaperSize() const; + + void SetVertical( bool bVertical ); + bool IsVertical() const; + + void SetFixedCellHeight( sal_Bool bUseFixedCellHeight ); + + void SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir ); + EEHorizontalTextDirection GetDefaultHorizontalTextDirection() const; + + sal_uInt16 GetScriptType( const ESelection& rSelection ) const; + LanguageType GetLanguage(const EditPaM& rPaM) const; + LanguageType GetLanguage( sal_uInt16 nPara, sal_uInt16 nPos ) const; + + void TransliterateText( const ESelection& rSelection, sal_Int32 nTransliterationMode ); + EditSelection TransliterateText( const EditSelection& rSelection, sal_Int32 nTransliterationMode ); + + void SetAsianCompressionMode( sal_uInt16 nCompression ); + + void SetKernAsianPunctuation( sal_Bool bEnabled ); + + void SetAddExtLeading( sal_Bool b ); + + void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon ); + void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon); + void ClearPolygon(); + + const Size& GetMinAutoPaperSize() const; + void SetMinAutoPaperSize( const Size& rSz ); + + const Size& GetMaxAutoPaperSize() const; + void SetMaxAutoPaperSize( const Size& rSz ); + + OUString GetText( LineEnd eEnd = LINEEND_LF ) const; + String GetText( const ESelection& rSelection, const LineEnd eEnd = LINEEND_LF ) const; + sal_uInt32 GetTextLen() const; + sal_uInt32 GetTextHeight() const; + sal_uInt32 GetTextHeightNTP() const; + sal_uInt32 CalcTextWidth(); + + String GetText( sal_uInt16 nParagraph ) const; + xub_StrLen GetTextLen( sal_uInt16 nParagraph ) const; + sal_uInt32 GetTextHeight( sal_uInt16 nParagraph ) const; + + sal_uInt16 GetParagraphCount() const; + + sal_uInt16 GetLineCount( sal_uInt16 nParagraph ) const; + xub_StrLen GetLineLen( sal_uInt16 nParagraph, sal_uInt16 nLine ) const; + void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const; + sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const; + sal_uInt32 GetLineHeight( sal_uInt16 nParagraph, sal_uInt16 nLine = 0 ); + ParagraphInfos GetParagraphInfos( sal_uInt16 nPara ); + sal_uInt16 FindParagraph( long nDocPosY ); + EPosition FindDocPosition( const Point& rDocPos ) const; + Rectangle GetCharacterBounds( const EPosition& rPos ) const; + + String GetWord( sal_uInt16 nPara, xub_StrLen nIndex ); + + ESelection GetWord( const ESelection& rSelection, sal_uInt16 nWordType ) const; + + void Clear(); + void SetText( const OUString& rStr ); + + EditTextObject* CreateTextObject(); + EditTextObject* CreateTextObject( sal_uInt16 nPara, sal_uInt16 nParas = 1 ); + EditTextObject* CreateTextObject( const ESelection& rESelection ); + void SetText( const EditTextObject& rTextObject ); + + void RemoveParagraph( sal_uInt16 nPara ); + void InsertParagraph( sal_uInt16 nPara, const EditTextObject& rTxtObj ); + void InsertParagraph( sal_uInt16 nPara, const String& rText); + + void SetText( sal_uInt16 nPara, const String& rText); + + virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ); + virtual const SfxItemSet& GetParaAttribs( sal_uInt16 nPara ) const; + + void GetCharAttribs( sal_uInt16 nPara, std::vector<EECharAttrib>& rLst ) const; + + SfxItemSet GetAttribs( sal_uInt16 nPara, sal_uInt16 nStart, sal_uInt16 nEnd, sal_uInt8 nFlags = 0xFF ) const; + SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = EditEngineAttribs_All ); + + sal_Bool HasParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ) const; + const SfxPoolItem& GetParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ); + + Font GetStandardFont( sal_uInt16 nPara ); + SvxFont GetStandardSvxFont( sal_uInt16 nPara ); + + void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ); + + void ShowParagraph( sal_uInt16 nParagraph, sal_Bool bShow = sal_True ); + + ::svl::IUndoManager& + GetUndoManager(); + void UndoActionStart( sal_uInt16 nId ); + void UndoActionStart(sal_uInt16 nId, const ESelection& rSel); + void UndoActionEnd( sal_uInt16 nId ); + sal_Bool IsInUndo(); + + void EnableUndo( sal_Bool bEnable ); + sal_Bool IsUndoEnabled(); + + /** returns the value last used for bTryMerge while calling ImpEditEngine::InsertUndo + This is currently used in a bad but needed hack to get undo actions merged in the + OutlineView in impress. Do not use it unless you want to sell your soul too! */ + bool HasTriedMergeOnLastAddUndo() const; + + void ClearModifyFlag(); + void SetModified(); + sal_Bool IsModified() const; + + void SetModifyHdl( const Link& rLink ); + Link GetModifyHdl() const; + + sal_Bool IsInSelectionMode() const; + + void StripPortions(); + void GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ); + + long GetFirstLineStartX( sal_uInt16 nParagraph ); + Point GetDocPosTopLeft( sal_uInt16 nParagraph ); + Point GetDocPos( const Point& rPaperPos ) const; + sal_Bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder = 0 ); + + // StartDocPos corrresponds to VisArea.TopLeft(). + void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect ); + void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect, const Point& rStartDocPos ); + void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect, const Point& rStartDocPos, sal_Bool bClip ); + void Draw( OutputDevice* pOutDev, const Point& rStartPos, short nOrientation = 0 ); + +// sal_uInt32: Error code of the stream. + sal_uLong Read( SvStream& rInput, const String& rBaseURL, EETextFormat, SvKeyValueIterator* pHTTPHeaderAttrs = NULL ); + sal_uLong Write( SvStream& rOutput, EETextFormat ); + + void SetStatusEventHdl( const Link& rLink ); + Link GetStatusEventHdl() const; + + void SetNotifyHdl( const Link& rLink ); + Link GetNotifyHdl() const; + + void SetImportHdl( const Link& rLink ); + Link GetImportHdl() const; + + // Do not evaluate font formatting => For Outliner + sal_Bool IsFlatMode() const; + void SetFlatMode( sal_Bool bFlat ); + + void SetControlWord( sal_uInt32 nWord ); + sal_uInt32 GetControlWord() const; + + void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ); + void QuickRemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich = 0 ); + void QuickMarkInvalid( const ESelection& rSel ); + void QuickFormatDoc( sal_Bool bFull = sal_False ); + void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ); + void QuickInsertLineBreak( const ESelection& rSel ); + void QuickInsertText( const String& rText, const ESelection& rSel ); + void QuickDelete( const ESelection& rSel ); + void QuickMarkToBeRepainted( sal_uInt16 nPara ); + + void SetGlobalCharStretching( sal_uInt16 nX = 100, sal_uInt16 nY = 100 ); + void GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ) const; + + void SetEditTextObjectPool( SfxItemPool* pPool ); + SfxItemPool* GetEditTextObjectPool() const; + + void SetStyleSheetPool( SfxStyleSheetPool* pSPool ); + SfxStyleSheetPool* GetStyleSheetPool(); + + void SetStyleSheet(const EditSelection& aSel, SfxStyleSheet* pStyle); + void SetStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pStyle ); + const SfxStyleSheet* GetStyleSheet( sal_uInt16 nPara ) const; + SfxStyleSheet* GetStyleSheet( sal_uInt16 nPara ); + + void SetWordDelimiters( const String& rDelimiters ); + String GetWordDelimiters() const; + + void EraseVirtualDevice(); + + void SetSpeller( ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XSpellChecker1 > &xSpeller ); + ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XSpellChecker1 > + GetSpeller(); + void SetHyphenator( ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XHyphenator >& xHyph ); + + void SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars ); + + void SetDefaultLanguage( LanguageType eLang ); + LanguageType GetDefaultLanguage() const; + + sal_Bool HasOnlineSpellErrors() const; + void CompleteOnlineSpelling(); + + sal_Bool ShouldCreateBigTextObject() const; + + // For fast Pre-Test without view: + EESpellState HasSpellErrors(); + sal_Bool HasText( const SvxSearchItem& rSearchItem ); + + //initialize sentence spelling + void StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc); + //spell and return a sentence + bool SpellSentence(EditView& rEditView, ::svx::SpellPortions& rToFill, bool bIsGrammarChecking ); + // put spell position to start of current sentence + void PutSpellingToSentenceStart( EditView& rEditView ); + //applies a changed sentence + void ApplyChangedSentence(EditView& rEditView, const ::svx::SpellPortions& rNewPortions, bool bRecheck ); + + // for text conversion (see also HasSpellErrors) + sal_Bool HasConvertibleTextPortion( LanguageType nLang ); + virtual sal_Bool ConvertNextDocument(); + + bool UpdateFields(); + bool UpdateFieldsOnly(); + void RemoveFields( sal_Bool bKeepFieldText, TypeId aType = NULL ); + + sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const; + EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const; + + sal_Bool IsRightToLeft( sal_uInt16 nPara ) const; + + ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > + CreateTransferable( const ESelection& rSelection ) const; + + // MT: Can't create new virtual functions like for ParagraphInserted/Deleted, musst be compatible in SRC638, change later... + void SetBeginMovingParagraphsHdl( const Link& rLink ); + void SetEndMovingParagraphsHdl( const Link& rLink ); + void SetBeginPasteOrDropHdl( const Link& rLink ); + void SetEndPasteOrDropHdl( const Link& rLink ); + + virtual void PaintingFirstLine( sal_uInt16 nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev ); + virtual void ParagraphInserted( sal_uInt16 nNewParagraph ); + virtual void ParagraphDeleted( sal_uInt16 nDeletedParagraph ); + virtual void ParagraphConnected( sal_uInt16 nLeftParagraph, sal_uInt16 nRightParagraph ); + virtual void ParaAttribsChanged( sal_uInt16 nParagraph ); + virtual void StyleSheetChanged( SfxStyleSheet* pStyle ); + virtual void ParagraphHeightChanged( sal_uInt16 nPara ); + + virtual void DrawingText( + const Point& rStartPos, const String& rText, sal_uInt16 nTextStart, sal_uInt16 nTextLen, const sal_Int32* pDXArray, + const SvxFont& rFont, sal_uInt16 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft, + const EEngineData::WrongSpellVector* pWrongSpellVector, + const SvxFieldData* pFieldData, + bool bEndOfLine, + bool bEndOfParagraph, + bool bEndOfBullet, + const ::com::sun::star::lang::Locale* pLocale, + const Color& rOverlineColor, + const Color& rTextLineColor); + + virtual void DrawingTab( + const Point& rStartPos, long nWidth, const String& rChar, + const SvxFont& rFont, sal_uInt16 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft, + bool bEndOfLine, + bool bEndOfParagraph, + const Color& rOverlineColor, + const Color& rTextLineColor); + virtual String GetUndoComment( sal_uInt16 nUndoId ) const; + virtual sal_Bool FormattingParagraph( sal_uInt16 nPara ); + virtual sal_Bool SpellNextDocument(); + virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos ); + virtual void FieldSelected( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos ); + virtual String CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos, Color*& rTxtColor, Color*& rFldColor ); + + // to be overloaded if access to bullet information needs to be provided + virtual const SvxNumberFormat * GetNumberFormat( sal_uInt16 nPara ) const; + + virtual Rectangle GetBulletArea( sal_uInt16 nPara ); + + static SfxItemPool* CreatePool( sal_Bool bLoadRefCounts = sal_True ); + static SfxItemPool& GetGlobalItemPool(); + static sal_Bool DoesKeyChangeText( const KeyEvent& rKeyEvent ); + static sal_Bool DoesKeyMoveCursor( const KeyEvent& rKeyEvent ); + static sal_Bool IsSimpleCharInput( const KeyEvent& rKeyEvent ); + static void SetFontInfoInItemSet( SfxItemSet& rItemSet, const Font& rFont ); + static void SetFontInfoInItemSet( SfxItemSet& rItemSet, const SvxFont& rFont ); + static Font CreateFontFromItemSet( const SfxItemSet& rItemSet, sal_uInt16 nScriptType ); + static SvxFont CreateSvxFontFromItemSet( const SfxItemSet& rItemSet ); + static sal_Bool IsPrintable( sal_Unicode c ) { return ( ( c >= 32 ) && ( c != 127 ) ); } + static sal_Bool HasValidData( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rTransferable ); + + /** sets a link that is called at the beginning of a drag operation at an edit view */ + void SetBeginDropHdl( const Link& rLink ); + Link GetBeginDropHdl() const; + + /** sets a link that is called at the end of a drag operation at an edit view */ + void SetEndDropHdl( const Link& rLink ); + Link GetEndDropHdl() const; + + /// specifies if auto-correction should capitalize the first word or not (default is on) + void SetFirstWordCapitalization( sal_Bool bCapitalize ); + + EditDoc& GetEditDoc(); + const EditDoc& GetEditDoc() const; + + ParaPortionList& GetParaPortions(); + const ParaPortionList& GetParaPortions() const; + + bool IsFormatted() const; + bool IsImportHandlerSet() const; + bool IsImportRTFStyleSheetsSet() const; + + void CallImportHandler(ImportInfo& rInfo); + + void ParaAttribsToCharAttribs(ContentNode* pNode); + + EditPaM CreateEditPaM(const EPaM& rEPaM); + EditPaM ConnectParagraphs( + ContentNode* pLeft, ContentNode* pRight, bool bBackward = false); + + EditPaM InsertField(const EditSelection& rEditSelection, const SvxFieldItem& rFld); + EditPaM InsertText(const EditSelection& aCurEditSelection, const String& rStr); + EditSelection InsertText(const EditTextObject& rTextObject, const EditSelection& rSel); + EditPaM InsertParaBreak( + const EditSelection& rEditSelection, bool bKeepEndingAttribs = true); + EditPaM InsertLineBreak(const EditSelection& rEditSelection); + + EditPaM CursorLeft( + const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode = com::sun::star::i18n::CharacterIteratorMode::SKIPCELL); + EditPaM CursorRight( + const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode = com::sun::star::i18n::CharacterIteratorMode::SKIPCELL); + + void SeekCursor( + ContentNode* pNode, sal_uInt16 nPos, SvxFont& rFont, OutputDevice* pOut = NULL, sal_uInt16 nIgnoreWhich = 0); + + EditPaM DeleteSelection(const EditSelection& rSel); + + ESelection CreateESelection(const EditSelection& rSel); + EditSelection CreateSelection(const ESelection& rSel); + + const SfxItemSet& GetBaseParaAttribs(sal_uInt16 nPara) const; + void SetParaAttribsOnly(sal_uInt16 nPara, const SfxItemSet& rSet); + void SetAttribs(const EditSelection& rSel, const SfxItemSet& rSet, sal_uInt8 nSpecial = 0); + + String GetSelected(const EditSelection& rSel, const LineEnd eParaSep = LINEEND_LF) const; + EditPaM DeleteSelected(const EditSelection& rSel); + + sal_uInt16 GetScriptType(const EditSelection& rSel) const; + + void RemoveParaPortion(size_t nNode); + + void SetCallParaInsertedOrDeleted(bool b); + bool IsCallParaInsertedOrDeleted() const; + + void AppendDeletedNodeInfo(DeletedNodeInfo* pInfo); + void UpdateSelections(); + + void InsertContent(ContentNode* pNode, sal_uInt16 nPos); + EditPaM SplitContent(sal_uInt16 nNode, sal_uInt16 nSepPos); + EditPaM ConnectContents(sal_uInt16 nLeftNode, bool bBackward); + + EditPaM InsertFeature(const EditSelection& rEditSelection, const SfxPoolItem& rItem); + + EditSelection MoveParagraphs(const Range& rParagraphs, sal_uInt16 nNewPos, EditView* pCurView); + + void RemoveCharAttribs(sal_uInt16 nPara, sal_uInt16 nWhich = 0, bool bRemoveFeatures = false); + void RemoveCharAttribs(const EditSelection& rSel, bool bRemoveParaAttribs, sal_uInt16 nWhich = 0); + + ViewsType& GetEditViews(); + const ViewsType& GetEditViews() const; + + void SetUndoMode(bool b); + void FormatAndUpdate(EditView* pCurView = NULL); + + bool Undo(EditView* pView); + bool Redo(EditView* pView); +}; + +#endif // _MyEDITENG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/editengdllapi.h b/include/editeng/editengdllapi.h new file mode 100644 index 000000000000..ce764e81fece --- /dev/null +++ b/include/editeng/editengdllapi.h @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_EDITENGDLLAPI_H +#define INCLUDED_EDITENGDLLAPI_H + +#include "sal/types.h" + +#if defined(EDITENG_DLLIMPLEMENTATION) +#define EDITENG_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define EDITENG_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif +#define EDITENG_DLLPRIVATE SAL_DLLPRIVATE + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/editerr.hxx b/include/editeng/editerr.hxx new file mode 100644 index 000000000000..d262057763e7 --- /dev/null +++ b/include/editeng/editerr.hxx @@ -0,0 +1,30 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _EDIT_ERR_HRC +#define _EDIT_ERR_HRC + +#include <tools/errcode.hxx> + +#define ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS (2UL | ERRCODE_AREA_SVX) + +#define ERRCODE_SVX_GRAPHIC_WRONG_FILEFORMAT (8UL | ERRCODE_AREA_SVX | \ + ERRCODE_CLASS_READ ) +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/editids.hrc b/include/editeng/editids.hrc new file mode 100644 index 000000000000..7dbaae890a51 --- /dev/null +++ b/include/editeng/editids.hrc @@ -0,0 +1,236 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _EDIT_SVXIDS_HRC +#define _EDIT_SVXIDS_HRC + +#include <svl/solar.hrc> + +#define SID_ATTR_BRUSH ( SID_SVX_START + 1 ) +#define SID_ATTR_TABSTOP ( SID_SVX_START + 2 ) +#define SID_ATTR_TABSTOP_DEFAULTS ( SID_SVX_START + 3 ) +#define SID_ATTR_TABSTOP_POS ( SID_SVX_START + 4 ) +#define SID_ATTR_TABSTOP_OFFSET ( SID_SVX_START + 5 ) +#define SID_ATTR_CHAR ( SID_SVX_START + 6 ) +#define SID_ATTR_CHAR_FONT ( SID_SVX_START + 7 ) +#define SID_ATTR_CHAR_POSTURE ( SID_SVX_START + 8 ) +#define SID_ATTR_CHAR_WEIGHT ( SID_SVX_START + 9 ) +#define SID_ATTR_CHAR_SHADOWED ( SID_SVX_START + 10 ) +#define SID_ATTR_CHAR_WORDLINEMODE ( SID_SVX_START + 11 ) +#define SID_ATTR_CHAR_CONTOUR ( SID_SVX_START + 12 ) +#define SID_ATTR_CHAR_STRIKEOUT ( SID_SVX_START + 13 ) +#define SID_ATTR_CHAR_UNDERLINE ( SID_SVX_START + 14 ) +#define SID_ATTR_CHAR_FONTHEIGHT ( SID_SVX_START + 15 ) +#define SID_ATTR_CHAR_PROPSIZE ( SID_SVX_START + 16 ) +#define SID_ATTR_CHAR_COLOR ( SID_SVX_START + 17 ) +#define SID_ATTR_CHAR_KERNING ( SID_SVX_START + 18 ) +#define SID_ATTR_CHAR_CASEMAP ( SID_SVX_START + 19 ) +#define SID_ATTR_CHAR_LANGUAGE ( SID_SVX_START + 20 ) +#define SID_ATTR_CHAR_ESCAPEMENT ( SID_SVX_START + 21 ) +#define SID_ATTR_CHAR_FONTLIST ( SID_SVX_START + 22 ) +#define SID_ATTR_BORDER_OUTER ( SID_SVX_START + 24 ) +#define SID_ATTR_BORDER_SHADOW ( SID_SVX_START + 25 ) +#define SID_ATTR_PARA ( SID_SVX_START + 26 ) +#define SID_ATTR_PARA_ADJUST ( SID_SVX_START + 27 ) +#define SID_ATTR_PARA_ADJUST_LEFT ( SID_SVX_START + 28 ) +#define SID_ATTR_PARA_ADJUST_RIGHT ( SID_SVX_START + 29 ) +#define SID_ATTR_PARA_ADJUST_CENTER ( SID_SVX_START + 30 ) +#define SID_ATTR_PARA_ADJUST_BLOCK ( SID_SVX_START + 31 ) +#define SID_ATTR_PARA_ADJUST_BLOCKLINE ( SID_SVX_START + 32 ) +#define SID_ATTR_PARA_LINESPACE ( SID_SVX_START + 33 ) +#define SID_ATTR_PARA_LINESPACE_10 ( SID_SVX_START + 34 ) +#define SID_ATTR_PARA_LINESPACE_15 ( SID_SVX_START + 35 ) +#define SID_ATTR_PARA_LINESPACE_20 ( SID_SVX_START + 36 ) +#define SID_ATTR_PARA_PAGEBREAK ( SID_SVX_START + 37 ) +#define SID_ATTR_PARA_HYPHENZONE ( SID_SVX_START + 38 ) +#define SID_ATTR_PARA_SPLIT ( SID_SVX_START + 39 ) +#define SID_ATTR_PARA_ORPHANS ( SID_SVX_START + 40 ) +#define SID_ATTR_PARA_WIDOWS ( SID_SVX_START + 41 ) +#define SID_ATTR_PARA_ULSPACE ( SID_SVX_START + 42 ) +#define SID_ATTR_PARA_LRSPACE ( SID_SVX_START + 43 ) +#define SID_ATTR_LRSPACE ( SID_SVX_START + 48 ) +#define SID_ATTR_ULSPACE ( SID_SVX_START + 49 ) +#define SID_ATTR_CHAR_MAPTYPE ( SID_SVX_START + 64 ) +#define SID_ATTR_PARA_MODEL ( SID_SVX_START + 65 ) +#define SID_ATTR_PARA_KEEP ( SID_SVX_START + 66 ) +#define SID_ATTR_CHAR_AUTOKERN ( SID_SVX_START + 67 ) +#define SID_ATTR_PARA_BULLET ( SID_SVX_START + 250 ) +#define SID_ATTR_PARA_OUTLLEVEL ( SID_SVX_START + 300 ) +#define SID_FIELD ( SID_SVX_START + 363 ) +#define SID_ATTR_PARA_REGISTER ( SID_SVX_START + 413 ) +#define SID_ATTR_PARA_PAGENUM ( SID_SVX_START + 457 ) +#define SID_ATTR_PARA_NUMRULE ( SID_SVX_START + 587 ) +#define SID_ATTR_BRUSH_CHAR ( SID_SVX_START + 591 ) +#define SID_ATTR_NUMBERING_RULE ( SID_SVX_START + 855 ) +#define SID_ATTR_CHAR_CHARSETCOLOR ( SID_SVX_START + 877 ) +#define SID_ATTR_CHAR_CJK_FONT ( SID_SVX_START + 887 ) +#define SID_ATTR_CHAR_CJK_FONTHEIGHT ( SID_SVX_START + 888 ) +#define SID_ATTR_CHAR_CJK_LANGUAGE ( SID_SVX_START + 889 ) +#define SID_ATTR_CHAR_CJK_POSTURE ( SID_SVX_START + 890 ) +#define SID_ATTR_CHAR_CJK_WEIGHT ( SID_SVX_START + 891 ) +#define SID_ATTR_CHAR_CTL_FONT ( SID_SVX_START + 892 ) +#define SID_ATTR_CHAR_CTL_FONTHEIGHT ( SID_SVX_START + 893 ) +#define SID_ATTR_CHAR_CTL_LANGUAGE ( SID_SVX_START + 894 ) +#define SID_ATTR_CHAR_CTL_POSTURE ( SID_SVX_START + 895 ) +#define SID_ATTR_CHAR_CTL_WEIGHT ( SID_SVX_START + 896 ) +#define SID_ATTR_CHAR_TWO_LINES ( SID_SVX_START + 897 ) +#define SID_ATTR_CHAR_CJK_RUBY ( SID_SVX_START + 898 ) +#define SID_ATTR_CHAR_EMPHASISMARK ( SID_SVX_START + 899 ) +#define SID_ATTR_CHAR_SCRIPTTYPE ( SID_SVX_START + 900 ) +#define SID_ATTR_PARA_SCRIPTSPACE ( SID_SVX_START + 901 ) +#define SID_ATTR_PARA_HANGPUNCTUATION ( SID_SVX_START + 902 ) +#define SID_ATTR_PARA_FORBIDDEN_RULES ( SID_SVX_START + 903 ) +#define SID_ATTR_CHAR_VERTICAL ( SID_SVX_START + 905 ) +#define SID_ATTR_CHAR_ROTATED ( SID_SVX_START + 910 ) +#define SID_ATTR_CHAR_SCALEWIDTH ( SID_SVX_START + 911 ) +#define SID_ATTR_CHAR_WIDTH_FIT_TO_LINE ( SID_SVX_START + 919 ) +#define SID_ATTR_CHAR_RELIEF ( SID_SVX_START + 920 ) +#define SID_PARA_VERTALIGN ( SID_SVX_START + 925 ) +#define SID_ATTR_FRAMEDIRECTION ( SID_SVX_START + 944 ) +#define SID_ATTR_PARA_SNAPTOGRID ( SID_SVX_START + 945 ) +#define SID_ATTR_PARA_LRSPACE_VERTICAL ( SID_SVX_START + 947 ) +#define SID_ATTR_PARA_LEFT_TO_RIGHT ( SID_SVX_START + 950 ) +#define SID_ATTR_PARA_RIGHT_TO_LEFT ( SID_SVX_START + 951 ) +#define SID_ATTR_CHAR_HIDDEN ( SID_SVX_START + 989 ) +#define SID_ATTR_CHAR_LATIN_FONT ( SID_SVX_START + 994 ) +#define SID_ATTR_CHAR_LATIN_FONTHEIGHT ( SID_SVX_START + 995 ) +#define SID_ATTR_CHAR_LATIN_LANGUAGE ( SID_SVX_START + 996 ) +#define SID_ATTR_CHAR_LATIN_POSTURE ( SID_SVX_START + 997 ) +#define SID_ATTR_CHAR_LATIN_WEIGHT ( SID_SVX_START + 998 ) +#define SID_ATTR_PARA_OUTLINE_LEVEL ( SID_SVX_START + 1121 ) +#define SID_ATTR_CHAR_PREVIEW_FONT ( SID_SVX_START + 1122 ) +#define SID_ATTR_CHAR_ENDPREVIEW_FONT ( SID_SVX_START + 1123 ) + + +// this ID didn't exist prior to the svx split +#define SID_ATTR_CHAR_OVERLINE ( SID_EDIT_START + 68 ) +#define SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD ( SID_EDIT_START + 69 ) +#define SID_ATTR_ALIGN_VER_JUSTIFY_METHOD ( SID_EDIT_START + 70 ) +#define SID_ATTR_ALIGN_HOR_JUSTIFY ( SID_EDIT_START + 71 ) +#define SID_ATTR_ALIGN_VER_JUSTIFY ( SID_EDIT_START + 72 ) + +/* +// planned, but not doable: changing value of SIDs will break code that uses them for WhichRanges +#define SID_PARA_VERTALIGN ( SID_EDIT_START ) +#define SID_ATTR_BORDER_OUTER ( SID_EDIT_START + 1 ) +#define SID_ATTR_BORDER_SHADOW ( SID_EDIT_START + 2 ) +#define SID_ATTR_BRUSH ( SID_EDIT_START + 3 ) +#define SID_ATTR_BRUSH_CHAR ( SID_EDIT_START + 4 ) + + +#define SID_FIELD ( SID_EDIT_START + 7 ) +#define SID_ATTR_FRAMEDIRECTION ( SID_EDIT_START + 8 ) +#define SID_ATTR_PARA ( SID_EDIT_START + 9 ) +#define SID_ATTR_PARA_ADJUST ( SID_EDIT_START + 10 ) +#define SID_ATTR_PARA_ADJUST_LEFT ( SID_EDIT_START + 11 ) +#define SID_ATTR_PARA_BULLET ( SID_EDIT_START + 12 ) +#define SID_ATTR_PARA_OUTLLEVEL ( SID_EDIT_START + 13 ) +#define SID_ATTR_PARA_REGISTER ( SID_EDIT_START + 14 ) +#define SID_ATTR_PARA_PAGENUM ( SID_EDIT_START + 15 ) +#define SID_ATTR_PARA_NUMRULE ( SID_EDIT_START + 16 ) +#define SID_ATTR_PARA_SCRIPTSPACE ( SID_EDIT_START + 17 ) +#define SID_ATTR_PARA_HANGPUNCTUATION ( SID_EDIT_START + 18 ) +#define SID_ATTR_PARA_FORBIDDEN_RULES ( SID_EDIT_START + 19 ) +#define SID_ATTR_PARA_SNAPTOGRID ( SID_EDIT_START + 20 ) +#define SID_ATTR_PARA_LRSPACE_VERTICAL ( SID_EDIT_START + 21 ) +#define SID_ATTR_PARA_LEFT_TO_RIGHT ( SID_EDIT_START + 22 ) +#define SID_ATTR_PARA_RIGHT_TO_LEFT ( SID_EDIT_START + 23 ) +#define SID_ATTR_PARA_OUTLINE_LEVEL ( SID_EDIT_START + 24 ) +#define SID_ATTR_PARA_ADJUST_RIGHT ( SID_EDIT_START + 25 ) +#define SID_ATTR_PARA_ADJUST_CENTER ( SID_EDIT_START + 26 ) +#define SID_ATTR_PARA_ADJUST_BLOCK ( SID_EDIT_START + 27 ) +#define SID_ATTR_PARA_ADJUST_BLOCKLINE ( SID_EDIT_START + 28 ) +#define SID_ATTR_PARA_LINESPACE ( SID_EDIT_START + 29 ) +#define SID_ATTR_PARA_LINESPACE_10 ( SID_EDIT_START + 30 ) +#define SID_ATTR_PARA_LINESPACE_15 ( SID_EDIT_START + 31 ) +#define SID_ATTR_PARA_LINESPACE_20 ( SID_EDIT_START + 32 ) +#define SID_ATTR_PARA_PAGEBREAK ( SID_EDIT_START + 33 ) +#define SID_ATTR_PARA_HYPHENZONE ( SID_EDIT_START + 34 ) +#define SID_ATTR_PARA_SPLIT ( SID_EDIT_START + 35 ) +#define SID_ATTR_PARA_ORPHANS ( SID_EDIT_START + 36 ) +#define SID_ATTR_PARA_WIDOWS ( SID_EDIT_START + 37 ) +#define SID_ATTR_PARA_ULSPACE ( SID_EDIT_START + 38 ) +#define SID_ATTR_PARA_LRSPACE ( SID_EDIT_START + 39 ) +#define SID_ATTR_PARA_MODEL ( SID_EDIT_START + 40 ) +#define SID_ATTR_PARA_KEEP ( SID_EDIT_START + 41 ) +#define SID_ATTR_NUMBERING_RULE ( SID_EDIT_START + 42 ) +#define SID_ATTR_LRSPACE ( SID_EDIT_START + 43 ) +#define SID_ATTR_ULSPACE ( SID_EDIT_START + 44 ) +#define SID_ATTR_TABSTOP ( SID_EDIT_START + 45 ) +#define SID_ATTR_TABSTOP_DEFAULTS ( SID_EDIT_START + 46 ) +#define SID_ATTR_TABSTOP_POS ( SID_EDIT_START + 47 ) +#define SID_ATTR_TABSTOP_OFFSET ( SID_EDIT_START + 48 ) +#define SID_ATTR_CHAR ( SID_EDIT_START + 49 ) +#define SID_ATTR_CHAR_FONT ( SID_EDIT_START + 50 ) +#define SID_ATTR_CHAR_POSTURE ( SID_EDIT_START + 51 ) +#define SID_ATTR_CHAR_WEIGHT ( SID_EDIT_START + 52 ) +#define SID_ATTR_CHAR_SHADOWED ( SID_EDIT_START + 53 ) +#define SID_ATTR_CHAR_WORDLINEMODE ( SID_EDIT_START + 54 ) +#define SID_ATTR_CHAR_CONTOUR ( SID_EDIT_START + 55 ) +#define SID_ATTR_CHAR_STRIKEOUT ( SID_EDIT_START + 56 ) +#define SID_ATTR_CHAR_UNDERLINE ( SID_EDIT_START + 57 ) +#define SID_ATTR_CHAR_FONTHEIGHT ( SID_EDIT_START + 58 ) +#define SID_ATTR_CHAR_PROPSIZE ( SID_EDIT_START + 59 ) +#define SID_ATTR_CHAR_COLOR ( SID_EDIT_START + 60 ) +#define SID_ATTR_CHAR_KERNING ( SID_EDIT_START + 61 ) +#define SID_ATTR_CHAR_CASEMAP ( SID_EDIT_START + 62 ) +#define SID_ATTR_CHAR_LANGUAGE ( SID_EDIT_START + 63 ) +#define SID_ATTR_CHAR_ESCAPEMENT ( SID_EDIT_START + 64 ) +#define SID_ATTR_CHAR_FONTLIST ( SID_EDIT_START + 65 ) +#define SID_ATTR_CHAR_MAPTYPE ( SID_EDIT_START + 66 ) +#define SID_ATTR_CHAR_AUTOKERN ( SID_EDIT_START + 67 ) +#define SID_ATTR_CHAR_OVERLINE ( SID_EDIT_START + 68 ) +#define SID_ATTR_CHAR_CHARSETCOLOR ( SID_EDIT_START + 69 ) +#define SID_ATTR_CHAR_CJK_FONT ( SID_EDIT_START + 70 ) +#define SID_ATTR_CHAR_CJK_FONTHEIGHT ( SID_EDIT_START + 71 ) +#define SID_ATTR_CHAR_CJK_LANGUAGE ( SID_EDIT_START + 72 ) +#define SID_ATTR_CHAR_CJK_POSTURE ( SID_EDIT_START + 73 ) +#define SID_ATTR_CHAR_CJK_WEIGHT ( SID_EDIT_START + 74 ) +#define SID_ATTR_CHAR_CTL_FONT ( SID_EDIT_START + 75 ) +#define SID_ATTR_CHAR_CTL_FONTHEIGHT ( SID_EDIT_START + 76 ) +#define SID_ATTR_CHAR_CTL_LANGUAGE ( SID_EDIT_START + 77 ) +#define SID_ATTR_CHAR_CTL_POSTURE ( SID_EDIT_START + 78 ) +#define SID_ATTR_CHAR_CTL_WEIGHT ( SID_EDIT_START + 79 ) +#define SID_ATTR_CHAR_TWO_LINES ( SID_EDIT_START + 80 ) +#define SID_ATTR_CHAR_CJK_RUBY ( SID_EDIT_START + 81 ) +#define SID_ATTR_CHAR_EMPHASISMARK ( SID_EDIT_START + 82 ) +#define SID_ATTR_CHAR_SCRIPTTYPE ( SID_EDIT_START + 83 ) +#define SID_ATTR_CHAR_VERTICAL ( SID_EDIT_START + 84 ) +#define SID_ATTR_CHAR_ROTATED ( SID_EDIT_START + 85 ) +#define SID_ATTR_CHAR_SCALEWIDTH ( SID_EDIT_START + 86 ) +#define SID_ATTR_CHAR_WIDTH_FIT_TO_LINE ( SID_EDIT_START + 87 ) +#define SID_ATTR_CHAR_RELIEF ( SID_EDIT_START + 88 ) +#define SID_ATTR_CHAR_HIDDEN ( SID_EDIT_START + 89 ) +#define SID_ATTR_CHAR_LATIN_FONT ( SID_EDIT_START + 90 ) +#define SID_ATTR_CHAR_LATIN_FONTHEIGHT ( SID_EDIT_START + 91 ) +#define SID_ATTR_CHAR_LATIN_LANGUAGE ( SID_EDIT_START + 92 ) +#define SID_ATTR_CHAR_LATIN_POSTURE ( SID_EDIT_START + 93 ) +#define SID_ATTR_CHAR_LATIN_WEIGHT ( SID_EDIT_START + 94 ) +*/ + +#if 94 > (SID_EDIT_END-SID_EDIT_START) +#error Resource-Ueberlauf in #line, #file +#endif + +#define SID_DRAW_TEXT_VERTICAL SID_ATTR_CHAR_VERTICAL + +#endif + +// ******************************************************************* EOF + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/editobj.hxx b/include/editeng/editobj.hxx new file mode 100644 index 000000000000..16bc0be626e5 --- /dev/null +++ b/include/editeng/editobj.hxx @@ -0,0 +1,130 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _EDITOBJ_HXX +#define _EDITOBJ_HXX + +#include <tools/stream.hxx> +#include <tools/debug.hxx> +#include <rsc/rscsfx.hxx> +#include <svl/itemset.hxx> +#include "svl/itempool.hxx" +#include <editeng/eeitem.hxx> +#include <editeng/editdata.hxx> +#include "editeng/editengdllapi.h" +#include "editeng/macros.hxx" + +#include <com/sun/star/text/textfield/Type.hpp> + +#include <vector> + +DBG_NAMEEX( EE_EditTextObject ) + +class SfxItemPool; +class SfxStyleSheetPool; +class SvxFieldItem; +class SvxFieldData; + +namespace editeng { + +class FieldUpdater; +class FieldUpdaterImpl; + +} + +class EditTextObjectImpl; + +class EDITENG_DLLPUBLIC EditTextObject : public SfxItemPoolUser +{ + friend class EditTextObjectImpl; + friend class editeng::FieldUpdaterImpl; + friend class ImpEditEngine; + + EditTextObjectImpl* mpImpl; + + EDITENG_DLLPRIVATE EditTextObject& operator=( const EditTextObject& ); + + EditTextObject(); // disabled + + EditTextObject( SfxItemPool* pPool ); + + void StoreData( SvStream& rStrm ) const; + void CreateData( SvStream& rStrm ); + +public: + EditTextObject( const EditTextObject& r ); + virtual ~EditTextObject(); + + sal_uInt16 GetUserType() const; // For OutlinerMode, it can however not save in compatible format + void SetUserType( sal_uInt16 n ); + + bool IsVertical() const; + void SetVertical( bool bVertical ); + + sal_uInt16 GetScriptType() const; + + EditTextObject* Clone() const; + + bool Store( SvStream& rOStream ) const; + + static EditTextObject* Create( + SvStream& rIStream, SfxItemPool* pGlobalTextObjectPool = NULL ); + + size_t GetParagraphCount() const; + + String GetText(size_t nPara) const; + + void ClearPortionInfo(); + + bool HasOnlineSpellErrors() const; + + void GetCharAttribs( sal_uInt16 nPara, std::vector<EECharAttrib>& rLst ) const; + + bool RemoveCharAttribs( sal_uInt16 nWhich = 0 ); + + bool IsFieldObject() const; + const SvxFieldItem* GetField() const; + const SvxFieldData* GetFieldData(size_t nPara, size_t nPos, sal_Int32 nType) const; + bool HasField( sal_Int32 nType = com::sun::star::text::textfield::Type::UNSPECIFIED ) const; + + const SfxItemSet& GetParaAttribs(size_t nPara) const; + + void GetStyleSheet(size_t nPara, String& rName, SfxStyleFamily& eFamily) const; + void SetStyleSheet(size_t nPara, const String& rName, const SfxStyleFamily& eFamily); + bool ChangeStyleSheets( + const XubString& rOldName, SfxStyleFamily eOldFamily, const XubString& rNewName, SfxStyleFamily eNewFamily ); + void ChangeStyleSheetName( SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName ); + + editeng::FieldUpdater GetFieldUpdater(); + + bool operator==( const EditTextObject& rCompare ) const; + + // #i102062# + bool isWrongListEqual(const EditTextObject& rCompare) const; + + virtual void ObjectInDestruction(const SfxItemPool& rSfxItemPool); + +#if DEBUG_EDIT_ENGINE + void Dump() const; +#endif +}; + +#endif // _EDITOBJ_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/editrids.hrc b/include/editeng/editrids.hrc new file mode 100644 index 000000000000..04ec3b6eccc7 --- /dev/null +++ b/include/editeng/editrids.hrc @@ -0,0 +1,395 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _EDIT_RIDS_HRC +#define _EDIT_RIDS_HRC + +#include <svl/solar.hrc> + +// strings also used in cui +#define RID_SVXSTR_PAPERBIN_SETTINGS (RID_EDIT_START) +#define RID_SVXSTR_PAPERBIN (RID_EDIT_START + 1) + +#define RID_OUTLUNDO_EXPAND (RID_EDIT_START + 2) +#define RID_OUTLUNDO_COLLAPSE (RID_EDIT_START + 3) +#define RID_OUTLUNDO_ATTR (RID_EDIT_START + 4) +#define RID_OUTLUNDO_INSERT (RID_EDIT_START + 5) +#define RID_OUTLUNDO_DEPTH (RID_EDIT_START + 6) +#define RID_OUTLUNDO_HEIGHT (RID_EDIT_START + 7) + +// strings for items + +#define RID_SVXITEMS_FRMDIR_BEGIN (RID_EDIT_START + 9) +#define RID_SVXITEMS_FRMDIR_HORI_LEFT_TOP (RID_EDIT_START + 9) +#define RID_SVXITEMS_FRMDIR_HORI_RIGHT_TOP (RID_EDIT_START + 10) +#define RID_SVXITEMS_FRMDIR_VERT_TOP_RIGHT (RID_EDIT_START + 11) +#define RID_SVXITEMS_FRMDIR_VERT_TOP_LEFT (RID_EDIT_START + 12) +#define RID_SVXITEMS_FRMDIR_ENVIRONMENT (RID_EDIT_START + 13) +// RID_SVXITEMS_FRMDIR_END (RID_EDIT_START + 14) + +#define RID_SVXITEMS_TRUE (RID_EDIT_START + 15) +#define RID_SVXITEMS_FALSE (RID_EDIT_START + 16) +#define RID_SVXITEMS_BORDER_COMPLETE (RID_EDIT_START + 17) +#define RID_SVXITEMS_BORDER_TOP (RID_EDIT_START + 18) +#define RID_SVXITEMS_BORDER_BOTTOM (RID_EDIT_START + 19) +#define RID_SVXITEMS_BORDER_LEFT (RID_EDIT_START + 20) +#define RID_SVXITEMS_BORDER_RIGHT (RID_EDIT_START + 21) +#define RID_SVXITEMS_BORDER_DISTANCE (RID_EDIT_START + 22) +#define RID_SVXITEMS_BORDER_NONE (RID_EDIT_START + 23) + +#define RID_SVXITEMS_TRANSPARENT_TRUE (RID_EDIT_START + 24) +#define RID_SVXITEMS_TRANSPARENT_FALSE (RID_EDIT_START + 25) +#define RID_SVXITEMS_OPAQUE_TRUE (RID_EDIT_START + 26) +#define RID_SVXITEMS_OPAQUE_FALSE (RID_EDIT_START + 27) + +#define RID_SVXITEMS_SHADOW_COMPLETE (RID_EDIT_START + 28) +#define RID_SVXITEMS_GRAPHIC (RID_EDIT_START + 29) +#define RID_SVXITEMS_LINES (RID_EDIT_START + 30) +#define RID_SVXITEMS_ORPHANS_COMPLETE (RID_EDIT_START + 31) +#define RID_SVXITEMS_WIDOWS_COMPLETE (RID_EDIT_START + 32) +#define RID_SVXITEMS_PAGEMODEL_COMPLETE (RID_EDIT_START + 33) + +#define RID_SVXITEMS_SHADOWED_TRUE (RID_EDIT_START + 34) +#define RID_SVXITEMS_SHADOWED_FALSE (RID_EDIT_START + 35) +#define RID_SVXITEMS_AUTOKERN_TRUE (RID_EDIT_START + 36) +#define RID_SVXITEMS_AUTOKERN_FALSE (RID_EDIT_START + 37) +#define RID_SVXITEMS_WORDLINE_TRUE (RID_EDIT_START + 38) +#define RID_SVXITEMS_WORDLINE_FALSE (RID_EDIT_START + 39) +#define RID_SVXITEMS_CONTOUR_TRUE (RID_EDIT_START + 40) +#define RID_SVXITEMS_CONTOUR_FALSE (RID_EDIT_START + 41) +#define RID_SVXITEMS_NOLINEBREAK_TRUE (RID_EDIT_START + 42) +#define RID_SVXITEMS_NOLINEBREAK_FALSE (RID_EDIT_START + 43) +#define RID_SVXITEMS_NOHYPHEN_TRUE (RID_EDIT_START + 44) +#define RID_SVXITEMS_NOHYPHEN_FALSE (RID_EDIT_START + 45) +#define RID_SVXITEMS_FMTKEEP_TRUE (RID_EDIT_START + 46) +#define RID_SVXITEMS_FMTKEEP_FALSE (RID_EDIT_START + 47) +#define RID_SVXITEMS_FMTSPLIT_TRUE (RID_EDIT_START + 48) +#define RID_SVXITEMS_FMTSPLIT_FALSE (RID_EDIT_START + 49) +#define RID_SVXITEMS_PRINT_TRUE (RID_EDIT_START + 50) +#define RID_SVXITEMS_PRINT_FALSE (RID_EDIT_START + 51) +#define RID_SVXITEMS_PROT_POS_TRUE (RID_EDIT_START + 52) +#define RID_SVXITEMS_PROT_POS_FALSE (RID_EDIT_START + 53) +#define RID_SVXITEMS_PROT_SIZE_TRUE (RID_EDIT_START + 54) +#define RID_SVXITEMS_PROT_SIZE_FALSE (RID_EDIT_START + 55) +#define RID_SVXITEMS_PROT_CONTENT_TRUE (RID_EDIT_START + 56) +#define RID_SVXITEMS_PROT_CONTENT_FALSE (RID_EDIT_START + 57) +#define RID_SVXITEMS_ULSPACE_UPPER (RID_EDIT_START + 58) +#define RID_SVXITEMS_ULSPACE_LOWER (RID_EDIT_START + 59) +#define RID_SVXITEMS_LRSPACE_LEFT (RID_EDIT_START + 60) +#define RID_SVXITEMS_LRSPACE_FLINE (RID_EDIT_START + 62) +#define RID_SVXITEMS_LRSPACE_RIGHT (RID_EDIT_START + 63) +#define RID_SVXITEMS_SIZE_WIDTH (RID_EDIT_START + 64) +#define RID_SVXITEMS_SIZE_HEIGHT (RID_EDIT_START + 65) +#define RID_SVXITEMS_PAGE_END_TRUE (RID_EDIT_START + 66) +#define RID_SVXITEMS_PAGE_END_FALSE (RID_EDIT_START + 67) +#define RID_SVXITEMS_HYPHEN_TRUE (RID_EDIT_START + 68) +#define RID_SVXITEMS_HYPHEN_FALSE (RID_EDIT_START + 69) +#define RID_SVXITEMS_HYPHEN_MINLEAD (RID_EDIT_START + 70) +#define RID_SVXITEMS_HYPHEN_MINTRAIL (RID_EDIT_START + 71) +#define RID_SVXITEMS_HYPHEN_MAX (RID_EDIT_START + 72) +#define RID_SVXITEMS_HNGPNCT_OFF (RID_EDIT_START + 73) +#define RID_SVXITEMS_HNGPNCT_ON (RID_EDIT_START + 74) +#define RID_SVXITEMS_FORBIDDEN_RULE_OFF (RID_EDIT_START + 75) +#define RID_SVXITEMS_FORBIDDEN_RULE_ON (RID_EDIT_START + 76) +#define RID_SVXITEMS_SCRPTSPC_OFF (RID_EDIT_START + 77) +#define RID_SVXITEMS_SCRPTSPC_ON (RID_EDIT_START + 78) +#define RID_SVXITEMS_CHARSCALE_OFF (RID_EDIT_START + 79) +#define RID_SVXITEMS_CHARSCALE (RID_EDIT_START + 80) +#define RID_SVXITEMS_CHARROTATE_OFF (RID_EDIT_START + 81) +#define RID_SVXITEMS_CHARROTATE (RID_EDIT_START + 82) +#define RID_SVXITEMS_CHARROTATE_FITLINE (RID_EDIT_START + 83) + +#define RID_SVXITEMS_RELIEF_BEGIN (RID_EDIT_START + 85) +#define RID_SVXITEMS_RELIEF_NONE (RID_EDIT_START + 85) +#define RID_SVXITEMS_RELIEF_EMBOSSED (RID_EDIT_START + 86) +#define RID_SVXITEMS_RELIEF_ENGRAVED (RID_EDIT_START + 87) +// RID_SVXITEMS_RELIEF_END (RID_EDIT_START + 88) + +// HM_ERR +#define RID_SVXSTR_HMERR_THESAURUS (RID_EDIT_START + 89) + +// enum FontEmphasisMark --------------------------------------------------- +#define RID_SVXITEMS_EMPHASIS_BEGIN_STYLE (RID_EDIT_START + 90) +#define RID_SVXITEMS_EMPHASIS_NONE_STYLE (RID_EDIT_START + 90) +#define RID_SVXITEMS_EMPHASIS_DOT_STYLE (RID_EDIT_START + 91) +#define RID_SVXITEMS_EMPHASIS_CIRCLE_STYLE (RID_EDIT_START + 92) +#define RID_SVXITEMS_EMPHASIS_DISC_STYLE (RID_EDIT_START + 93) +#define RID_SVXITEMS_EMPHASIS_ACCENT_STYLE (RID_EDIT_START + 94) + +#define RID_SVXITEMS_EMPHASIS_ABOVE_POS (RID_EDIT_START + 95) +#define RID_SVXITEMS_EMPHASIS_BELOW_POS (RID_EDIT_START + 96) + +// enum ESCAPEMENT ------------------------------------------------------- +#define RID_SVXITEMS_ESCAPEMENT_BEGIN (RID_EDIT_START + 97) +#define RID_SVXITEMS_ESCAPEMENT_OFF (RID_EDIT_START + 97) +#define RID_SVXITEMS_ESCAPEMENT_SUPER (RID_EDIT_START + 98) +#define RID_SVXITEMS_ESCAPEMENT_SUB (RID_EDIT_START + 99) +#define RID_SVXITEMS_ESCAPEMENT_AUTO (RID_EDIT_START + 100) + +// enum CASEMAP ---------------------------------------------------------- +#define RID_SVXITEMS_CASEMAP_BEGIN (RID_EDIT_START + 101) +#define RID_SVXITEMS_CASEMAP_NONE (RID_EDIT_START + 101) +#define RID_SVXITEMS_CASEMAP_VERSALIEN (RID_EDIT_START + 102) +#define RID_SVXITEMS_CASEMAP_GEMEINE (RID_EDIT_START + 103) +#define RID_SVXITEMS_CASEMAP_TITEL (RID_EDIT_START + 104) +#define RID_SVXITEMS_CASEMAP_KAPITAELCHEN (RID_EDIT_START + 105) + +#define RID_SVXITEMS_KERNING_COMPLETE (RID_EDIT_START + 106) +#define RID_SVXITEMS_KERNING_EXPANDED (RID_EDIT_START + 107) +#define RID_SVXITEMS_KERNING_CONDENSED (RID_EDIT_START + 108) + +#define RID_SVXITEMS_BLINK_TRUE (RID_EDIT_START + 109) +#define RID_SVXITEMS_BLINK_FALSE (RID_EDIT_START + 110) + +#define RID_SVXITEMS_TWOLINES_OFF (RID_EDIT_START + 111) +#define RID_SVXITEMS_TWOLINES (RID_EDIT_START + 112) + +// enum FontStrikeout ---------------------------------------------------- +#define RID_SVXITEMS_STRIKEOUT_BEGIN (RID_EDIT_START + 113) +#define RID_SVXITEMS_STRIKEOUT_NONE (RID_EDIT_START + 113) +#define RID_SVXITEMS_STRIKEOUT_SINGLE (RID_EDIT_START + 114) +#define RID_SVXITEMS_STRIKEOUT_DOUBLE (RID_EDIT_START + 115) +#define RID_SVXITEMS_STRIKEOUT_BOLD (RID_EDIT_START + 117) +#define RID_SVXITEMS_STRIKEOUT_SLASH (RID_EDIT_START + 118) +#define RID_SVXITEMS_STRIKEOUT_X (RID_EDIT_START + 119) + +// enum FontUnderline - used for overline -------------------------------- +#define RID_SVXITEMS_OL_BEGIN (RID_EDIT_START + 120) +#define RID_SVXITEMS_OL_NONE (RID_EDIT_START + 120) +#define RID_SVXITEMS_OL_SINGLE (RID_EDIT_START + 121) +#define RID_SVXITEMS_OL_DOUBLE (RID_EDIT_START + 122) +#define RID_SVXITEMS_OL_DOTTED (RID_EDIT_START + 123) +#define RID_SVXITEMS_OL_DONTKNOW (RID_EDIT_START + 124) +#define RID_SVXITEMS_OL_DASH (RID_EDIT_START + 125) +#define RID_SVXITEMS_OL_LONGDASH (RID_EDIT_START + 126) +#define RID_SVXITEMS_OL_DASHDOT (RID_EDIT_START + 127) +#define RID_SVXITEMS_OL_DASHDOTDOT (RID_EDIT_START + 128) +#define RID_SVXITEMS_OL_SMALLWAVE (RID_EDIT_START + 129) +#define RID_SVXITEMS_OL_WAVE (RID_EDIT_START + 130) +#define RID_SVXITEMS_OL_DOUBLEWAVE (RID_EDIT_START + 131) +#define RID_SVXITEMS_OL_BOLD (RID_EDIT_START + 132) +#define RID_SVXITEMS_OL_BOLDDOTTED (RID_EDIT_START + 133) +#define RID_SVXITEMS_OL_BOLDDASH (RID_EDIT_START + 134) +#define RID_SVXITEMS_OL_BOLDLONGDASH (RID_EDIT_START + 135) +#define RID_SVXITEMS_OL_BOLDDASHDOT (RID_EDIT_START + 136) +#define RID_SVXITEMS_OL_BOLDDASHDOTDOT (RID_EDIT_START + 137) +#define RID_SVXITEMS_OL_BOLDWAVE (RID_EDIT_START + 138) + +// enum FontUnderline - used for underline ------------------------------- +#define RID_SVXITEMS_UL_BEGIN (RID_EDIT_START + 139) +#define RID_SVXITEMS_UL_NONE (RID_EDIT_START + 139) +#define RID_SVXITEMS_UL_SINGLE (RID_EDIT_START + 140) +#define RID_SVXITEMS_UL_DOUBLE (RID_EDIT_START + 141) +#define RID_SVXITEMS_UL_DOTTED (RID_EDIT_START + 142) +#define RID_SVXITEMS_UL_DONTKNOW (RID_EDIT_START + 143) +#define RID_SVXITEMS_UL_DASH (RID_EDIT_START + 144) +#define RID_SVXITEMS_UL_LONGDASH (RID_EDIT_START + 145) +#define RID_SVXITEMS_UL_DASHDOT (RID_EDIT_START + 146) +#define RID_SVXITEMS_UL_DASHDOTDOT (RID_EDIT_START + 147) +#define RID_SVXITEMS_UL_SMALLWAVE (RID_EDIT_START + 148) +#define RID_SVXITEMS_UL_WAVE (RID_EDIT_START + 149) +#define RID_SVXITEMS_UL_DOUBLEWAVE (RID_EDIT_START + 150) +#define RID_SVXITEMS_UL_BOLD (RID_EDIT_START + 151) +#define RID_SVXITEMS_UL_BOLDDOTTED (RID_EDIT_START + 152) +#define RID_SVXITEMS_UL_BOLDDASH (RID_EDIT_START + 153) +#define RID_SVXITEMS_UL_BOLDLONGDASH (RID_EDIT_START + 154) +#define RID_SVXITEMS_UL_BOLDDASHDOT (RID_EDIT_START + 155) +#define RID_SVXITEMS_UL_BOLDDASHDOTDOT (RID_EDIT_START + 156) +#define RID_SVXITEMS_UL_BOLDWAVE (RID_EDIT_START + 157) + +// enum FontWeight ------------------------------------------------------- +#define RID_SVXITEMS_WEIGHT_BEGIN (RID_EDIT_START + 158) +#define RID_SVXITEMS_WEIGHT_DONTKNOW (RID_EDIT_START + 158) +#define RID_SVXITEMS_WEIGHT_THIN (RID_EDIT_START + 159) +#define RID_SVXITEMS_WEIGHT_ULTRALIGHT (RID_EDIT_START + 160) +#define RID_SVXITEMS_WEIGHT_LIGHT (RID_EDIT_START + 161) +#define RID_SVXITEMS_WEIGHT_SEMILIGHT (RID_EDIT_START + 162) +#define RID_SVXITEMS_WEIGHT_NORMAL (RID_EDIT_START + 163) +#define RID_SVXITEMS_WEIGHT_MEDIUM (RID_EDIT_START + 164) +#define RID_SVXITEMS_WEIGHT_SEMIBOLD (RID_EDIT_START + 165) +#define RID_SVXITEMS_WEIGHT_BOLD (RID_EDIT_START + 166) +#define RID_SVXITEMS_WEIGHT_ULTRABOLD (RID_EDIT_START + 167) +#define RID_SVXITEMS_WEIGHT_BLACK (RID_EDIT_START + 168) + +// enum FontItalic ------------------------------------------------------- +#define RID_SVXITEMS_ITALIC_NONE (RID_EDIT_START + 206) +#define RID_SVXITEMS_ITALIC_OBLIQUE (RID_EDIT_START + 207) +#define RID_SVXITEMS_ITALIC_NORMAL (RID_EDIT_START + 208) + +// enum SvxAdjust ----------------------------------------------------------- +#define RID_SVXITEMS_ADJUST_BEGIN (RID_EDIT_START + 209) +#define RID_SVXITEMS_ADJUST_LEFT (RID_EDIT_START + 209) +#define RID_SVXITEMS_ADJUST_RIGHT (RID_EDIT_START + 210) +#define RID_SVXITEMS_ADJUST_BLOCK (RID_EDIT_START + 211) +#define RID_SVXITEMS_ADJUST_CENTER (RID_EDIT_START + 212) +#define RID_SVXITEMS_ADJUST_BLOCKLINE (RID_EDIT_START + 213) + +#define RID_SVXITEMS_TAB_DECIMAL_CHAR (RID_EDIT_START + 214) +#define RID_SVXITEMS_TAB_FILL_CHAR (RID_EDIT_START + 215) + +#define RID_SVXITEMS_TAB_ADJUST_BEGIN (RID_EDIT_START + 217) +#define RID_SVXITEMS_TAB_ADJUST_LEFT (RID_EDIT_START + 217) +#define RID_SVXITEMS_TAB_ADJUST_RIGHT (RID_EDIT_START + 218) +#define RID_SVXITEMS_TAB_ADJUST_DECIMAL (RID_EDIT_START + 219) +#define RID_SVXITEMS_TAB_ADJUST_CENTER (RID_EDIT_START + 220) +#define RID_SVXITEMS_TAB_ADJUST_DEFAULT (RID_EDIT_START + 221) + +// enum SvxBreak ------------------------------------------------------------ +#define RID_SVXITEMS_BREAK_BEGIN (RID_EDIT_START + 222) +#define RID_SVXITEMS_BREAK_NONE (RID_EDIT_START + 222) +#define RID_SVXITEMS_BREAK_COLUMN_BEFORE (RID_EDIT_START + 223) +#define RID_SVXITEMS_BREAK_COLUMN_AFTER (RID_EDIT_START + 224) +#define RID_SVXITEMS_BREAK_COLUMN_BOTH (RID_EDIT_START + 225) +#define RID_SVXITEMS_BREAK_PAGE_BEFORE (RID_EDIT_START + 226) +#define RID_SVXITEMS_BREAK_PAGE_AFTER (RID_EDIT_START + 227) +#define RID_SVXITEMS_BREAK_PAGE_BOTH (RID_EDIT_START + 228) + +// enum SvxShadowLocation --------------------------------------------------- +#define RID_SVXITEMS_SHADOW_BEGIN (RID_EDIT_START + 229) +#define RID_SVXITEMS_SHADOW_NONE (RID_EDIT_START + 229) +#define RID_SVXITEMS_SHADOW_TOPLEFT (RID_EDIT_START + 230) +#define RID_SVXITEMS_SHADOW_TOPRIGHT (RID_EDIT_START + 231) +#define RID_SVXITEMS_SHADOW_BOTTOMLEFT (RID_EDIT_START + 232) +#define RID_SVXITEMS_SHADOW_BOTTOMRIGHT (RID_EDIT_START + 233) + +// Border lines +#define RID_SOLID (RID_EDIT_START + 234) +#define RID_DOTTED (RID_EDIT_START + 235) +#define RID_DASHED (RID_EDIT_START + 236) +#define RID_DOUBLE (RID_EDIT_START + 237) +#define RID_THINTHICK_SMALLGAP (RID_EDIT_START + 238) +#define RID_THINTHICK_MEDIUMGAP (RID_EDIT_START + 239) +#define RID_THINTHICK_LARGEGAP (RID_EDIT_START + 240) +#define RID_THICKTHIN_SMALLGAP (RID_EDIT_START + 241) +#define RID_THICKTHIN_MEDIUMGAP (RID_EDIT_START + 242) +#define RID_THICKTHIN_LARGEGAP (RID_EDIT_START + 243) +#define RID_EMBOSSED (RID_EDIT_START + 244) +#define RID_ENGRAVED (RID_EDIT_START + 245) +#define RID_OUTSET (RID_EDIT_START + 246) +#define RID_INSET (RID_EDIT_START + 247) + +// Metric-Text +#define RID_SVXITEMS_METRIC_MM (RID_EDIT_START + 250) +#define RID_SVXITEMS_METRIC_CM (RID_EDIT_START + 251) +#define RID_SVXITEMS_METRIC_INCH (RID_EDIT_START + 252) +#define RID_SVXITEMS_METRIC_POINT (RID_EDIT_START + 253) +#define RID_SVXITEMS_METRIC_TWIP (RID_EDIT_START + 254) +#define RID_SVXITEMS_METRIC_PIXEL (RID_EDIT_START + 255) + +// enum ColorName ----------------------------------------------------------- +#define RID_SVXITEMS_COLOR_BEGIN (RID_EDIT_START + 256) +#define RID_SVXITEMS_COLOR (RID_EDIT_START + 256) +#define RID_SVXITEMS_COLOR_BLACK (RID_EDIT_START + 257) +#define RID_SVXITEMS_COLOR_BLUE (RID_EDIT_START + 258) +#define RID_SVXITEMS_COLOR_GREEN (RID_EDIT_START + 259) +#define RID_SVXITEMS_COLOR_CYAN (RID_EDIT_START + 260) +#define RID_SVXITEMS_COLOR_RED (RID_EDIT_START + 261) +#define RID_SVXITEMS_COLOR_MAGENTA (RID_EDIT_START + 262) +#define RID_SVXITEMS_COLOR_BROWN (RID_EDIT_START + 263) +#define RID_SVXITEMS_COLOR_GRAY (RID_EDIT_START + 264) +#define RID_SVXITEMS_COLOR_LIGHTGRAY (RID_EDIT_START + 265) +#define RID_SVXITEMS_COLOR_LIGHTBLUE (RID_EDIT_START + 266) +#define RID_SVXITEMS_COLOR_LIGHTGREEN (RID_EDIT_START + 267) +#define RID_SVXITEMS_COLOR_LIGHTCYAN (RID_EDIT_START + 268) +#define RID_SVXITEMS_COLOR_LIGHTRED (RID_EDIT_START + 269) +#define RID_SVXITEMS_COLOR_LIGHTMAGENTA (RID_EDIT_START + 270) +#define RID_SVXITEMS_COLOR_YELLOW (RID_EDIT_START + 271) +#define RID_SVXITEMS_COLOR_WHITE (RID_EDIT_START + 272) +#define RID_SVXITEMS_COLOR_MENUBAR (RID_EDIT_START + 273) +#define RID_SVXITEMS_COLOR_MENUBARTEXT (RID_EDIT_START + 274) +#define RID_SVXITEMS_COLOR_POPUPMENU (RID_EDIT_START + 275) +#define RID_SVXITEMS_COLOR_POPUPMENUTEXT (RID_EDIT_START + 276) +#define RID_SVXITEMS_COLOR_WINDOWTEXT (RID_EDIT_START + 277) +#define RID_SVXITEMS_COLOR_WINDOWWORKSPACE (RID_EDIT_START + 278) +#define RID_SVXITEMS_COLOR_HIGHLIGHT (RID_EDIT_START + 279) +#define RID_SVXITEMS_COLOR_HIGHLIGHTTEXT (RID_EDIT_START + 280) +#define RID_SVXITEMS_COLOR_3DTEXT (RID_EDIT_START + 281) +#define RID_SVXITEMS_COLOR_3DFACE (RID_EDIT_START + 282) +#define RID_SVXITEMS_COLOR_3DLIGHT (RID_EDIT_START + 283) +#define RID_SVXITEMS_COLOR_3DSHADOW (RID_EDIT_START + 284) +#define RID_SVXITEMS_COLOR_SCROLLBAR (RID_EDIT_START + 285) +#define RID_SVXITEMS_COLOR_FIELD (RID_EDIT_START + 286) +#define RID_SVXITEMS_COLOR_FIELDTEXT (RID_EDIT_START + 287) + + +#define RID_SVXITEMS_PARASNAPTOGRID_ON (RID_EDIT_START + 288) +#define RID_SVXITEMS_PARASNAPTOGRID_OFF (RID_EDIT_START + 289) + +#define RID_SVXITEMS_PARAVERTALIGN_AUTO (RID_EDIT_START + 290) +#define RID_SVXITEMS_PARAVERTALIGN_BASELINE (RID_EDIT_START + 291) +#define RID_SVXITEMS_PARAVERTALIGN_TOP (RID_EDIT_START + 292) +#define RID_SVXITEMS_PARAVERTALIGN_CENTER (RID_EDIT_START + 293) +#define RID_SVXITEMS_PARAVERTALIGN_BOTTOM (RID_EDIT_START + 294) + +#define RID_SVXITEMS_CHARHIDDEN_FALSE (RID_EDIT_START + 295) +#define RID_SVXITEMS_CHARHIDDEN_TRUE (RID_EDIT_START + 296) + +// strings for error messsages in dictionary updates +#define RID_SVXSTR_DIC_ERR_UNKNOWN (RID_EDIT_START + 297) +#define RID_SVXSTR_DIC_ERR_FULL (RID_EDIT_START + 298) +#define RID_SVXSTR_DIC_ERR_READONLY (RID_EDIT_START + 299) + +// ResIds fuer HM-QueryBoxen und Error-Strings +#define RID_SVXQB_BW_CONTINUE (RID_EDIT_START + 300) +#define RID_SVXQB_CONTINUE (RID_EDIT_START + 301) + +// EditEngine +#define RID_EDITUNDO_DEL (RID_EDIT_START + 302) +#define RID_EDITUNDO_MOVE (RID_EDIT_START + 303) +#define RID_EDITUNDO_INSERT (RID_EDIT_START + 304) +#define RID_EDITUNDO_REPLACE (RID_EDIT_START + 305) +#define RID_EDITUNDO_SETATTRIBS (RID_EDIT_START + 306) +#define RID_EDITUNDO_SETSTYLE (RID_EDIT_START + 307) +#define RID_EDITUNDO_RESETATTRIBS (RID_EDIT_START + 308) +#define RID_EDITUNDO_INDENT (RID_EDIT_START + 309) +#define RID_EDITUNDO_TRANSLITERATE (RID_EDIT_START + 310) +#define RID_MENU_SPELL (RID_EDIT_START + 311) +#define RID_STR_PARAGRAPH (RID_EDIT_START + 312) +#define RID_STR_WORD (RID_EDIT_START + 313) +#define RID_SVXSTR_A11Y_IMAGEBULLET_DESCRIPTION (RID_EDIT_START + 314) +#define RID_SVXSTR_A11Y_IMAGEBULLET_NAME (RID_EDIT_START + 315) + +// enum SvxCellHorJustify +#define RID_SVXITEMS_HORJUST_STANDARD (RID_EDIT_START + 316) +#define RID_SVXITEMS_HORJUST_LEFT (RID_EDIT_START + 317) +#define RID_SVXITEMS_HORJUST_CENTER (RID_EDIT_START + 318) +#define RID_SVXITEMS_HORJUST_RIGHT (RID_EDIT_START + 319) +#define RID_SVXITEMS_HORJUST_BLOCK (RID_EDIT_START + 320) +#define RID_SVXITEMS_HORJUST_REPEAT (RID_EDIT_START + 321) + +// enum SvxCellVerJustify +#define RID_SVXITEMS_VERJUST_STANDARD (RID_EDIT_START + 322) +#define RID_SVXITEMS_VERJUST_TOP (RID_EDIT_START + 323) +#define RID_SVXITEMS_VERJUST_CENTER (RID_EDIT_START + 324) +#define RID_SVXITEMS_VERJUST_BOTTOM (RID_EDIT_START + 325) + +// enum SvxCellJustifyMethod +#define RID_SVXITEMS_JUSTMETHOD_AUTO (RID_EDIT_START + 326) +#define RID_SVXITEMS_JUSTMETHOD_DISTRIBUTE (RID_EDIT_START + 327) + +#if 327 > (RID_EDIT_END-RID_EDIT_START) +#error Resource-Ueberlauf in #line, #file +#endif + + + +#endif + +// ******************************************************************* EOF + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/editstat.hxx b/include/editeng/editstat.hxx new file mode 100644 index 000000000000..175267938c91 --- /dev/null +++ b/include/editeng/editstat.hxx @@ -0,0 +1,139 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _EDITSTAT_HXX +#define _EDITSTAT_HXX + +#include <tools/string.hxx> +#include <i18nlangtag/lang.h> + +#define EE_CNTRL_USECHARATTRIBS 0x00000001 // Use of hard character attributes +#define EE_CNTRL_USEPARAATTRIBS 0x00000002 // Using paragraph attributes. +#define EE_CNTRL_CRSRLEFTPARA 0x00000004 // Cursor is moved to another paragraph +#define EE_CNTRL_DOIDLEFORMAT 0x00000008 // Formatting idle +#define EE_CNTRL_PASTESPECIAL 0x00000010 // Allow PasteSpecial +#define EE_CNTRL_AUTOINDENTING 0x00000020 // Automatic indenting +#define EE_CNTRL_UNDOATTRIBS 0x00000040 // Undo for Attributes.... +#define EE_CNTRL_ONECHARPERLINE 0x00000080 // One character per line +#define EE_CNTRL_NOCOLORS 0x00000100 // Engine: No Color +#define EE_CNTRL_OUTLINER 0x00000200 // Special treatment Outliner/Outline mode +#define EE_CNTRL_OUTLINER2 0x00000400 // Special treatment Outliner/Page +#define EE_CNTRL_ALLOWBIGOBJS 0x00000800 // Portion info in text object +#define EE_CNTRL_ONLINESPELLING 0x00001000 // During the edit Spelling +#define EE_CNTRL_STRETCHING 0x00002000 // Stretch mode +#define EE_CNTRL_MARKFIELDS 0x00004000 // Mark Fields with color +#define EE_CNTRL_URLSFXEXECUTE 0x00008000 // !!!OLD!!!: SFX-URL-Execute. +#define EE_CNTRL_RESTOREFONT 0x00010000 // Restore Font in OutDev +#define EE_CNTRL_RTFSTYLESHEETS 0x00020000 // Use Stylesheets when imported +//#define EE_CNTRL_NOREDLINES 0x00040000 // No RedLines when OnlineSpellError /* removed #i91949 */ +#define EE_CNTRL_AUTOCORRECT 0x00080000 // AutoCorrect +#define EE_CNTRL_AUTOCOMPLETE 0x00100000 // AutoComplete +#define EE_CNTRL_AUTOPAGESIZEX 0x00200000 // Adjust paper width to Text +#define EE_CNTRL_AUTOPAGESIZEY 0x00400000 // Adjust paper height to Text +#define EE_CNTRL_AUTOPAGESIZE (EE_CNTRL_AUTOPAGESIZEX|EE_CNTRL_AUTOPAGESIZEY) +#define EE_CNTRL_TABINDENTING 0x00800000 // Indent with tab +#define EE_CNTRL_FORMAT100 0x01000000 // Always format to 100% +#define EE_CNTRL_ULSPACESUMMATION 0x02000000 // MS Compat: sum SA and SB, not maximum value +#define EE_CNTRL_ULSPACEFIRSTPARA 0x04000000 // MS Compat: evaluate also at the first paragraph + +#define EV_CNTRL_AUTOSCROLL 0x00000001 // Auto scrolling horizontally +#define EV_CNTRL_BIGSCROLL 0x00000002 // Scroll further to the cursor +#define EV_CNTRL_ENABLEPASTE 0x00000004 // Enable Paste +#define EV_CNTRL_SINGLELINEPASTE 0x00000008 // View: Paste in input line ... +#define EV_CNTRL_OVERWRITE 0x00000010 // Overwrite mode +#define EV_CNTRL_INVONEMORE 0x00000020 // Invalidate one pixel more +#define EV_CNTRL_AUTOSIZEX 0x00000040 // Automatically adapt to text width +#define EV_CNTRL_AUTOSIZEY 0x00000080 // Automatically adapt to Text width +#define EV_CNTRL_AUTOSIZE (EV_CNTRL_AUTOSIZEX|EV_CNTRL_AUTOSIZEY) + +#define EE_STAT_HSCROLL 0x00000001 +#define EE_STAT_VSCROLL 0x00000002 +#define EE_STAT_CURSOROUT 0x00000004 +#define EE_STAT_CRSRMOVEFAIL 0x00000008 +#define EE_STAT_CRSRLEFTPARA 0x00000010 +#define EE_STAT_TEXTWIDTHCHANGED 0x00000020 +#define EE_STAT_TEXTHEIGHTCHANGED 0x00000040 +#define EE_STAT_WRONGWORDCHANGED 0x00000080 +// #define EE_STAT_MODIFIED 0x00000100 + +/* + EE_STAT_CRSRLEFTPARA at the time cursor movement and the enter. +*/ + +inline void SetFlags( sal_uLong& rBits, const sal_uInt32 nMask, bool bOn ) +{ + if ( bOn ) + rBits |= nMask; + else + rBits &= ~nMask; +} + +class EditStatus +{ +protected: + sal_uLong nStatusBits; + sal_uLong nControlBits; + sal_uInt16 nPrevPara; // for EE_STAT_CRSRLEFTPARA + +public: + EditStatus() { nStatusBits = 0; nControlBits = 0; nPrevPara = 0xFFFF; } + + void Clear() { nStatusBits = 0; } + void SetControlBits( sal_uLong nMask, bool bOn ) + { SetFlags( nControlBits, nMask, bOn ); } + + sal_uLong GetStatusWord() const { return nStatusBits; } + sal_uLong& GetStatusWord() { return nStatusBits; } + + sal_uLong GetControlWord() const { return nControlBits; } + sal_uLong& GetControlWord() { return nControlBits; } + + sal_uInt16 GetPrevParagraph() const { return nPrevPara; } + sal_uInt16& GetPrevParagraph() { return nPrevPara; } +}; + +#define SPELLCMD_IGNOREWORD 0x0001 +#define SPELLCMD_STARTSPELLDLG 0x0002 +#define SPELLCMD_ADDTODICTIONARY 0x0003 +#define SPELLCMD_WORDLANGUAGE 0x0004 +#define SPELLCMD_PARALANGUAGE 0x0005 + +struct SpellCallbackInfo +{ + sal_uInt16 nCommand; + String aWord; + LanguageType eLanguage; + + SpellCallbackInfo( sal_uInt16 nCMD, const String& rWord ) + : aWord( rWord ) + { + nCommand = nCMD; + eLanguage = LANGUAGE_DONTKNOW; + } + + SpellCallbackInfo( sal_uInt16 nCMD, LanguageType eLang ) + { + nCommand = nCMD; + eLanguage = eLang; + } +}; + +#endif // _EDITSTAT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/editund2.hxx b/include/editeng/editund2.hxx new file mode 100644 index 000000000000..2312aee93c79 --- /dev/null +++ b/include/editeng/editund2.hxx @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _EDITUND2_HXX +#define _EDITUND2_HXX + +#include "editeng/editengdllapi.h" +#include <svl/undo.hxx> + +class EditEngine; + +class EDITENG_DLLPRIVATE EditUndoManager : public SfxUndoManager +{ + using SfxUndoManager::Undo; + using SfxUndoManager::Redo; + + EditEngine* mpEditEngine; +public: + EditUndoManager(EditEngine* pEE); + + virtual sal_Bool Undo(); + virtual sal_Bool Redo(); +}; + +// ----------------------------------------------------------------------- +// EditUndo +// ------------------------------------------------------------------------ +class EDITENG_DLLPUBLIC EditUndo : public SfxUndoAction +{ +private: + sal_uInt16 nId; + EditEngine* mpEditEngine; + +public: + EditUndo(sal_uInt16 nI, EditEngine* pEE); + virtual ~EditUndo(); + + EditEngine* GetEditEngine(); + + virtual void Undo() = 0; + virtual void Redo() = 0; + + virtual sal_Bool CanRepeat(SfxRepeatTarget&) const; + virtual OUString GetComment() const; + virtual sal_uInt16 GetId() const; +}; + +#endif // _EDITUND2_HXX + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx new file mode 100644 index 000000000000..a2f5ce8a3d65 --- /dev/null +++ b/include/editeng/editview.hxx @@ -0,0 +1,247 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +// MyEDITVIEW, due to exported EditView +#ifndef _MyEDITVIEW_HXX +#define _MyEDITVIEW_HXX + +#include <com/sun/star/i18n/WordType.hpp> + +#include <rsc/rscsfx.hxx> +#include <i18nlangtag/lang.h> +#include <tools/color.hxx> +#include <tools/gen.hxx> + +class EditEngine; +class ImpEditEngine; +class ImpEditView; +class SvxSearchItem; +class SvxFieldItem; +class Window; +class Pointer; +class Cursor; +class KeyEvent; +class MouseEvent; +class DropEvent; +class CommandEvent; +class Rectangle; +class Link; +class Pair; +class Point; +class Range; +class SvStream; +class SvKeyValueIterator; +class SfxStyleSheet; +class Font; +class FontList; +class OutputDevice; + +#include <editeng/editdata.hxx> +#include <com/sun/star/uno/Reference.h> +#include "editeng/editengdllapi.h" + +namespace com { +namespace sun { +namespace star { +namespace datatransfer { + class XTransferable; +} +namespace linguistic2 { + class XSpellChecker1; + class XLanguageGuessing; +} +}}} + +class EDITENG_DLLPUBLIC EditView +{ + friend class EditEngine; + friend class ImpEditEngine; + friend class EditSelFunctionSet; + +public: // Needed for Undo + ImpEditView* GetImpEditView() const { return pImpEditView; } + ImpEditEngine* GetImpEditEngine() const; + +private: + ImpEditView* pImpEditView; + String aDicNameSingle; + + EDITENG_DLLPRIVATE EditView( const EditView& ); + EDITENG_DLLPRIVATE EditView& operator=( const EditView& ); + +public: + EditView( EditEngine* pEng, Window* pWindow ); + virtual ~EditView(); + + void SetEditEngine( EditEngine* pEditEngine ); + EditEngine* GetEditEngine() const; + + void SetWindow( Window* pWin ); + Window* GetWindow() const; + + void Paint( const Rectangle& rRect, OutputDevice* pTargetDevice = 0 ); + void Invalidate(); + Pair Scroll( long nHorzScroll, long nVertScroll, sal_uInt8 nRangeCheck = RGCHK_NEG ); + + void ShowCursor( sal_Bool bGotoCursor = sal_True, sal_Bool bForceVisCursor = sal_True ); + void HideCursor(); + + void SetSelectionMode( EESelectionMode eMode ); + + void SetReadOnly( sal_Bool bReadOnly ); + sal_Bool IsReadOnly() const; + + sal_Bool HasSelection() const; + ESelection GetSelection() const; + void SetSelection( const ESelection& rNewSel ); + sal_Bool SelectCurrentWord( sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ); + + sal_Bool IsInsertMode() const; + void SetInsertMode( sal_Bool bInsert ); + + void ReplaceSelected( const String& rStr ); + String GetSelected(); + void DeleteSelected(); + + sal_uInt16 GetSelectedScriptType() const; + + // VisArea position of the Output window. + // A size change also affects the VisArea + void SetOutputArea( const Rectangle& rRect ); + const Rectangle& GetOutputArea() const; + + // Document position. + // A size change also affects the VisArea + void SetVisArea( const Rectangle& rRect ); + const Rectangle& GetVisArea() const; + + const Pointer& GetPointer() const; + + Cursor* GetCursor() const; + + void InsertText( const String& rNew, sal_Bool bSelect = sal_False ); + + sal_Bool PostKeyEvent( const KeyEvent& rKeyEvent, Window* pFrameWin = NULL ); + + sal_Bool MouseButtonUp( const MouseEvent& rMouseEvent ); + sal_Bool MouseButtonDown( const MouseEvent& rMouseEvent ); + sal_Bool MouseMove( const MouseEvent& rMouseEvent ); + void Command( const CommandEvent& rCEvt ); + + void Cut(); + void Copy(); + void Paste(); + void PasteSpecial(); + + void Undo(); + void Redo(); + + // especially for Oliver Specht + Point GetWindowPosTopLeft( sal_uInt16 nParagraph ); + void MoveParagraphs( Range aParagraphs, sal_uInt16 nNewPos ); + void MoveParagraphs( long nDiff ); + + const SfxItemSet& GetEmptyItemSet(); + SfxItemSet GetAttribs(); + void SetAttribs( const SfxItemSet& rSet ); + void RemoveAttribs( sal_Bool bRemoveParaAttribs = sal_False, sal_uInt16 nWhich = 0 ); + void RemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich = 0 ); + void RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs = sal_False ); + + sal_uLong Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, sal_Bool bSelect = sal_False, SvKeyValueIterator* pHTTPHeaderAttrs = NULL ); + + void SetBackgroundColor( const Color& rColor ); + Color GetBackgroundColor() const; + + void SetControlWord( sal_uInt32 nWord ); + sal_uInt32 GetControlWord() const; + + EditTextObject* CreateTextObject(); + void InsertText( const EditTextObject& rTextObject ); + void InsertText( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > xDataObj, const String& rBaseURL, sal_Bool bUseSpecial ); + + ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > GetTransferable(); + + // An EditView, so that when TRUE the update will be free from flickering: + void SetEditEngineUpdateMode( sal_Bool bUpdate ); + void ForceUpdate(); + + const SfxStyleSheet* GetStyleSheet() const; + SfxStyleSheet* GetStyleSheet(); + + void SetAnchorMode( EVAnchorMode eMode ); + EVAnchorMode GetAnchorMode() const; + + void CompleteAutoCorrect( Window* pFrameWin = NULL ); + + EESpellState StartSpeller( sal_Bool bMultipleDoc = sal_False ); + EESpellState StartThesaurus(); + sal_uInt16 StartSearchAndReplace( const SvxSearchItem& rSearchItem ); + + // for text conversion + void StartTextConversion( LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc ); + sal_Bool HasConvertibleTextPortion( LanguageType nLang ); + + void TransliterateText( sal_Int32 nTransliterationMode ); + + sal_Bool IsCursorAtWrongSpelledWord( sal_Bool bMarkIfWrong = sal_False ); + sal_Bool IsWrongSpelledWordAtPos( const Point& rPosPixel, sal_Bool bMarkIfWrong = sal_False ); + void ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack = 0 ); + + void InsertField( const SvxFieldItem& rFld ); + const SvxFieldItem* GetFieldUnderMousePointer() const; + const SvxFieldItem* GetFieldUnderMousePointer( sal_uInt16& nPara, xub_StrLen& nPos ) const; + const SvxFieldItem* GetField( const Point& rPos, sal_uInt16* pnPara = NULL, xub_StrLen* pnPos = NULL ) const; + + const SvxFieldItem* GetFieldAtSelection() const; + + void SetInvalidateMore( sal_uInt16 nPixel ); + sal_uInt16 GetInvalidateMore() const; + + // grows or shrinks the font height for the current selection + void ChangeFontSize( bool bGrow, const FontList* pList ); + + static bool ChangeFontSize( bool bGrow, SfxItemSet& rSet, const FontList* pFontList ); + + String GetSurroundingText() const; + Selection GetSurroundingTextSelection() const; + + /** Tries to determine the language of 'rText', returning a matching known + locale if possible, or a fallback, or LANGUAGE_NONE if nothing found or + matched. + + @param bIsParaText + If TRUE, rText is a paragraph and the language is obtained by + passing the text to xLangGuess. + IF FALSE, a language match is tried for, in order, + 1. the default document language (non-CTL, non-CJK, aka LATIN) + 2. the UI language (Tools->Options->LanguageSettings->Languages User Interface) + 3. the locale (Tools->Options->LanguageSettings->Languages Locale) + 4. en-US + If nothing matched, LANGUAGE_NONE is returned. + */ + static LanguageType CheckLanguage( + const OUString &rText, + com::sun::star::uno::Reference< com::sun::star::linguistic2::XSpellChecker1 > xSpell, + com::sun::star::uno::Reference< com::sun::star::linguistic2::XLanguageGuessing > xLangGuess, + bool bIsParaText ); +}; + +#endif // _MyEDITVIEW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/edtdlg.hxx b/include/editeng/edtdlg.hxx new file mode 100644 index 000000000000..7c998dfa637b --- /dev/null +++ b/include/editeng/edtdlg.hxx @@ -0,0 +1,102 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _EDT_ABSTDLG_HXX +#define _EDT_ABSTDLG_HXX + +#include <tools/solar.h> +#include <tools/string.hxx> +#include <editeng/editengdllapi.h> +#include <i18nlangtag/lang.h> +#include <com/sun/star/uno/Reference.hxx> +#include <vcl/abstdlg.hxx> +#include <editeng/hangulhanja.hxx> + +namespace com { namespace sun { namespace star { namespace linguistic2 +{ + class XThesaurus; + class XHyphenator; +} } } } + +class Window; +class ResId; +class Link; +class SvxSpellWrapper; + +class AbstractThesaurusDialog : public VclAbstractDialog +{ +public: + virtual String GetWord() = 0; + virtual sal_uInt16 GetLanguage() const = 0; + virtual Window* GetWindow() = 0; +}; + +class AbstractHyphenWordDialog : public VclAbstractDialog +{ +public: + virtual void SelLeft() = 0; + virtual void SelRight() = 0; + virtual Window* GetWindow() = 0; +}; + +class AbstractHangulHanjaConversionDialog : public VclAbstractTerminatedDialog +{ + public: + virtual void EnableRubySupport( bool _bVal ) = 0; + virtual void SetByCharacter( bool _bByCharacter ) = 0; + virtual void SetConversionDirectionState( bool _bTryBothDirections, editeng::HangulHanjaConversion::ConversionDirection _ePrimaryConversionDirection ) = 0; + virtual void SetConversionFormat( editeng::HangulHanjaConversion::ConversionFormat _eType ) = 0; + virtual void SetOptionsChangedHdl( const Link& _rHdl ) = 0; + virtual void SetIgnoreHdl( const Link& _rHdl ) = 0; + virtual void SetIgnoreAllHdl( const Link& _rHdl ) = 0; + virtual void SetChangeHdl( const Link& _rHdl ) = 0; + virtual void SetChangeAllHdl( const Link& _rHdl ) = 0; + virtual void SetClickByCharacterHdl( const Link& _rHdl ) = 0; + virtual void SetConversionFormatChangedHdl( const Link& _rHdl ) = 0; + virtual void SetFindHdl( const Link& _rHdl ) = 0; + virtual bool GetUseBothDirections() const= 0; + virtual editeng::HangulHanjaConversion::ConversionDirection GetDirection( editeng::HangulHanjaConversion::ConversionDirection _eDefaultDirection ) const = 0; + virtual void SetCurrentString( + const String& _rNewString, + const ::com::sun::star::uno::Sequence< OUString >& _rSuggestions, + bool _bOriginatesFromDocument = true )=0; + virtual String GetCurrentString( ) const =0; + virtual editeng::HangulHanjaConversion::ConversionFormat GetConversionFormat( ) const =0; + virtual void FocusSuggestion( )= 0; + virtual String GetCurrentSuggestion( ) const =0; +}; + +class EDITENG_DLLPUBLIC EditAbstractDialogFactory : virtual public VclAbstractDialogFactory +{ +public: + virtual ~EditAbstractDialogFactory(); // needed for export of vtable + static EditAbstractDialogFactory* Create(); + virtual AbstractThesaurusDialog* CreateThesaurusDialog( Window*, ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XThesaurus > xThesaurus, + const String &rWord, sal_Int16 nLanguage ) = 0; + + virtual AbstractHyphenWordDialog* CreateHyphenWordDialog( Window*, + const String &rWord, LanguageType nLang, + ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenator > &xHyphen, + SvxSpellWrapper* pWrapper ) = 0; + virtual AbstractHangulHanjaConversionDialog * CreateHangulHanjaConversionDialog( Window* _pParent, + editeng::HangulHanjaConversion::ConversionDirection _ePrimaryDirection ) = 0; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/eedata.hxx b/include/editeng/eedata.hxx new file mode 100644 index 000000000000..1332c56f4a54 --- /dev/null +++ b/include/editeng/eedata.hxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _EEDATA_HXX +#define _EEDATA_HXX + +////////////////////////////////////////////////////////////////////////////// +// extended data definitions for EditEngine portion stripping (StripPortions() +// support). These may be mapped to some primitive definitions from Drawinglayer +// later. +#include <vector> + +namespace EEngineData +{ + // spell checking wrong vector containing the redlining data + class WrongSpellClass + { + public: + sal_uInt32 nStart; + sal_uInt32 nEnd; + + WrongSpellClass(sal_uInt32 nS, sal_uInt32 nE) : nStart(nS), nEnd(nE) {} + }; + + typedef std::vector< WrongSpellClass > WrongSpellVector; + + // text marking vector containing the EOC, EOW and EOS TEXT definitions + enum TextMarkingType + { + EndOfCaracter = 0, + EndOfWord = 1, + EndOfSentence = 2 + }; + + class TextMarkingClass + { + public: + TextMarkingType eType; + sal_uInt32 nIndex; + + TextMarkingClass(TextMarkingType eT, sal_uInt32 nI) : eType(eT), nIndex(nI) {} + }; + + typedef std::vector< TextMarkingClass > TextMarkingVector; + +} // end of namespace EditEngine + +#endif // _EEDATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/eeitem.hxx b/include/editeng/eeitem.hxx new file mode 100644 index 000000000000..04ce68ce1ef5 --- /dev/null +++ b/include/editeng/eeitem.hxx @@ -0,0 +1,97 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef EEITEM_HXX +#define EEITEM_HXX + +#include <svl/solar.hrc> + +#define EE_ITEMS_START (OWN_ATTR_VALUE_END+1) + +// Paragraph attributes: +#define EE_PARA_START (EE_ITEMS_START+0) +#define EE_PARA_WRITINGDIR (EE_ITEMS_START+0) +#define EE_PARA_XMLATTRIBS (EE_ITEMS_START+1) +#define EE_PARA_HANGINGPUNCTUATION (EE_ITEMS_START+2) +#define EE_PARA_FORBIDDENRULES (EE_ITEMS_START+3) +#define EE_PARA_ASIANCJKSPACING (EE_ITEMS_START+4) +#define EE_PARA_NUMBULLET (EE_ITEMS_START+5) +#define EE_PARA_HYPHENATE (EE_ITEMS_START+6) +#define EE_PARA_BULLETSTATE (EE_ITEMS_START+7) +#define EE_PARA_OUTLLRSPACE (EE_ITEMS_START+8) +#define EE_PARA_OUTLLEVEL (EE_ITEMS_START+9) +#define EE_PARA_BULLET (EE_ITEMS_START+10) +#define EE_PARA_LRSPACE (EE_ITEMS_START+11) +#define EE_PARA_ULSPACE (EE_ITEMS_START+12) +#define EE_PARA_SBL (EE_ITEMS_START+13) +#define EE_PARA_JUST (EE_ITEMS_START+14) +#define EE_PARA_TABS (EE_ITEMS_START+15) +#define EE_PARA_JUST_METHOD (EE_ITEMS_START+16) +#define EE_PARA_VER_JUST (EE_ITEMS_START+17) +#define EE_PARA_END (EE_ITEMS_START+17) + +// Character attributes: +#define EE_CHAR_START (EE_ITEMS_START+18) +#define EE_CHAR_COLOR (EE_ITEMS_START+18) +#define EE_CHAR_FONTINFO (EE_ITEMS_START+19) +#define EE_CHAR_FONTHEIGHT (EE_ITEMS_START+20) +#define EE_CHAR_FONTWIDTH (EE_ITEMS_START+21) +#define EE_CHAR_WEIGHT (EE_ITEMS_START+22) +#define EE_CHAR_UNDERLINE (EE_ITEMS_START+23) +#define EE_CHAR_STRIKEOUT (EE_ITEMS_START+24) +#define EE_CHAR_ITALIC (EE_ITEMS_START+25) +#define EE_CHAR_OUTLINE (EE_ITEMS_START+26) +#define EE_CHAR_SHADOW (EE_ITEMS_START+27) +#define EE_CHAR_ESCAPEMENT (EE_ITEMS_START+28) +#define EE_CHAR_PAIRKERNING (EE_ITEMS_START+29) +#define EE_CHAR_KERNING (EE_ITEMS_START+30) +#define EE_CHAR_WLM (EE_ITEMS_START+31) +#define EE_CHAR_LANGUAGE (EE_ITEMS_START+32) +#define EE_CHAR_LANGUAGE_CJK (EE_ITEMS_START+33) +#define EE_CHAR_LANGUAGE_CTL (EE_ITEMS_START+34) +#define EE_CHAR_FONTINFO_CJK (EE_ITEMS_START+35) +#define EE_CHAR_FONTINFO_CTL (EE_ITEMS_START+36) +#define EE_CHAR_FONTHEIGHT_CJK (EE_ITEMS_START+37) +#define EE_CHAR_FONTHEIGHT_CTL (EE_ITEMS_START+38) +#define EE_CHAR_WEIGHT_CJK (EE_ITEMS_START+39) +#define EE_CHAR_WEIGHT_CTL (EE_ITEMS_START+40) +#define EE_CHAR_ITALIC_CJK (EE_ITEMS_START+41) +#define EE_CHAR_ITALIC_CTL (EE_ITEMS_START+42) +#define EE_CHAR_EMPHASISMARK (EE_ITEMS_START+43) +#define EE_CHAR_RELIEF (EE_ITEMS_START+44) +#define EE_CHAR_RUBI_DUMMY (EE_ITEMS_START+45) +#define EE_CHAR_XMLATTRIBS (EE_ITEMS_START+46) +#define EE_CHAR_OVERLINE (EE_ITEMS_START+47) +#define EE_CHAR_END (EE_ITEMS_START+47) + + +#define EE_FEATURE_START (EE_ITEMS_START+48) +#define EE_FEATURE_TAB (EE_ITEMS_START+48) +#define EE_FEATURE_LINEBR (EE_ITEMS_START+49) +#define EE_FEATURE_NOTCONV (EE_ITEMS_START+50) +#define EE_FEATURE_FIELD (EE_ITEMS_START+51) +#define EE_FEATURE_END (EE_ITEMS_START+51) + +#define EE_ITEMS_END (EE_ITEMS_START+51) + +#define EDITITEMCOUNT ( EE_ITEMS_END - EE_ITEMS_START + 1 ) + +#endif // _EEITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/eeitemid.hxx b/include/editeng/eeitemid.hxx new file mode 100644 index 000000000000..8230387048ff --- /dev/null +++ b/include/editeng/eeitemid.hxx @@ -0,0 +1,129 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _EEITEMID_HXX +#define _EEITEMID_HXX + +#include <editeng/eeitem.hxx> + +#ifdef ITEMID_FONT +#undef ITEMID_FONT +#endif +#ifdef ITEMID_FONTHEIGHT +#undef ITEMID_FONTHEIGHT +#endif +#ifdef ITEMID_COLOR +#undef ITEMID_COLOR +#endif +#ifdef ITEMID_WEIGHT +#undef ITEMID_WEIGHT +#endif +#ifdef ITEMID_POSTURE +#undef ITEMID_POSTURE +#endif +#ifdef ITEMID_SHADOWED +#undef ITEMID_SHADOWED +#endif +#ifdef ITEMID_CONTOUR +#undef ITEMID_CONTOUR +#endif +#ifdef ITEMID_CROSSEDOUT +#undef ITEMID_CROSSEDOUT +#endif +#ifdef ITEMID_UNDERLINE +#undef ITEMID_UNDERLINE +#endif +#ifdef ITEMID_OVERLINE +#undef ITEMID_OVERLINE +#endif +#ifdef ITEMID_LANGUAGE +#undef ITEMID_LANGUAGE +#endif +#ifdef ITEMID_ADJUST +#undef ITEMID_ADJUST +#endif +#ifdef ITEMID_WORDLINEMODE +#undef ITEMID_WORDLINEMODE +#endif +#ifdef ITEMID_CHARSETCOLOR +#undef ITEMID_CHARSETCOLOR +#endif +#ifdef ITEMID_SEARCH +#undef ITEMID_SEARCH +#endif +#ifdef ITEMID_BRUSH +#undef ITEMID_BRUSH +#endif + +// Character Attributes.... +#define ITEMID_FONT EE_CHAR_FONTINFO +#define ITEMID_POSTURE EE_CHAR_ITALIC +#define ITEMID_WEIGHT EE_CHAR_WEIGHT +#define ITEMID_SHADOWED EE_CHAR_SHADOW +#define ITEMID_CONTOUR EE_CHAR_OUTLINE +#define ITEMID_CROSSEDOUT EE_CHAR_STRIKEOUT +#define ITEMID_UNDERLINE EE_CHAR_UNDERLINE +#define ITEMID_OVERLINE EE_CHAR_OVERLINE +#define ITEMID_FONTHEIGHT EE_CHAR_FONTHEIGHT +#define ITEMID_CHARSCALE_W EE_CHAR_FONTWIDTH +#define ITEMID_COLOR EE_CHAR_COLOR +#define ITEMID_WORDLINEMODE EE_CHAR_WLM +#define ITEMID_PROPSIZE 0 +#define ITEMID_CHARSETCOLOR 0 // EE_FEATURE_NOTCONV +#define ITEMID_CASEMAP 0 +#define ITEMID_LANGUAGE 0 +#define ITEMID_ESCAPEMENT EE_CHAR_ESCAPEMENT +#define ITEMID_NOLINEBREAK 0 +#define ITEMID_NOHYPHENHERE 0 +#define ITEMID_AUTOKERN EE_CHAR_PAIRKERNING +#define ITEMID_KERNING EE_CHAR_KERNING +#define ITEMID_EMPHASISMARK EE_CHAR_EMPHASISMARK +#define ITEMID_CHARRELIEF EE_CHAR_RELIEF + +// Paragraph Attributes +#define ITEMID_SCRIPTSPACE EE_PARA_ASIANCJKSPACING +#define ITEMID_ADJUST EE_PARA_JUST +#define ITEMID_LINESPACING EE_PARA_SBL +#define ITEMID_WIDOWS 0 +#define ITEMID_ORPHANS 0 +#define ITEMID_HYPHENZONE 0 + +#define ITEMID_TABSTOP EE_PARA_TABS + +#define ITEMID_PAPERBIN 0 +#define ITEMID_LRSPACE EE_PARA_LRSPACE +#define ITEMID_ULSPACE EE_PARA_ULSPACE +#define ITEMID_FRAMEDIR EE_PARA_WRITINGDIR +#define ITEMID_PRINT 0 +#define ITEMID_OPAQUE 0 +#define ITEMID_PROTECT 0 +#define ITEMID_BACKGROUND 0 +#define ITEMID_SHADOW 0 +#define ITEMID_MACRO 0 +#define ITEMID_BOX 0 +#define ITEMID_BOXINFO 0 +#define ITEMID_BRUSH 0 + +#define ITEMID_FIELD EE_FEATURE_FIELD + +#define ITEMID_SEARCH 0 + +#endif //_EEITEMID_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/eerdll.hxx b/include/editeng/eerdll.hxx new file mode 100644 index 000000000000..2d6ba34976fa --- /dev/null +++ b/include/editeng/eerdll.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _EERDLL_HXX +#define _EERDLL_HXX + +class GlobalEditData; + +#include <tools/resid.hxx> +#include <tools/shl.hxx> +#include <editeng/editengdllapi.h> + +class EDITENG_DLLPUBLIC EditResId: public ResId +{ +public: + EditResId( sal_uInt16 nId ); +}; + +class EditDLL +{ + ResMgr* pResMgr; + GlobalEditData* pGlobalData; + +public: + EditDLL(); + ~EditDLL(); + + ResMgr* GetResMgr() const { return pResMgr; } + GlobalEditData* GetGlobalData() const { return pGlobalData; } + static EditDLL& Get(); +}; + +#define EE_DLL() EditDLL::Get() + +#define EE_RESSTR(x) EditResId(x).toString() + +#endif //_EERDLL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/emphasismarkitem.hxx b/include/editeng/emphasismarkitem.hxx new file mode 100644 index 000000000000..1be4b0a7ce7d --- /dev/null +++ b/include/editeng/emphasismarkitem.hxx @@ -0,0 +1,73 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_EMPHITEM_HXX +#define _SVX_EMPHITEM_HXX + +#include <vcl/vclenum.hxx> +#include <svl/intitem.hxx> +#include <editeng/editengdllapi.h> + +class SvXMLUnitConverter; + +// class SvxEmphasisMarkItem ---------------------------------------------- + +/* [Description] + + This item describes the Font emphasis. +*/ + +class EDITENG_DLLPUBLIC SvxEmphasisMarkItem : public SfxUInt16Item +{ +public: + TYPEINFO(); + + SvxEmphasisMarkItem( const FontEmphasisMark eVal /*= EMPHASISMARK_NONE*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + SfxEnumItem + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, + const IntlWrapper * = 0 ) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + inline SvxEmphasisMarkItem& operator=(const SvxEmphasisMarkItem& rItem ) + { + SetValue( rItem.GetValue() ); + return *this; + } + + // enum cast + FontEmphasisMark GetEmphasisMark() const + { return (FontEmphasisMark)GetValue(); } + void SetEmphasisMark( FontEmphasisMark eNew ) + { SetValue( (sal_uInt16)eNew ); } +}; + +#endif // #ifndef _SVX_EMPHITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/escapementitem.hxx b/include/editeng/escapementitem.hxx new file mode 100644 index 000000000000..53fcb736f971 --- /dev/null +++ b/include/editeng/escapementitem.hxx @@ -0,0 +1,101 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_ESCPITEM_HXX +#define _SVX_ESCPITEM_HXX + +#include <svl/eitem.hxx> +#include <editeng/svxenum.hxx> +#include <editeng/editengdllapi.h> + +class SvXMLUnitConverter; + +// class SvxEscapementItem ----------------------------------------------- + +#define DFLT_ESC_SUPER 33 // 1/3 +#define DFLT_ESC_SUB -33 // also 1/3 previously 8/100 +#define DFLT_ESC_PROP 58 +#define DFLT_ESC_AUTO_SUPER 101 +#define DFLT_ESC_AUTO_SUB -101 + +/* [Description] + + This item describes the writing position. +*/ + +class EDITENG_DLLPUBLIC SvxEscapementItem : public SfxEnumItemInterface +{ + short nEsc; + sal_uInt8 nProp; +public: + TYPEINFO(); + + explicit SvxEscapementItem( const sal_uInt16 nId ); + SvxEscapementItem( const SvxEscapement eEscape, + const sal_uInt16 nId ); + SvxEscapementItem( const short nEsc, const sal_uInt8 nProp, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + + inline void SetEscapement( const SvxEscapement eNew ) + { + if( SVX_ESCAPEMENT_OFF == eNew ) + nEsc = 0, nProp = 100; + else + if( SVX_ESCAPEMENT_SUPERSCRIPT == eNew ) + nEsc = DFLT_ESC_SUPER, nProp = DFLT_ESC_PROP; + else + nEsc = DFLT_ESC_SUB, nProp = DFLT_ESC_PROP; + } + inline SvxEscapement GetEscapement() const { return static_cast< SvxEscapement >( GetEnumValue() ); } + + inline short &GetEsc() { return nEsc; } + inline short GetEsc() const { return nEsc; } + + inline sal_uInt8 &GetProp() { return nProp; } + inline sal_uInt8 GetProp() const { return nProp; } + + inline SvxEscapementItem& operator=(const SvxEscapementItem& rEsc) + { + nEsc = rEsc.GetEsc(); + nProp = rEsc.GetProp(); + return *this; + } + + virtual sal_uInt16 GetValueCount() const; + virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const; + virtual sal_uInt16 GetEnumValue() const; + virtual void SetEnumValue( sal_uInt16 nNewVal ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/fhgtitem.hxx b/include/editeng/fhgtitem.hxx new file mode 100644 index 000000000000..60f417428827 --- /dev/null +++ b/include/editeng/fhgtitem.hxx @@ -0,0 +1,103 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_FHGTITEM_HXX +#define _SVX_FHGTITEM_HXX + +#include <svl/poolitem.hxx> +#include <editeng/editengdllapi.h> + +class SvXMLUnitConverter; + +// class SvxFontHeightItem ----------------------------------------------- + +// Warning: twips values + +/* [Description] + + This item describes the font height +*/ + +#define FONTHEIGHT_16_VERSION ((sal_uInt16)0x0001) +#define FONTHEIGHT_UNIT_VERSION ((sal_uInt16)0x0002) + +class EDITENG_DLLPUBLIC SvxFontHeightItem : public SfxPoolItem +{ + sal_uInt32 nHeight; + sal_uInt16 nProp; // default 100% + SfxMapUnit ePropUnit; // Percent, Twip, ... +public: + TYPEINFO(); + + SvxFontHeightItem( const sal_uLong nSz /*= 240*/, const sal_uInt16 nPropHeight /*= 100*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual int operator==( const SfxPoolItem& ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nItemVersion) const; + virtual bool ScaleMetrics( long nMult, long nDiv ); + virtual bool HasMetrics() const; + + inline SvxFontHeightItem& operator=(const SvxFontHeightItem& rSize) + { + SetHeightValue( rSize.GetHeight() ); + SetProp( rSize.GetProp(), ePropUnit ); + return *this; + } + + void SetHeight( sal_uInt32 nNewHeight, const sal_uInt16 nNewProp = 100, + SfxMapUnit eUnit = SFX_MAPUNIT_RELATIVE ); + + void SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp, + SfxMapUnit eUnit, SfxMapUnit eCoreUnit ); + + sal_uInt32 GetHeight() const { return nHeight; } + + void SetHeightValue( sal_uInt32 nNewHeight ) + { + DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); + nHeight = nNewHeight; + } + + void SetProp( const sal_uInt16 nNewProp, + SfxMapUnit eUnit = SFX_MAPUNIT_RELATIVE ) + { + DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); + nProp = nNewProp; + ePropUnit = eUnit; + } + + sal_uInt16 GetProp() const { return nProp; } + + SfxMapUnit GetPropUnit() const { return ePropUnit; } // Percent, Twip, ... +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/fieldupdater.hxx b/include/editeng/fieldupdater.hxx new file mode 100644 index 000000000000..8ddab5ecf91e --- /dev/null +++ b/include/editeng/fieldupdater.hxx @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef __EDITENG_FIELDUPDATER_HXX__ +#define __EDITENG_FIELDUPDATER_HXX__ + +#include "editengdllapi.h" + +class EditTextObject; + +namespace editeng { + +class FieldUpdaterImpl; + +/** + * Wrapper for EditTextObject to handle updating of fields without exposing + * the internals of EditTextObject structure. + */ +class EDITENG_DLLPUBLIC FieldUpdater +{ + FieldUpdaterImpl* mpImpl; + + FieldUpdater(); // disabled +public: + FieldUpdater(EditTextObject& rObj); + FieldUpdater(const FieldUpdater& r); + ~FieldUpdater(); + + /** + * Set a new table ID to all table fields. + * + * @param nTab new table ID + */ + void updateTableFields(int nTab); +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/flditem.hxx b/include/editeng/flditem.hxx new file mode 100644 index 000000000000..37f42a37c217 --- /dev/null +++ b/include/editeng/flditem.hxx @@ -0,0 +1,420 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_FLDITEM_HXX +#define _SVX_FLDITEM_HXX + +#include <i18nlangtag/lang.h> +#include <tools/time.hxx> +#include <tools/date.hxx> +#include <svl/poolitem.hxx> +#include <tools/pstm.hxx> +#include "editeng/editengdllapi.h" + +#include <com/sun/star/text/textfield/Type.hpp> + +#include <boost/noncopyable.hpp> + +namespace com { namespace sun { namespace star { namespace text { + +class XTextContent; + +}}}} + +class SvNumberFormatter; +class MetaAction; + +// class SvxFieldItem --------------------------------------------------- + + + +class EDITENG_DLLPUBLIC SvxFieldData : public SvPersistBase +{ +public: + static const sal_Int32 UNKNOWN_FIELD; + + static SvxFieldData* Create(const com::sun::star::uno::Reference<com::sun::star::text::XTextContent>& xContent); + + SV_DECL_PERSIST1( SvxFieldData, SvPersistBase, com::sun::star::text::textfield::Type::UNSPECIFIED) + + SvxFieldData(); + virtual ~SvxFieldData(); + + virtual SvxFieldData* Clone() const; + virtual int operator==( const SvxFieldData& ) const; + + virtual MetaAction* createBeginComment() const; + virtual MetaAction* createEndComment() const; +}; + +/** + * This item stores a field (SvxFieldData). The field is controlled by or + * belongs to the item. The field itself is determined by a derivation from + * SvxFieldData (RTTI) + */ +class EDITENG_DLLPUBLIC SvxFieldItem : public SfxPoolItem +{ +private: + SvxFieldData* pField; + + EDITENG_DLLPRIVATE SvxFieldItem( SvxFieldData* pField, const sal_uInt16 nId ); + +public: + TYPEINFO(); + + SvxFieldItem( const SvxFieldData& rField, const sal_uInt16 nId ); + SvxFieldItem( const SvxFieldItem& rItem ); + ~SvxFieldItem(); + + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nVer ) const; + virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const; + + const SvxFieldData* GetField() const { return pField; } + static SvClassManager& GetClassManager(); +}; + +// ================================================================= +// The following are the derivatives of SvxFieldData ... +// ================================================================= + +enum SvxDateType { SVXDATETYPE_FIX, SVXDATETYPE_VAR }; +enum SvxDateFormat { SVXDATEFORMAT_APPDEFAULT = 0, // Set as in App + SVXDATEFORMAT_SYSTEM, // Set as in System + SVXDATEFORMAT_STDSMALL, + SVXDATEFORMAT_STDBIG, + SVXDATEFORMAT_A, // 13.02.96 + SVXDATEFORMAT_B, // 13.02.1996 + SVXDATEFORMAT_C, // 13.Feb 1996 + SVXDATEFORMAT_D, // 13.February 1996 + SVXDATEFORMAT_E, // Tue, 13.February 1996 + SVXDATEFORMAT_F // Tuesday, 13.February 1996 + }; + +class EDITENG_DLLPUBLIC SvxDateField : public SvxFieldData +{ + sal_uInt32 nFixDate; + SvxDateType eType; + SvxDateFormat eFormat; + +public: + SV_DECL_PERSIST1( SvxDateField, SvxFieldData, com::sun::star::text::textfield::Type::DATE ) + + SvxDateField(); + explicit SvxDateField( const Date& rDate, + SvxDateType eType = SVXDATETYPE_VAR, + SvxDateFormat eFormat = SVXDATEFORMAT_STDSMALL ); + + sal_uInt32 GetFixDate() const { return nFixDate; } + void SetFixDate( const Date& rDate ) { nFixDate = rDate.GetDate(); } + + SvxDateType GetType() const { return eType; } + void SetType( SvxDateType eTp ) { eType = eTp; } + + SvxDateFormat GetFormat() const { return eFormat; } + void SetFormat( SvxDateFormat eFmt ) { eFormat = eFmt; } + + // If eLanguage==LANGUAGE_DONTKNOW the language/country + // used in number formatter initialization is taken. + OUString GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLanguage ) const; + static OUString GetFormatted( Date& rDate, SvxDateFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage ); + + virtual SvxFieldData* Clone() const; + virtual int operator==( const SvxFieldData& ) const; + + virtual MetaAction* createBeginComment() const; +}; + + +enum SvxURLFormat { SVXURLFORMAT_APPDEFAULT = 0, // Set as in App + SVXURLFORMAT_URL, // Represent URL + SVXURLFORMAT_REPR // Constitute repraesentation + }; + +class EDITENG_DLLPUBLIC SvxURLField : public SvxFieldData +{ +private: + SvxURLFormat eFormat; + OUString aURL; // URL-Address + OUString aRepresentation; // What is shown + OUString aTargetFrame; // In what Frame + +public: + SV_DECL_PERSIST1( SvxURLField, SvxFieldData, com::sun::star::text::textfield::Type::URL ) + + SvxURLField(); + SvxURLField( const OUString& rURL, const OUString& rRepres, SvxURLFormat eFmt = SVXURLFORMAT_URL ); + + const OUString& GetURL() const { return aURL; } + void SetURL( const OUString& rURL ) { aURL = rURL; } + + const OUString& GetRepresentation() const { return aRepresentation; } + void SetRepresentation( const OUString& rRep ) { aRepresentation= rRep; } + + const OUString& GetTargetFrame() const { return aTargetFrame; } + void SetTargetFrame( const OUString& rFrm ) { aTargetFrame = rFrm; } + + SvxURLFormat GetFormat() const { return eFormat; } + void SetFormat( SvxURLFormat eFmt ) { eFormat = eFmt; } + + virtual SvxFieldData* Clone() const; + virtual int operator==( const SvxFieldData& ) const; + + virtual MetaAction* createBeginComment() const; +}; + +class EDITENG_DLLPUBLIC SvxPageField : public SvxFieldData +{ +public: + SV_DECL_PERSIST1( SvxPageField, SvxFieldData, com::sun::star::text::textfield::Type::PAGE ) + SvxPageField(); + + virtual SvxFieldData* Clone() const; + virtual int operator==( const SvxFieldData& ) const; + + virtual MetaAction* createBeginComment() const; +}; + +class EDITENG_DLLPUBLIC SvxPagesField : public SvxFieldData +{ +public: + SV_DECL_PERSIST1( SvxPagesField, SvxFieldData, com::sun::star::text::textfield::Type::PAGES ) + SvxPagesField(); + + virtual SvxFieldData* Clone() const; + virtual int operator==( const SvxFieldData& ) const; +}; + +class EDITENG_DLLPUBLIC SvxTimeField : public SvxFieldData +{ +public: + SV_DECL_PERSIST1( SvxTimeField, SvxFieldData, com::sun::star::text::textfield::Type::TIME ) + SvxTimeField(); + + virtual SvxFieldData* Clone() const; + virtual int operator==( const SvxFieldData& ) const; + + virtual MetaAction* createBeginComment() const; +}; + +class EDITENG_DLLPUBLIC SvxFileField : public SvxFieldData +{ +public: + SV_DECL_PERSIST1( SvxFileField, SvxFieldData, com::sun::star::text::textfield::Type::DOCINFO_TITLE ) + SvxFileField(); + + virtual SvxFieldData* Clone() const; + virtual int operator==( const SvxFieldData& ) const; +}; + +class EDITENG_DLLPUBLIC SvxTableField : public SvxFieldData +{ + int mnTab; +public: + SV_DECL_PERSIST1( SvxTableField, SvxFieldData, com::sun::star::text::textfield::Type::TABLE ) + SvxTableField(); + explicit SvxTableField(int nTab); + + void SetTab(int nTab); + int GetTab() const; + + virtual SvxFieldData* Clone() const; + virtual int operator==( const SvxFieldData& ) const; +}; + + +enum SvxTimeType { SVXTIMETYPE_FIX, SVXTIMETYPE_VAR }; +enum SvxTimeFormat { SVXTIMEFORMAT_APPDEFAULT = 0, // Set as in App + SVXTIMEFORMAT_SYSTEM, // Set as in System + SVXTIMEFORMAT_STANDARD, + SVXTIMEFORMAT_24_HM, // 13:49 + SVXTIMEFORMAT_24_HMS, // 13:49:38 + SVXTIMEFORMAT_24_HMSH, // 13:49:38.78 + SVXTIMEFORMAT_12_HM, // 01:49 + SVXTIMEFORMAT_12_HMS, // 01:49:38 + SVXTIMEFORMAT_12_HMSH, // 01:49:38.78 + SVXTIMEFORMAT_AM_HM, // 01:49 PM + SVXTIMEFORMAT_AM_HMS, // 01:49:38 PM + SVXTIMEFORMAT_AM_HMSH // 01:49:38.78 PM + }; + +class EDITENG_DLLPUBLIC SvxExtTimeField : public SvxFieldData +{ +private: + sal_uInt32 nFixTime; + SvxTimeType eType; + SvxTimeFormat eFormat; + +public: + SV_DECL_PERSIST1( SvxExtTimeField, SvxFieldData, com::sun::star::text::textfield::Type::EXTENDED_TIME ) + SvxExtTimeField(); + explicit SvxExtTimeField( const Time& rTime, + SvxTimeType eType = SVXTIMETYPE_VAR, + SvxTimeFormat eFormat = SVXTIMEFORMAT_STANDARD ); + + sal_uInt32 GetFixTime() const { return nFixTime; } + void SetFixTime( const Time& rTime ) { nFixTime = rTime.GetTime(); } + + SvxTimeType GetType() const { return eType; } + void SetType( SvxTimeType eTp ) { eType = eTp; } + + SvxTimeFormat GetFormat() const { return eFormat; } + void SetFormat( SvxTimeFormat eFmt ) { eFormat = eFmt; } + + // If eLanguage==LANGUAGE_DONTKNOW the language/country + // used in number formatter initialization is taken. + OUString GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLanguage ) const; + static OUString GetFormatted( Time& rTime, SvxTimeFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage ); + + virtual SvxFieldData* Clone() const; + virtual int operator==( const SvxFieldData& ) const; + + virtual MetaAction* createBeginComment() const; +}; + + +enum SvxFileType { SVXFILETYPE_FIX, SVXFILETYPE_VAR }; +enum SvxFileFormat { SVXFILEFORMAT_NAME_EXT = 0, // File name with Extension + SVXFILEFORMAT_FULLPATH, // full path + SVXFILEFORMAT_PATH, // only path + SVXFILEFORMAT_NAME // only file name + }; + + + +class EDITENG_DLLPUBLIC SvxExtFileField : public SvxFieldData +{ +private: + OUString aFile; + SvxFileType eType; + SvxFileFormat eFormat; + +public: + SV_DECL_PERSIST1( SvxExtFileField, SvxFieldData, com::sun::star::text::textfield::Type::EXTENDED_FILE ) + SvxExtFileField(); + explicit SvxExtFileField( const OUString& rString, + SvxFileType eType = SVXFILETYPE_VAR, + SvxFileFormat eFormat = SVXFILEFORMAT_FULLPATH ); + + OUString GetFile() const { return aFile; } + void SetFile( const OUString& rString ) { aFile = rString; } + + SvxFileType GetType() const { return eType; } + void SetType( SvxFileType eTp ) { eType = eTp; } + + SvxFileFormat GetFormat() const { return eFormat; } + void SetFormat( SvxFileFormat eFmt ) { eFormat = eFmt; } + + OUString GetFormatted() const; + + virtual SvxFieldData* Clone() const; + virtual int operator==( const SvxFieldData& ) const; +}; + + +enum SvxAuthorType { SVXAUTHORTYPE_FIX, SVXAUTHORTYPE_VAR }; +enum SvxAuthorFormat { SVXAUTHORFORMAT_FULLNAME = 0, // full name + SVXAUTHORFORMAT_NAME, // Only Last name + SVXAUTHORFORMAT_FIRSTNAME, // Only first name + SVXAUTHORFORMAT_SHORTNAME // Initials + }; + +class EDITENG_DLLPUBLIC SvxAuthorField : public SvxFieldData +{ +private: + OUString aName; + OUString aFirstName; + OUString aShortName; + SvxAuthorType eType; + SvxAuthorFormat eFormat; + +public: + SV_DECL_PERSIST1( SvxAuthorField, SvxFieldData, com::sun::star::text::textfield::Type::AUTHOR ) + SvxAuthorField(); + SvxAuthorField( + const OUString& rFirstName, + const OUString& rLastName, + const OUString& rShortName, + SvxAuthorType eType = SVXAUTHORTYPE_VAR, + SvxAuthorFormat eFormat = SVXAUTHORFORMAT_FULLNAME ); + + OUString GetName() const { return aName; } + void SetName( const OUString& rString ) { aName = rString; } + + OUString GetFirstName() const { return aFirstName; } + void SetFirstName( const OUString& rString ) { aFirstName = rString; } + + OUString GetShortName() const { return aShortName; } + void SetShortName( const OUString& rString ) { aShortName = rString; } + + SvxAuthorType GetType() const { return eType; } + void SetType( SvxAuthorType eTp ) { eType = eTp; } + + SvxAuthorFormat GetFormat() const { return eFormat; } + void SetFormat( SvxAuthorFormat eFmt ) { eFormat = eFmt; } + + OUString GetFormatted() const; + + virtual SvxFieldData* Clone() const; + virtual int operator==( const SvxFieldData& ) const; +}; + +/** this field is used as a placeholder for a header&footer in impress. The actual + value is stored at the page */ +class EDITENG_DLLPUBLIC SvxHeaderField : public SvxFieldData +{ +public: + SV_DECL_PERSIST1( SvxHeaderField, SvxFieldData, com::sun::star::text::textfield::Type::PRESENTATION_HEADER ) + SvxHeaderField(); + + virtual SvxFieldData* Clone() const; + virtual int operator==( const SvxFieldData& ) const; +}; + +/** this field is used as a placeholder for a header&footer in impress. The actual + value is stored at the page */ +class EDITENG_DLLPUBLIC SvxFooterField : public SvxFieldData +{ +public: + SV_DECL_PERSIST1( SvxFooterField, SvxFieldData, com::sun::star::text::textfield::Type::PRESENTATION_FOOTER ) + SvxFooterField(); + virtual SvxFieldData* Clone() const; + virtual int operator==( const SvxFieldData& ) const; +}; + +/** this field is used as a placeholder for a header&footer in impress. The actual + value is stored at the page */ +class EDITENG_DLLPUBLIC SvxDateTimeField : public SvxFieldData +{ +public: + SV_DECL_PERSIST1( SvxDateTimeField, SvxFieldData, com::sun::star::text::textfield::Type::PRESENTATION_DATE_TIME ) + SvxDateTimeField(); + + static OUString GetFormatted( Date& rDate, Time& rTime, int eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage ); + + virtual SvxFieldData* Clone() const; + virtual int operator==( const SvxFieldData& ) const; +}; + + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/flstitem.hxx b/include/editeng/flstitem.hxx new file mode 100644 index 000000000000..f298732e25e4 --- /dev/null +++ b/include/editeng/flstitem.hxx @@ -0,0 +1,70 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_FLSTITEM_HXX +#define _SVX_FLSTITEM_HXX + +#include <svl/poolitem.hxx> +#include <rtl/ustring.hxx> +#include <com/sun/star/uno/Sequence.h> +#include "editeng/editengdllapi.h" + +// class SvxFontListItem ------------------------------------------------- + +class FontList; + +/* + [Description] + + This item serves as a transport medium for a font list. The font list is + not copied and not deleted! +*/ + +class EDITENG_DLLPUBLIC SvxFontListItem : public SfxPoolItem +{ +private: + const FontList* pFontList; + com::sun::star::uno::Sequence< OUString > aFontNameSeq; + +public: + TYPEINFO(); + + SvxFontListItem( const FontList* pFontLst, + const sal_uInt16 nId ); + SvxFontListItem( const SvxFontListItem& rItem ); + + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + const FontList* GetFontList() const { return pFontList; } +}; + + + + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/fontitem.hxx b/include/editeng/fontitem.hxx new file mode 100644 index 000000000000..e9d14755906e --- /dev/null +++ b/include/editeng/fontitem.hxx @@ -0,0 +1,98 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_FONTITEM_HXX +#define _SVX_FONTITEM_HXX + +#include <svl/poolitem.hxx> +#include <tools/string.hxx> +#include <vcl/font.hxx> +#include "editeng/editengdllapi.h" + +class SvXMLUnitConverter; + +// class SvxFontItem ----------------------------------------------------- + +/* [Description] + + This item describes a Font. +*/ + +class EDITENG_DLLPUBLIC SvxFontItem : public SfxPoolItem +{ + String aFamilyName; + String aStyleName; + FontFamily eFamily; + FontPitch ePitch; + rtl_TextEncoding eTextEncoding; + + static sal_Bool bEnableStoreUnicodeNames; + +public: + TYPEINFO(); + + explicit SvxFontItem( const sal_uInt16 nId ); + SvxFontItem( const FontFamily eFam, const String& rFamilyName, + const String& rStyleName, + const FontPitch eFontPitch /*= PITCH_DONTKNOW*/, + const rtl_TextEncoding eFontTextEncoding /*= RTL_TEXTENCODING_DONTKNOW*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from 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; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + // Access methods: + void SetFamilyName( const String& rFamilyName ) { aFamilyName = rFamilyName; } + inline const String &GetFamilyName() const { return aFamilyName; } + + void SetStyleName(const String &rStyleName ) { aStyleName = rStyleName; } + inline const String &GetStyleName() const { return aStyleName; } + + void SetFamily( FontFamily _eFamily ) { eFamily = _eFamily; } + inline FontFamily GetFamily() const { return eFamily; } + + void SetPitch(FontPitch _ePitch ) { ePitch = _ePitch; } + inline FontPitch GetPitch() const { return ePitch; } + + void SetCharSet(rtl_TextEncoding _eEncoding) { eTextEncoding = _eEncoding; } + + inline rtl_TextEncoding GetCharSet() const { return eTextEncoding; } + + SvxFontItem& operator=(const SvxFontItem& rFont); + + static void EnableStoreUnicodeNames( sal_Bool bEnable ); + +}; + +EDITENG_DLLPUBLIC void GetDefaultFonts( SvxFontItem& rLatin, SvxFontItem& rAsian, + SvxFontItem& rComplex ); + +#endif // #ifndef _SVX_FONTITEM_HXX + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/forbiddencharacterstable.hxx b/include/editeng/forbiddencharacterstable.hxx new file mode 100644 index 000000000000..14556fd0ceda --- /dev/null +++ b/include/editeng/forbiddencharacterstable.hxx @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _FORBIDDENCHARACTERSTABLE_HXX +#define _FORBIDDENCHARACTERSTABLE_HXX + +#include <salhelper/simplereferenceobject.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/i18n/ForbiddenCharacters.hpp> +#include "editeng/editengdllapi.h" +#include <map> + +namespace com { +namespace sun { +namespace star { +namespace uno { + class XComponentContext; +}}}} + +class EDITENG_DLLPUBLIC SvxForbiddenCharactersTable : public salhelper::SimpleReferenceObject +{ +public: + typedef std::map<sal_uInt16, com::sun::star::i18n::ForbiddenCharacters> Map; +private: + Map maMap; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; + +public: + SvxForbiddenCharactersTable( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext); + ~SvxForbiddenCharactersTable() {} + + Map& GetMap() { return maMap; } + const com::sun::star::i18n::ForbiddenCharacters* GetForbiddenCharacters( sal_uInt16 nLanguage, sal_Bool bGetDefault ); + void SetForbiddenCharacters( sal_uInt16 nLanguage , const com::sun::star::i18n::ForbiddenCharacters& ); + void ClearForbiddenCharacters( sal_uInt16 nLanguage ); +}; + +#endif // _FORBIDDENCHARACTERSTABLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/forbiddenruleitem.hxx b/include/editeng/forbiddenruleitem.hxx new file mode 100644 index 000000000000..2d15a3d00bf3 --- /dev/null +++ b/include/editeng/forbiddenruleitem.hxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_FORBIDDENRULEITEM_HXX +#define _SVX_FORBIDDENRULEITEM_HXX + +#include <svl/eitem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxForbiddenRuleItem ----------------------------------------- + +/* [Description] + + This item describe how to handle the last character of a line. +*/ + +class EDITENG_DLLPUBLIC SvxForbiddenRuleItem : public SfxBoolItem +{ +public: + TYPEINFO(); + + SvxForbiddenRuleItem( sal_Bool bOn /*= sal_False*/, + const sal_uInt16 nId ); + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, + const IntlWrapper * = 0 ) const; + + inline SvxForbiddenRuleItem& operator=( + const SvxForbiddenRuleItem& rItem ) + { + SetValue( rItem.GetValue() ); + return *this; + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/formatbreakitem.hxx b/include/editeng/formatbreakitem.hxx new file mode 100644 index 000000000000..229e1d05f55f --- /dev/null +++ b/include/editeng/formatbreakitem.hxx @@ -0,0 +1,90 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_BRKITEM_HXX +#define _SVX_BRKITEM_HXX + +#include <svl/eitem.hxx> +#include <editeng/svxenum.hxx> +#include <editeng/editengdllapi.h> + + +// class SvxFmtBreakItem ------------------------------------------------- + +/* [Description] + + This item Describes a wrap-attribute + Automatic?, Page or column break, before or after? +*/ +#define FMTBREAK_NOAUTO ((sal_uInt16)0x0001) + +class EDITENG_DLLPUBLIC SvxFmtBreakItem : public SfxEnumItem +{ +public: + TYPEINFO(); + + inline SvxFmtBreakItem( const SvxBreak eBrk /*= SVX_BREAK_NONE*/, + const sal_uInt16 nWhich ); + inline SvxFmtBreakItem( const SvxFmtBreakItem& rBreak ); + inline SvxFmtBreakItem& operator=( const SvxFmtBreakItem& rCpy ); + + // "pure virtual Methods" from SfxPoolItem + virtual int operator==( const SfxPoolItem& ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; + virtual SfxPoolItem* Create( SvStream&, sal_uInt16 ) const; + virtual sal_uInt16 GetValueCount() const; + + // MS VC4.0 messes things up + void SetValue( sal_uInt16 nNewVal ) + {SfxEnumItem::SetValue(nNewVal); } + SvxBreak GetBreak() const { return SvxBreak( GetValue() ); } + void SetBreak( const SvxBreak eNew ) + { SetValue( (sal_uInt16)eNew ); } +}; + + +inline SvxFmtBreakItem::SvxFmtBreakItem( const SvxBreak eBreak, + const sal_uInt16 _nWhich ) : + SfxEnumItem( _nWhich, (sal_uInt16)eBreak ) +{} + +inline SvxFmtBreakItem::SvxFmtBreakItem( const SvxFmtBreakItem& rBreak ) : + SfxEnumItem( rBreak ) +{} + +inline SvxFmtBreakItem& SvxFmtBreakItem::operator=( + const SvxFmtBreakItem& rBreak ) +{ + SetValue( rBreak.GetValue() ); + return *this; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/frmdir.hxx b/include/editeng/frmdir.hxx new file mode 100644 index 000000000000..f687c32c5610 --- /dev/null +++ b/include/editeng/frmdir.hxx @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SVX_FRMDIR_HXX +#define _SVX_FRMDIR_HXX + +// ---------------------------------------------------------------------------- + +/** Defines possible text directions in frames. */ +enum SvxFrameDirection +{ + /** Horizontal, from left to right, from top to bottom + (typical for western languages). */ + FRMDIR_HORI_LEFT_TOP, + + /** Horizontal, from right to left, from top to bottom + (typical for ararbic/hebrew languages). */ + FRMDIR_HORI_RIGHT_TOP, + + /** Vertical, from top to bottom, from right to left + (typical for asian languages). */ + FRMDIR_VERT_TOP_RIGHT, + + /** Vertical, from top to bottom, from left to right + (typical for mongol language). */ + FRMDIR_VERT_TOP_LEFT, + + /** Use the value from the environment, can only be used in frames. */ + FRMDIR_ENVIRONMENT +}; + +// ---------------------------------------------------------------------------- + +#endif // #ifndef _SVX_FRMDIR_HXX + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/frmdiritem.hxx b/include/editeng/frmdiritem.hxx new file mode 100644 index 000000000000..6ea04dc66f09 --- /dev/null +++ b/include/editeng/frmdiritem.hxx @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_FRMDIRITEM_HXX +#define _SVX_FRMDIRITEM_HXX + +#include <svl/intitem.hxx> +#include <editeng/frmdir.hxx> +#include <editeng/editengdllapi.h> + +// class SvxFrameDirectionItem ---------------------------------------------- + +/* [Description] + + This item defines a frame direction, which place the content inside + a frame. It exist different kind of directions which are used to the + layout text for Western, CJK and CTL languages. +*/ + +class EDITENG_DLLPUBLIC SvxFrameDirectionItem : public SfxUInt16Item +{ +public: + TYPEINFO(); + + SvxFrameDirectionItem( SvxFrameDirection nValue /*= FRMDIR_HORI_LEFT_TOP*/, + sal_uInt16 nWhich ); + virtual ~SvxFrameDirectionItem(); + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream & rStrm, sal_uInt16 nIVer) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; + virtual int operator==( const SfxPoolItem& ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, + const IntlWrapper * = 0 ) const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + inline SvxFrameDirectionItem& operator=( const SvxFrameDirectionItem& rItem ) + { + SetValue( rItem.GetValue() ); + return *this; + } +}; + +#endif // #ifndef _SVX_FRMDIRITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/fwdtitem.hxx b/include/editeng/fwdtitem.hxx new file mode 100644 index 000000000000..73f897ffc06d --- /dev/null +++ b/include/editeng/fwdtitem.hxx @@ -0,0 +1,98 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_FWDTITEM_HXX +#define _SVX_FWDTITEM_HXX + +#include <svl/poolitem.hxx> + + +// class SvxFontWidthItem ----------------------------------------------- + + +/* [Description] + + This item describes the font width. +*/ + +class SvxFontWidthItem : public SfxPoolItem +{ + sal_uInt16 nWidth; // 0 = default + sal_uInt16 nProp; // default 100% +public: + TYPEINFO(); + + SvxFontWidthItem( const sal_uInt16 nSz /*= 0*/, + const sal_uInt16 nPropWidth /*= 100*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual int operator==( const SfxPoolItem& ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + virtual bool ScaleMetrics( long nMult, long nDiv ); + virtual bool HasMetrics() const; + + inline SvxFontWidthItem& operator=(const SvxFontWidthItem& rItem ) + { + SetWidthValue( rItem.GetWidth() ); + SetProp( rItem.GetProp() ); + return *this; + } + + void SetWidth( sal_uInt16 nNewWidth, const sal_uInt16 nNewProp = 100 ) + { + DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); + nWidth = sal_uInt16(( (sal_uInt32)nNewWidth * nNewProp ) / 100 ); + nProp = nNewProp; + } + + sal_uInt16 GetWidth() const { return nWidth; } + + void SetWidthValue( sal_uInt16 nNewWidth ) + { + DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); + nWidth = nNewWidth; + } + + void SetProp( const sal_uInt16 nNewProp ) + { + DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); + nProp = nNewProp; + } + + sal_uInt16 GetProp() const { return nProp; } +}; + + + + + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/hangulhanja.hxx b/include/editeng/hangulhanja.hxx new file mode 100644 index 000000000000..014dc3e229a9 --- /dev/null +++ b/include/editeng/hangulhanja.hxx @@ -0,0 +1,288 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SVX_HANGUL_HANJA_CONVERSION_HXX +#define SVX_HANGUL_HANJA_CONVERSION_HXX + +#include <vcl/window.hxx> +#include <memory> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/Locale.hpp> +#include <com/sun/star/uno/Sequence.hxx> +#include "editeng/editengdllapi.h" +#include <i18nlangtag/mslangid.hxx> + +//............................................................................. +namespace editeng +{ +//............................................................................. + + class HangulHanjaConversion_Impl; + + //========================================================================= + //= HangulHanjaConversion + //========================================================================= + /** encapsulates Hangul-Hanja conversion functionality + + <p>terminology: + <ul><li>A <b>text <em>portion</em></b> is some (potentially large) piece of text + which is to be analyzed for convertible sub-strings.</li> + <li>A <b>text <em>unit</em></b> is a sub string in a text portion, which is + to be converted as a whole.</li> + </ul> + For instance, you could have two independent selections within your document, which are then + two text portions. A text unit would be single Hangul/Hanja words within a portion, or even + single Hangul syllabills when "replace by character" is enabled. + </p> + */ + class EDITENG_DLLPUBLIC HangulHanjaConversion + { + friend class HangulHanjaConversion_Impl; + + public: + enum ReplacementAction + { + eExchange, // simply exchange one text with another + eReplacementBracketed, // keep the original, and put the replacement in brackets after it + eOriginalBracketed, // replace the original text, but put it in brackeds after the replacement + eReplacementAbove, // keep the original, and put the replacement text as ruby text above it + eOriginalAbove, // replace the original text, but put it as ruby text above it + eReplacementBelow, // keep the original, and put the replacement text as ruby text below it + eOriginalBelow // replace the original text, but put it as ruby text below it + }; + + enum ConversionType // does not specify direction... + { + eConvHangulHanja, // Korean Hangul/Hanja conversion + eConvSimplifiedTraditional // Chinese simplified / Chinese traditional conversion + }; + + // Note: conversion direction for eConvSimplifiedTraditional is + // specified by source language. + // This one is for Hangul/Hanja where source and target language + // are the same. + enum ConversionDirection + { + eHangulToHanja, + eHanjaToHangul + }; + + enum ConversionFormat + { + eSimpleConversion, // used for simplified / traditional Chinese as well + eHangulBracketed, + eHanjaBracketed, + eRubyHanjaAbove, + eRubyHanjaBelow, + eRubyHangulAbove, + eRubyHangulBelow + }; + + private: + SAL_WNODEPRECATED_DECLARATIONS_PUSH + ::std::auto_ptr< HangulHanjaConversion_Impl > m_pImpl; + SAL_WNODEPRECATED_DECLARATIONS_POP + + // used to set initial values of m_pImpl object from saved ones + static bool m_bUseSavedValues; // defines if the followng two values should be used for initialization + static bool m_bTryBothDirectionsSave; + static ConversionDirection m_ePrimaryConversionDirectionSave; + + // Forbidden and not implemented. + HangulHanjaConversion (const HangulHanjaConversion &); + HangulHanjaConversion & operator= (const HangulHanjaConversion &); + + public: + HangulHanjaConversion( + Window* _pUIParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, + const ::com::sun::star::lang::Locale& _rSourceLocale, + const ::com::sun::star::lang::Locale& _rTargetLocale, + const Font* _pTargetFont, + sal_Int32 nOptions, + bool _bIsInteractive + ); + + virtual ~HangulHanjaConversion( ); + + // converts the whole document + void ConvertDocument(); + + LanguageType GetSourceLanguage() const; + LanguageType GetTargetLanguage() const; + const Font * GetTargetFont() const; + sal_Int32 GetConversionOptions() const; + bool IsInteractive() const; + + // chinese text conversion + static inline bool IsSimplified( LanguageType nLang ); + static inline bool IsTraditional( LanguageType nLang ); + static inline bool IsChinese( LanguageType nLang ); + + // used to specify that the conversion direction states from the + // last incarnation should be used as + // initial conversion direction for the next incarnation. + // (A hack used to transport a state information from + // one incarnation to the next. Used in Writers text conversion...) + static void SetUseSavedConversionDirectionState( bool bVal ); + static bool IsUseSavedConversionDirectionState(); + + protected: + /** retrieves the next text portion which is to be analyzed + + <p>pseudo-abstract, needs to be overridden</p> + + @param _rNextPortion + upon return, this must contain the next text portion + @param _rLangOfPortion + upon return, this must contain the language for the found text portion. + (necessary for Chinese translation since there are 5 language variants + too look for even if the 'source' language usually is only 'simplified' + or 'traditional'.) + */ + virtual void GetNextPortion( + OUString& /* [out] */ _rNextPortion, + LanguageType& /* [out] */ _rLangOfPortion, + bool /* [in] */ _bAllowImplicitChangesForNotConvertibleText ) = 0; + + /** announces a new "current unit" + + <p>This will be called whenever it is necessary to interactively ask the user for + a conversion. In such a case, a range within the current portion (see <member>GetNextPortion</member>) + is presented to the user for chosing a substitution. Additionally, this method is called, + so that derived classes can e.g. highlight this text range in a document view.</p> + + <p>Note that the indexes are relative to the most recent replace action. See + <member>ReplaceUnit</member> for details.</p> + + @param _nUnitStart + the start index of the unit + + @param _nUnitEnd + the start index (exclusively!) of the unit. + + @param _bAllowImplicitChangesForNotConvertibleText + allows implicit changes other than the text itself for the + text parts not being convertible. + Used for chinese translation to attribute all not convertible + text (e.g. western text, empty paragraphs, spaces, ...) to + the target language and target font of the conversion. + This is to ensure that after the conversion any new text entered + anywhere in the document will have the target language (of course + CJK Language only) and target font (CJK font only) set. + + @see GetNextPortion + */ + virtual void HandleNewUnit( const sal_Int32 _nUnitStart, const sal_Int32 _nUnitEnd ) = 0; + + /** replaces a text unit within a text portion with a new text + + <p>pseudo-abstract, needs to be overridden</p> + + <p>Note an important thing about the indicies: They are always relative to the <em>previous + call</em> of ReplaceUnit. This means whe you get a call to ReplaceUnit, and replace some text + in your document, than you have to remember the document position immediately <em>behind</em> + the changed text. In a next call to ReplaceUnit, an index of <em>0</em> will denote exactly + this position behind the previous replacement<br/> + The reaons for this is that this class here does not know anything about your document structure, + so after a replacement took place, it's impossible to address anything in the range from the + beginning of the portion up to the replaced text.<br/> + In the very first call to ReplaceUnit, an index of <em>0</em> denotes the very first position of + the current portion.</p> + + <p>If the language of the text to be replaced is different from + the target language (as given by 'GetTargetLanguage') for example + when converting simplified Chinese from/to traditional Chinese + the language attribute of the new text has to be changed as well, + **and** the font is to be set to the default (document) font for + that language.</p> + + @param _nUnitStart + the start index of the range to replace + + @param _nUnitEnd + the end index (exclusively!) of the range to replace. E.g., an index + pair (4,5) indicates a range of length 1. + + @param _rOrigText + the original text to be replaced (as returned by GetNextPortion). + Since in Chinese conversion the original text is needed as well + in order to only do the minimal necassry text changes and to keep + as much attributes as possible this is supplied here as well. + + @param _rReplaceWith + The replacement text + + @param _rOffsets + An sequence matching the indices (characters) of _rReplaceWith + to the indices of the characters in the original text they are + replacing. + This is necessary since some portions of the text may get + converted in portions of different length than the original. + The sequence will be empty if all conversions in the text are + of equal length. That is if always the character at index i in + _rOffsets is replacing the character at index i in the original + text for all valid index values of i. + + @param _eAction + replacement action to take + + @param pNewUnitLanguage + if the replacement unit is required to have a new language that + is specified here. If the language is to be left unchanged this + is the 0 pointer. + */ + virtual void ReplaceUnit( + const sal_Int32 _nUnitStart, const sal_Int32 _nUnitEnd, + const OUString& _rOrigText, + const OUString& _rReplaceWith, + const ::com::sun::star::uno::Sequence< sal_Int32 > &_rOffsets, + ReplacementAction _eAction, + LanguageType *pNewUnitLanguage + ) = 0; + + /** specifies if rubies are supported by the document implementing + this class. + + @return + <TRUE/> if rubies are supported. + */ + virtual bool HasRubySupport() const = 0; + }; + + bool HangulHanjaConversion::IsSimplified( LanguageType nLang ) + { + return MsLangId::isSimplifiedChinese(nLang); + } + + bool HangulHanjaConversion::IsTraditional( LanguageType nLang ) + { + return MsLangId::isTraditionalChinese(nLang); + } + + bool HangulHanjaConversion::IsChinese( LanguageType nLang ) + { + return MsLangId::isChinese(nLang); + } +//............................................................................. +} // namespace svx +//............................................................................. + +#endif // SVX_HANGUL_HANJA_CONVERSION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/hngpnctitem.hxx b/include/editeng/hngpnctitem.hxx new file mode 100644 index 000000000000..4454faab0b76 --- /dev/null +++ b/include/editeng/hngpnctitem.hxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_HNGPNCTITEM_HXX +#define _SVX_HNGPNCTITEM_HXX + +#include <svl/eitem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxHangingPunctuationItem ----------------------------------------- + +/* [Description] + + This item describe how to handle the last character of a line. +*/ + +class EDITENG_DLLPUBLIC SvxHangingPunctuationItem : public SfxBoolItem +{ +public: + TYPEINFO(); + + SvxHangingPunctuationItem( sal_Bool bOn /*= sal_False*/, + const sal_uInt16 nId ); + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, + const IntlWrapper * = 0 ) const; + + inline SvxHangingPunctuationItem& operator=( + const SvxHangingPunctuationItem& rItem ) + { + SetValue( rItem.GetValue() ); + return *this; + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/hyphenzoneitem.hxx b/include/editeng/hyphenzoneitem.hxx new file mode 100644 index 000000000000..3f0682096772 --- /dev/null +++ b/include/editeng/hyphenzoneitem.hxx @@ -0,0 +1,93 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_HYZNITEM_HXX +#define _SVX_HYZNITEM_HXX + +#include <svl/poolitem.hxx> +#include <editeng/editengdllapi.h> + +class SvXMLUnitConverter; + +// class SvxHyphenZoneItem ----------------------------------------------- + +/* [Description] + + This item describes a hyphenation attribute (automatic?, number of + characters at the end of the line and start). +*/ + +class EDITENG_DLLPUBLIC SvxHyphenZoneItem : public SfxPoolItem +{ + sal_Bool bHyphen: 1; + sal_Bool bPageEnd: 1; + sal_uInt8 nMinLead; + sal_uInt8 nMinTrail; + sal_uInt8 nMaxHyphens; + + friend SvStream & operator<<( SvStream & aS, SvxHyphenZoneItem & ); + +public: + TYPEINFO(); + + SvxHyphenZoneItem( const sal_Bool bHyph /*= sal_False*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual int operator==( const SfxPoolItem& ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; + + inline void SetHyphen( const sal_Bool bNew ) { bHyphen = bNew; } + inline sal_Bool IsHyphen() const { return bHyphen; } + + inline void SetPageEnd( const sal_Bool bNew ) { bPageEnd = bNew; } + inline sal_Bool IsPageEnd() const { return bPageEnd; } + + inline sal_uInt8 &GetMinLead() { return nMinLead; } + inline sal_uInt8 GetMinLead() const { return nMinLead; } + + inline sal_uInt8 &GetMinTrail() { return nMinTrail; } + inline sal_uInt8 GetMinTrail() const { return nMinTrail; } + + inline sal_uInt8 &GetMaxHyphens() { return nMaxHyphens; } + inline sal_uInt8 GetMaxHyphens() const { return nMaxHyphens; } + + inline SvxHyphenZoneItem &operator=( const SvxHyphenZoneItem &rNew ) + { + bHyphen = rNew.IsHyphen(); + bPageEnd = rNew.IsPageEnd(); + nMinLead = rNew.GetMinLead(); + nMinTrail = rNew.GetMinTrail(); + nMaxHyphens = rNew.GetMaxHyphens(); + return *this; + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/itemtype.hxx b/include/editeng/itemtype.hxx new file mode 100644 index 000000000000..422cb3b9e22e --- /dev/null +++ b/include/editeng/itemtype.hxx @@ -0,0 +1,64 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_ITEMTYPE_HXX +#define _SVX_ITEMTYPE_HXX + +#include <editeng/editrids.hrc> +#include <editeng/eerdll.hxx> + +// forward --------------------------------------------------------------- +#include <tools/string.hxx> +#include <tools/resid.hxx> +#include <tools/bigint.hxx> +#include <svl/poolitem.hxx> +#include <tools/shl.hxx> +#include "editeng/editengdllapi.h" + +class Color; +class IntlWrapper; +// static and prototypes ------------------------------------------------- + +static const sal_Unicode cpDelim[] = { ',' , ' ', '\0' }; + +EDITENG_DLLPUBLIC String GetSvxString( sal_uInt16 nId ); +EDITENG_DLLPUBLIC String GetMetricText( long nVal, SfxMapUnit eSrcUnit, SfxMapUnit eDestUnit, const IntlWrapper * pIntl ); +String GetColorString( const Color& rCol ); +EDITENG_DLLPUBLIC sal_uInt16 GetMetricId( SfxMapUnit eUnit ); + +// ----------------------------------------------------------------------- + +inline String GetBoolString( sal_Bool bVal ) +{ + return EE_RESSTR(bVal ? RID_SVXITEMS_TRUE : RID_SVXITEMS_FALSE); +} + +// ----------------------------------------------------------------------- + +inline long Scale( long nVal, long nMult, long nDiv ) +{ + BigInt aVal( nVal ); + aVal *= nMult; + aVal += nDiv/2; + aVal /= nDiv; + return aVal; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/justifyitem.hxx b/include/editeng/justifyitem.hxx new file mode 100644 index 000000000000..cfbdcff00a65 --- /dev/null +++ b/include/editeng/justifyitem.hxx @@ -0,0 +1,119 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef __EDITENG_JUSTIFYITEM_HXX__ +#define __EDITENG_JUSTIFYITEM_HXX__ + +#include "editeng/editengdllapi.h" +#include "editeng/svxenum.hxx" +#include <svl/eitem.hxx> +#include <sal/types.h> + +class EDITENG_DLLPUBLIC SvxHorJustifyItem: public SfxEnumItem +{ +public: + TYPEINFO(); + + explicit SvxHorJustifyItem( const sal_uInt16 nId ); + + SvxHorJustifyItem( + const SvxCellHorJustify eJustify /*= SVX_HOR_JUSTIFY_STANDARD*/, + const sal_uInt16 nId ); + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + virtual sal_uInt16 GetValueCount() const; + virtual String GetValueText( sal_uInt16 nVal ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const; + + inline SvxHorJustifyItem& operator=(const SvxHorJustifyItem& rHorJustify) + { + SetValue( rHorJustify.GetValue() ); + return *this; + } +}; + +//------------------------------------------------------------------------ + +class EDITENG_DLLPUBLIC SvxVerJustifyItem: public SfxEnumItem +{ +public: + TYPEINFO(); + + explicit SvxVerJustifyItem( const sal_uInt16 nId ); + + SvxVerJustifyItem( + const SvxCellVerJustify eJustify /*= SVX_VER_JUSTIFY_STANDARD*/, + const sal_uInt16 nId ); + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + virtual sal_uInt16 GetValueCount() const; + virtual String GetValueText( sal_uInt16 nVal ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const; + + inline SvxVerJustifyItem& operator=(const SvxVerJustifyItem& rVerJustify) + { + SetValue( rVerJustify.GetValue() ); + return *this; + } +}; + +//------------------------------------------------------------------------ + +class EDITENG_DLLPUBLIC SvxJustifyMethodItem: public SfxEnumItem +{ +public: + SvxJustifyMethodItem( + const SvxCellJustifyMethod eMethod, + const sal_uInt16 nId ); + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + virtual sal_uInt16 GetValueCount() const; + virtual String GetValueText( sal_uInt16 nVal ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const; + + SvxJustifyMethodItem& operator=(const SvxJustifyMethodItem& r); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/keepitem.hxx b/include/editeng/keepitem.hxx new file mode 100644 index 000000000000..57e8fe022af4 --- /dev/null +++ b/include/editeng/keepitem.hxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_KEEPITEM_HXX +#define _SVX_KEEPITEM_HXX + +#include <svl/eitem.hxx> +#include <editeng/editengdllapi.h> + + +// class SvxFmtKeepItem ------------------------------------------------ + +/* [Description] + + This item describes a logical variable "keep paragraphs together?". +*/ + +class EDITENG_DLLPUBLIC SvxFmtKeepItem : public SfxBoolItem +{ +public: + TYPEINFO(); + + inline SvxFmtKeepItem( const sal_Bool bKeep /*= sal_False*/, + const sal_uInt16 _nWhich ); + inline SvxFmtKeepItem& operator=( const SvxFmtKeepItem& rSplit ); + + // "pure virtual Methods" from SfxPoolItem + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create( SvStream&, sal_uInt16 ) const; + virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; +}; + +inline SvxFmtKeepItem::SvxFmtKeepItem( const sal_Bool bKeep, const sal_uInt16 _nWhich ) : + SfxBoolItem( _nWhich, bKeep ) +{} + +inline SvxFmtKeepItem& SvxFmtKeepItem::operator=( const SvxFmtKeepItem& rKeep ) +{ + SetValue( rKeep.GetValue() ); + return *this; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/kernitem.hxx b/include/editeng/kernitem.hxx new file mode 100644 index 000000000000..1b5f937afc01 --- /dev/null +++ b/include/editeng/kernitem.hxx @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_KERNITEM_HXX +#define _SVX_KERNITEM_HXX + +#include <svl/intitem.hxx> +#include <editeng/editengdllapi.h> + +class SvXMLUnitConverter; + +// class SvxKerningItem -------------------------------------------------- + +// Note: Twips value +// Twips: 0 = no kerning + +/* [Description] + + This item describes the kerning. +*/ + +class EDITENG_DLLPUBLIC SvxKerningItem : public SfxInt16Item +{ +public: + TYPEINFO(); + + SvxKerningItem( const short nKern /*= 0*/, const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + virtual bool ScaleMetrics( long nMult, long nDiv ); + virtual bool HasMetrics() const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + inline SvxKerningItem& operator=(const SvxKerningItem& rKern) { + SetValue( rKern.GetValue() ); + return *this; + } + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/langitem.hxx b/include/editeng/langitem.hxx new file mode 100644 index 000000000000..e1231cded21c --- /dev/null +++ b/include/editeng/langitem.hxx @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_LANGITEM_HXX +#define _SVX_LANGITEM_HXX + +#include <svl/eitem.hxx> +#include <i18nlangtag/lang.h> +#include <editeng/editengdllapi.h> + +class SvXMLUnitConverter; + +// class SvxLanguageItem ------------------------------------------------- + +/* [Description] + + This item describes a Language. +*/ + +class EDITENG_DLLPUBLIC SvxLanguageItem : public SfxEnumItem +{ +public: + TYPEINFO(); + + SvxLanguageItem( const LanguageType eLang /*= LANGUAGE_GERMAN*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + virtual sal_uInt16 GetValueCount() const; + + inline SvxLanguageItem& operator=(const SvxLanguageItem& rLang) + { + SetValue( rLang.GetValue() ); + return *this; + } + + // enum cast + LanguageType GetLanguage() const + { return (LanguageType)GetValue(); } + void SetLanguage( const LanguageType eLang ) + { SetValue( (sal_uInt16)eLang ); } + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/lcolitem.hxx b/include/editeng/lcolitem.hxx new file mode 100644 index 000000000000..5b97c52d6c6d --- /dev/null +++ b/include/editeng/lcolitem.hxx @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_LCOLITEM_HXX +#define _SVX_LCOLITEM_HXX + +#include <editeng/colritem.hxx> +#include <editeng/editengdllapi.h> + +/* + * Dummy item for ToolBox controller: + * + */ + +class EDITENG_DLLPUBLIC SvxLineColorItem : public SvxColorItem +{ +public: + TYPEINFO(); + + explicit SvxLineColorItem( const sal_uInt16 nId ); + SvxLineColorItem( const SvxLineColorItem& rCopy ); + ~SvxLineColorItem(); + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, + const IntlWrapper * pIntlWrapper = 0 ) + const; + + inline SvxLineColorItem& operator=(const SvxLineColorItem& rColor) + { return (SvxLineColorItem&)SvxColorItem:: + operator=((const SvxColorItem&)rColor); } + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/lineitem.hxx b/include/editeng/lineitem.hxx new file mode 100644 index 000000000000..07ad4da38bc5 --- /dev/null +++ b/include/editeng/lineitem.hxx @@ -0,0 +1,75 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_BOLNITEM_HXX +#define _SVX_BOLNITEM_HXX + +#include <svl/poolitem.hxx> +#include "editeng/editengdllapi.h" + + + +// class SvxLineItem ----------------------------------------------------- + + +/* +[Description] +This Item transports a editeng::SvxBorderLine. +*/ + +namespace editeng { + class SvxBorderLine; +} + +class EDITENG_DLLPUBLIC SvxLineItem : public SfxPoolItem +{ +public: + TYPEINFO(); + + explicit SvxLineItem( const sal_uInt16 nId ); + SvxLineItem( const SvxLineItem& rCpy ); + ~SvxLineItem(); + SvxLineItem &operator=( const SvxLineItem& rLine ); + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; + virtual bool ScaleMetrics( long nMult, long nDiv ); + virtual bool HasMetrics() const; + + const editeng::SvxBorderLine* GetLine () const { return pLine; } + void SetLine ( const editeng::SvxBorderLine *pNew ); + +private: + editeng::SvxBorderLine* pLine; +}; + + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/lrspitem.hxx b/include/editeng/lrspitem.hxx new file mode 100644 index 000000000000..a7e95ccb6e63 --- /dev/null +++ b/include/editeng/lrspitem.hxx @@ -0,0 +1,165 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_LRSPITEM_HXX +#define _SVX_LRSPITEM_HXX + +#include <svl/poolitem.hxx> +#include <editeng/editengdllapi.h> + + +// class SvxLRSpaceItem -------------------------------------------------- + +/* [Description] + + Left/Right margin and first line indent + + SvxLRSpaceItem offers two interfaces for views from the left margin and + first line indent. The get methods return the member, with the layout also + as expected: the left edge shifts to the negative first line indent to the + left. The SetTxt/Gettxt methods assume that the left side represents the + 0 coordinate for the first line indent: + + UI UI LAYOUT UI/TEXT UI/TEXT (Where?) + SetTxtLeft SetTxtFirst GetLeft GetTxtLeft GetTxtFirst (What?) + 500 -500 0 500 -500 (How much?) + 500 0 500 500 0 + 500 +500 500 500 +500 + 700 -500 200 700 -500 +*/ + +#define LRSPACE_16_VERSION ((sal_uInt16)0x0001) +#define LRSPACE_TXTLEFT_VERSION ((sal_uInt16)0x0002) +#define LRSPACE_AUTOFIRST_VERSION ((sal_uInt16)0x0003) +#define LRSPACE_NEGATIVE_VERSION ((sal_uInt16)0x0004) + +class EDITENG_DLLPUBLIC SvxLRSpaceItem : public SfxPoolItem +{ + short nFirstLineOfst; // First-line indent _always_ relative to nTxtLeft + long nTxtLeft; // We spend a sal_uInt16 + long nLeftMargin; // nLeft or the negative first-line indent + long nRightMargin; // The unproblematic right edge + + sal_uInt16 nPropFirstLineOfst, nPropLeftMargin, nPropRightMargin; + sal_Bool bAutoFirst : 1; // Automatic calculation of the first line indent + + void AdjustLeft(); // nLeftMargin and nTxtLeft are being adjusted. + +public: + TYPEINFO(); + + explicit SvxLRSpaceItem( const sal_uInt16 nId ); + SvxLRSpaceItem( const long nLeft, const long nRight, + const long nTLeft /*= 0*/, const short nOfset /*= 0*/, + const sal_uInt16 nId ); + inline SvxLRSpaceItem& operator=( const SvxLRSpaceItem &rCpy ); + + // "pure virtual Methods" from SfxPoolItem + virtual int operator==( const SfxPoolItem& ) const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; + virtual bool ScaleMetrics( long nMult, long nDiv ); + virtual bool HasMetrics() const; + + // Die "Layout-Schnittstelle": + inline void SetLeft ( const long nL, const sal_uInt16 nProp = 100 ); + inline void SetRight( const long nR, const sal_uInt16 nProp = 100 ); + + // Query/direct setting of the absolute values + inline long GetLeft() const { return nLeftMargin; } + inline long GetRight() const { return nRightMargin;} + inline void SetLeftValue( const long nL ) { nTxtLeft = nLeftMargin = nL; } + inline void SetRightValue( const long nR ) { nRightMargin = nR; } + inline sal_Bool IsAutoFirst() const { return bAutoFirst; } + inline void SetAutoFirst( const sal_Bool bNew ) { bAutoFirst = bNew; } + + // Query/Setting the percentage values + inline void SetPropLeft( const sal_uInt16 nProp = 100 ) + { nPropLeftMargin = nProp; } + inline void SetPropRight( const sal_uInt16 nProp = 100 ) + { nPropRightMargin = nProp;} + inline sal_uInt16 GetPropLeft() const { return nPropLeftMargin; } + inline sal_uInt16 GetPropRight() const { return nPropRightMargin;} + + // The UI/text interface: + inline void SetTxtLeft( const long nL, const sal_uInt16 nProp = 100 ); + inline long GetTxtLeft() const { return nTxtLeft; } + + inline void SetTxtFirstLineOfst( const short nF, const sal_uInt16 nProp = 100 ); + inline short GetTxtFirstLineOfst() const { return nFirstLineOfst; } + inline void SetPropTxtFirstLineOfst( const sal_uInt16 nProp = 100 ) + { nPropFirstLineOfst = nProp; } + inline sal_uInt16 GetPropTxtFirstLineOfst() const + { return nPropFirstLineOfst; } + inline void SetTxtFirstLineOfstValue( const short nValue ) + { nFirstLineOfst = nValue; } +}; + +inline SvxLRSpaceItem &SvxLRSpaceItem::operator=( const SvxLRSpaceItem &rCpy ) +{ + nFirstLineOfst = rCpy.nFirstLineOfst; + nTxtLeft = rCpy.nTxtLeft; + nLeftMargin = rCpy.nLeftMargin; + nRightMargin = rCpy.nRightMargin; + nPropFirstLineOfst = rCpy.nPropFirstLineOfst; + nPropLeftMargin = rCpy.nPropLeftMargin; + nPropRightMargin = rCpy.nPropRightMargin; + bAutoFirst = rCpy.bAutoFirst; + return *this; +} + +inline void SvxLRSpaceItem::SetLeft( const long nL, const sal_uInt16 nProp ) +{ + nLeftMargin = (nL * nProp) / 100; + nTxtLeft = nLeftMargin; + nPropLeftMargin = nProp; +} +inline void SvxLRSpaceItem::SetRight( const long nR, const sal_uInt16 nProp ) +{ + nRightMargin = (nR * nProp) / 100; + nPropRightMargin = nProp; +} +inline void SvxLRSpaceItem::SetTxtFirstLineOfst( const short nF, + const sal_uInt16 nProp ) +{ + nFirstLineOfst = short((long(nF) * nProp ) / 100); + nPropFirstLineOfst = nProp; + AdjustLeft(); +} + +inline void SvxLRSpaceItem::SetTxtLeft( const long nL, const sal_uInt16 nProp ) +{ + nTxtLeft = (nL * nProp) / 100; + nPropLeftMargin = nProp; + AdjustLeft(); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/lspcitem.hxx b/include/editeng/lspcitem.hxx new file mode 100644 index 000000000000..de0a163e34e6 --- /dev/null +++ b/include/editeng/lspcitem.hxx @@ -0,0 +1,107 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_LSPCITEM_HXX +#define _SVX_LSPCITEM_HXX + +#include <svl/eitem.hxx> +#include <editeng/svxenum.hxx> +#include <editeng/editengdllapi.h> + +class SvXMLUnitConverter; + +// class SvxLineSpacingItem ---------------------------------------------- + +/* [Description] + This item describes the distance between the lines. +*/ + +#define LINE_SPACE_DEFAULT_HEIGHT 200 +class EDITENG_DLLPUBLIC SvxLineSpacingItem : public SfxEnumItemInterface +{ + friend SvStream& operator<<( SvStream&, SvxLineSpacingItem& ); //$ ostream + + short nInterLineSpace; + sal_uInt16 nLineHeight; + sal_uInt8 nPropLineSpace; + SvxLineSpace eLineSpace; + SvxInterLineSpace eInterLineSpace; + +public: + TYPEINFO(); + + // The writer relies on a default height of 200! Actually, I would + // initialize all values to 0, but who can ignore the consequences in + // writer? => Rather have a crooked vales as the default, but the + // programmer sees that there's something special happening. + + SvxLineSpacingItem( sal_uInt16 nHeight /*= LINE_SPACE_DEFAULT_HEIGHT*/, const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual int operator==( const SfxPoolItem& ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; + + // Methods to query and edit. InterlineSpace is added to the height. + inline short GetInterLineSpace() const { return nInterLineSpace; } + inline void SetInterLineSpace( const short nSpace ) + { + nInterLineSpace = nSpace; + eInterLineSpace = SVX_INTER_LINE_SPACE_FIX; + } + + // Determines the absolute or minimum row height. + inline sal_uInt16 GetLineHeight() const { return nLineHeight; } + inline void SetLineHeight( const sal_uInt16 nHeight ) + { + nLineHeight = nHeight; + eLineSpace = SVX_LINE_SPACE_MIN; + } + + // To increase or decrease the row height. + sal_uInt8 GetPropLineSpace() const { return nPropLineSpace; } + inline void SetPropLineSpace( const sal_uInt8 nProp ) + { + nPropLineSpace = nProp; + eInterLineSpace = SVX_INTER_LINE_SPACE_PROP; + } + + inline SvxLineSpace &GetLineSpaceRule() { return eLineSpace; } + inline SvxLineSpace GetLineSpaceRule() const { return eLineSpace; } + + inline SvxInterLineSpace &GetInterLineSpaceRule() { return eInterLineSpace; } + inline SvxInterLineSpace GetInterLineSpaceRule() const { return eInterLineSpace; } + + virtual sal_uInt16 GetValueCount() const; + virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const; + virtual sal_uInt16 GetEnumValue() const; + virtual void SetEnumValue( sal_uInt16 nNewVal ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/macros.hxx b/include/editeng/macros.hxx new file mode 100644 index 000000000000..c667cfd6e8b8 --- /dev/null +++ b/include/editeng/macros.hxx @@ -0,0 +1,17 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef __EDITENGINE_MACROS_HXX__ +#define __EDITENGINE_MACROS_HXX__ + +#define DEBUG_EDIT_ENGINE 0 + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/measfld.hxx b/include/editeng/measfld.hxx new file mode 100644 index 000000000000..040560397dd0 --- /dev/null +++ b/include/editeng/measfld.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _EDIT_MEASFIELD_HXX +#define _EDIT_MEASFIELD_HXX + +#include <editeng/eeitem.hxx> + +#ifndef _FLDITEM_HXX +#ifndef ITEMID_FIELD +#include <editeng/editdata.hxx> /* this include is needed due to EE_FEATURE_FIELD */ +#define ITEMID_FIELD EE_FEATURE_FIELD /* is needed for #include <editeng/flditem.hxx> */ +#endif +#include <editeng/flditem.hxx> +#endif +#include "editeng/editengdllapi.h" + +#include <com/sun/star/text/textfield/Type.hpp> + +class SdrMeasureObj; + +enum SdrMeasureFieldKind {SDRMEASUREFIELD_VALUE,SDRMEASUREFIELD_UNIT,SDRMEASUREFIELD_ROTA90BLANCS}; + +class EDITENG_DLLPUBLIC SdrMeasureField: public SvxFieldData { + SdrMeasureFieldKind eMeasureFieldKind; +public: + SV_DECL_PERSIST1(SdrMeasureField,SvxFieldData,com::sun::star::text::textfield::Type::MEASURE) + SdrMeasureField(): eMeasureFieldKind(SDRMEASUREFIELD_VALUE) {} + SdrMeasureField(SdrMeasureFieldKind eNewKind): eMeasureFieldKind(eNewKind) {} + virtual ~SdrMeasureField(); + virtual SvxFieldData* Clone() const; + virtual int operator==(const SvxFieldData&) const; + SdrMeasureFieldKind GetMeasureFieldKind() const { return eMeasureFieldKind; } + void SetMeasureFieldKind(SdrMeasureFieldKind eNewKind) { eMeasureFieldKind=eNewKind; } +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +#endif //_SVDFIELD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/memberids.hrc b/include/editeng/memberids.hrc new file mode 100644 index 000000000000..1dbe7ba9da5f --- /dev/null +++ b/include/editeng/memberids.hrc @@ -0,0 +1,185 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _EDT_UNOMID_HXX +#define _EDT_UNOMID_HXX + +#include <svl/memberid.hrc> + +#define MID_LOCATION 0x3c +#define MID_TRANSPARENT 0x4b +#define MID_BG_COLOR 0x22 +#define MID_FLAGS 0x2e +#define MID_DISTANCE 0x29 +#define MID_FG_COLOR 0x2c +#define MID_OUTER_WIDTH 0x41 +#define MID_INNER_WIDTH 0x35 +#define MID_LINESPACE 0x3b +#define MID_LINE_STYLE 0x90 + + +//NameOrIndex +#define MID_NAME 16 +#define MID_GRAFURL 32 + +// SvxPageModelItem +#define MID_AUTO 1 + +// SvxTabStop +#define MID_TABSTOPS 0 +#define MID_STD_TAB 1 + +//SvxHyphenZoneItem +#define MID_IS_HYPHEN 0 +#define MID_HYPHEN_MIN_LEAD 1 +#define MID_HYPHEN_MIN_TRAIL 2 +#define MID_HYPHEN_MAX_HYPHENS 3 + +// SvxBoxInfoItem +#define MID_HORIZONTAL 1 +#define MID_VERTICAL 2 +#define MID_VALIDFLAGS 4 + +//AdjustItem +#define MID_PARA_ADJUST 0 +#define MID_LAST_LINE_ADJUST 1 +#define MID_EXPAND_SINGLE 2 + +//SvxFontItem +// Don't use 0 as it used for the whole struct +#define MID_FONT_FAMILY_NAME 1 +#define MID_FONT_STYLE_NAME 2 +#define MID_FONT_FAMILY 3 +#define MID_FONT_CHAR_SET 4 +#define MID_FONT_PITCH 5 + +// SvxCharReliefItem +#define MID_RELIEF 0 + +//SvxCharRotateItem +#define MID_ROTATE 0 +#define MID_FITTOLINE 1 + +//SvxExcapementItem +#define MID_ESC 0 +#define MID_ESC_HEIGHT 1 +#define MID_AUTO_ESC 2 + +//SvxFontWidthItem +#define MID_FONTWIDTH 0 +#define MID_FONTWIDTH_PROP 1 + +//SvxFontHeightItem +#define MID_FONTHEIGHT 1 +#define MID_FONTHEIGHT_PROP 2 +#define MID_FONTHEIGHT_DIFF 3 + +//SvxTextLineItem +#define MID_TEXTLINED 0 +#define MID_TL_STYLE 1 +#define MID_TL_COLOR 2 +#define MID_TL_HASCOLOR 3 + +//SvxCrossedOutItem +#define MID_CROSSED_OUT 0 +#define MID_CROSS_OUT 1 + +//SvxPostureItem +#define MID_ITALIC 0 +#define MID_POSTURE 1 + +//SvxBoolItem +#define MID_BOLD 0 +#define MID_WEIGHT 1 + +//SvxLanguageItem +#define MID_LANG_INT 0 +#define MID_LANG_LOCALE 1 + +//SvxEmphasisMarkItem +#define MID_EMPHASIS 0 + +//SvxTwoLinesItem +#define MID_TWOLINES 0 +#define MID_START_BRACKET 1 +#define MID_END_BRACKET 2 + +//ULSpaceItem +#define MID_UP_MARGIN 3 +#define MID_LO_MARGIN 4 +#define MID_UP_REL_MARGIN 5 +#define MID_LO_REL_MARGIN 6 +#define MID_CTX_MARGIN 7 + +//LRSpaceItem +#define MID_L_MARGIN 4 +#define MID_R_MARGIN 5 +#define MID_L_REL_MARGIN 6 +#define MID_R_REL_MARGIN 7 +#define MID_FIRST_LINE_INDENT 8 +#define MID_FIRST_LINE_REL_INDENT 9 +#define MID_FIRST_AUTO 10 +#define MID_TXT_LMARGIN 11 + +//ProtectItem +#define MID_PROTECT_CONTENT 0 +#define MID_PROTECT_SIZE 1 +#define MID_PROTECT_POSITION 2 + +//SvxBoxItem +#define LEFT_BORDER 1 +#define RIGHT_BORDER 2 +#define TOP_BORDER 3 +#define BOTTOM_BORDER 4 +#define BORDER_DISTANCE 5 +#define LEFT_BORDER_DISTANCE 6 +#define RIGHT_BORDER_DISTANCE 7 +#define TOP_BORDER_DISTANCE 8 +#define BOTTOM_BORDER_DISTANCE 9 +#define MID_LEFT_BORDER 10 +#define MID_RIGHT_BORDER 11 +#define MID_TOP_BORDER 12 +#define MID_BOTTOM_BORDER 13 +#define LINE_STYLE 14 +#define LINE_WIDTH 15 + +//BrushItem +#define MID_BACK_COLOR 0 +#define MID_GRAPHIC_POSITION 1 +#define MID_GRAPHIC_LINK 2 +#define MID_GRAPHIC 3 +#define MID_GRAPHIC_TRANSPARENT 4 +#define MID_GRAPHIC_URL 5 +#define MID_GRAPHIC_FILTER 6 +#define MID_GRAPHIC_REPEAT 7 +#define MID_GRAPHIC_TRANSPARENCY 8 +#define MID_BACK_COLOR_R_G_B 9 +#define MID_BACK_COLOR_TRANSPARENCY 10 + +//SvxFmtBreakItem +#define MID_BREAK_BEFORE 0 +#define MID_BREAK_AFTER 1 + +// SvxHorJustifyItem +#define MID_HORJUST_HORJUST 0 +#define MID_HORJUST_ADJUST 1 + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/mutxhelp.hxx b/include/editeng/mutxhelp.hxx new file mode 100644 index 000000000000..14b36347b74d --- /dev/null +++ b/include/editeng/mutxhelp.hxx @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SVX_MUTXHELP_HXX +#define _SVX_MUTXHELP_HXX + +#include <osl/mutex.hxx> + +class SvxMutexHelper +{ +private: + ::osl::Mutex maMutex; + +public: + ::osl::Mutex& getMutex() { return maMutex; } +}; + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/nhypitem.hxx b/include/editeng/nhypitem.hxx new file mode 100644 index 000000000000..51942c318bbd --- /dev/null +++ b/include/editeng/nhypitem.hxx @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_NHYPITEM_HXX +#define _SVX_NHYPITEM_HXX + +#include <svl/eitem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxNoHyphenItem ------------------------------------------------- +class EDITENG_DLLPUBLIC SvxNoHyphenItem : public SfxBoolItem +{ +public: + TYPEINFO(); + + SvxNoHyphenItem( const sal_Bool bHyphen /*= sal_True*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + inline SvxNoHyphenItem& operator=(const SvxNoHyphenItem& rNHH) + { + SetValue( rNHH.GetValue() ); + return *this; + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/nlbkitem.hxx b/include/editeng/nlbkitem.hxx new file mode 100644 index 000000000000..209b0539ba07 --- /dev/null +++ b/include/editeng/nlbkitem.hxx @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_NLBKITEM_HXX +#define _SVX_NLBKITEM_HXX + +#include <svl/eitem.hxx> +#include "editeng/editengdllapi.h" + +// class SvxNoLinebreakItem ---------------------------------------------- +class EDITENG_DLLPUBLIC SvxNoLinebreakItem : public SfxBoolItem +{ +public: + TYPEINFO(); + + SvxNoLinebreakItem( const sal_Bool bBreak /*= sal_True*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + inline SvxNoLinebreakItem& operator=(const SvxNoLinebreakItem& rLB) + { + SetValue( rLB.GetValue() ); + return *this; + } +}; + + + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/numdef.hxx b/include/editeng/numdef.hxx new file mode 100644 index 000000000000..28f94d2d3ae5 --- /dev/null +++ b/include/editeng/numdef.hxx @@ -0,0 +1,23 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#define SVX_MAX_NUM 10 // max. possible numbering level +#define SVX_DEF_BULLET (0xF000 + 149)// Character for lists + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx new file mode 100644 index 000000000000..9f88e79de0ec --- /dev/null +++ b/include/editeng/numitem.hxx @@ -0,0 +1,356 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_NUMITEM_HXX +#define _SVX_NUMITEM_HXX + +#include <tools/link.hxx> +#include <tools/string.hxx> +#include <svl/poolitem.hxx> +#include <editeng/svxenum.hxx> +#include <tools/gen.hxx> +#include <editeng/numdef.hxx> +#include <tools/color.hxx> +#include <cppuhelper/weakref.hxx> +#include <com/sun/star/lang/Locale.hpp> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/style/NumberingType.hpp> +#include <unotools/fontcvt.hxx> +#include <editeng/editengdllapi.h> + +class SvxBrushItem; +class Font; +class Graphic; +class SvxNodeNum; +namespace com{namespace sun{ namespace star{ + namespace text{ + class XNumberingFormatter; + } +}}} + +// ----------------------------------------------------------------------- +//Feature-Flags (only sal_uInt16!) +#define NUM_CONTINUOUS 0x0001 // consecutive numbers possible? +#define NUM_CHAR_TEXT_DISTANCE 0x0002 // Distance Symbol<->Text? +#define NUM_CHAR_STYLE 0x0004 // Character styles? +#define NUM_BULLET_REL_SIZE 0x0008 // relative bullet size? +#define NUM_BULLET_COLOR 0x0010 // Bullet color +#define NUM_SYMBOL_ALIGNMENT 0x0040 // alignment to be shown in the options +#define NUM_NO_NUMBERS 0x0080 // Numbering are not allowed +#define NUM_ENABLE_LINKED_BMP 0x0100 // linked bitmaps are available +#define NUM_ENABLE_EMBEDDED_BMP 0x0200 // embedded bitmaps are available + +#define SVX_NO_NUM 200 // Marker for no numbering +#define SVX_NO_NUMLEVEL 0x20 + +#define LINK_TOKEN 0x80 //indicate linked bitmaps - for use in dialog only +class EDITENG_DLLPUBLIC SvxNumberType +{ + static sal_Int32 nRefCount; + static com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter> xFormatter; + + sal_Int16 nNumType; + sal_Bool bShowSymbol; // Also show Symbol ? + +public: + explicit SvxNumberType(sal_Int16 nType = com::sun::star::style::NumberingType::ARABIC); + SvxNumberType(const SvxNumberType& rType); + ~SvxNumberType(); + + String GetNumStr( sal_uLong nNo ) const; + String GetNumStr( sal_uLong nNo, const com::sun::star::lang::Locale& rLocale ) const; + + void SetNumberingType(sal_Int16 nSet) {nNumType = nSet;} + sal_Int16 GetNumberingType() const {return nNumType;} + + void SetShowSymbol(sal_Bool bSet) {bShowSymbol = bSet;} + sal_Bool IsShowSymbol()const{return bShowSymbol;} + + sal_Bool IsTxtFmt() const + { + return com::sun::star::style::NumberingType::NUMBER_NONE != nNumType && + com::sun::star::style::NumberingType::CHAR_SPECIAL != nNumType && + com::sun::star::style::NumberingType::BITMAP != nNumType; + } +}; + +class EDITENG_DLLPUBLIC SvxNumberFormat : public SvxNumberType +{ +public: + enum SvxNumPositionAndSpaceMode + { + LABEL_WIDTH_AND_POSITION, + LABEL_ALIGNMENT + }; + enum LabelFollowedBy + { + LISTTAB, + SPACE, + NOTHING + }; + +private: + OUString sPrefix; + OUString sSuffix; + + SvxAdjust eNumAdjust; + + sal_uInt8 nInclUpperLevels; // Take over numbers from the previous level. + sal_uInt16 nStart; // Start of counting + + sal_Unicode cBullet; // Symbol + sal_uInt16 nBulletRelSize; // percentage size of bullets + Color nBulletColor; // Bullet color + + // mode indicating, if the position and spacing of the list label is + // determined by the former attributes (nFirstLineOffset, nAbsLSpace, + // nLSpace and nCharTextDistance) called position and spacing via label + // width and position (LABEL_WIDTH_AND_POSITION) or by the new attributes + // (meLabelFollowedBy, mnListtabPos, mnFirstLineIndent and mnIndentAt) + // called position and spacing via label alignment. + // Note 1: Attribute <eNumAdjust> is relevant for both modes. + // Note 2: The values of the former attributes are treated as 0, if mode + // LABEL_ALIGNMENT is active. + SvxNumPositionAndSpaceMode mePositionAndSpaceMode; + + short nFirstLineOffset; // First line indent + short nAbsLSpace; // Distance Border<->Number + short nLSpace; // relative to the previous indentation + short nCharTextDistance; // Distance Number<->Text + + // specifies what follows the list label before the text of the first line + // of the list item starts + LabelFollowedBy meLabelFollowedBy; + // specifies an additional list tab stop position for meLabelFollowedBy = LISTTAB + long mnListtabPos; + // specifies the first line indent + long mnFirstLineIndent; + // specifies the indent before the text, e.g. in L2R-layout the left margin + long mnIndentAt; + + SvxBrushItem* pGraphicBrush; + sal_Int16 eVertOrient; // vertical alignment of a bitmap + + Size aGraphicSize; // Always! in 1/100 mm + Font* pBulletFont; // Pointer to the bullet font + + String sCharStyleName; // Character Style + + DECL_STATIC_LINK( SvxNumberFormat, GraphicArrived, void * ); + virtual void NotifyGraphicArrived(); +public: + explicit SvxNumberFormat( sal_Int16 nNumberingType, + SvxNumPositionAndSpaceMode ePositionAndSpaceMode = LABEL_WIDTH_AND_POSITION ); + SvxNumberFormat(const SvxNumberFormat& rFormat); + SvxNumberFormat( SvStream & rStream ); + + virtual ~SvxNumberFormat(); + + SvStream& Store(SvStream &rStream, FontToSubsFontConverter pConverter); + SvxNumberFormat* Create(SvStream& rStream ); + + SvxNumberFormat& operator=( const SvxNumberFormat& ); + sal_Bool operator==( const SvxNumberFormat& ) const; + sal_Bool operator!=( const SvxNumberFormat& rFmt) const {return !(*this == rFmt);} + + void SetNumAdjust(SvxAdjust eSet) {eNumAdjust = eSet;} + SvxAdjust GetNumAdjust() const {return eNumAdjust;} + void SetPrefix(const OUString& rSet) { sPrefix = rSet;} + const OUString& GetPrefix() const { return sPrefix;} + void SetSuffix(const OUString& rSet) { sSuffix = rSet;} + const OUString& GetSuffix() const { return sSuffix;} + + void SetCharFmtName(const String& rSet){ sCharStyleName = rSet; } + virtual const String& GetCharFmtName()const; + + void SetBulletFont(const Font* pFont); + const Font* GetBulletFont() const {return pBulletFont;} + void SetBulletChar(sal_Unicode cSet){cBullet = cSet;} + sal_Unicode GetBulletChar()const {return cBullet;} + void SetBulletRelSize(sal_uInt16 nSet) {nBulletRelSize = nSet;} + sal_uInt16 GetBulletRelSize() const { return nBulletRelSize;} + void SetBulletColor(Color nSet){nBulletColor = nSet;} + Color GetBulletColor()const {return nBulletColor;} + + void SetIncludeUpperLevels( sal_uInt8 nSet ) { nInclUpperLevels = nSet;} + sal_uInt8 GetIncludeUpperLevels()const { return nInclUpperLevels;} + void SetStart(sal_uInt16 nSet) {nStart = nSet;} + sal_uInt16 GetStart() const {return nStart;} + + virtual void SetGraphicBrush( const SvxBrushItem* pBrushItem, const Size* pSize = 0, const sal_Int16* pOrient = 0); + const SvxBrushItem* GetBrush() const {return pGraphicBrush;} + void SetGraphic( const String& rName ); + virtual void SetVertOrient(sal_Int16 eSet); + virtual sal_Int16 GetVertOrient() const; + void SetGraphicSize(const Size& rSet) {aGraphicSize = rSet;} + const Size& GetGraphicSize() const {return aGraphicSize;} + + SvxNumPositionAndSpaceMode GetPositionAndSpaceMode() const; + void SetPositionAndSpaceMode( SvxNumPositionAndSpaceMode ePositionAndSpaceMode ); + + void SetLSpace(short nSet) {nLSpace = nSet;} + short GetLSpace() const; + void SetAbsLSpace(short nSet) {nAbsLSpace = nSet;} + short GetAbsLSpace() const; + void SetFirstLineOffset(short nSet) { nFirstLineOffset = nSet;} + short GetFirstLineOffset() const; + void SetCharTextDistance(short nSet) { nCharTextDistance = nSet; } + short GetCharTextDistance() const; + + void SetLabelFollowedBy( const LabelFollowedBy eLabelFollowedBy ); + LabelFollowedBy GetLabelFollowedBy() const; + void SetListtabPos( const long nListtabPos ); + long GetListtabPos() const; + void SetFirstLineIndent( const long nFirstLineIndent ); + long GetFirstLineIndent() const; + void SetIndentAt( const long nIndentAt ); + long GetIndentAt() const; + + static Size GetGraphicSizeMM100(const Graphic* pGraphic); + static String CreateRomanString( sal_uLong nNo, sal_Bool bUpper ); +}; + +enum SvxNumRuleType +{ + SVX_RULETYPE_NUMBERING, + SVX_RULETYPE_OUTLINE_NUMBERING, + SVX_RULETYPE_PRESENTATION_NUMBERING, + SVX_RULETYPE_END +}; + +class EDITENG_DLLPUBLIC SvxNumRule +{ + sal_uInt16 nLevelCount; // Number of supported levels + sal_uInt32 nFeatureFlags; // What is supported? + SvxNumRuleType eNumberingType; // Type of numbering + sal_Bool bContinuousNumbering; // sequential numbering + + SvxNumberFormat* aFmts[SVX_MAX_NUM]; + sal_Bool aFmtsSet[SVX_MAX_NUM]; // Flags indicating valid levels + + static sal_Int32 nRefCount; + com::sun::star::lang::Locale aLocale; +public: + SvxNumRule( sal_uLong nFeatures, + sal_uInt16 nLevels, + sal_Bool bCont, + SvxNumRuleType eType = SVX_RULETYPE_NUMBERING, + SvxNumberFormat::SvxNumPositionAndSpaceMode + eDefaultNumberFormatPositionAndSpaceMode + = SvxNumberFormat::LABEL_WIDTH_AND_POSITION ); + SvxNumRule(const SvxNumRule& rCopy); + SvxNumRule(SvStream &rStream); + virtual ~SvxNumRule(); + + int operator==( const SvxNumRule& ) const; + int operator!=( const SvxNumRule& rRule ) const {return !(*this == rRule);} + + SvxNumRule& operator=( const SvxNumRule& ); + + SvStream& Store(SvStream &rStream); + SvxNumRule* Create(SvStream &rStream); + const SvxNumberFormat* Get(sal_uInt16 nLevel)const; + const SvxNumberFormat& GetLevel(sal_uInt16 nLevel)const; + void SetLevel(sal_uInt16 nLevel, const SvxNumberFormat& rFmt, sal_Bool bIsValid = sal_True); + void SetLevel(sal_uInt16 nLevel, const SvxNumberFormat* pFmt); + + sal_Bool IsContinuousNumbering()const + {return bContinuousNumbering;} + void SetContinuousNumbering(sal_Bool bSet) + {bContinuousNumbering = bSet;} + + sal_uInt16 GetLevelCount() const {return nLevelCount;} + sal_Bool IsFeatureSupported(sal_uInt32 nFeature) const + {return 0 != (nFeatureFlags & nFeature);} + sal_uInt32 GetFeatureFlags() const {return nFeatureFlags;} + void SetFeatureFlag( sal_uInt32 nFlag, sal_Bool bSet = sal_True ) { if(bSet) nFeatureFlags |= nFlag; else nFeatureFlags &= ~nFlag; } + + String MakeNumString( const SvxNodeNum&, sal_Bool bInclStrings = sal_True ) const; + + SvxNumRuleType GetNumRuleType() const { return eNumberingType; } + void SetNumRuleType( const SvxNumRuleType& rType ) { eNumberingType = rType; } + + sal_Bool UnLinkGraphics(); +}; + +class EDITENG_DLLPUBLIC SvxNumBulletItem : public SfxPoolItem +{ + SvxNumRule* pNumRule; +public: + explicit SvxNumBulletItem(SvxNumRule& rRule); + SvxNumBulletItem(SvxNumRule& rRule, sal_uInt16 nWhich ); + SvxNumBulletItem(const SvxNumBulletItem& rCopy); + virtual ~SvxNumBulletItem(); + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &rStream, sal_uInt16 nItemVersion) const; + sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; + virtual SvStream& Store(SvStream &rStream, sal_uInt16 nItemVersion ) const; + virtual int operator==( const SfxPoolItem& ) const; + + SvxNumRule* GetNumRule() const {return pNumRule;} + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); +}; + +class SvxNodeNum +{ + sal_uInt16 nLevelVal[ SVX_MAX_NUM ]; // Numbers of all levels + sal_uInt16 nSetValue; // predetermined number + sal_uInt8 nMyLevel; // Current Level + sal_Bool bStartNum; // Restart numbering + +public: + explicit inline SvxNodeNum( sal_uInt8 nLevel = SVX_NO_NUM, sal_uInt16 nSetVal = USHRT_MAX ); + inline SvxNodeNum& operator=( const SvxNodeNum& rCpy ); + + sal_uInt8 GetLevel() const { return nMyLevel; } + void SetLevel( sal_uInt8 nVal ) { nMyLevel = nVal; } + + sal_Bool IsStart() const { return bStartNum; } + void SetStart( sal_Bool bFlag = sal_True ) { bStartNum = bFlag; } + + sal_uInt16 GetSetValue() const { return nSetValue; } + void SetSetValue( sal_uInt16 nVal ) { nSetValue = nVal; } + + const sal_uInt16* GetLevelVal() const { return nLevelVal; } + sal_uInt16* GetLevelVal() { return nLevelVal; } +}; + +SvxNodeNum::SvxNodeNum( sal_uInt8 nLevel, sal_uInt16 nSetVal ) + : nSetValue( nSetVal ), nMyLevel( nLevel ), bStartNum( sal_False ) +{ + memset( nLevelVal, 0, sizeof( nLevelVal ) ); +} + +inline SvxNodeNum& SvxNodeNum::operator=( const SvxNodeNum& rCpy ) +{ + nSetValue = rCpy.nSetValue; + nMyLevel = rCpy.nMyLevel; + bStartNum = rCpy.bStartNum; + + memcpy( nLevelVal, rCpy.nLevelVal, sizeof( nLevelVal ) ); + return *this; +} + +SvxNumRule* SvxConvertNumRule( const SvxNumRule* pRule, sal_uInt16 nLevel, SvxNumRuleType eType ); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/opaqitem.hxx b/include/editeng/opaqitem.hxx new file mode 100644 index 000000000000..7780c4237c5d --- /dev/null +++ b/include/editeng/opaqitem.hxx @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_OPAQITEM_HXX +#define _SVX_OPAQITEM_HXX + +#include <svl/eitem.hxx> +#include "editeng/editengdllapi.h" + +class SvXMLUnitConverter; + +// class SvxOpaqueItem --------------------------------------------------- + + +/* [Description] + + This item describes a logical variable "Opaque yes or no." +*/ + +class EDITENG_DLLPUBLIC SvxOpaqueItem : public SfxBoolItem +{ +public: + TYPEINFO(); + + explicit SvxOpaqueItem( const sal_uInt16 nId , const sal_Bool bOpa = sal_True ); + inline SvxOpaqueItem &operator=( const SvxOpaqueItem &rCpy ); + + // "pure virtual Methods" from SfxPoolItem + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; +}; + +inline SvxOpaqueItem::SvxOpaqueItem( const sal_uInt16 nId, const sal_Bool bOpa ) + : SfxBoolItem( nId, bOpa ) +{} + +inline SvxOpaqueItem &SvxOpaqueItem::operator=( const SvxOpaqueItem &rCpy ) +{ + SetValue( rCpy.GetValue() ); + return *this; +} + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/optitems.hxx b/include/editeng/optitems.hxx new file mode 100644 index 000000000000..34970ebbc42c --- /dev/null +++ b/include/editeng/optitems.hxx @@ -0,0 +1,102 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _EDITENG_OPTITEMS_HXX +#define _EDITENG_OPTITEMS_HXX + +#include <svl/poolitem.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <editeng/editengdllapi.h> + +// forward --------------------------------------------------------------- +namespace com { namespace sun { namespace star { +namespace linguistic2{ + class XSpellChecker1; +}}}} + + +// class SfxSpellCheckItem ----------------------------------------------- + +class EDITENG_DLLPUBLIC SfxSpellCheckItem: public SfxPoolItem +{ +public: + TYPEINFO(); + + SfxSpellCheckItem( ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XSpellChecker1 > &xChecker, + sal_uInt16 nWhich ); + SfxSpellCheckItem( const SfxSpellCheckItem& rItem ); + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual int operator==( const SfxPoolItem& ) const; + + ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XSpellChecker1 > + GetXSpellChecker() const { return xSpellCheck; } + +private: + ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XSpellChecker1 > xSpellCheck; +}; + + +// class SfxHyphenRegionItem --------------------------------------------- + +class EDITENG_DLLPUBLIC SfxHyphenRegionItem: public SfxPoolItem +{ + sal_uInt8 nMinLead; + sal_uInt8 nMinTrail; + +public: + TYPEINFO(); + + SfxHyphenRegionItem( const sal_uInt16 nId ); + SfxHyphenRegionItem( const SfxHyphenRegionItem& rItem ); + + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create( SvStream& rStrm, sal_uInt16 nVer ) const; + virtual SvStream& Store( SvStream& rStrm, sal_uInt16 ) const; + + inline sal_uInt8 &GetMinLead() { return nMinLead; } + inline sal_uInt8 GetMinLead() const { return nMinLead; } + + inline sal_uInt8 &GetMinTrail() { return nMinTrail; } + inline sal_uInt8 GetMinTrail() const { return nMinTrail; } + + inline SfxHyphenRegionItem& operator=( const SfxHyphenRegionItem& rNew ) + { + nMinLead = rNew.GetMinLead(); + nMinTrail = rNew.GetMinTrail(); + return *this; + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/orphitem.hxx b/include/editeng/orphitem.hxx new file mode 100644 index 000000000000..60ef8520c677 --- /dev/null +++ b/include/editeng/orphitem.hxx @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_ORPHITEM_HXX +#define _SVX_ORPHITEM_HXX + +#include <svl/intitem.hxx> +#include <editeng/editengdllapi.h> + +class SvXMLUnitConverter; + +// class SvxOrphansItem -------------------------------------------------- + +/* [Description] + + This item describes the number of lines for the orphans system. +*/ + +class EDITENG_DLLPUBLIC SvxOrphansItem: public SfxByteItem +{ + friend SvStream & operator<<( SvStream & aS, SvxOrphansItem & ); +public: + TYPEINFO(); + + SvxOrphansItem( const sal_uInt8 nL /*= 0*/, const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + inline SvxOrphansItem& operator=( const SvxOrphansItem& rOrphans ) + { + SetValue( rOrphans.GetValue() ); + return *this; + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx new file mode 100644 index 000000000000..e2f208e9b824 --- /dev/null +++ b/include/editeng/outliner.hxx @@ -0,0 +1,1001 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _OUTLINER_HXX +#define _OUTLINER_HXX + +#include <tools/gen.hxx> +#include <tools/string.hxx> + +#include <svl/brdcst.hxx> + +#include <editeng/editdata.hxx> +#include <i18nlangtag/lang.h> +#include <tools/color.hxx> +#include <tools/contnr.hxx> +#include <vcl/graph.hxx> +#include <tools/link.hxx> +#include <rsc/rscsfx.hxx> +#include "editeng/editengdllapi.h" +#include <com/sun/star/lang/Locale.hpp> + +#include <svtools/grfmgr.hxx> + +#include <tools/rtti.hxx> // due to typedef TypeId +#include <vector> + +class OutlinerEditEng; +class Outliner; +class EditView; +class EditUndo; +class ParagraphList; +class OutlinerParaObject; +class SvStream; +class SvxBulletItem; +class SvxFont; +class SvxSearchItem; +class SvxFieldItem; +class Window; +class KeyEvent; +class MouseEvent; +class Pointer; +class CommandEvent; +class MapMode; +class OutputDevice; +class PolyPolygon; +class SfxStyleSheetPool; +class SfxStyleSheet; +class SfxItemPool; +class SfxItemSet; +class SvxNumBulletItem; +class SvxNumberFormat; +class SvxLRSpaceItem; +class EditEngine; +class SvKeyValueIterator; +class SvxForbiddenCharactersTable; + +namespace svl +{ + class IUndoManager; +} + +#include <com/sun/star/uno/Reference.h> + +#include <rtl/ref.hxx> +#include <editeng/svxfont.hxx> +#include <editeng/eedata.hxx> +#include <editeng/paragraphdata.hxx> + +class SvxFieldData; +////////////////////////////////////////////////////////////////////////////// + +namespace com { namespace sun { namespace star { namespace linguistic2 { + class XSpellChecker1; + class XHyphenator; +}}}} +namespace svx{ +struct SpellPortion; +typedef std::vector<SpellPortion> SpellPortions; +} + +namespace basegfx { class B2DPolyPolygon; } + +// internal use only! +#define PARAFLAG_DROPTARGET 0x1000 +#define PARAFLAG_DROPTARGET_EMPTY 0x2000 +#define PARAFLAG_HOLDDEPTH 0x4000 +#define PARAFLAG_SETBULLETTEXT 0x8000 +#define PARAFLAG_ISPAGE 0x0100 + +// Undo-Action-Ids +#define OLUNDO_DEPTH EDITUNDO_USER +// #define OLUNDO_HEIGHT EDITUNDO_USER+1 +#define OLUNDO_EXPAND EDITUNDO_USER+2 +#define OLUNDO_COLLAPSE EDITUNDO_USER+3 +// #define OLUNDO_REMOVE EDITUNDO_USER+4 +#define OLUNDO_ATTR EDITUNDO_USER+5 +#define OLUNDO_INSERT EDITUNDO_USER+6 +// #define OLUNDO_MOVEPARAGRAPHS EDITUNDO_USER+7 +#define OLUNDO_CHECKPARA EDITUNDO_USER+8 + +class Paragraph : protected ParagraphData +{ +private: + friend class Outliner; + friend class ParagraphList; + friend class OutlinerView; + friend class OutlinerParaObject; + friend class OutlinerEditEng; + friend class OutlinerUndoCheckPara; + friend class OutlinerUndoChangeParaFlags; + + Paragraph& operator=(const Paragraph& rPara ); + + sal_uInt16 nFlags; + OUString aBulText; + Size aBulSize; + sal_Bool bVisible; + + sal_Bool IsVisible() const { return bVisible; } + void SetText( const OUString& rText ) { aBulText = rText; aBulSize.Width() = -1; } + void Invalidate() { aBulSize.Width() = -1; } + void SetDepth( sal_Int16 nNewDepth ) { nDepth = nNewDepth; aBulSize.Width() = -1; } + const OUString& GetText() const { return aBulText; } + + Paragraph( sal_Int16 nDepth ); + Paragraph( const Paragraph& ); + Paragraph( const ParagraphData& ); + ~Paragraph(); + + sal_Int16 GetDepth() const { return nDepth; } + + sal_Int16 GetNumberingStartValue() const { return mnNumberingStartValue; } + void SetNumberingStartValue( sal_Int16 nNumberingStartValue ); + + sal_Bool IsParaIsNumberingRestart() const { return mbParaIsNumberingRestart; } + void SetParaIsNumberingRestart( sal_Bool bParaIsNumberingRestart ); + + void SetFlag( sal_uInt16 nFlag ) { nFlags |= nFlag; } + void RemoveFlag( sal_uInt16 nFlag ) { nFlags &= ~nFlag; } + bool HasFlag( sal_uInt16 nFlag ) const { return (nFlags & nFlag) != 0; } +}; + +struct ParaRange +{ + sal_uInt16 nStartPara; + sal_uInt16 nEndPara; + + ParaRange( sal_uInt16 nS, sal_uInt16 nE ) { nStartPara = nS, nEndPara = nE; } + + void Adjust(); + sal_uInt16 Len() const { return 1 + ( ( nEndPara > nStartPara ) ? (nEndPara-nStartPara) : (nStartPara-nEndPara) ); } +}; + +inline void ParaRange::Adjust() +{ + if ( nStartPara > nEndPara ) + { + sal_uInt16 nTmp = nStartPara; + nStartPara = nEndPara; + nEndPara = nTmp; + } +} + +class EDITENG_DLLPUBLIC OutlinerView +{ + friend class Outliner; + +private: + + Outliner* pOwner; + EditView* pEditView; + + // Drag & Drop + sal_Bool bBeginDragAtMove_OLDMEMBER; + sal_Bool bInDragMode; + Point aDDStartPosRef; + Point aDDStartPosPix; + sal_uLong nDDStartPara; + sal_uLong nDDStartParaVisChildCount; + sal_uLong nDDCurPara; + sal_uInt16 nDDStartDepth; + sal_uInt16 nDDCurDepth; + sal_uInt16 nDDMaxDepth; + sal_Bool bDDChangingDepth; + sal_Bool bDDCursorVisible; + long* pHorTabArrDoc; + long nDDScrollLRBorderWidthWin; // Left Right + long nDDScrollTBBorderWidthWin; // Top Bottom + long nDDScrollLROffs; + long nDDScrollTDOffs; + + void* pDummy; + sal_uLong nDummy; + + enum MouseTarget { + MouseText = 0, + MouseBullet = 1, + MouseHypertext = 2, // Outside OutputArea + MouseOutside = 3, // Outside OutputArea + MouseDontKnow = 4 + }; + MouseTarget OLD_ePrevMouseTarget; + +#ifdef _OUTLINER_CXX + + EDITENG_DLLPRIVATE void ImplExpandOrCollaps( sal_uInt16 nStartPara, sal_uInt16 nEndPara, sal_Bool bExpand ); + + EDITENG_DLLPRIVATE sal_uLong ImpCheckMousePos( const Point& rPosPixel, MouseTarget& reTarget); + EDITENG_DLLPRIVATE void ImpToggleExpand( Paragraph* pParentPara ); + EDITENG_DLLPRIVATE ParaRange ImpGetSelectedParagraphs( sal_Bool bIncludeHiddenChildren ); + + EDITENG_DLLPRIVATE Pointer ImpGetMousePointer( MouseTarget eTarget ); + EDITENG_DLLPRIVATE sal_uInt16 ImpInitPaste( sal_uLong& rStart ); + EDITENG_DLLPRIVATE void ImpPasted( sal_uLong nStart, sal_uLong nPrevParaCount, sal_uInt16 nSize); + EDITENG_DLLPRIVATE sal_uInt16 ImpCalcSelectedPages( sal_Bool bIncludeFirstSelected ); + EDITENG_DLLPRIVATE sal_Bool ImpIsIndentingPages(); + +#endif + +public: + OutlinerView( Outliner* pOut, Window* pWindow ); + virtual ~OutlinerView(); + + EditView& GetEditView() const { return *pEditView; } + + void Scroll( long nHorzScroll, long nVertScroll ); + + void Paint( const Rectangle& rRect, OutputDevice* pTargetDevice = 0 ); + sal_Bool PostKeyEvent( const KeyEvent& rKEvt, Window* pFrameWin = NULL ); + sal_Bool MouseButtonDown( const MouseEvent& ); + sal_Bool MouseButtonUp( const MouseEvent& ); + sal_Bool MouseMove( const MouseEvent& ); + + void ShowCursor( sal_Bool bGotoCursor = sal_True ); + void HideCursor(); + + Outliner* GetOutliner() const { return pOwner; } + + void SetWindow( Window* pWindow ); + Window* GetWindow() const; + + void SetReadOnly( sal_Bool bReadOnly ); + sal_Bool IsReadOnly() const; + + void SetOutputArea( const Rectangle& rRect ); + Rectangle GetOutputArea() const; + + Rectangle GetVisArea() const; + + void CreateSelectionList (std::vector<Paragraph*> &aSelList) ; + + // Retruns the number of selected paragraphs + sal_uLong Select( Paragraph* pParagraph, + sal_Bool bSelect=sal_True, + sal_Bool bWChildren=sal_True); + + String GetSelected() const; + void SelectRange( sal_uLong nFirst, sal_uInt16 nCount ); + void SetAttribs( const SfxItemSet& ); + void Indent( short nDiff ); + void AdjustDepth( short nDX ); // Later replace with Indent! + + sal_Bool AdjustHeight( long nDY ); + + sal_uLong Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, sal_Bool bSelect = sal_False, SvKeyValueIterator* pHTTPHeaderAttrs = NULL ); + + void InsertText( const String& rNew, sal_Bool bSelect = sal_False ); + void InsertText( const OutlinerParaObject& rParaObj ); + void Expand(); + void Collapse(); + void ExpandAll(); + void CollapseAll(); + + void SetBackgroundColor( const Color& rColor ); + Color GetBackgroundColor(); + + SfxItemSet GetAttribs(); + + void Cut(); + void Copy(); + void Paste(); + void PasteSpecial(); + + const SfxStyleSheet* GetStyleSheet() const; + SfxStyleSheet* GetStyleSheet(); + + void SetControlWord( sal_uLong nWord ); + sal_uLong GetControlWord() const; + + void SetAnchorMode( EVAnchorMode eMode ); + EVAnchorMode GetAnchorMode() const; + + Pointer GetPointer( const Point& rPosPixel ); + void Command( const CommandEvent& rCEvt ); + + EESpellState StartSpeller( sal_Bool bMultipleDoc = sal_False ); + EESpellState StartThesaurus(); + sal_uInt16 StartSearchAndReplace( const SvxSearchItem& rSearchItem ); + + // for text conversion + void StartTextConversion( LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc ); + + void TransliterateText( sal_Int32 nTransliterationMode ); + + ESelection GetSelection(); + + sal_uInt16 GetSelectedScriptType() const; + + void SetVisArea( const Rectangle& rRect ); + void SetSelection( const ESelection& ); + + void RemoveAttribs( sal_Bool bRemoveParaAttribs = sal_False, sal_uInt16 nWhich = 0, sal_Bool bKeepLanguages = sal_False ); + void RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs ); + sal_Bool HasSelection() const; + + void InsertField( const SvxFieldItem& rFld ); + const SvxFieldItem* GetFieldUnderMousePointer() const; + const SvxFieldItem* GetFieldAtSelection() const; + + /** enables numbering for the selected paragraphs if the numbering of the first paragraph is off + or disables numbering for the selected paragraphs if the numbering of the first paragraph is on + */ + void ToggleBullets(); + + /** enables numbering for the selected paragraphs that are not enabled and ignore all selected + paragraphs that already have numbering enabled. + */ + void EnableBullets(); + + sal_Bool IsCursorAtWrongSpelledWord( sal_Bool bMarkIfWrong = sal_False ); + sal_Bool IsWrongSpelledWordAtPos( const Point& rPosPixel, sal_Bool bMarkIfWrong = sal_False ); + void ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack = 0 ); + + void SetInvalidateMore( sal_uInt16 nPixel ); + sal_uInt16 GetInvalidateMore() const; + + String GetSurroundingText() const; + Selection GetSurroundingTextSelection() const; +}; + + +// some thesaurus functionality to avoid code duplication in different projects... +bool EDITENG_DLLPUBLIC GetStatusValueForThesaurusFromContext( String &rStatusVal, LanguageType &rLang, const EditView &rEditView ); +void EDITENG_DLLPUBLIC ReplaceTextWithSynonym( EditView &rEditView, const String &rSynonmText ); + +typedef ::std::vector< OutlinerView* > ViewList; + +class EDITENG_DLLPUBLIC DrawPortionInfo +{ +public: + const Point& mrStartPos; + const String& mrText; + sal_uInt16 mnTextStart; + sal_uInt16 mnTextLen; + sal_uInt16 mnPara; + xub_StrLen mnIndex; + const SvxFont& mrFont; + const sal_Int32* mpDXArray; + + const EEngineData::WrongSpellVector* mpWrongSpellVector; + const SvxFieldData* mpFieldData; + const ::com::sun::star::lang::Locale* mpLocale; + const Color maOverlineColor; + const Color maTextLineColor; + + sal_uInt8 mnBiDiLevel; + + bool mbFilled; + long mnWidthToFill; + + // bitfield + unsigned mbEndOfLine : 1; + unsigned mbEndOfParagraph : 1; + unsigned mbEndOfBullet : 1; + + sal_uInt8 GetBiDiLevel() const { return mnBiDiLevel; } + sal_Bool IsRTL() const { return mnBiDiLevel % 2 ? sal_True : sal_False; } + + DrawPortionInfo( + const Point& rPos, + const String& rTxt, + sal_uInt16 nTxtStart, + sal_uInt16 nTxtLen, + const SvxFont& rFnt, + sal_uInt16 nPar, + xub_StrLen nIdx, + const sal_Int32* pDXArr, + const EEngineData::WrongSpellVector* pWrongSpellVector, + const SvxFieldData* pFieldData, + const ::com::sun::star::lang::Locale* pLocale, + const Color& rOverlineColor, + const Color& rTextLineColor, + sal_uInt8 nBiDiLevel, + bool bFilled, + long nWidthToFill, + bool bEndOfLine, + bool bEndOfParagraph, + bool bEndOfBullet) + : mrStartPos(rPos), + mrText(rTxt), + mnTextStart(nTxtStart), + mnTextLen(nTxtLen), + mnPara(nPar), + mnIndex(nIdx), + mrFont(rFnt), + mpDXArray(pDXArr), + mpWrongSpellVector(pWrongSpellVector), + mpFieldData(pFieldData), + mpLocale(pLocale), + maOverlineColor(rOverlineColor), + maTextLineColor(rTextLineColor), + mnBiDiLevel(nBiDiLevel), + mbFilled( bFilled ), + mnWidthToFill( nWidthToFill ), + mbEndOfLine(bEndOfLine), + mbEndOfParagraph(bEndOfParagraph), + mbEndOfBullet(bEndOfBullet) + {} +}; + +class EDITENG_DLLPUBLIC DrawBulletInfo +{ +public: + const GraphicObject maBulletGraphicObject; + Point maBulletPosition; + Size maBulletSize; + + DrawBulletInfo( + const GraphicObject& rBulletGraphicObject, + const Point& rBulletPosition, + const Size& rBulletSize) + : maBulletGraphicObject(rBulletGraphicObject), + maBulletPosition(rBulletPosition), + maBulletSize(rBulletSize) + {} +}; + +struct EDITENG_DLLPUBLIC PaintFirstLineInfo +{ + sal_uInt16 mnPara; + const Point& mrStartPos; + long mnBaseLineY; + const Point& mrOrigin; + short mnOrientation; + OutputDevice* mpOutDev; + + PaintFirstLineInfo( sal_uInt16 nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev ) + : mnPara( nPara ), mrStartPos( rStartPos ), mnBaseLineY( nBaseLineY ), mrOrigin( rOrigin ), mnOrientation( nOrientation ), mpOutDev( pOutDev ) + {} +}; + +class SdrPage; + +class EditFieldInfo +{ +private: + Outliner* pOutliner; + const SvxFieldItem& rFldItem; + + Color* pTxtColor; + Color* pFldColor; + + String aRepresentation; + + sal_uInt16 nPara; + xub_StrLen nPos; + sal_Bool bSimpleClick; + + EditFieldInfo(); + EditFieldInfo( const EditFieldInfo& ); + + SdrPage* mpSdrPage; + +public: + EditFieldInfo( Outliner* pOutl, const SvxFieldItem& rFItem, sal_uInt16 nPa, xub_StrLen nPo ) + : rFldItem( rFItem ) + { + pOutliner = pOutl; + nPara = nPa; nPos = nPo; + pTxtColor = 0; pFldColor = 0; bSimpleClick = sal_False; + mpSdrPage = 0; + } + ~EditFieldInfo() + { + delete pTxtColor; + delete pFldColor; + } + + Outliner* GetOutliner() const { return pOutliner; } + + const SvxFieldItem& GetField() const { return rFldItem; } + + Color* GetTxtColor() const { return pTxtColor; } + void SetTxtColor( const Color& rColor ) + { delete pTxtColor; pTxtColor = new Color( rColor ); } + + Color* GetFldColor() const { return pFldColor; } + void SetFldColor( const Color& rColor ) + { delete pFldColor; pFldColor = new Color( rColor ); } + void ClearFldColor() + { delete pFldColor; pFldColor = 0; } + + sal_uInt16 GetPara() const { return nPara; } + xub_StrLen GetPos() const { return nPos; } + + sal_Bool IsSimpleClick() const { return bSimpleClick; } + void SetSimpleClick( sal_Bool bSimple ) { bSimpleClick = bSimple; } + + const String& GetRepresentation() const { return aRepresentation; } + String& GetRepresentation() { return aRepresentation; } + void SetRepresentation( const String& rStr ) { aRepresentation = rStr; } + + void SetSdrPage( SdrPage* pPage ) { mpSdrPage = pPage; } + SdrPage* GetSdrPage() const { return mpSdrPage; } +}; + +struct EBulletInfo +{ + sal_Bool bVisible; + sal_uInt16 nType; // see SvxNumberType + String aText; + SvxFont aFont; + Graphic aGraphic; + sal_uInt16 nParagraph; + Rectangle aBounds; + + EBulletInfo() : bVisible( sal_False ), nType( 0 ), nParagraph( EE_PARA_NOT_FOUND ) {} +}; + +#define OUTLINERMODE_DONTKNOW 0x0000 +#define OUTLINERMODE_TEXTOBJECT 0x0001 +#define OUTLINERMODE_TITLEOBJECT 0x0002 +#define OUTLINERMODE_OUTLINEOBJECT 0x0003 +#define OUTLINERMODE_OUTLINEVIEW 0x0004 + +#define OUTLINERMODE_USERMASK 0x00FF + +#define OUTLINERMODE_SUBTITLE (0x0100|OUTLINERMODE_TEXTOBJECT) +#define OUTLINERMODE_NOTE (0x0200|OUTLINERMODE_TEXTOBJECT) + +class EDITENG_DLLPUBLIC Outliner : public SfxBroadcaster +{ + friend class OutlinerView; + friend class OutlinerEditEng; + friend class OutlinerParaObject; + friend class OLUndoExpand; + friend class OutlinerUndoChangeDepth; + friend class OutlinerUndoCheckPara; + friend class OutlinerUndoChangeParaFlags; + + OutlinerEditEng* pEditEngine; + + ParagraphList* pParaList; + ViewList aViewList; + + Paragraph* pHdlParagraph; + sal_uLong mnFirstSelPage; + Link aDrawPortionHdl; + Link aDrawBulletHdl; + Link aExpandHdl; + Link aParaInsertedHdl; + Link aParaRemovingHdl; + Link aDepthChangedHdl; + Link aWidthArrReqHdl; + Link aBeginMovingHdl; + Link aEndMovingHdl; + Link aIndentingPagesHdl; + Link aRemovingPagesHdl; + Link aFieldClickedHdl; + Link aCalcFieldValueHdl; + Link maPaintFirstLineHdl; + Link maBeginPasteOrDropHdl; + Link maEndPasteOrDropHdl; + + sal_Int16 nDepthChangedHdlPrevDepth; + sal_uInt16 mnDepthChangeHdlPrevFlags; + sal_Int16 nMaxDepth; + const sal_Int16 nMinDepth; + sal_uInt16 nFirstPage; + + sal_uInt16 nOutlinerMode; + + sal_Bool bIsExpanding; // Only valid in Expand/Collaps-Hdl, reset + sal_Bool bFirstParaIsEmpty; + sal_Bool bBlockInsCallback; + sal_Bool bStrippingPortions; + sal_Bool bPasting; + + sal_uLong nDummy; + +#ifdef _OUTLINER_CXX + + DECL_LINK( ParaVisibleStateChangedHdl, Paragraph* ); + DECL_LINK( BeginMovingParagraphsHdl, void* ); + DECL_LINK( EndMovingParagraphsHdl, MoveParagraphsInfo* ); + DECL_LINK( BeginPasteOrDropHdl, PasteOrDropInfos* ); + DECL_LINK( EndPasteOrDropHdl, PasteOrDropInfos* ); + DECL_LINK( EditEngineNotifyHdl, EENotify* ); + void ImplCheckParagraphs( sal_uInt16 nStart, sal_uInt16 nEnd ); + sal_Bool ImplHasBullet( sal_uInt16 nPara ) const; + Size ImplGetBulletSize( sal_uInt16 nPara ); + sal_uInt16 ImplGetNumbering( sal_uInt16 nPara, const SvxNumberFormat* pParaFmt ); + void ImplCalcBulletText( sal_uInt16 nPara, sal_Bool bRecalcLevel, sal_Bool bRecalcChildren ); + String ImplGetBulletText( sal_uInt16 nPara ); + void ImplCheckNumBulletItem( sal_uInt16 nPara ); + void ImplInitDepth( sal_uInt16 nPara, sal_Int16 nDepth, sal_Bool bCreateUndo, sal_Bool bUndoAction = sal_False ); + void ImplSetLevelDependendStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pLevelStyle = NULL ); + + void ImplBlockInsertionCallbacks( sal_Bool b ); + + void ImplCheckStyleSheet( sal_uInt16 nPara, sal_Bool bReplaceExistingStyle ); + void ImpRecalcBulletIndent( sal_uLong nPara ); + + const SvxBulletItem& ImpGetBullet( sal_uLong nPara, sal_uInt16& ); + void ImpFilterIndents( sal_uLong nFirstPara, sal_uLong nLastPara ); + bool ImpConvertEdtToOut( sal_uInt32 nPara, EditView* pView = 0 ); + + void ImpTextPasted( sal_uLong nStartPara, sal_uInt16 nCount ); + long ImpCalcMaxBulletWidth( sal_uInt16 nPara, const SvxBulletItem& rBullet ); + Font ImpCalcBulletFont( sal_uInt16 nPara ) const; + Rectangle ImpCalcBulletArea( sal_uInt16 nPara, sal_Bool bAdjust, sal_Bool bReturnPaperPos ); + long ImpGetTextIndent( sal_uLong nPara ); + sal_Bool ImpCanIndentSelectedPages( OutlinerView* pCurView ); + sal_Bool ImpCanDeleteSelectedPages( OutlinerView* pCurView ); + sal_Bool ImpCanDeleteSelectedPages( OutlinerView* pCurView, sal_uInt16 nFirstPage, sal_uInt16 nPages ); + + sal_uInt16 ImplGetOutlinerMode() const { return nOutlinerMode & OUTLINERMODE_USERMASK; } + void ImplCheckDepth( sal_Int16& rnDepth ) const; +#endif + +protected: + void ParagraphInserted( sal_uInt16 nParagraph ); + void ParagraphDeleted( sal_uInt16 nParagraph ); + void ParaAttribsChanged( sal_uInt16 nParagraph ); + + virtual void StyleSheetChanged( SfxStyleSheet* pStyle ); + + void InvalidateBullet( Paragraph* pPara, sal_uLong nPara ); + void PaintBullet( sal_uInt16 nPara, const Point& rStartPos, + const Point& rOrigin, short nOrientation, + OutputDevice* pOutDev ); + + // used by OutlinerEditEng. Allows Outliner objects to provide + // bullet access to the EditEngine. + virtual const SvxNumberFormat* GetNumberFormat( sal_uInt16 nPara ) const; + +public: + + Outliner( SfxItemPool* pPool, sal_uInt16 nOutlinerMode ); + virtual ~Outliner(); + + void Init( sal_uInt16 nOutlinerMode ); + sal_uInt16 GetMode() const { return nOutlinerMode; } + + void SetVertical( sal_Bool bVertical ); + sal_Bool IsVertical() const; + + void SetFixedCellHeight( sal_Bool bUseFixedCellHeight ); + + void SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir ); + EEHorizontalTextDirection GetDefaultHorizontalTextDirection() const; + + sal_uInt16 GetScriptType( const ESelection& rSelection ) const; + LanguageType GetLanguage( sal_uInt16 nPara, sal_uInt16 nPos ) const; + + void SetAsianCompressionMode( sal_uInt16 nCompressionMode ); + + void SetKernAsianPunctuation( sal_Bool bEnabled ); + + void SetAddExtLeading( sal_Bool b ); + + size_t InsertView( OutlinerView* pView, size_t nIndex = size_t(-1) ); + OutlinerView* RemoveView( OutlinerView* pView ); + OutlinerView* RemoveView( size_t nIndex ); + OutlinerView* GetView( size_t nIndex ) const; + size_t GetViewCount() const; + + Paragraph* Insert( const String& rText, sal_uLong nAbsPos = CONTAINER_APPEND, sal_Int16 nDepth = 0 ); + void SetText( const OutlinerParaObject& ); + void AddText( const OutlinerParaObject& ); + void SetText( const String& rText, Paragraph* pParagraph ); + String GetText( Paragraph* pPara, sal_uLong nParaCount=1 ) const; + + OutlinerParaObject* CreateParaObject( sal_uInt16 nStartPara = 0, sal_uInt16 nParaCount = 0xFFFF ) const; + + const SfxItemSet& GetEmptyItemSet() const; + + void SetRefMapMode( const MapMode& ); + MapMode GetRefMapMode() const; + + void SetBackgroundColor( const Color& rColor ); + Color GetBackgroundColor() const; + + sal_Int16 GetMinDepth() const { return -1; } + + void SetMaxDepth( sal_Int16 nDepth, sal_Bool bCheckParas = sal_False ); + sal_Int16 GetMaxDepth() const { return nMaxDepth; } + + void SetUpdateMode( sal_Bool bUpdate ); + sal_Bool GetUpdateMode() const; + + void Clear(); + + void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ); + + sal_uLong GetParagraphCount() const; + Paragraph* GetParagraph( sal_uLong nAbsPos ) const; + + sal_Bool HasParent( Paragraph* pParagraph ) const; + sal_Bool HasChildren( Paragraph* pParagraph ) const; + sal_uLong GetChildCount( Paragraph* pParent ) const; + sal_Bool IsExpanded( Paragraph* pPara ) const; + Paragraph* GetParent( Paragraph* pParagraph ) const; + sal_uLong GetAbsPos( Paragraph* pPara ); + + sal_Int16 GetDepth( sal_uLong nPara ) const; + void SetDepth( Paragraph* pParagraph, sal_Int16 nNewDepth ); + + sal_Bool IsVisible( Paragraph* pPara ) const { return pPara->IsVisible(); } + + void EnableUndo( sal_Bool bEnable ); + sal_Bool IsUndoEnabled() const; + void UndoActionStart( sal_uInt16 nId ); + void UndoActionEnd( sal_uInt16 nId ); + void InsertUndo( EditUndo* pUndo ); + sal_Bool IsInUndo(); + + void ClearModifyFlag(); + sal_Bool IsModified() const; + + Paragraph* GetHdlParagraph() const { return pHdlParagraph; } + sal_Bool IsExpanding() const { return bIsExpanding; } + + virtual void ExpandHdl(); + void SetExpandHdl( const Link& rLink ) { aExpandHdl = rLink; } + Link GetExpandHdl() const { return aExpandHdl; } + + virtual void ParagraphInsertedHdl(); + void SetParaInsertedHdl(const Link& rLink){aParaInsertedHdl=rLink;} + Link GetParaInsertedHdl() const { return aParaInsertedHdl; } + + virtual void ParagraphRemovingHdl(); + void SetParaRemovingHdl(const Link& rLink){aParaRemovingHdl=rLink;} + Link GetParaRemovingHdl() const { return aParaRemovingHdl; } + + virtual void DepthChangedHdl(); + void SetDepthChangedHdl(const Link& rLink){aDepthChangedHdl=rLink;} + Link GetDepthChangedHdl() const { return aDepthChangedHdl; } + sal_Int16 GetPrevDepth() const { return nDepthChangedHdlPrevDepth; } + sal_uInt16 GetPrevFlags() const { return mnDepthChangeHdlPrevFlags; } + + virtual long RemovingPagesHdl( OutlinerView* ); + void SetRemovingPagesHdl(const Link& rLink){aRemovingPagesHdl=rLink;} + Link GetRemovingPagesHdl() const { return aRemovingPagesHdl; } + virtual long IndentingPagesHdl( OutlinerView* ); + void SetIndentingPagesHdl(const Link& rLink){aIndentingPagesHdl=rLink;} + Link GetIndentingPagesHdl() const { return aIndentingPagesHdl; } + // valid only in the two upper handlers + sal_uInt16 GetSelPageCount() const { return nDepthChangedHdlPrevDepth; } + + // valid only in the two upper handlers + sal_uLong GetFirstSelPage() const { return mnFirstSelPage; } + + void SetCalcFieldValueHdl(const Link& rLink ) { aCalcFieldValueHdl= rLink; } + Link GetCalcFieldValueHdl() const { return aCalcFieldValueHdl; } + + void SetFieldClickedHdl(const Link& rLink ) { aFieldClickedHdl= rLink; } + Link GetFieldClickedHdl() const { return aFieldClickedHdl; } + + void SetDrawPortionHdl(const Link& rLink){aDrawPortionHdl=rLink;} + Link GetDrawPortionHdl() const { return aDrawPortionHdl; } + + void SetDrawBulletHdl(const Link& rLink){aDrawBulletHdl=rLink;} + Link GetDrawBulletHdl() const { return aDrawBulletHdl; } + + void SetPaintFirstLineHdl(const Link& rLink) { maPaintFirstLineHdl = rLink; } + Link GetPaintFirstLineHdl() const { return maPaintFirstLineHdl; } + + void SetModifyHdl( const Link& rLink ); + Link GetModifyHdl() const; + + void SetNotifyHdl( const Link& rLink ); + + void SetStatusEventHdl( const Link& rLink ); + Link GetStatusEventHdl() const; + + void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect ); + void Draw( OutputDevice* pOutDev, const Point& rStartPos, short nOrientation = 0 ); + + const Size& GetPaperSize() const; + void SetPaperSize( const Size& rSize ); + + void SetFirstPageNumber( sal_uInt16 n ) { nFirstPage = n; } + sal_uInt16 GetFirstPageNumber() const { return nFirstPage; } + + void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon ); + void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon); + void ClearPolygon(); + + const Size& GetMinAutoPaperSize() const; + void SetMinAutoPaperSize( const Size& rSz ); + + const Size& GetMaxAutoPaperSize() const; + void SetMaxAutoPaperSize( const Size& rSz ); + + void SetDefTab( sal_uInt16 nTab ); + + sal_Bool IsFlatMode() const; + void SetFlatMode( sal_Bool bFlat ); + + void EnableAutoColor( sal_Bool b ); + + void ForceAutoColor( sal_Bool b ); + sal_Bool IsForceAutoColor() const; + + EBulletInfo GetBulletInfo( sal_uInt16 nPara ); + + void SetWordDelimiters( const String& rDelimiters ); + String GetWordDelimiters() const; + String GetWord( sal_uInt16 nPara, xub_StrLen nIndex ); + + void StripPortions(); + + virtual void DrawingText( + const Point& rStartPos, const String& rText, sal_uInt16 nTextStart, sal_uInt16 nTextLen, + const sal_Int32* pDXArray, const SvxFont& rFont, sal_uInt16 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft, + const EEngineData::WrongSpellVector* pWrongSpellVector, + const SvxFieldData* pFieldData, + bool bEndOfLine, + bool bEndOfParagraph, + bool bEndOfBullet, + const ::com::sun::star::lang::Locale* pLocale, + const Color& rOverlineColor, + const Color& rTextLineColor); + + virtual void DrawingTab( + const Point& rStartPos, long nWidth, const String& rChar, + const SvxFont& rFont, sal_uInt16 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft, + bool bEndOfLine, + bool bEndOfParagraph, + const Color& rOverlineColor, + const Color& rTextLineColor); + + Size CalcTextSize(); + Size CalcTextSizeNTP(); + + void SetStyleSheetPool( SfxStyleSheetPool* pSPool ); + SfxStyleSheetPool* GetStyleSheetPool(); + + sal_Bool IsInSelectionMode() const; + + void SetStyleSheet( sal_uLong nPara, SfxStyleSheet* pStyle ); + SfxStyleSheet* GetStyleSheet( sal_uLong nPara ); + + void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& ); + SfxItemSet GetParaAttribs( sal_uInt16 nPara ); + + void Remove( Paragraph* pPara, sal_uLong nParaCount ); + sal_Bool Expand( Paragraph* ); + sal_Bool Collapse( Paragraph* ); + + void SetParaFlag( Paragraph* pPara, sal_uInt16 nFlag ); + bool HasParaFlag( const Paragraph* pPara, sal_uInt16 nFlag ) const; + + // Returns an array containing the widths of the Bullet Indentations + // Last value must be -1. Is deleted by the outliner. + Link GetWidthArrReqHdl() const{ return aWidthArrReqHdl; } + void SetWidthArrReqHdl(const Link& rLink){aWidthArrReqHdl=rLink; } + + void SetControlWord( sal_uLong nWord ); + sal_uLong GetControlWord() const; + + Link GetBeginMovingHdl() const { return aBeginMovingHdl; } + void SetBeginMovingHdl(const Link& rLink) {aBeginMovingHdl=rLink;} + Link GetEndMovingHdl() const {return aEndMovingHdl;} + void SetEndMovingHdl( const Link& rLink){aEndMovingHdl=rLink;} + + sal_uLong GetLineCount( sal_uLong nParagraph ) const; + sal_uInt16 GetLineLen( sal_uLong nParagraph, sal_uInt16 nLine ) const; + sal_uLong GetLineHeight( sal_uLong nParagraph, sal_uLong nLine = 0 ); + + // nFormat must be a value from the enum EETextFormat (due to CLOOKS) + sal_uLong Read( SvStream& rInput, const String& rBaseURL, sal_uInt16, SvKeyValueIterator* pHTTPHeaderAttrs = NULL ); + + ::svl::IUndoManager& + GetUndoManager(); + + void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ); + void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ); + void QuickInsertLineBreak( const ESelection& rSel ); + + // Only for EditEngine mode + void QuickInsertText( const String& rText, const ESelection& rSel ); + void QuickDelete( const ESelection& rSel ); + void QuickRemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich = 0 ); + void QuickFormatDoc( sal_Bool bFull = sal_False ); + + sal_Bool UpdateFields(); + void RemoveFields( sal_Bool bKeepFieldText, TypeId aType = NULL ); + + virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos ); + virtual void FieldSelected( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos ); + virtual String CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos, Color*& rTxtColor, Color*& rFldColor ); + + void SetSpeller( ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XSpellChecker1 > &xSpeller ); + ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XSpellChecker1 > + GetSpeller(); + void SetHyphenator( ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XHyphenator >& xHyph ); + + void SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars ); + + // Depricated + void SetDefaultLanguage( LanguageType eLang ); + LanguageType GetDefaultLanguage() const; + + void CompleteOnlineSpelling(); + + EESpellState HasSpellErrors(); + sal_Bool HasText( const SvxSearchItem& rSearchItem ); + virtual sal_Bool SpellNextDocument(); + + // for text conversion + sal_Bool HasConvertibleTextPortion( LanguageType nLang ); + virtual sal_Bool ConvertNextDocument(); + + void SetEditTextObjectPool( SfxItemPool* pPool ); + SfxItemPool* GetEditTextObjectPool() const; + + void SetRefDevice( OutputDevice* pRefDev ); + OutputDevice* GetRefDevice() const; + + sal_uLong GetTextHeight() const; + sal_uLong GetTextHeight( sal_uLong nParagraph ) const; + Point GetDocPosTopLeft( sal_uLong nParagraph ); + Point GetDocPos( const Point& rPaperPos ) const; + sal_Bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder = 0 ); + sal_Bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder, sal_Bool* pbBuuletPos ); + + void SetGlobalCharStretching( sal_uInt16 nX = 100, sal_uInt16 nY = 100 ); + void GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ) const; + void EraseVirtualDevice(); + + sal_Bool ShouldCreateBigTextObject() const; + + const EditEngine& GetEditEngine() const { return *((EditEngine*)pEditEngine); } + + // this is needed for StarOffice Api + void SetLevelDependendStyleSheet( sal_uInt16 nPara ); + + sal_uInt16 GetOutlinerMode() const { return nOutlinerMode & OUTLINERMODE_USERMASK; } + + void StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc); + // spell and return a sentence + bool SpellSentence(EditView& rEditView, ::svx::SpellPortions& rToFill, bool bIsGrammarChecking ); + // put spell position to start of current sentence + void PutSpellingToSentenceStart( EditView& rEditView ); + // applies a changed sentence + void ApplyChangedSentence(EditView& rEditView, const ::svx::SpellPortions& rNewPortions, bool bRecheck ); + + /** sets a link that is called at the beginning of a drag operation at an edit view */ + void SetBeginDropHdl( const Link& rLink ); + + /** sets a link that is called at the end of a drag operation at an edit view */ + void SetEndDropHdl( const Link& rLink ); + + /** sets a link that is called before a drop or paste operation. */ + void SetBeginPasteOrDropHdl( const Link& rLink ); + Link GetBeginPasteOrDropHdl() const { return maBeginPasteOrDropHdl; } + + /** sets a link that is called after a drop or paste operation. */ + void SetEndPasteOrDropHdl( const Link& rLink ); + Link GetEndPasteOrDropHdl() const { return maEndPasteOrDropHdl; } + + virtual sal_Int16 GetNumberingStartValue( sal_uInt16 nPara ); + virtual void SetNumberingStartValue( sal_uInt16 nPara, sal_Int16 nNumberingStartValue ); + + virtual sal_Bool IsParaIsNumberingRestart( sal_uInt16 nPara ); + virtual void SetParaIsNumberingRestart( sal_uInt16 nPara, sal_Bool bParaIsNumberingRestart ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/outlobj.hxx b/include/editeng/outlobj.hxx new file mode 100644 index 000000000000..73eb9b5b96d5 --- /dev/null +++ b/include/editeng/outlobj.hxx @@ -0,0 +1,93 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _OUTLOBJ_HXX +#define _OUTLOBJ_HXX + +////////////////////////////////////////////////////////////////////////////// + +#include <tools/solar.h> +#include <tools/string.hxx> +#include <rsc/rscsfx.hxx> +#include <editeng/paragraphdata.hxx> +#include "editeng/editengdllapi.h" + +class EditTextObject; +class ImplOutlinerParaObject; + +////////////////////////////////////////////////////////////////////////////// + +class EDITENG_DLLPUBLIC OutlinerParaObject +{ +private: + ImplOutlinerParaObject* mpImplOutlinerParaObject; + + void ImplMakeUnique(); + +public: + // constructors/destructor + OutlinerParaObject( + const EditTextObject& rEditTextObject, + const ParagraphDataVector& rParagraphDataVector = ParagraphDataVector(), + bool bIsEditDoc = true); + OutlinerParaObject(const OutlinerParaObject& rCandidate); + ~OutlinerParaObject(); + + // assignment operator + OutlinerParaObject& operator=(const OutlinerParaObject& rCandidate); + + // compare operator + bool operator==(const OutlinerParaObject& rCandidate) const; + bool operator!=(const OutlinerParaObject& rCandidate) const { return !operator==(rCandidate); } + + // #i102062# + bool isWrongListEqual(const OutlinerParaObject& rCompare) const; + + // outliner mode access + sal_uInt16 GetOutlinerMode() const; + void SetOutlinerMode(sal_uInt16 nNew); + + // vertical access + bool IsVertical() const; + void SetVertical(bool bNew); + + // data read access + sal_uInt32 Count() const; + sal_Int16 GetDepth(sal_uInt16 nPara) const; + const EditTextObject& GetTextObject() const; + bool IsEditDoc() const; + const ParagraphData& GetParagraphData(sal_uInt32 nIndex) const; + + // portion info support + void ClearPortionInfo(); + + // StyleSheet support + bool ChangeStyleSheets(const OUString& rOldName, SfxStyleFamily eOldFamily, + const OUString& rNewName, SfxStyleFamily eNewFamily); + void ChangeStyleSheetName(SfxStyleFamily eFamily, const OUString& rOldName, + const OUString& rNewName); + void SetStyleSheets(sal_uInt16 nLevel, const OUString rNewName, + const SfxStyleFamily& rNewFamily); +}; + +////////////////////////////////////////////////////////////////////////////// + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/paperinf.hxx b/include/editeng/paperinf.hxx new file mode 100644 index 000000000000..2c53ca554122 --- /dev/null +++ b/include/editeng/paperinf.hxx @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_PAPERINF_HXX +#define _SVX_PAPERINF_HXX + +// INCLUDE --------------------------------------------------------------- + +#include <vcl/print.hxx> +#include <vcl/mapmod.hxx> +#include <editeng/svxenum.hxx> +#include "editeng/editengdllapi.h" + +// forward --------------------------------------------------------------- + +class Printer; +class Size; +class String; + +// class SvxPaperInfo ----------------------------------------------------- + +class EDITENG_DLLPUBLIC SvxPaperInfo +{ +public: + static Size GetDefaultPaperSize( MapUnit eUnit = MAP_TWIP ); + static Size GetPaperSize( Paper ePaper, MapUnit eUnit = MAP_TWIP ); + static Size GetPaperSize( const Printer* pPrinter ); + static Paper GetSvxPaper( const Size &rSize, MapUnit eUnit = MAP_TWIP, bool bSloppy = sal_False ); + static long GetSloppyPaperDimension( long nSize, MapUnit eUnit = MAP_TWIP ); + static String GetName( Paper ePaper ); +}; + +// INLINE ----------------------------------------------------------------- + +inline Size &Swap(Size &rSize) +{ + const long lVal = rSize.Width(); + rSize.Width() = rSize.Height(); + rSize.Height() = lVal; + return rSize; +} + +inline Size &LandscapeSwap(Size &rSize) +{ + if ( rSize.Height() > rSize.Width() ) + Swap( rSize ); + return rSize; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/paragraphdata.hxx b/include/editeng/paragraphdata.hxx new file mode 100644 index 000000000000..81d12bb00a2f --- /dev/null +++ b/include/editeng/paragraphdata.hxx @@ -0,0 +1,64 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _PARAGRAPH_DATA_HXX +#define _PARAGRAPH_DATA_HXX + +#include <tools/solar.h> +#include <vector> + +////////////////////////////////////////////////////////////////////////////// +// Only for internal use, oder some kind like hPara for the few +// functions where you need it outside ( eg. moving paragraphs... ) +// +// Unfortunately NOT only local (formally in outliner.hxx), but also +// used in outlobj.hxx. Moved to own header + +class ParagraphData +{ + friend class Paragraph; + friend class OutlinerParaObject; + +protected: + sal_Int16 nDepth; + sal_Int16 mnNumberingStartValue; + sal_Bool mbParaIsNumberingRestart; + +public: + ParagraphData( const ParagraphData& ); + ParagraphData(); + + ParagraphData& operator=( const ParagraphData& ); + + // compare operator + bool operator==(const ParagraphData& rCandidate) const; + + // data read access + sal_Int16 getDepth() const { return nDepth; } +}; + +////////////////////////////////////////////////////////////////////////////// + +typedef ::std::vector< ParagraphData > ParagraphDataVector; + +////////////////////////////////////////////////////////////////////////////// + +#endif // _PARAGRAPH_DATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/paravertalignitem.hxx b/include/editeng/paravertalignitem.hxx new file mode 100644 index 000000000000..ab65b8994325 --- /dev/null +++ b/include/editeng/paravertalignitem.hxx @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_PARAVERTALIGNITEM_HXX +#define _SVX_PARAVERTALIGNITEM_HXX + +#include <svl/intitem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxParaVertAlignItem ---------------------------------------------- + +/* [Description] + + This item defines the character alignment in the lines of a paragraph. + Currently the alignment can be none (i.e. baseline), top, center or bottom. + +*/ + +class EDITENG_DLLPUBLIC SvxParaVertAlignItem : public SfxUInt16Item +{ +public: + enum { AUTOMATIC, BASELINE, TOP, CENTER, BOTTOM }; + TYPEINFO(); + + SvxParaVertAlignItem( sal_uInt16 nValue /*= 0*/, + const sal_uInt16 nId ); + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream & rStrm, sal_uInt16 nIVer) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, + const IntlWrapper * = 0 ) const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + inline SvxParaVertAlignItem& operator=( const SvxParaVertAlignItem& rItem ) + { + SetValue( rItem.GetValue() ); + return *this; + } + + virtual int operator==( const SfxPoolItem& ) const; + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/pbinitem.hxx b/include/editeng/pbinitem.hxx new file mode 100644 index 000000000000..38630c78f86c --- /dev/null +++ b/include/editeng/pbinitem.hxx @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_PBINITEM_HXX +#define _SVX_PBINITEM_HXX + +#include <svl/intitem.hxx> +#include <editeng/editengdllapi.h> + +// define ---------------------------------------------------------------- + +#define PAPERBIN_PRINTER_SETTINGS ((sal_uInt8)0xFF) + +// class SvxPaperBinItem ------------------------------------------------- + +/* [Description] + + This item describes selecting a paper tray of the printer. +*/ + +class EDITENG_DLLPUBLIC SvxPaperBinItem : public SfxByteItem +{ +public: + TYPEINFO(); + + explicit inline SvxPaperBinItem( const sal_uInt16 nId , + const sal_uInt8 nTray = PAPERBIN_PRINTER_SETTINGS ); + inline SvxPaperBinItem &operator=( const SvxPaperBinItem &rCpy ); + + // "pure virtual Methods" from SfxPoolItem + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create( SvStream &, sal_uInt16 ) const; + virtual SvStream& Store( SvStream &, sal_uInt16 nItemVersion ) const; + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; +}; + +inline SvxPaperBinItem::SvxPaperBinItem( const sal_uInt16 nId, const sal_uInt8 nT ) + : SfxByteItem( nId, nT ) +{} + +inline SvxPaperBinItem &SvxPaperBinItem::operator=( + const SvxPaperBinItem &rCpy ) +{ + SetValue( rCpy.GetValue() ); + return *this; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/pgrditem.hxx b/include/editeng/pgrditem.hxx new file mode 100644 index 000000000000..9c4c47cce882 --- /dev/null +++ b/include/editeng/pgrditem.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_PGRDITEM_HXX +#define _SVX_PGRDITEM_HXX + +#include <svl/eitem.hxx> +#include "editeng/editengdllapi.h" + +// class SvxParaGridItem ------------------------------------------------- + + +/* [Description] + + Paragraph snap to grid +*/ + +class EDITENG_DLLPUBLIC SvxParaGridItem : public SfxBoolItem +{ +public: + TYPEINFO(); + + SvxParaGridItem( const sal_Bool bSnapToGrid /*= sal_True*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; +}; + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/pmdlitem.hxx b/include/editeng/pmdlitem.hxx new file mode 100644 index 000000000000..55fee950d8f0 --- /dev/null +++ b/include/editeng/pmdlitem.hxx @@ -0,0 +1,77 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_PMDLITEM_HXX +#define _SVX_PMDLITEM_HXX + +#include <svl/stritem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxPageModelItem ------------------------------------------------ + +/* [Description] + + This item contains a name of a page template. +*/ + +class EDITENG_DLLPUBLIC SvxPageModelItem : public SfxStringItem +{ +private: + sal_Bool bAuto; + +public: + TYPEINFO(); + + explicit inline SvxPageModelItem( sal_uInt16 nWh ); + inline SvxPageModelItem( const String& rModel, sal_Bool bA /*= sal_False*/, + sal_uInt16 nWh ); + inline SvxPageModelItem& operator=( const SvxPageModelItem& rModel ); + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + sal_Bool IsAuto() const { return bAuto; } +}; + +inline SvxPageModelItem::SvxPageModelItem( sal_uInt16 nWh ) + : bAuto( sal_False ) +{ + SetWhich( nWh ); +} + +inline SvxPageModelItem::SvxPageModelItem( const String& rModel, sal_Bool bA, + sal_uInt16 nWh ) : + SfxStringItem( nWh, rModel ), + bAuto( bA ) +{} + +inline SvxPageModelItem& SvxPageModelItem::operator=( const SvxPageModelItem& rModel ) +{ + SetValue( rModel.GetValue() ); + return *this; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/postitem.hxx b/include/editeng/postitem.hxx new file mode 100644 index 000000000000..e547d5a5e438 --- /dev/null +++ b/include/editeng/postitem.hxx @@ -0,0 +1,76 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_POSTITEM_HXX +#define _SVX_POSTITEM_HXX + +#include <vcl/vclenum.hxx> +#include <svl/eitem.hxx> +#include <editeng/editengdllapi.h> + +class SvXMLUnitConverter; + +// class SvxPostureItem -------------------------------------------------- + +/* [Description] + + This item describes the font setting (Italic) +*/ + +class EDITENG_DLLPUBLIC SvxPostureItem : public SfxEnumItem +{ +public: + TYPEINFO(); + + SvxPostureItem( const FontItalic ePost /*= ITALIC_NONE*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + SwEnumItem + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const; + virtual sal_uInt16 GetValueCount() const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + virtual int HasBoolValue() const; + virtual sal_Bool GetBoolValue() const; + virtual void SetBoolValue( sal_Bool bVal ); + + inline SvxPostureItem& operator=(const SvxPostureItem& rPost) { + SetValue( rPost.GetValue() ); + return *this; + } + + // enum cast + FontItalic GetPosture() const + { return (FontItalic)GetValue(); } + void SetPosture( FontItalic eNew ) + { SetValue( (sal_uInt16)eNew ); } +}; + +#endif // #ifndef _SVX_POSTITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/prntitem.hxx b/include/editeng/prntitem.hxx new file mode 100644 index 000000000000..050131953dc3 --- /dev/null +++ b/include/editeng/prntitem.hxx @@ -0,0 +1,70 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_PRNTITEM_HXX +#define _SVX_PRNTITEM_HXX + +#include <svl/eitem.hxx> +#include "editeng/editengdllapi.h" + + + +// class SvxPrintItem ---------------------------------------------------- + + +/* [Description] + + This item describes a logical variable "Print yes or no". +*/ + + +class EDITENG_DLLPUBLIC SvxPrintItem : public SfxBoolItem +{ +public: + TYPEINFO(); + + explicit SvxPrintItem( const sal_uInt16 nId , const sal_Bool bPrt = sal_True ); + inline SvxPrintItem &operator=( const SvxPrintItem &rCpy ); + + // "pure virtual Methods" from SfxPoolItem + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; +}; + +inline SvxPrintItem::SvxPrintItem( const sal_uInt16 nId, const sal_Bool bPrt ) + : SfxBoolItem( nId, bPrt ) +{} + +inline SvxPrintItem &SvxPrintItem::operator=( const SvxPrintItem &rCpy ) +{ + SetValue( rCpy.GetValue() ); + return *this; +} + + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/protitem.hxx b/include/editeng/protitem.hxx new file mode 100644 index 000000000000..37f2bec77998 --- /dev/null +++ b/include/editeng/protitem.hxx @@ -0,0 +1,90 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_PROTITEM_HXX +#define _SVX_PROTITEM_HXX + +#include <svl/poolitem.hxx> +#include "editeng/editengdllapi.h" + +class SvXMLUnitConverter; + +// class SvxProtectItem -------------------------------------------------- + + +/* [Description] + + This item describes, if content, size or position should be protected. +*/ + +class EDITENG_DLLPUBLIC SvxProtectItem : public SfxPoolItem +{ + sal_Bool bCntnt :1; // Content protected + sal_Bool bSize :1; // Size protected + sal_Bool bPos :1; // Position protected + +public: + TYPEINFO(); + + explicit inline SvxProtectItem( const sal_uInt16 nId ); + inline SvxProtectItem &operator=( const SvxProtectItem &rCpy ); + + // "pure virtual Methods" from SfxPoolItem + virtual int operator==( const SfxPoolItem& ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; + + sal_Bool IsCntntProtected() const { return bCntnt; } + sal_Bool IsSizeProtected() const { return bSize; } + sal_Bool IsPosProtected() const { return bPos; } + void SetCntntProtect( sal_Bool bNew ) { bCntnt = bNew; } + void SetSizeProtect ( sal_Bool bNew ) { bSize = bNew; } + void SetPosProtect ( sal_Bool bNew ) { bPos = bNew; } + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); +}; + +inline SvxProtectItem::SvxProtectItem( const sal_uInt16 nId ) + : SfxPoolItem( nId ) +{ + bCntnt = bSize = bPos = sal_False; +} + +inline SvxProtectItem &SvxProtectItem::operator=( const SvxProtectItem &rCpy ) +{ + bCntnt = rCpy.IsCntntProtected(); + bSize = rCpy.IsSizeProtected(); + bPos = rCpy.IsPosProtected(); + return *this; +} + + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/prszitem.hxx b/include/editeng/prszitem.hxx new file mode 100644 index 000000000000..d89669d8eca2 --- /dev/null +++ b/include/editeng/prszitem.hxx @@ -0,0 +1,59 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_PRSZITEM_HXX +#define _SVX_PRSZITEM_HXX + +#include <svl/intitem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxPropSizeItem ------------------------------------------------- + +/* [Description] + + This item describes the relative Font Size. +*/ + +class EDITENG_DLLPUBLIC SvxPropSizeItem : public SfxUInt16Item +{ +public: + TYPEINFO(); + + SvxPropSizeItem( const sal_uInt16 nPercent /*= 100*/, + const sal_uInt16 nID ); + + // "pure virtual Methods" from SfxPoolItem + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + inline SvxPropSizeItem& operator=(const SvxPropSizeItem& rPropSize) + { + SetValue( rPropSize.GetValue() ); + return *this; + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/rsiditem.hxx b/include/editeng/rsiditem.hxx new file mode 100644 index 000000000000..e98fb8e4e129 --- /dev/null +++ b/include/editeng/rsiditem.hxx @@ -0,0 +1,43 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * [ Copyright (C) 2009 Tzvetelina Tzeneva <tzvetelina@gmail.com> (initial developer) ] + */ +#ifndef _SVX_RSIDITEM_HXX +#define _SVX_RSIDITEM_HXX + +#include <svl/intitem.hxx> +#include "editeng/editengdllapi.h" + +//---------------------- +// SvxRsidItem +//---------------------- + +class EDITENG_DLLPUBLIC SvxRsidItem : public SfxUInt32Item +{ +public: + TYPEINFO(); + + SvxRsidItem( sal_uInt32 nRsid, sal_uInt16 nId ) : SfxUInt32Item( nId, nRsid ) {} + SvxRsidItem( SvStream& rIn, sal_uInt16 nId ) : SfxUInt32Item( nId, rIn ) {} + + virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const; + virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); +}; + +#endif // _SVX_RSIDITEM_HXX diff --git a/include/editeng/scriptspaceitem.hxx b/include/editeng/scriptspaceitem.hxx new file mode 100644 index 000000000000..f58234baf042 --- /dev/null +++ b/include/editeng/scriptspaceitem.hxx @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SRIPTSPACEITEM_HXX +#define _SVX_SRIPTSPACEITEM_HXX + +#include <svl/eitem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxScriptSpaceItem ---------------------------------------------- + +/* [Description] + + This item describe the script type of the selected text and is only + used for the user interface. +*/ + +class EDITENG_DLLPUBLIC SvxScriptSpaceItem : public SfxBoolItem +{ +public: + TYPEINFO(); + + SvxScriptSpaceItem( sal_Bool bOn /*= sal_False*/, + const sal_uInt16 nId ); + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, + const IntlWrapper * = 0 ) const; + + inline SvxScriptSpaceItem& operator=(const SvxScriptSpaceItem& rItem ) + { + SetValue( rItem.GetValue() ); + return *this; + } + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/scripttypeitem.hxx b/include/editeng/scripttypeitem.hxx new file mode 100644 index 000000000000..a50f82d9d951 --- /dev/null +++ b/include/editeng/scripttypeitem.hxx @@ -0,0 +1,82 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SCRIPTTYPEITEM_HXX +#define _SVX_SCRIPTTYPEITEM_HXX + +#include <svl/intitem.hxx> +#include <svl/languageoptions.hxx> +#include <editeng/editengdllapi.h> + +// class SvxScriptTypeItem ---------------------------------------------- + +/* [Description] + + This item describes the script type of the selected text and is only + used for the user interface. +*/ + +EDITENG_DLLPUBLIC sal_uInt16 GetI18NScriptTypeOfLanguage( sal_uInt16 nLang ); +sal_uInt16 GetItemScriptType( short nI18NType ); +short GetI18NScriptType( sal_uInt16 nItemType ); + +class EDITENG_DLLPUBLIC SvxScriptTypeItem : public SfxUInt16Item +{ +public: + TYPEINFO(); + + explicit SvxScriptTypeItem( sal_uInt16 nType = SCRIPTTYPE_LATIN ); + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + +}; + +class EDITENG_DLLPUBLIC SvxScriptSetItem : public SfxSetItem +{ +public: + TYPEINFO(); + + SvxScriptSetItem( sal_uInt16 nSlotId, SfxItemPool& rPool ); + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create( SvStream &, sal_uInt16 nVersion ) const; + + static const SfxPoolItem* GetItemOfScriptSet( const SfxItemSet& rSet, + sal_uInt16 nWhich ); + inline const SfxPoolItem* GetItemOfScriptSet( sal_uInt16 _nWhich ) const + { return SvxScriptSetItem::GetItemOfScriptSet( GetItemSet(), _nWhich ); } + + static const SfxPoolItem* GetItemOfScript( sal_uInt16 nSlotId, const SfxItemSet& rSet, sal_uInt16 nScript ); + + const SfxPoolItem* GetItemOfScript( sal_uInt16 nScript ) const; + + void PutItemForScriptType( sal_uInt16 nScriptType, const SfxPoolItem& rItem ); + + static void GetWhichIds( sal_uInt16 nSlotId, const SfxItemSet& rSet, sal_uInt16& rLatin, sal_uInt16& rAsian, sal_uInt16& rComplex); + + void GetWhichIds( sal_uInt16& rLatin, sal_uInt16& rAsian, sal_uInt16& rComplex) const; + + static void GetSlotIds( sal_uInt16 nSlotId, sal_uInt16& rLatin, sal_uInt16& rAsian, + sal_uInt16& rComplex ); + inline void GetSlotIds( sal_uInt16& rLatin, sal_uInt16& rAsian, + sal_uInt16& rComplex ) const + { GetSlotIds( Which(), rLatin, rAsian, rComplex ); } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/shaditem.hxx b/include/editeng/shaditem.hxx new file mode 100644 index 000000000000..e76c77a7ec4e --- /dev/null +++ b/include/editeng/shaditem.hxx @@ -0,0 +1,98 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SHADITEM_HXX +#define _SVX_SHADITEM_HXX + +#include <tools/color.hxx> +#include <svl/eitem.hxx> +#include <editeng/svxenum.hxx> +#include <editeng/editengdllapi.h> + + +// class SvxShadowItem --------------------------------------------------- + +/* [Description] + + This item describes the shadow attribute (color, width and position). +*/ + +#define SHADOW_TOP ((sal_uInt16)0) +#define SHADOW_BOTTOM ((sal_uInt16)1) +#define SHADOW_LEFT ((sal_uInt16)2) +#define SHADOW_RIGHT ((sal_uInt16)3) + +class EDITENG_DLLPUBLIC SvxShadowItem : public SfxEnumItemInterface +{ + Color aShadowColor; + sal_uInt16 nWidth; + SvxShadowLocation eLocation; +public: + TYPEINFO(); + + explicit SvxShadowItem( const sal_uInt16 nId , + const Color *pColor = 0, const sal_uInt16 nWidth = 100 /*5pt*/, + const SvxShadowLocation eLoc = SVX_SHADOW_NONE ); + + inline SvxShadowItem& operator=( const SvxShadowItem& rFmtShadow ); + + // "pure virtual Methods" from SfxPoolItem + virtual int operator==( const SfxPoolItem& ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; + virtual bool ScaleMetrics( long nMult, long nDiv ); + virtual bool HasMetrics() const; + + const Color& GetColor() const { return aShadowColor;} + void SetColor( const Color &rNew ) { aShadowColor = rNew; } + + sal_uInt16 GetWidth() const { return nWidth; } + SvxShadowLocation GetLocation() const { return eLocation; } + + void SetWidth( sal_uInt16 nNew ) { nWidth = nNew; } + void SetLocation( SvxShadowLocation eNew ) { eLocation = eNew; } + + // Calculate width of the shadow on the page. + sal_uInt16 CalcShadowSpace( sal_uInt16 nShadow ) const; + + virtual sal_uInt16 GetValueCount() const; + virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const; + virtual sal_uInt16 GetEnumValue() const; + virtual void SetEnumValue( sal_uInt16 nNewVal ); +}; + +inline SvxShadowItem &SvxShadowItem::operator=( const SvxShadowItem& rFmtShadow ) +{ + aShadowColor = rFmtShadow.aShadowColor; + nWidth = rFmtShadow.GetWidth(); + eLocation = rFmtShadow.GetLocation(); + return *this; +} + +#endif // #ifndef _SVX_SHADITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/shdditem.hxx b/include/editeng/shdditem.hxx new file mode 100644 index 000000000000..d738a8794f5f --- /dev/null +++ b/include/editeng/shdditem.hxx @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SHDDITEM_HXX +#define _SVX_SHDDITEM_HXX + +#include <svl/eitem.hxx> +#include <editeng/editengdllapi.h> + +class SvXMLUnitConverter; + +// class SvxShadowedItem ------------------------------------------------- + +/* [Description] + + This item describes, whether and how it is shaded. +*/ + +class EDITENG_DLLPUBLIC SvxShadowedItem : public SfxBoolItem +{ +public: + TYPEINFO(); + + SvxShadowedItem( const sal_Bool bShadowed /*= sal_False*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + inline SvxShadowedItem& operator=(const SvxShadowedItem& rShadow) { + SetValue(rShadow.GetValue()); + return *this; + } + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/sizeitem.hxx b/include/editeng/sizeitem.hxx new file mode 100644 index 000000000000..df70d40c47cf --- /dev/null +++ b/include/editeng/sizeitem.hxx @@ -0,0 +1,74 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SIZEITEM_HXX +#define _SVX_SIZEITEM_HXX + +#include <tools/gen.hxx> +#include <svl/poolitem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxSizeItem ----------------------------------------------------- + +/* [Description] + + This item describes a two-dimensional size. +*/ + +class EDITENG_DLLPUBLIC SvxSizeItem : public SfxPoolItem +{ + + Size aSize; + +public: + TYPEINFO(); + + explicit SvxSizeItem( const sal_uInt16 nId ); + SvxSizeItem( const sal_uInt16 nId, const Size& rSize); + + inline SvxSizeItem& operator=( const SvxSizeItem &rCpy ); + + // "pure virtual Methods" from SfxPoolItem + virtual int operator==( const SfxPoolItem& ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; + virtual bool ScaleMetrics( long nMult, long nDiv ); + virtual bool HasMetrics() const; + + const Size& GetSize() const { return aSize; } + void SetSize(const Size& rSize) { aSize = rSize; } +}; + +inline SvxSizeItem& SvxSizeItem::operator=( const SvxSizeItem &rCpy ) +{ + aSize = rCpy.aSize; + return *this; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/spltitem.hxx b/include/editeng/spltitem.hxx new file mode 100644 index 000000000000..a7a0a9f0665c --- /dev/null +++ b/include/editeng/spltitem.hxx @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SPLTITEM_HXX +#define _SVX_SPLTITEM_HXX + +#include <svl/eitem.hxx> +#include <editeng/editengdllapi.h> + +class SvXMLUnitConverter; + +// class SvxFmtSplitItem ------------------------------------------------- + +/* [Description] + + This item describes a logical variable "split paragraph yes or no". +*/ + +class EDITENG_DLLPUBLIC SvxFmtSplitItem : public SfxBoolItem +{ +public: + TYPEINFO(); + ~SvxFmtSplitItem(); + + inline SvxFmtSplitItem( const sal_Bool bSplit /*= sal_True*/, + const sal_uInt16 nWh ); + inline SvxFmtSplitItem& operator=( const SvxFmtSplitItem& rSplit ); + + // "pure virtual Methods" from SfxPoolItem + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create( SvStream&, sal_uInt16 ) const; + virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; +}; + +inline SvxFmtSplitItem::SvxFmtSplitItem( const sal_Bool bSplit, const sal_uInt16 nWh ) : + SfxBoolItem( nWh, bSplit ) +{} + +inline SvxFmtSplitItem& SvxFmtSplitItem::operator=( + const SvxFmtSplitItem& rSplit ) +{ + SetValue( rSplit.GetValue() ); + return *this; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/splwrap.hxx b/include/editeng/splwrap.hxx new file mode 100644 index 000000000000..d4c9b8da8732 --- /dev/null +++ b/include/editeng/splwrap.hxx @@ -0,0 +1,151 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SPLWRAP_HXX +#define _SVX_SPLWRAP_HXX + +#include <editeng/svxenum.hxx> +#include <tools/string.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include "editeng/editengdllapi.h" + +// forward --------------------------------------------------------------- + +namespace com { namespace sun { namespace star { namespace linguistic2 { + class XDictionary; + class XSpellChecker1; + class XHyphenator; +}}}} + +class Window; + +// misc functions --------------------------------------------------------------- + +void EDITENG_DLLPUBLIC SvxPrepareAutoCorrect( String &rOldText, String &rNewText ); + +/*-------------------------------------------------------------------- + Description: The SpellWrapper + --------------------------------------------------------------------*/ + +class EDITENG_DLLPUBLIC SvxSpellWrapper { +private: + friend class SvxSpellCheckDialog; + friend class SvxHyphenWordDialog; + friend struct SvxHyphenWordDialog_Impl; + + Window* pWin; + ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XInterface > xLast; // result of last spelling/hyphenation attempt + ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XSpellChecker1 > xSpell; + ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XHyphenator > xHyph; + sal_uInt16 nOldLang; // Set Language, only call SetLanguage on changes + sal_Bool bOtherCntnt : 1; // set => Check special sections initially + sal_Bool bDialog : 1; // Is pWin the Svx...Dialog? + sal_Bool bHyphen : 1; // Split instead of spell checking + sal_Bool bAuto : 1; // AutoCorrect available? + sal_Bool bReverse : 1; // Reverse spell check + sal_Bool bStartDone : 1; // Beginning already corrected + sal_Bool bEndDone : 1; // End part already corrected + sal_Bool bStartChk : 1; // Examine the beginning + sal_Bool bRevAllowed : 1; // Reverse spell check prohibited + sal_Bool bAllRight : 1; // Record wrong words in the dedicated + // dictionary and do not start the dialog. + + EDITENG_DLLPRIVATE sal_Bool SpellNext(); // select next area + sal_Bool FindSpellError(); // Check for errors (over areas) + +public: + SvxSpellWrapper( Window* pWn, + ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XSpellChecker1 > &xSpellChecker, + const sal_Bool bStart = sal_False, const sal_Bool bIsAllRight = sal_False, + const sal_Bool bOther = sal_False, const sal_Bool bRevAllow = sal_True ); + SvxSpellWrapper( Window* pWn, + ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XHyphenator > &xHyphenator, + const sal_Bool bStart = sal_False, const sal_Bool bOther = sal_False ); + + virtual ~SvxSpellWrapper(); + + static sal_Int16 CheckSpellLang( + ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XSpellChecker1 > xSpell, + sal_Int16 nLang ); + static sal_Int16 CheckHyphLang( + ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XHyphenator > xHyph, + sal_Int16 nLang ); + + static void ShowLanguageErrors(); + + void SpellDocument(); // Perform Spell Checking + inline sal_Bool IsStartDone(){ return bStartDone; } + inline sal_Bool IsEndDone(){ return bEndDone; } + inline sal_Bool IsReverse(){ return bReverse; } + inline sal_Bool IsDialog(){ return bDialog; } // SvxSpellCheckDialog OnScreen + inline sal_Bool IsHyphen(){ return bHyphen; } // Split instead of Spell check + inline void SetHyphen( const sal_Bool bNew = sal_True ){ bHyphen = bNew; } + inline ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XSpellChecker1 > + GetXSpellChecker() { return xSpell; } + inline ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XHyphenator > + GetXHyphenator() { return xHyph; } + inline sal_Bool IsAllRight() { return bAllRight; } + inline Window* GetWin() { return pWin; } + // can possibly be omitted in ONE_LINGU: + inline void SetOldLang( const sal_uInt16 nNew ){ nOldLang = nNew; } + // can possibly be omitted in ONE_LINGU: + inline void ChangeLanguage( const sal_uInt16 nNew ) // call SetLanguage if needed. + { if ( nNew != nOldLang ) { SetLanguage( nNew ); nOldLang = nNew; } } + inline void EnableAutoCorrect() { bAuto = sal_True; } + +protected: + ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XInterface > + GetLast() { return xLast; } + void SetLast(const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XInterface > &xNewLast) + { xLast = xNewLast; } + virtual sal_Bool SpellMore(); // examine further documents? + virtual sal_Bool HasOtherCnt(); // Are there any special areas? + virtual void SpellStart( SvxSpellArea eSpell ); // Preparing the area + virtual sal_Bool SpellContinue(); // Check Areas + // Result available through GetLast + virtual void ReplaceAll( const String &rNewText, sal_Int16 nLanguage ); //Replace word from the replace list + virtual void StartThesaurus( const String &rWord, sal_uInt16 nLang ); + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XDictionary > + GetAllRightDic() const; + virtual void SpellEnd(); // Finish area + virtual void ScrollArea(); // Set ScrollArea + // Replace word + virtual void ChangeWord( const String& rNewWord, const sal_uInt16 nLang ); + // Wort via Thesaurus ersetzen + virtual void ChangeThesWord( const String& rNewWord ); + virtual void SetLanguage( const sal_uInt16 nLang ); // Change Language + virtual void AutoCorrect( const String& rAktStr, const String& rNewStr ); + virtual void InsertHyphen( const sal_uInt16 nPos ); // Insert hyphen + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx new file mode 100644 index 000000000000..4f54d8f2f11b --- /dev/null +++ b/include/editeng/svxacorr.hxx @@ -0,0 +1,441 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef EE_SVXACORR_HXX +#define EE_SVXACORR_HXX + +#include <com/sun/star/embed/XStorage.hpp> + +#include <o3tl/sorted_vector.hxx> +#include <tools/rtti.hxx> +#include <i18nlangtag/lang.h> +#include <tools/time.hxx> +#include <tools/date.hxx> +#include <tools/string.hxx> +#include <editeng/swafopt.hxx> +#include "editeng/editengdllapi.h" + +#include <map> +#include <set> +#include <boost/unordered_map.hpp> +#include <boost/ptr_container/ptr_map.hpp> + +class CharClass; +class SfxPoolItem; +class SvxAutoCorrect; +class SfxObjectShell; +class SotStorageRef; +class SotStorage; +class Window; + +struct CompareSvStringsISortDtor +{ + bool operator()( String* const& lhs, String* const& rhs ) const + { + return lhs->CompareIgnoreCaseToAscii( *rhs ) == COMPARE_LESS; + } +}; + +class SvStringsISortDtor + : public o3tl::sorted_vector<String*, CompareSvStringsISortDtor> +{ +public: + ~SvStringsISortDtor() { DeleteAndDestroyAll(); } +}; + +// Auto correct flags +const long CptlSttSntnc = 0x00000001; // Capital letters at the beginning of a sentence +const long CptlSttWrd = 0x00000002; // not two Capital letters at the beginning of a word +const long AddNonBrkSpace = 0x00000004; // Add non breaking space before :;?!% +const long ChgOrdinalNumber = 0x00000008; // Ordinal-Number 1st, 2nd,.. +const long ChgToEnEmDash = 0x00000010; // - -> Endash/Emdash +const long ChgWeightUnderl = 0x00000020; // * -> Bold, _ -> Underscore +const long SetINetAttr = 0x00000040; // Set INetAttribut +const long Autocorrect = 0x00000080; // Call AutoCorrect +const long ChgQuotes = 0x00000100; // replace double quotes +const long SaveWordCplSttLst= 0x00000200; // Save Auto correction of Capital letter at beginning of sentence. +const long SaveWordWrdSttLst= 0x00000400; // Save Auto correction of 2 Capital letter at beginning of word. +const long IgnoreDoubleSpace= 0x00000800; // Ignore 2 Spaces +const long ChgSglQuotes = 0x00001000; // Replace simple quotes +const long CorrectCapsLock = 0x00002000; // Correct accidental use of cAPS LOCK key + +const long ChgWordLstLoad = 0x20000000; // Replacement list loaded +const long CplSttLstLoad = 0x40000000; // Exception list for Capital letters Start loaded +const long WrdSttLstLoad = 0x80000000; // Exception list for Word Start loaded + +// TODO: handle unicodes > U+FFFF and check users of this class + +// only a mapping class +class EDITENG_DLLPUBLIC SvxAutoCorrDoc +{ +public: + SvxAutoCorrDoc() {} + virtual ~SvxAutoCorrDoc(); + + virtual sal_Bool Delete( xub_StrLen nStt, xub_StrLen nEnd ) = 0; + virtual sal_Bool Insert( xub_StrLen nPos, const String& rTxt ) = 0; + virtual sal_Bool Replace( xub_StrLen nPos, const String& rTxt ) = 0; + virtual sal_Bool ReplaceRange( xub_StrLen nPos, xub_StrLen nLen, const String& rTxt ) = 0; + + virtual sal_Bool SetAttr( xub_StrLen nStt, xub_StrLen nEnd, sal_uInt16 nSlotId, + SfxPoolItem& ) = 0; + + virtual sal_Bool SetINetAttr( xub_StrLen nStt, xub_StrLen nEnd, const String& rURL ) = 0; + + // Return the text of a previous paragraph. This must not be empty! + // If no paragraph exits or just an empty one, then return 0. + // The flag indicates: + // TRUE: before the normal insertion position (TRUE) + // FALSE: in which the corrected word was inserted. + // (Does not to have to be the same paragraph !!!!) + virtual const String* GetPrevPara( sal_Bool bAtNormalPos ) = 0; + + virtual sal_Bool ChgAutoCorrWord( xub_StrLen& rSttPos, xub_StrLen nEndPos, + SvxAutoCorrect& rACorrect, + const String** ppPara ) = 0; + // Is called after the change of the signs by the functions + // - FnCptlSttWrd + // - FnCptlSttSntnc + // As an option, the words can then be inserted into the exception lists. + virtual void SaveCpltSttWord( sal_uLong nFlag, xub_StrLen nPos, + const String& rExceptWord, + sal_Unicode cChar ); + + // which language at the position? + virtual LanguageType GetLanguage( xub_StrLen nPos, sal_Bool bPrevPara = sal_False ) const; +}; + + +class EDITENG_DLLPUBLIC SvxAutocorrWord +{ + String sShort, sLong; + sal_Bool bIsTxtOnly; // Is pure ASCII - Text +public: + SvxAutocorrWord( const String& rS, const String& rL, sal_Bool bFlag = sal_True ) + : sShort( rS ), sLong( rL ), bIsTxtOnly( bFlag ) + {} + + const String& GetShort() const { return sShort; } + const String& GetLong() const { return sLong; } + sal_Bool IsTextOnly() const { return bIsTxtOnly; } +}; + +struct CompareSvxAutocorrWordList +{ + bool operator()( SvxAutocorrWord* const& lhs, SvxAutocorrWord* const& rhs ) const; +}; + +typedef std::set<SvxAutocorrWord*, CompareSvxAutocorrWordList> SvxAutocorrWordList_Set; +typedef ::boost::unordered_map< OUString, SvxAutocorrWord *, + OUStringHash > SvxAutocorrWordList_Hash; + +class EDITENG_DLLPUBLIC SvxAutocorrWordList +{ + // only one of these contains the data + mutable SvxAutocorrWordList_Set maSet; + mutable SvxAutocorrWordList_Hash maHash; // key is 'Short' + + bool WordMatches(const SvxAutocorrWord *pFnd, + const String &rTxt, + xub_StrLen &rStt, + xub_StrLen nEndPos) const; +public: + // free any objects still in the set + ~SvxAutocorrWordList(); + void DeleteAndDestroyAll(); + bool Insert(SvxAutocorrWord *pWord); + SvxAutocorrWord* FindAndRemove(SvxAutocorrWord *pWord); + void LoadEntry(String sWrong, String sRight, sal_Bool bOnlyTxt); + bool empty() const; + + typedef std::vector<SvxAutocorrWord *> Content; + Content getSortedContent() const; + + const SvxAutocorrWord* SearchWordsInList(const String& rTxt, xub_StrLen& rStt, xub_StrLen nEndPos) const; +}; + +class EDITENG_DLLPUBLIC SvxAutoCorrectLanguageLists +{ + String sShareAutoCorrFile, sUserAutoCorrFile; + // If the AutoCorr file is newer + Date aModifiedDate; + Time aModifiedTime, aLastCheckTime; + + SvStringsISortDtor* pCplStt_ExcptLst; + SvStringsISortDtor* pWrdStt_ExcptLst; + SvxAutocorrWordList* pAutocorr_List; + SvxAutoCorrect& rAutoCorrect; + + long nFlags; + + sal_Bool IsFileChanged_Imp(); + void LoadXMLExceptList_Imp( SvStringsISortDtor*& rpLst, + const sal_Char* pStrmName, + SotStorageRef& rStg); + void SaveExceptList_Imp( const SvStringsISortDtor& rLst, + const sal_Char* pStrmName, + SotStorageRef& rStg, + sal_Bool bConvert = sal_False); + + sal_Bool MakeBlocklist_Imp( SotStorage& rStg ); + void RemoveStream_Imp( const String& rName ); + void MakeUserStorage_Impl(); + +public: + SvxAutoCorrectLanguageLists( SvxAutoCorrect& rParent, + const String& rShareAutoCorrectFile, + const String& rUserAutoCorrectFile); + ~SvxAutoCorrectLanguageLists(); + + // Load, Set, Get - the replacement list + SvxAutocorrWordList* LoadAutocorrWordList(); + void SetAutocorrWordList( SvxAutocorrWordList* pList ); + const SvxAutocorrWordList* GetAutocorrWordList(); + + // Load, Set, Get - the exception list for Capital letter at the + // beginning of a sentence + SvStringsISortDtor* LoadCplSttExceptList(); + void SaveCplSttExceptList(); + void SetCplSttExceptList( SvStringsISortDtor* pList ); + SvStringsISortDtor* GetCplSttExceptList(); + sal_Bool AddToCplSttExceptList(const String& rNew); + + // Load, Set, Get the exception list for 2 Capital letters at the + // beginning of a word. + SvStringsISortDtor* LoadWrdSttExceptList(); + void SaveWrdSttExceptList(); + void SetWrdSttExceptList( SvStringsISortDtor* pList ); + SvStringsISortDtor* GetWrdSttExceptList(); + sal_Bool AddToWrdSttExceptList(const String& rNew); + + // Save word substitutions: + // Store these directly in the storage. The word list is updated + // accordingly! + // - pure Text + sal_Bool PutText( const String& rShort, const String& rLong ); + // - Text with attribution (only the SWG - SWG format!) + sal_Bool PutText( const String& rShort, SfxObjectShell& ); + // - Deleting an entry + sal_Bool DeleteText( const String& rShort ); + // - Make combined changes in one pass + sal_Bool MakeCombinedChanges( std::vector<SvxAutocorrWord>& aNewEntries, std::vector<SvxAutocorrWord>& aDeleteEntries ); +}; + +class EDITENG_DLLPUBLIC SvxAutoCorrect +{ + friend class SvxAutoCorrectLanguageLists; + + String sShareAutoCorrFile, sUserAutoCorrFile; + + SvxSwAutoFmtFlags aSwFlags; // StarWriter AutoFormat Flags + + // all languages in a table + boost::ptr_map<LanguageType, SvxAutoCorrectLanguageLists>* pLangTable; + std::map<LanguageType, long> aLastFileTable; + CharClass* pCharClass; + + bool bRunNext; + + LanguageType eCharClassLang; + + long nFlags; + sal_Unicode cStartDQuote, cEndDQuote, cStartSQuote, cEndSQuote, + cEmDash, cEnDash; + + + // private methods + SvxAutoCorrectLanguageLists& _GetLanguageList( LanguageType eLang ); + + void _GetCharClass( LanguageType eLang ); + +protected: + // - Text with attribution (only the SWG - SWG format!) + // rShort is the stream name - encrypted! + virtual sal_Bool PutText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStg, const String& rFileName, const String& rShort, SfxObjectShell& , + String& ); + + // required language in the table add if possible only when the file exists + sal_Bool CreateLanguageFile(LanguageType eLang, sal_Bool bNewFile = sal_True); + // - Return the replacement text (only for SWG format, all others can be + // taken from the word list!) + // rShort is the stream name - encrypted! +public: + + sal_Unicode GetQuote( sal_Unicode cInsChar, sal_Bool bSttQuote, + LanguageType eLang ) const; + virtual sal_Bool GetLongText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStg, const String& rFileName, const String& rShort, String& rLong ); + + TYPEINFO(); + + SvxAutoCorrect( const String& rShareAutocorrFile, + const String& rUserAutocorrFile ); + SvxAutoCorrect( const SvxAutoCorrect& ); + virtual ~SvxAutoCorrect(); + + // Execute an AutoCorrect. + // Returns what has been executed, according to the above flags + sal_uLong AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, + xub_StrLen nPos, sal_Unicode cInsChar, sal_Bool bInsert, Window* pFrameWin = NULL ); + + // Return for the autotext expansion the previous word, + // AutoCorrect - corresponding algorithm + sal_Bool GetPrevAutoCorrWord( SvxAutoCorrDoc& rDoc, const String& rTxt, + xub_StrLen nPos, String& rWord ) const; + + // Search for or or the words in the replacement table. + // rText - check in this text the words of the list + // rStt - the detected starting position + // nEnd - to check position - as of this item forward + // rLang - Input: in which language is searched + // Output: in which "language list" was it found + const SvxAutocorrWord* SearchWordsInList( const String& rTxt, + xub_StrLen& rStt, xub_StrLen nEndPos, + SvxAutoCorrDoc& rDoc, + LanguageType& rLang ); + + // Query/Set the Character for the Quote substitution + sal_Unicode GetStartSingleQuote() const { return cStartSQuote; } + sal_Unicode GetEndSingleQuote() const { return cEndSQuote; } + sal_Unicode GetStartDoubleQuote() const { return cStartDQuote; } + sal_Unicode GetEndDoubleQuote() const { return cEndDQuote; } + + void SetStartSingleQuote( const sal_Unicode cStart ) { cStartSQuote = cStart; } + void SetEndSingleQuote( const sal_Unicode cEnd ) { cEndSQuote = cEnd; } + void SetStartDoubleQuote( const sal_Unicode cStart ) { cStartDQuote = cStart; } + void SetEndDoubleQuote( const sal_Unicode cEnd ) { cEndDQuote = cEnd; } + + String GetQuote( SvxAutoCorrDoc& rDoc, xub_StrLen nInsPos, + sal_Unicode cInsChar, sal_Bool bSttQuote ); + void InsertQuote( SvxAutoCorrDoc& rDoc, xub_StrLen nInsPos, + sal_Unicode cInsChar, sal_Bool bSttQuote, sal_Bool bIns ); + + // Query/Set the name of the AutoCorrect file + // the default is "autocorr.dat" + String GetAutoCorrFileName( LanguageType eLang = LANGUAGE_SYSTEM, + sal_Bool bNewFile = sal_False, + sal_Bool bTstUserExist = sal_False ) const; + + // Query/Set the current settings of AutoCorrect + long GetFlags() const { return nFlags; } + inline SvxSwAutoFmtFlags& GetSwFlags() { return aSwFlags;} + sal_Bool IsAutoCorrFlag( long nFlag ) const + { return nFlags & nFlag ? sal_True : sal_False; } + void SetAutoCorrFlag( long nFlag, sal_Bool bOn = sal_True ); + + // Load, Set, Get - the replacement list + SvxAutocorrWordList* LoadAutocorrWordList( + LanguageType eLang = LANGUAGE_SYSTEM ) + { return _GetLanguageList( eLang ).LoadAutocorrWordList(); } + const SvxAutocorrWordList* GetAutocorrWordList( + LanguageType eLang = LANGUAGE_SYSTEM ) + { return _GetLanguageList( eLang ).GetAutocorrWordList(); } + + // Save word substitutions: + // Save these directly in the storage. The word list is updated + // accordingly! + // - pure Text + sal_Bool PutText( const String& rShort, const String& rLong, LanguageType eLang = LANGUAGE_SYSTEM ); + // - Text with attribution (only in the SWG - SWG format!) + sal_Bool PutText( const String& rShort, SfxObjectShell& rShell, + LanguageType eLang = LANGUAGE_SYSTEM ) + { return _GetLanguageList( eLang ).PutText(rShort, rShell ); } + + sal_Bool MakeCombinedChanges( std::vector<SvxAutocorrWord>& aNewEntries, + std::vector<SvxAutocorrWord>& aDeleteEntries, + LanguageType eLang = LANGUAGE_SYSTEM ); + + // Load, Set, Get - the exception list for capital letters at the + // beginning of a sentence + void SaveCplSttExceptList( LanguageType eLang = LANGUAGE_SYSTEM ); + SvStringsISortDtor* LoadCplSttExceptList( + LanguageType eLang = LANGUAGE_SYSTEM) + { return _GetLanguageList( eLang ).LoadCplSttExceptList(); } + const SvStringsISortDtor* GetCplSttExceptList( + LanguageType eLang = LANGUAGE_SYSTEM ) + { return _GetLanguageList( eLang ).GetCplSttExceptList(); } + + // Adds a single word. The list will be immediately written to the file! + sal_Bool AddCplSttException( const String& rNew, + LanguageType eLang = LANGUAGE_SYSTEM ); + + // Load, Set, Get the exception list for 2 Capital letters at the + // beginning of a word. + void SaveWrdSttExceptList( LanguageType eLang = LANGUAGE_SYSTEM ); + SvStringsISortDtor* LoadWrdSttExceptList( + LanguageType eLang = LANGUAGE_SYSTEM ) + { return _GetLanguageList( eLang ).LoadWrdSttExceptList(); } + const SvStringsISortDtor* GetWrdSttExceptList( + LanguageType eLang = LANGUAGE_SYSTEM ) + { return _GetLanguageList( eLang ).GetWrdSttExceptList(); } + // Adds a single word. The list will be immediately written to the file! + sal_Bool AddWrtSttException( const String& rNew, LanguageType eLang = LANGUAGE_SYSTEM); + + // Search through the Languages for the entry + sal_Bool FindInWrdSttExceptList( LanguageType eLang, const String& sWord ); + sal_Bool FindInCplSttExceptList( LanguageType eLang, const String& sWord, + sal_Bool bAbbreviation = sal_False); + + // Methods for the auto-correction + sal_Bool FnCptlSttWrd( SvxAutoCorrDoc&, const String&, + xub_StrLen nSttPos, xub_StrLen nEndPos, + LanguageType eLang = LANGUAGE_SYSTEM ); + sal_Bool FnChgOrdinalNumber( SvxAutoCorrDoc&, const String&, + xub_StrLen nSttPos, xub_StrLen nEndPos, + LanguageType eLang = LANGUAGE_SYSTEM ); + sal_Bool FnChgToEnEmDash( SvxAutoCorrDoc&, const String&, + xub_StrLen nSttPos, xub_StrLen nEndPos, + LanguageType eLang = LANGUAGE_SYSTEM ); + sal_Bool FnAddNonBrkSpace( SvxAutoCorrDoc&, const String&, + xub_StrLen nSttPos, xub_StrLen nEndPos, + LanguageType eLang = LANGUAGE_SYSTEM ); + sal_Bool FnSetINetAttr( SvxAutoCorrDoc&, const String&, + xub_StrLen nSttPos, xub_StrLen nEndPos, + LanguageType eLang = LANGUAGE_SYSTEM ); + sal_Bool FnChgWeightUnderl( SvxAutoCorrDoc&, const String&, + xub_StrLen nSttPos, xub_StrLen nEndPos, + LanguageType eLang = LANGUAGE_SYSTEM ); + sal_Bool FnCptlSttSntnc( SvxAutoCorrDoc&, const String&, sal_Bool bNormalPos, + xub_StrLen nSttPos, xub_StrLen nEndPos, + LanguageType eLang = LANGUAGE_SYSTEM); + bool FnCorrectCapsLock( SvxAutoCorrDoc&, const String&, + xub_StrLen nSttPos, xub_StrLen nEndPos, + LanguageType eLang = LANGUAGE_SYSTEM ); + + bool HasRunNext() { return bRunNext; } + + static long GetDefaultFlags(); + +// returns sal_True for characters where the function +// 'SvxAutoCorrect::AutoCorrect' should be called. +// (used to avoid occasional 'collisions' with (Thai) input-sequence-checking) + static sal_Bool IsAutoCorrectChar( sal_Unicode cChar ); + + sal_Bool NeedsHardspaceAutocorr( sal_Unicode cChar ); + + CharClass& GetCharClass( LanguageType eLang ) + { + if( !pCharClass || eLang != eCharClassLang ) + _GetCharClass( eLang ); + return *pCharClass; + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/svxenum.hxx b/include/editeng/svxenum.hxx new file mode 100644 index 000000000000..2759bebcd0ea --- /dev/null +++ b/include/editeng/svxenum.hxx @@ -0,0 +1,239 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SVXENUM_HXX +#define _SVX_SVXENUM_HXX + +// ----------------------------------------------------------------------- + +enum SvxCaseMap +{ + SVX_CASEMAP_NOT_MAPPED, + SVX_CASEMAP_VERSALIEN, + SVX_CASEMAP_GEMEINE, + SVX_CASEMAP_TITEL, + SVX_CASEMAP_KAPITAELCHEN, + SVX_CASEMAP_END +}; + +enum SvxEscapement +{ + SVX_ESCAPEMENT_OFF, + SVX_ESCAPEMENT_SUPERSCRIPT, + SVX_ESCAPEMENT_SUBSCRIPT, + SVX_ESCAPEMENT_END +}; + +enum SvxShadowLocation +{ + SVX_SHADOW_NONE, + SVX_SHADOW_TOPLEFT, + SVX_SHADOW_TOPRIGHT, + SVX_SHADOW_BOTTOMLEFT, + SVX_SHADOW_BOTTOMRIGHT, + SVX_SHADOW_END +}; + +enum SvxTabAdjust +{ + SVX_TAB_ADJUST_LEFT = 0, + SVX_TAB_ADJUST_RIGHT, + SVX_TAB_ADJUST_DECIMAL, + SVX_TAB_ADJUST_CENTER, + SVX_TAB_ADJUST_DEFAULT, + SVX_TAB_ADJUST_END +}; + +enum SvxLineSpace +{ + SVX_LINE_SPACE_AUTO, + SVX_LINE_SPACE_FIX, + SVX_LINE_SPACE_MIN, + SVX_LINE_SPACE_END +}; + +enum SvxInterLineSpace +{ + SVX_INTER_LINE_SPACE_OFF, + SVX_INTER_LINE_SPACE_PROP, + SVX_INTER_LINE_SPACE_FIX, + SVX_INTER_LINE_SPACE_END +}; + +enum SvxAdjust +{ + SVX_ADJUST_LEFT, + SVX_ADJUST_RIGHT, + SVX_ADJUST_BLOCK, + SVX_ADJUST_CENTER, + SVX_ADJUST_BLOCKLINE, + SVX_ADJUST_END +}; + +enum SvxSpecialLineSpace +{ + SVX_LINESPACE_USER, + SVX_LINESPACE_ONE_LINE, + SVX_LINESPACE_ONE_POINT_FIVE_LINES, + SVX_LINESPACE_TWO_LINES, + SVX_LINESPACE_END +}; + +enum SvxBreak +{ + SVX_BREAK_NONE, + SVX_BREAK_COLUMN_BEFORE, + SVX_BREAK_COLUMN_AFTER, + SVX_BREAK_COLUMN_BOTH, + SVX_BREAK_PAGE_BEFORE, + SVX_BREAK_PAGE_AFTER, + SVX_BREAK_PAGE_BOTH, + SVX_BREAK_END +}; + +enum SvxCellHorJustify +{ + SVX_HOR_JUSTIFY_STANDARD, + SVX_HOR_JUSTIFY_LEFT, + SVX_HOR_JUSTIFY_CENTER, + SVX_HOR_JUSTIFY_RIGHT, + SVX_HOR_JUSTIFY_BLOCK, + SVX_HOR_JUSTIFY_REPEAT +}; + +enum SvxCellJustifyMethod +{ + SVX_JUSTIFY_METHOD_AUTO, + SVX_JUSTIFY_METHOD_DISTRIBUTE +}; + +enum SvxCellVerJustify +{ + SVX_VER_JUSTIFY_STANDARD, + SVX_VER_JUSTIFY_TOP, + SVX_VER_JUSTIFY_CENTER, + SVX_VER_JUSTIFY_BOTTOM, + SVX_VER_JUSTIFY_BLOCK +}; + +enum SvxCellOrientation +{ + SVX_ORIENTATION_STANDARD, + SVX_ORIENTATION_TOPBOTTOM, + SVX_ORIENTATION_BOTTOMTOP, + SVX_ORIENTATION_STACKED +}; + +enum SvxDrawToolEnum +{ + SVX_SNAP_DRAW_SELECT, + // + SVX_SNAP_DRAW_LINE, + SVX_SNAP_DRAW_RECT, + SVX_SNAP_DRAW_ELLIPSE, + SVX_SNAP_DRAW_POLYGON_NOFILL, + SVX_SNAP_DRAW_BEZIER_NOFILL, + SVX_SNAP_DRAW_FREELINE_NOFILL, + SVX_SNAP_DRAW_ARC, + SVX_SNAP_DRAW_PIE, + SVX_SNAP_DRAW_CIRCLECUT, + SVX_SNAP_DRAW_TEXT, + SVX_SNAP_DRAW_TEXT_VERTICAL, + SVX_SNAP_DRAW_TEXT_MARQUEE, + SVX_SNAP_DRAW_CAPTION, + SVX_SNAP_DRAW_CAPTION_VERTICAL +}; + +enum SvxDrawAlignEnum +{ + SVX_OBJECT_ALIGN_LEFT, + SVX_OBJECT_ALIGN_CENTER, + SVX_OBJECT_ALIGN_RIGHT, + SVX_OBJECT_ALIGN_UP, + SVX_OBJECT_ALIGN_MIDDLE, + SVX_OBJECT_ALIGN_DOWN +}; + +enum SvxDrawBezierEnum +{ + SVX_BEZIER_MOVE, + SVX_BEZIER_INSERT, + SVX_BEZIER_DELETE, + SVX_BEZIER_CUTLINE, + SVX_BEZIER_CONVERT, + SVX_BEZIER_EDGE, + SVX_BEZIER_SMOOTH, + SVX_BEZIER_SYMMTR, + SVX_BEZIER_CLOSE, + SVX_BEZIER_ELIMINATE_POINTS +}; + +enum SvxSpellArea +{ + SVX_SPELL_BODY = 0, + SVX_SPELL_BODY_END, + SVX_SPELL_BODY_START, + SVX_SPELL_OTHER +}; + +enum SvxFrameAnchor +{ + SVX_FLY_AT_CNTNT, // Paragraph-based frame + SVX_FLY_IN_CNTNT, // Character-based frame + SVX_FLY_PAGE // Page-based frame +}; + +enum SvxExtNumType +{ + SVX_NUM_CHARS_UPPER_LETTER, // Counts from a-z, aa - az, ba - bz, ... + SVX_NUM_CHARS_LOWER_LETTER, + SVX_NUM_ROMAN_UPPER, + SVX_NUM_ROMAN_LOWER, + SVX_NUM_ARABIC, + SVX_NUM_NUMBER_NONE, + SVX_NUM_CHAR_SPECIAL, // Bullet + SVX_NUM_PAGEDESC, // Numbering from the page template + SVX_NUM_BITMAP, + SVX_NUM_CHARS_UPPER_LETTER_N, // Counts from a-z, aa-zz, aaa-zzz + SVX_NUM_CHARS_LOWER_LETTER_N, + SVX_NUM_TRANSLITERATION, + SVX_NUM_NATIVE_NUMBERING, + SVX_NUM_FULL_WIDTH_ARABIC, + SVX_NUM_CIRCLE_NUMBER, + SVX_NUM_NUMBER_LOWER_ZH, + SVX_NUM_NUMBER_UPPER_ZH, + SVX_NUM_NUMBER_UPPER_ZH_TW, + SVX_NUM_TIAN_GAN_ZH, + SVX_NUM_DI_ZI_ZH, + SVX_NUM_NUMBER_TRADITIONAL_JA, + SVX_NUM_AIU_FULLWIDTH_JA, + SVX_NUM_AIU_HALFWIDTH_JA, + SVX_NUM_IROHA_FULLWIDTH_JA, + SVX_NUM_IROHA_HALFWIDTH_JA +}; + +enum SvxCompareMode +{ + SVX_CMP_AUTO = 0, + SVX_CMP_BY_WORD, + SVX_CMP_BY_CHAR +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/svxfont.hxx b/include/editeng/svxfont.hxx new file mode 100644 index 000000000000..858157453aa1 --- /dev/null +++ b/include/editeng/svxfont.hxx @@ -0,0 +1,119 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SVXFONT_HXX +#define _SVX_SVXFONT_HXX + +#include <limits.h> // USHRT_MAX +#include <editeng/svxenum.hxx> +#include <i18nlangtag/lang.h> +#include <vcl/font.hxx> +#include "editeng/editengdllapi.h" + +// Percentage of height of lower case small capital letters compared to upper case letters +// See i#1526# for full explanation +#define SMALL_CAPS_PERCENTAGE 80 + +class SvxDoCapitals; +class OutputDevice; +class Printer; +class Point; +class Rectangle; +class Size; + +class EDITENG_DLLPUBLIC SvxFont : public Font +{ + LanguageType eLang; // Language + SvxCaseMap eCaseMap; // Text Markup + short nEsc; // Degree of Superscript/Subscript + sal_uInt8 nPropr; // Degree of reduction of the font height + short nKern; // Kerning in Pt + +public: + SvxFont(); + SvxFont( const Font &rFont ); + SvxFont( const SvxFont &rFont ); + + // Methods for Superscript/Subscript + inline short GetEscapement() const { return nEsc; } + inline void SetEscapement( const short nNewEsc ) { nEsc = nNewEsc; } + + inline sal_uInt8 GetPropr() const { return nPropr; } + inline void SetPropr( const sal_uInt8 nNewPropr ) { nPropr = nNewPropr; } + inline void SetProprRel( const sal_uInt8 nNewPropr ) + { SetPropr( (sal_uInt8)( (long)nNewPropr * (long)nPropr / 100L ) ); } + + // Kerning + inline short GetFixKerning() const { return nKern; } + inline void SetFixKerning( const short nNewKern ) { nKern = nNewKern; } + + inline SvxCaseMap GetCaseMap() const { return eCaseMap; } + inline void SetCaseMap( const SvxCaseMap eNew ) { eCaseMap = eNew; } + + inline LanguageType GetLanguage() const { return eLang; } + inline void SetLanguage( const LanguageType eNewLan ) + { eLang = eNewLan; Font::SetLanguage(eNewLan); } + + // Is-Methods: + inline sal_Bool IsCaseMap() const { return SVX_CASEMAP_NOT_MAPPED != eCaseMap; } + inline sal_Bool IsCapital() const { return SVX_CASEMAP_KAPITAELCHEN == eCaseMap; } + inline sal_Bool IsKern() const { return 0 != nKern; } + inline sal_Bool IsEsc() const { return 0 != nEsc; } + + // Consider Upper case, Lower case letters etc. + OUString CalcCaseMap(const OUString &rTxt) const; + + // Handle upper case letters + void DoOnCapitals( SvxDoCapitals &rDo, + const sal_uInt16 nPartLen = USHRT_MAX ) const; + + void SetPhysFont( OutputDevice *pOut ) const; + Font ChgPhysFont( OutputDevice *pOut ) const; + + Size GetCapitalSize( const OutputDevice *pOut, const String &rTxt, + const sal_uInt16 nIdx, const sal_uInt16 nLen) const; + void DrawCapital( OutputDevice *pOut, const Point &rPos, const String &rTxt, + const sal_uInt16 nIdx, const sal_uInt16 nLen ) const; + + Size GetPhysTxtSize( const OutputDevice *pOut, const String &rTxt, + const sal_uInt16 nIdx, const sal_uInt16 nLen ) const; + + Size GetPhysTxtSize( const OutputDevice *pOut, const String &rTxt ); + + Size GetTxtSize( const OutputDevice *pOut, const String &rTxt, + const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN ) const; + + void QuickDrawText( OutputDevice *pOut, const Point &rPos, const String &rTxt, + const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN, const sal_Int32* pDXArray = NULL ) const; + + Size QuickGetTextSize( const OutputDevice *pOut, const String &rTxt, + const sal_uInt16 nIdx, const sal_uInt16 nLen, sal_Int32* pDXArray = NULL ) const; + + void DrawPrev( OutputDevice* pOut, Printer* pPrinter, + const Point &rPos, const String &rTxt, + const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN ) const; + + static void DrawArrow( OutputDevice &rOut, const Rectangle& rRect, + const Size& rSize, const Color& rCol, sal_Bool bLeft ); + SvxFont& operator=( const SvxFont& rFont ); + SvxFont& operator=( const Font& rFont ); +}; + +#endif // #ifndef _SVX_SVXFONT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/svxrtf.hxx b/include/editeng/svxrtf.hxx new file mode 100644 index 000000000000..84c00a28634b --- /dev/null +++ b/include/editeng/svxrtf.hxx @@ -0,0 +1,424 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SVXRTF_HXX +#define _SVXRTF_HXX + +#include <tools/string.hxx> +#include <svl/itemset.hxx> +#include <svtools/parrtf.hxx> + +#include <editeng/editengdllapi.h> + +#include <deque> +#include <utility> +#include <vector> +#include "boost/ptr_container/ptr_map.hpp" +#include "boost/ptr_container/ptr_vector.hpp" + +class Font; +class Color; +class Graphic; +class DateTime; +struct SvxRTFStyleType; +class SvxRTFItemStackType; +class SvxRTFItemStackList : public boost::ptr_vector<SvxRTFItemStackType> {}; + +namespace com { namespace sun { namespace star { + namespace document { + class XDocumentProperties; + } + namespace util { + struct DateTime; + } +} } } + + +// Mapper-Classes for the various requirements on Document positions +// Swg - NodePosition is a SwIndex, which is used internally +// EditEngine - ULONG to list of paragraphs +// ..... + +class SvxNodeIdx +{ +public: + virtual ~SvxNodeIdx() {} + virtual sal_uLong GetIdx() const = 0; + virtual SvxNodeIdx* Clone() const = 0; // Cloning itself +}; + +class SvxPosition +{ +public: + virtual ~SvxPosition() {} + + virtual sal_uLong GetNodeIdx() const = 0; + virtual xub_StrLen GetCntIdx() const = 0; + + virtual SvxPosition* Clone() const = 0; // Cloning itself + virtual SvxNodeIdx* MakeNodeIdx() const = 0; // Cloning NodeIndex +}; + + +typedef Color* ColorPtr; +typedef std::deque< ColorPtr > SvxRTFColorTbl; +typedef boost::ptr_map<short, Font> SvxRTFFontTbl; +typedef boost::ptr_map<sal_uInt16, SvxRTFStyleType> SvxRTFStyleTbl; + +// SvxRTFItemStack can't be "std::stack< SvxRTFItemStackType* >" type, because +// the methods are using operator[] in sw/source/filter/rtf/rtftbl.cxx file +typedef std::deque< SvxRTFItemStackType* > SvxRTFItemStack; + +// own helper classes for the RTF Parser +struct SvxRTFStyleType +{ + SfxItemSet aAttrSet; // the attributes of Style (+ derivate!) + String sName; + sal_uInt16 nBasedOn, nNext; + sal_Bool bBasedOnIsSet; + sal_uInt8 nOutlineNo; + sal_Bool bIsCharFmt; + + SvxRTFStyleType( SfxItemPool& rPool, const sal_uInt16* pWhichRange ); +}; + + +// Here are the IDs for all character attributes, which can be detected by +// SvxParser and can be set in a SfxItemSet. The IDs are set correctly throught +// the SlotIds from POOL. +struct RTFPlainAttrMapIds +{ + sal_uInt16 nCaseMap, + nBgColor, + nColor, + nContour, + nCrossedOut, + nEscapement, + nFont, + nFontHeight, + nKering, + nLanguage, + nPosture, + nShadowed, + nUnderline, + nOverline, + nWeight, + nWordlineMode, + nAutoKerning, + nCJKFont, + nCJKFontHeight, + nCJKLanguage, + nCJKPosture, + nCJKWeight, + nCTLFont, + nCTLFontHeight, + nCTLLanguage, + nCTLPosture, + nCTLWeight, + nEmphasis, + nTwoLines, + nCharScaleX, + nHorzVert, + nRuby, + nRelief, + nHidden + ; + RTFPlainAttrMapIds( const SfxItemPool& rPool ); +}; + +// Here are the IDs for all paragraph attributes, which can be detected by +// SvxParser and can be set in a SfxItemSet. The IDs are set correctly throught +// the SlotIds from POOL. +struct RTFPardAttrMapIds +{ + sal_uInt16 nLinespacing, + nAdjust, + nTabStop, + nHyphenzone, + nLRSpace, + nULSpace, + nBrush, + nBox, + nShadow, + nOutlineLvl, + nSplit, + nKeep, + nFontAlign, + nScriptSpace, + nHangPunct, + nForbRule, + nDirection + ; + RTFPardAttrMapIds( const SfxItemPool& rPool ); +}; + + + +// ----------------------------------------------------------------------- + + +class EDITENG_DLLPUBLIC SvxRTFParser : public SvRTFParser +{ + SvStream &rStrm; + SvxRTFColorTbl aColorTbl; + SvxRTFFontTbl aFontTbl; + SvxRTFStyleTbl aStyleTbl; + SvxRTFItemStack aAttrStack; + SvxRTFItemStackList aAttrSetList; + + std::vector<sal_uInt16> aPlainMap; + std::vector<sal_uInt16> aPardMap; + std::vector<sal_uInt16> aWhichMap; + String sBaseURL; + + SvxPosition* pInsPos; + SfxItemPool* pAttrPool; + Color* pDfltColor; + Font* pDfltFont; + ::com::sun::star::uno::Reference< + ::com::sun::star::document::XDocumentProperties> m_xDocProps; + SfxItemSet *pRTFDefaults; + + long nVersionNo; + int nDfltFont; + + sal_Bool bNewDoc : 1; // sal_False - Reading in an existing + sal_Bool bNewGroup : 1; // sal_True - there was an opening parenthesis + sal_Bool bIsSetDfltTab : 1; // sal_True - DefTab was loaded + sal_Bool bChkStyleAttr : 1; // sal_True - StyleSheets are evaluated + sal_Bool bCalcValue : 1; // sal_True - Twip values adapt to App + sal_Bool bPardTokenRead : 1; // sal_True - Token \pard was detected + sal_Bool bReadDocInfo : 1; // sal_True - DocInfo to read + sal_Bool bIsLeftToRightDef : 1; // sal_True - in LeftToRight char run def. + // sal_False - in RightToLeft char run def. + sal_Bool bIsInReadStyleTab : 1; // sal_True - in ReadStyleTable + + void ClearColorTbl(); + void ClearFontTbl(); + void ClearStyleTbl(); + void ClearAttrStack(); + + SvxRTFItemStackType* _GetAttrSet( int bCopyAttr=sal_False ); // Create new ItemStackType:s + void _ClearStyleAttr( SvxRTFItemStackType& rStkType ); + + // Sets all the attributes that are different from the current + void SetAttrSet( SfxItemSet& rAttrSet, SvxPosition& rSttPos ); + void SetAttrSet( SvxRTFItemStackType &rSet ); + void SetDefault( int nToken, int nValue ); + + // Excecute pard / plain + void RTFPardPlain( int bPard, SfxItemSet** ppSet ); + + void BuildWhichTbl(); + + enum RTF_CharTypeDef + { + NOTDEF_CHARTYPE, + LOW_CHARTYPE, + HIGH_CHARTYPE, + DOUBLEBYTE_CHARTYPE + }; + + // set latin/asian/complex character attributes + void SetScriptAttr( + RTF_CharTypeDef eType, SfxItemSet& rSet, SfxPoolItem& rItem ); + +protected: + virtual void EnterEnvironment(); + virtual void LeaveEnvironment(); + virtual void ResetPard(); + virtual void InsertPara() = 0; + + + String& DelCharAtEnd( String& rStr, const sal_Unicode cDel ); + + // is called for each token that is recognized in CallParser + virtual void NextToken( int nToken ); + + virtual void ReadBitmapData(); + virtual void ReadOLEData(); + + void ReadStyleTable(); + void ReadColorTable(); + void ReadFontTable(); + void ReadAttr( int nToken, SfxItemSet* pSet ); + void ReadTabAttr( int nToken, SfxItemSet& rSet ); + + // Read Document-Info + ::com::sun::star::util::DateTime GetDateTimeStamp( ); + String& GetTextToEndGroup( String& rStr ); + virtual void ReadInfo( const sal_Char* pChkForVerNo = 0 ); + + inline SfxItemSet& GetAttrSet(); + // no text yet inserted? (SttPos from the top stack entry!) + int IsAttrSttPos(); + void AttrGroupEnd(); // edit the current, delete from stack + void SetAllAttrOfStk(); // end all Attr. and set it into doc + + + virtual void InsertText() = 0; + virtual void MovePos( int bForward = sal_True ) = 0; + virtual void SetEndPrevPara( SvxNodeIdx*& rpNodePos, + xub_StrLen& rCntPos )=0; + virtual void SetAttrInDoc( SvxRTFItemStackType &rSet ); + // for Tokens, which are not evaluated in ReadAttr + virtual void UnknownAttrToken( int nToken, SfxItemSet* pSet ); + + // if no-one would like to have any twips + virtual void CalcValue(); + + SvxRTFParser( SfxItemPool& rAttrPool, + SvStream& rIn, + ::com::sun::star::uno::Reference< + ::com::sun::star::document::XDocumentProperties> i_xDocProps, + int bReadNewDoc = sal_True ); + virtual ~SvxRTFParser(); + + int IsNewDoc() const { return bNewDoc; } + void SetNewDoc( int bFlag ) { bNewDoc = bFlag; } + int IsNewGroup() const { return bNewGroup; } + void SetNewGroup( int bFlag ) { bNewGroup = bFlag; } + int IsChkStyleAttr() const { return bChkStyleAttr; } + void SetChkStyleAttr( int bFlag ) { bChkStyleAttr = bFlag; } + int IsCalcValue() const { return bCalcValue; } + void SetCalcValue( int bFlag ) { bCalcValue = bFlag; } + int IsPardTokenRead() const { return bPardTokenRead; } + void SetPardTokenRead( int bFlag ) { bPardTokenRead = bFlag; } + int IsReadDocInfo() const { return bReadDocInfo; } + void SetReadDocInfo( int bFlag ) { bReadDocInfo = bFlag; } + + // Query/Set the current insert position + SvxPosition& GetInsPos() const { return *pInsPos; } + void SetInsPos( const SvxPosition& rNew ); + + long GetVersionNo() const { return nVersionNo; } + + // Query/Set the mapping IDs for the Pard/Plain attributes + //(Set: It is noted in the pointers, which thus does not create a copy) + void AddPardAttr( sal_uInt16 nWhich ) { aPardMap.push_back( nWhich ); } + void AddPlainAttr( sal_uInt16 nWhich ) { aPlainMap.push_back( nWhich ); } + + SvxRTFStyleTbl& GetStyleTbl() { return aStyleTbl; } + SvxRTFItemStack& GetAttrStack() { return aAttrStack; } + SvxRTFColorTbl& GetColorTbl() { return aColorTbl; } + SvxRTFFontTbl& GetFontTbl() { return aFontTbl; } + + const String& GetBaseURL() const { return sBaseURL; } + +public: + + virtual SvParserState CallParser(); + + inline const Color& GetColor( size_t nId ) const; + const Font& GetFont( sal_uInt16 nId ); // Changes the dflt Font + + virtual int IsEndPara( SvxNodeIdx* pNd, xub_StrLen nCnt ) const = 0; + + // to det a different attribute pool. May only be done prior to CallParser! + // The maps are not generated anew! + void SetAttrPool( SfxItemPool* pNewPool ) { pAttrPool = pNewPool; } + // to set different WhichIds for a different pool. + RTFPardAttrMapIds& GetPardMap() + { return (RTFPardAttrMapIds&)*aPardMap.begin(); } + RTFPlainAttrMapIds& GetPlainMap() + { return (RTFPlainAttrMapIds&)*aPlainMap.begin(); } + // to be able to assign them from the outside as for example table cells + void ReadBorderAttr( int nToken, SfxItemSet& rSet, int bTableDef=sal_False ); + void ReadBackgroundAttr( int nToken, SfxItemSet& rSet, int bTableDef=sal_False ); + + // for asynchronous read from the SvStream + virtual void Continue( int nToken ); + + // get RTF default ItemSets. Must be used by pard/plain tokens or in + // reset of Style-Items + const SfxItemSet& GetRTFDefaults(); + virtual bool UncompressableStackEntry(const SvxRTFItemStackType &rSet) const; +}; + +// The stack for the attributes: +// this class may only be used by SvxRTFParser! +class EDITENG_DLLPUBLIC SvxRTFItemStackType +{ + friend class SvxRTFParser; + + SfxItemSet aAttrSet; + SvxNodeIdx *pSttNd, *pEndNd; + xub_StrLen nSttCnt, nEndCnt; + SvxRTFItemStackList* pChildList; + sal_uInt16 nStyleNo; + + SvxRTFItemStackType( SfxItemPool&, const sal_uInt16* pWhichRange, + const SvxPosition& ); + + void Add( SvxRTFItemStackType* ); + void Compress( const SvxRTFParser& ); + +public: + SvxRTFItemStackType( const SvxRTFItemStackType&, const SvxPosition&, + int bCopyAttr = sal_False ); + ~SvxRTFItemStackType(); + //cmc, I'm very suspicios about SetStartPos, it doesn't change + //its children's starting position, and the implementation looks + //bad, consider this deprecated. + void SetStartPos( const SvxPosition& rPos ); + + void MoveFullNode(const SvxNodeIdx &rOldNode, + const SvxNodeIdx &rNewNode); + + sal_uLong GetSttNodeIdx() const { return pSttNd->GetIdx(); } + sal_uLong GetEndNodeIdx() const { return pEndNd->GetIdx(); } + + const SvxNodeIdx& GetSttNode() const { return *pSttNd; } + const SvxNodeIdx& GetEndNode() const { return *pEndNd; } + + xub_StrLen GetSttCnt() const { return nSttCnt; } + xub_StrLen GetEndCnt() const { return nEndCnt; } + + SfxItemSet& GetAttrSet() { return aAttrSet; } + const SfxItemSet& GetAttrSet() const { return aAttrSet; } + + sal_uInt16 StyleNo() const { return nStyleNo; } + + void SetRTFDefaults( const SfxItemSet& rDefaults ); +}; + + +// ----------- Inline Implementations -------------- + +inline const Color& SvxRTFParser::GetColor( size_t nId ) const +{ + ColorPtr pColor = (ColorPtr)pDfltColor; + if( nId < aColorTbl.size() ) + pColor = aColorTbl[ nId ]; + return *pColor; +} + +inline SfxItemSet& SvxRTFParser::GetAttrSet() +{ + SvxRTFItemStackType* pTmp; + if( bNewGroup || 0 == ( pTmp = aAttrStack.empty() ? 0 : aAttrStack.back()) ) + pTmp = _GetAttrSet(); + return pTmp->aAttrSet; +} + + +#endif + //_SVXRTF_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/swafopt.hxx b/include/editeng/swafopt.hxx new file mode 100644 index 000000000000..684a1838c731 --- /dev/null +++ b/include/editeng/swafopt.hxx @@ -0,0 +1,134 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef EE_SVXSWAFOPT_HXX +#define EE_SVXSWAFOPT_HXX + +#include <o3tl/sorted_vector.hxx> + +#include <tools/string.hxx> + +#include <vcl/font.hxx> +#include "editeng/editengdllapi.h" + +class SmartTagMgr; + +namespace editeng { + +class EDITENG_DLLPUBLIC IAutoCompleteString +{ +private: + String m_String; +public: + explicit IAutoCompleteString(String const& rString) : m_String(rString) {} + virtual ~IAutoCompleteString() {} + String const& GetAutoCompleteString() const { return m_String; } +}; + +struct CompareAutoCompleteString +{ + bool operator()(IAutoCompleteString *const& lhs, + IAutoCompleteString *const& rhs) const + { + return lhs->GetAutoCompleteString().CompareIgnoreCaseToAscii( + rhs->GetAutoCompleteString()) == COMPARE_LESS; + } +}; + +class SortedAutoCompleteStrings + : public o3tl::sorted_vector<IAutoCompleteString*, CompareAutoCompleteString> +{ +public: + ~SortedAutoCompleteStrings() { DeleteAndDestroyAll(); } +}; + +} // namespace editeng + +// Class of options for AutoFormat +struct EDITENG_DLLPUBLIC SvxSwAutoFmtFlags +{ + Font aBulletFont; + Font aByInputBulletFont; + /// only valid inside the Dialog!!! + const editeng::SortedAutoCompleteStrings * m_pAutoCompleteList; + SmartTagMgr* pSmartTagMgr; + + sal_Unicode cBullet; + sal_Unicode cByInputBullet; + + sal_uInt16 nAutoCmpltWordLen, nAutoCmpltListLen; + sal_uInt16 nAutoCmpltExpandKey; + + sal_uInt8 nRightMargin; + + sal_Bool bAutoCorrect : 1; + sal_Bool bCptlSttSntnc : 1; + sal_Bool bCptlSttWrd : 1; + sal_Bool bChkFontAttr : 1; + + sal_Bool bChgUserColl : 1; + sal_Bool bChgEnumNum : 1; + + sal_Bool bAFmtByInput : 1; + sal_Bool bDelEmptyNode : 1; + sal_Bool bSetNumRule : 1; + + sal_Bool bChgOrdinalNumber : 1; + sal_Bool bChgToEnEmDash : 1; + sal_Bool bAddNonBrkSpace : 1; + sal_Bool bChgWeightUnderl : 1; + sal_Bool bSetINetAttr : 1; + + sal_Bool bSetBorder : 1; + sal_Bool bCreateTable : 1; + sal_Bool bReplaceStyles : 1; + sal_Bool bDummy : 1; + + sal_Bool bWithRedlining : 1; + + sal_Bool bRightMargin : 1; + + sal_Bool bAutoCompleteWords : 1; + sal_Bool bAutoCmpltCollectWords : 1; + sal_Bool bAutoCmpltEndless : 1; +// -- under NT here starts a new long + sal_Bool bAutoCmpltAppendBlanc : 1; + sal_Bool bAutoCmpltShowAsTip : 1; + + sal_Bool bAFmtDelSpacesAtSttEnd : 1; + sal_Bool bAFmtDelSpacesBetweenLines : 1; + sal_Bool bAFmtByInpDelSpacesAtSttEnd : 1; + sal_Bool bAFmtByInpDelSpacesBetweenLines : 1; + + sal_Bool bAutoCmpltKeepList : 1; + + // some dummies for any new options + sal_Bool bDummy6 : 1, + bDummy7 : 1, + bDummy8 : 1 + ; + + SvxSwAutoFmtFlags(); + SvxSwAutoFmtFlags( const SvxSwAutoFmtFlags& rAFFlags ) { *this = rAFFlags; } + SvxSwAutoFmtFlags& operator=( const SvxSwAutoFmtFlags& ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/tstpitem.hxx b/include/editeng/tstpitem.hxx new file mode 100644 index 000000000000..f8eca761395b --- /dev/null +++ b/include/editeng/tstpitem.hxx @@ -0,0 +1,161 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_TSPTITEM_HXX +#define _SVX_TSPTITEM_HXX + +#include <svl/poolitem.hxx> +#include <editeng/svxenum.hxx> +#include <editeng/editengdllapi.h> +#include <o3tl/sorted_vector.hxx> + +// class SvxTabStop ------------------------------------------------------ + +#define SVX_TAB_DEFCOUNT 10 +#define SVX_TAB_DEFDIST 1134 // 2cm in twips +#define SVX_TAB_NOTFOUND USHRT_MAX +#define cDfltDecimalChar (sal_Unicode(0x00)) // Get from IntlWrapper +#define cDfltFillChar (sal_Unicode(' ')) + +class EDITENG_DLLPUBLIC SvxTabStop +{ +private: + sal_Int32 nTabPos; + + SvxTabAdjust eAdjustment; + mutable sal_Unicode m_cDecimal; + sal_Unicode cFill; + + EDITENG_DLLPRIVATE friend SvStream& operator<<( SvStream&, SvxTabStop& ); + + void fillDecimal() const; + +public: + SvxTabStop(); + explicit SvxTabStop( const sal_Int32 nPos, + const SvxTabAdjust eAdjst = SVX_TAB_ADJUST_LEFT, + const sal_Unicode cDec = cDfltDecimalChar, + const sal_Unicode cFil = cDfltFillChar ); + + sal_Int32& GetTabPos() { return nTabPos; } + sal_Int32 GetTabPos() const { return nTabPos; } + + SvxTabAdjust& GetAdjustment() { return eAdjustment; } + SvxTabAdjust GetAdjustment() const { return eAdjustment; } + + sal_Unicode& GetDecimal() { fillDecimal(); return m_cDecimal; } + sal_Unicode GetDecimal() const { fillDecimal(); return m_cDecimal; } + + sal_Unicode& GetFill() { return cFill; } + sal_Unicode GetFill() const { return cFill; } + + String GetValueString() const; + + // the "old" operator==() + sal_Bool IsEqual( const SvxTabStop& rTS ) const + { + return ( nTabPos == rTS.nTabPos && + eAdjustment == rTS.eAdjustment && + m_cDecimal == rTS.m_cDecimal && + cFill == rTS.cFill ); + } + + // For the SortedArray: + sal_Bool operator==( const SvxTabStop& rTS ) const + { return nTabPos == rTS.nTabPos; } + sal_Bool operator <( const SvxTabStop& rTS ) const + { return nTabPos < rTS.nTabPos; } + + SvxTabStop& operator=( const SvxTabStop& rTS ) + { + nTabPos = rTS.nTabPos; + eAdjustment = rTS.eAdjustment; + m_cDecimal = rTS.m_cDecimal; + cFill = rTS.cFill; + return *this; + } +}; + +// class SvxTabStopItem -------------------------------------------------- + +typedef o3tl::sorted_vector<SvxTabStop> SvxTabStopArr; + +/* [Description] + + This item describes a list of TabStops. +*/ + +class EDITENG_DLLPUBLIC SvxTabStopItem : public SfxPoolItem +{ + SvxTabStopArr maTabStops; + +public: + TYPEINFO(); + + explicit SvxTabStopItem( sal_uInt16 nWhich ); + SvxTabStopItem( const sal_uInt16 nTabs, + const sal_uInt16 nDist, + const SvxTabAdjust eAdjst /*= SVX_TAB_ADJUST_DEFAULT*/, + sal_uInt16 nWhich ); + SvxTabStopItem( const SvxTabStopItem& rTSI ); + + // Returns index of the tab or TAB_NOTFOUND + sal_uInt16 GetPos( const SvxTabStop& rTab ) const; + + // Returns index of the tab at nPos, or TAB_NOTFOUND + sal_uInt16 GetPos( const sal_Int32 nPos ) const; + + // unprivatized: + sal_uInt16 Count() const { return maTabStops.size(); } + bool Insert( const SvxTabStop& rTab ); + void Insert( const SvxTabStopItem* pTabs, sal_uInt16 nStart = 0, + sal_uInt16 nEnd = USHRT_MAX ); + void Remove( SvxTabStop& rTab ) + { maTabStops.erase( rTab ); } + void Remove( const sal_uInt16 nPos, const sal_uInt16 nLen = 1 ) + { maTabStops.erase( maTabStops.begin() + nPos, maTabStops.begin() + nPos + nLen ); } + + // Assignment operator, equality operator (caution: expensive!) + SvxTabStopItem& operator=( const SvxTabStopItem& rTSI ); + + // this is already included in SfxPoolItem declaration + //int operator!=( const SvxTabStopItem& rTSI ) const + // { return !( operator==( rTSI ) ); } + + const SvxTabStop& operator[]( const sal_uInt16 nPos ) const + { return maTabStops[nPos]; } + + // "pure virtual Methods" from SfxPoolItem + virtual int operator==( const SfxPoolItem& ) const; + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create( SvStream&, sal_uInt16 ) const; + virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const; + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/twolinesitem.hxx b/include/editeng/twolinesitem.hxx new file mode 100644 index 000000000000..dfdddde4b54b --- /dev/null +++ b/include/editeng/twolinesitem.hxx @@ -0,0 +1,77 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_TWOLINESITEM_HXX +#define _SVX_TWOLINESITEM_HXX + +#include <sal/types.h> +#include <svl/poolitem.hxx> +#include <editeng/editengdllapi.h> + +class SvXMLUnitConverter; + +class EDITENG_DLLPUBLIC SvxTwoLinesItem : public SfxPoolItem +{ + sal_Unicode cStartBracket, cEndBracket; + sal_Bool bOn; +public: + TYPEINFO(); + SvxTwoLinesItem( sal_Bool bOn /*= sal_True*/, + sal_Unicode nStartBracket /*= 0*/, + sal_Unicode nEndBracket /*= 0*/, + sal_uInt16 nId ); + SvxTwoLinesItem( const SvxTwoLinesItem& rAttr ); + virtual ~SvxTwoLinesItem(); + + // "pure virtual Methods" from SfxPoolItem + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16 nVer) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nIVer) const; + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, + const IntlWrapper* pIntl = 0 ) const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + virtual sal_uInt16 GetVersion( sal_uInt16 nFFVer ) const; + + SvxTwoLinesItem& operator=( const SvxTwoLinesItem& rCpy ) + { + SetValue( rCpy.GetValue() ); + SetStartBracket( rCpy.GetStartBracket() ); + SetEndBracket( rCpy.GetEndBracket() ); + return *this; + } + + sal_Bool GetValue() const { return bOn; } + void SetValue( sal_Bool bFlag ) { bOn = bFlag; } + + sal_Unicode GetStartBracket() const { return cStartBracket; } + void SetStartBracket( sal_Unicode c ) { cStartBracket = c; } + + sal_Unicode GetEndBracket() const { return cEndBracket; } + void SetEndBracket( sal_Unicode c ) { cEndBracket = c; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/txtrange.hxx b/include/editeng/txtrange.hxx new file mode 100644 index 000000000000..700db5760ad1 --- /dev/null +++ b/include/editeng/txtrange.hxx @@ -0,0 +1,112 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _MyTXTRANGE_HXX +#define _MyTXTRANGE_HXX + +#include "editeng/editengdllapi.h" +#include "tools/solar.h" +#include "tools/gen.hxx" + +#include <deque> + +class PolyPolygon; +class Rectangle; + +namespace basegfx { + class B2DPolyPolygon; +} + +typedef std::deque<long>* LongDqPtr; + +/************************************************************************* +|* +|* class TextRanger +|* +*************************************************************************/ +class EDITENG_DLLPUBLIC TextRanger +{ + //! The RangeCache class is used to cache the result of a single range calculation. + struct RangeCache + { + Range range; //!< Range for which we calculated results. + std::deque<long> results; //!< Calculated results for the range. + RangeCache(const Range& rng) : range(rng) {}; + }; + std::deque<RangeCache> mRangeCache; //!< Cached range calculations. + PolyPolygon *mpPolyPolygon; // Surface polygon + PolyPolygon *mpLinePolyPolygon; // Line polygon + Rectangle *pBound; // Comprehensive rectangle + sal_uInt16 nCacheSize; // Cache-Size + sal_uInt16 nRight; // Distance Contour-Text + sal_uInt16 nLeft; // Distance Text-Contour + sal_uInt16 nUpper; // Distance Contour-Text + sal_uInt16 nLower; // Distance Text-Contour + sal_uInt32 nPointCount; // Number of polygon points + sal_Bool bSimple : 1; // Just outside edge + sal_Bool bInner : 1; // TRUE: Objekt inline (EditEngine); + // FALSE: Objekt flow (StarWriter); + sal_Bool bVertical :1; // for vertical writing mode + sal_Bool bFlag3 :1; + sal_Bool bFlag4 :1; + sal_Bool bFlag5 :1; + sal_Bool bFlag6 :1; + sal_Bool bFlag7 :1; + TextRanger( const TextRanger& ); // not implemented + const Rectangle& _GetBoundRect(); +public: + TextRanger( const basegfx::B2DPolyPolygon& rPolyPolygon, + const basegfx::B2DPolyPolygon* pLinePolyPolygon, + sal_uInt16 nCacheSize, sal_uInt16 nLeft, sal_uInt16 nRight, + sal_Bool bSimple, sal_Bool bInner, sal_Bool bVert = sal_False ); + ~TextRanger(); + LongDqPtr GetTextRanges( const Range& rRange ); + sal_uInt16 GetRight() const { return nRight; } + sal_uInt16 GetLeft() const { return nLeft; } + sal_uInt16 GetUpper() const { return nUpper; } + sal_uInt16 GetLower() const { return nLower; } + sal_uInt32 GetPointCount() const { return nPointCount; } + sal_Bool IsSimple() const { return bSimple; } + sal_Bool IsInner() const { return bInner; } + sal_Bool IsVertical() const { return bVertical; } + sal_Bool HasBorder() const { return nRight || nLeft; } + const PolyPolygon& GetPolyPolygon() const { return *mpPolyPolygon; } + const PolyPolygon* GetLinePolygon() const { return mpLinePolyPolygon; } + const Rectangle& GetBoundRect() + { return pBound ? static_cast< const Rectangle& >(*pBound) : _GetBoundRect(); } + void SetUpper( sal_uInt16 nNew ){ nUpper = nNew; } + void SetLower( sal_uInt16 nNew ){ nLower = nNew; } + void SetVertical( sal_Bool bNew ); + sal_Bool IsFlag3() const { return bFlag3; } + void SetFlag3( sal_Bool bNew ) { bFlag3 = bNew; } + sal_Bool IsFlag4() const { return bFlag4; } + void SetFlag4( sal_Bool bNew ) { bFlag4 = bNew; } + sal_Bool IsFlag5() const { return bFlag5; } + void SetFlag5( sal_Bool bNew ) { bFlag5 = bNew; } + sal_Bool IsFlag6() const { return bFlag6; } + void SetFlag6( sal_Bool bNew ) { bFlag6 = bNew; } + sal_Bool IsFlag7() const { return bFlag7; } + void SetFlag7( sal_Bool bNew ) { bFlag7 = bNew; } +}; + + + +#endif // _TXTRANGE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/udlnitem.hxx b/include/editeng/udlnitem.hxx new file mode 100644 index 000000000000..7d1a88dfa81a --- /dev/null +++ b/include/editeng/udlnitem.hxx @@ -0,0 +1,119 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_UDLNITEM_HXX +#define _SVX_UDLNITEM_HXX + +#include <svl/eitem.hxx> +#include <vcl/vclenum.hxx> +#include <tools/color.hxx> +#include <editeng/editengdllapi.h> + +class SvXMLUnitConverter; + +// class SvxTextLineItem ------------------------------------------------ + +/* Value container for underline and overline font effects */ + +class EDITENG_DLLPUBLIC SvxTextLineItem : public SfxEnumItem +{ + Color mColor; +public: + TYPEINFO(); + + SvxTextLineItem( const FontUnderline eSt, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const; + virtual sal_uInt16 GetValueCount() const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + // MS VC4.0 messes things up + void SetValue( sal_uInt16 nNewVal ) + {SfxEnumItem::SetValue(nNewVal); } + virtual int HasBoolValue() const; + virtual sal_Bool GetBoolValue() const; + virtual void SetBoolValue( sal_Bool bVal ); + + virtual int operator==( const SfxPoolItem& ) const; + + inline SvxTextLineItem& operator=(const SvxTextLineItem& rTextLine) + { + SetValue( rTextLine.GetValue() ); + SetColor( rTextLine.GetColor() ); + return *this; + } + + // enum cast + FontUnderline GetLineStyle() const + { return (FontUnderline)GetValue(); } + void SetLineStyle( FontUnderline eNew ) + { SetValue((sal_uInt16) eNew); } + + const Color& GetColor() const { return mColor; } + void SetColor( const Color& rCol ) { mColor = rCol; } +}; + +// class SvxUnderlineItem ------------------------------------------------ + +/* Value container for underline font effects */ + +class EDITENG_DLLPUBLIC SvxUnderlineItem : public SvxTextLineItem +{ +public: + TYPEINFO(); + + SvxUnderlineItem( const FontUnderline eSt, + const sal_uInt16 nId ); + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const; +}; + +// class SvxOverlineItem ------------------------------------------------ + +/* Value container for overline font effects */ + +class EDITENG_DLLPUBLIC SvxOverlineItem : public SvxTextLineItem +{ +public: + TYPEINFO(); + + SvxOverlineItem( const FontUnderline eSt, + const sal_uInt16 nId ); + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const; +}; + +#endif // #ifndef _SVX_UDLNITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/ulspitem.hxx b/include/editeng/ulspitem.hxx new file mode 100644 index 000000000000..f57c01bb3d3f --- /dev/null +++ b/include/editeng/ulspitem.hxx @@ -0,0 +1,104 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_ULSPITEM_HXX +#define _SVX_ULSPITEM_HXX + +#include <svl/poolitem.hxx> +#include <editeng/editengdllapi.h> + + +// class SvxULSpaceItem -------------------------------------------------- + +/* [Description] + + This item describes the Upper- and Lower space of a page or paragraph. +*/ + +#define ULSPACE_16_VERSION ((sal_uInt16)0x0001) + +class EDITENG_DLLPUBLIC SvxULSpaceItem : public SfxPoolItem +{ + sal_uInt16 nUpper; // Upper space + sal_uInt16 nLower; // Lower space + sal_Bool bContext; // Contextual spacing? + sal_uInt16 nPropUpper, nPropLower; // relative or absolute (=100%) +public: + TYPEINFO(); + + explicit SvxULSpaceItem( const sal_uInt16 nId ); + SvxULSpaceItem( const sal_uInt16 nUp, const sal_uInt16 nLow, + const sal_uInt16 nId ); + inline SvxULSpaceItem& operator=( const SvxULSpaceItem &rCpy ); + + // "pure virtual Methods" from SfxPoolItem + virtual int operator==( const SfxPoolItem& ) const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; + virtual bool ScaleMetrics( long nMult, long nDiv ); + virtual bool HasMetrics() const; + + inline void SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp = 100 ); + inline void SetLower( const sal_uInt16 nL, const sal_uInt16 nProp = 100 ); + + void SetUpperValue( const sal_uInt16 nU ) { nUpper = nU; } + void SetLowerValue( const sal_uInt16 nL ) { nLower = nL; } + void SetContextValue( const sal_Bool bC ) { bContext = bC; } + void SetPropUpper( const sal_uInt16 nU ) { nPropUpper = nU; } + void SetPropLower( const sal_uInt16 nL ) { nPropLower = nL; } + + sal_uInt16 GetUpper() const { return nUpper; } + sal_uInt16 GetLower() const { return nLower; } + sal_Bool GetContext() const { return bContext; } + sal_uInt16 GetPropUpper() const { return nPropUpper; } + sal_uInt16 GetPropLower() const { return nPropLower; } +}; + +inline SvxULSpaceItem &SvxULSpaceItem::operator=( const SvxULSpaceItem &rCpy ) +{ + nUpper = rCpy.GetUpper(); + nLower = rCpy.GetLower(); + bContext = rCpy.GetContext(); + nPropUpper = rCpy.GetPropUpper(); + nPropLower = rCpy.GetPropLower(); + return *this; +} + +inline void SvxULSpaceItem::SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp ) +{ + nUpper = sal_uInt16((sal_uInt32(nU) * nProp ) / 100); nPropUpper = nProp; +} +inline void SvxULSpaceItem::SetLower( const sal_uInt16 nL, const sal_uInt16 nProp ) +{ + nLower = sal_uInt16((sal_uInt32(nL) * nProp ) / 100); nPropLower = nProp; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/unoedhlp.hxx b/include/editeng/unoedhlp.hxx new file mode 100644 index 000000000000..25cf36f17356 --- /dev/null +++ b/include/editeng/unoedhlp.hxx @@ -0,0 +1,161 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SVX_UNOEDHLP_HXX +#define _SVX_UNOEDHLP_HXX + +#include <memory> +#include <tools/solar.h> +#include <vcl/textdata.hxx> +#include <svl/hint.hxx> +#include <tools/gen.hxx> +#include "editeng/editengdllapi.h" + +struct EENotify; +class EditEngine; + +#define EDITSOURCE_HINT_PARASMOVED 20 +#define EDITSOURCE_HINT_SELECTIONCHANGED 21 + +/** Extends TextHint by two additional parameters which are necessary + for the EDITSOURCE_HINT_PARASMOVED hint. TextHint's value in this + case denotes the destination position, the two parameters the + start and the end of the moved paragraph range. + */ +class EDITENG_DLLPUBLIC SvxEditSourceHint : public TextHint +{ +private: + sal_uLong mnStart; + sal_uLong mnEnd; + +public: + TYPEINFO(); + SvxEditSourceHint( sal_uLong nId ); + SvxEditSourceHint( sal_uLong nId, sal_uLong nValue, sal_uLong nStart=0, sal_uLong nEnd=0 ); + + sal_uLong GetValue() const; + sal_uLong GetStartValue() const; + sal_uLong GetEndValue() const; +}; + +/** Helper class for common functionality in edit sources + */ +class EDITENG_DLLPUBLIC SvxEditSourceHelper +{ +public: + + /** Translates EditEngine notifications into broadcastable hints + + @param aNotify + Notification object send by the EditEngine. + + @return the translated hint + */ + SAL_WNODEPRECATED_DECLARATIONS_PUSH + static ::std::auto_ptr<SfxHint> EENotification2Hint( EENotify* aNotify ); + SAL_WNODEPRECATED_DECLARATIONS_POP + + /** Calculate attribute run for EditEngines + + Please note that the range returned is half-open: [nStartIndex,nEndIndex) + + @param nStartIndex + Herein, the start index of the range of similar attributes is returned + + @param nEndIndex + Herein, the end index (exclusive) of the range of similar attributes is returned + + @param rEE + The EditEngine to query for attributes + + @param nPara + The paragraph the following index value is to be interpreted in + + @param nIndex + The character index from which the range of similar attributed characters is requested + + @return sal_True, if the range has been successfully determined + */ + static sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, const EditEngine& rEE, sal_uInt16 nPara, sal_uInt16 nIndex ); + + /** Convert point from edit engine to user coordinate space + + As the edit engine internally keeps vertical text unrotated, + all internal edit engine methods return their stuff unrotated, + too. This method rotates and shifts given point appropriately, + if vertical writing is on. + + @param rPoint + Point to transform + + @param rEESize + Paper size of the edit engine + + @param bIsVertical + Whether output text is vertical or not + + @return the possibly transformed point + */ + static Point EEToUserSpace( const Point& rPoint, const Size& rEESize, bool bIsVertical ); + + /** Convert point from user to edit engine coordinate space + + As the edit engine internally keeps vertical text unrotated, + all internal edit engine methods return their stuff unrotated, + too. This method rotates and shifts given point appropriately, + if vertical writing is on. + + @param rPoint + Point to transform + + @param rEESize + Paper size of the edit engine + + @param bIsVertical + Whether output text is vertical or not + + @return the possibly transformed point + */ + static Point UserSpaceToEE( const Point& rPoint, const Size& rEESize, bool bIsVertical ); + + /** Convert rect from edit engine to user coordinate space + + As the edit engine internally keeps vertical text unrotated, + all internal edit engine methods return their stuff unrotated, + too. This method rotates and shifts given rect appropriately, + if vertical writing is on. + + @param rRect + Rectangle to transform + + @param rEESize + Paper size of the edit engine + + @param bIsVertical + Whether output text is vertical or not + + @return the possibly transformed rect + */ + static Rectangle EEToUserSpace( const Rectangle& rRect, const Size& rEESize, bool bIsVertical ); + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/unoedprx.hxx b/include/editeng/unoedprx.hxx new file mode 100644 index 000000000000..c6e067a6a633 --- /dev/null +++ b/include/editeng/unoedprx.hxx @@ -0,0 +1,176 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SVX_UNOEDPRX_HXX +#define _SVX_UNOEDPRX_HXX + +#include <memory> +#include <svl/brdcst.hxx> +#include <editeng/unoedsrc.hxx> + +#include <editeng/editdata.hxx> +#include "editeng/editengdllapi.h" + +class SvxAccessibleTextAdapter : public SvxTextForwarder +{ +public: + SvxAccessibleTextAdapter(); + virtual ~SvxAccessibleTextAdapter(); + + virtual sal_uInt16 GetParagraphCount() const; + virtual sal_uInt16 GetTextLen( sal_uInt16 nParagraph ) const; + virtual String GetText( const ESelection& rSel ) const; + virtual SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = 0 ) const; + virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const; + virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ); + virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ); + virtual void GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ) const; + + virtual sal_uInt16 CalcEditEngineIndex( sal_uInt16 nPara, sal_Int32 nLogicalIndex ); + + virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const; + virtual sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 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, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ); + virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos ); + + virtual sal_Bool IsValid() const; + + virtual LanguageType GetLanguage( sal_uInt16, sal_uInt16 ) const; + virtual sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const; + virtual EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const; + virtual EBulletInfo GetBulletInfo( sal_uInt16 nPara ) const; + virtual Rectangle GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const; + virtual Rectangle GetParaBounds( sal_uInt16 nPara ) const; + virtual MapMode GetMapMode() const; + virtual OutputDevice* GetRefDevice() const; + virtual sal_Bool GetIndexAtPoint( const Point&, sal_uInt16& nPara, sal_uInt16& nIndex ) const; + virtual sal_Bool GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const; + virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const; + virtual sal_uInt16 GetLineCount( sal_uInt16 nPara ) const; + virtual sal_uInt16 GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const; + virtual void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const; + virtual sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const; + + virtual sal_Bool Delete( const ESelection& ); + virtual sal_Bool InsertText( const String&, const ESelection& ); + virtual sal_Bool QuickFormatDoc( sal_Bool bFull=sal_False ); + virtual sal_Int16 GetDepth( sal_uInt16 nPara ) const; + virtual sal_Bool SetDepth( sal_uInt16 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( sal_uInt16 nPara, const String &rText, const SfxItemSet &rSet ); + + //XTextCopy + virtual void CopyText(const SvxTextForwarder& rSource); + + void SetForwarder( SvxTextForwarder& ); + sal_Bool HaveImageBullet( sal_uInt16 nPara ) const; + sal_Bool HaveTextBullet( sal_uInt16 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 sal_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 EDITENG_DLLPUBLIC 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; + + SAL_WNODEPRECATED_DECLARATIONS_PUSH + void SetEditSource( ::std::auto_ptr< SvxEditSource > pAdaptee ); + SAL_WNODEPRECATED_DECLARATIONS_POP + sal_Bool IsValid() const; + +private: + // declared, but not defined + SvxEditSourceAdapter( const SvxEditSourceAdapter& ); + SvxEditSourceAdapter& operator= ( const SvxEditSourceAdapter& ); + + SAL_WNODEPRECATED_DECLARATIONS_PUSH + ::std::auto_ptr< SvxEditSource > mpAdaptee; + SAL_WNODEPRECATED_DECLARATIONS_POP + + SvxAccessibleTextAdapter maTextAdapter; + SvxAccessibleTextEditViewAdapter maEditViewAdapter; + + mutable SfxBroadcaster maDummyBroadcaster; + + sal_Bool mbEditSourceValid; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/unoedsrc.hxx b/include/editeng/unoedsrc.hxx new file mode 100644 index 000000000000..9e5bba23e56b --- /dev/null +++ b/include/editeng/unoedsrc.hxx @@ -0,0 +1,540 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SVX_UNOEDSRC_HXX +#define _SVX_UNOEDSRC_HXX + +#include <com/sun/star/accessibility/TextSegment.hpp> + +#include <tools/solar.h> +#include <i18nlangtag/lang.h> +#include <tools/gen.hxx> +#include <vcl/mapmod.hxx> +#include <tools/string.hxx> +#include <tools/color.hxx> +#include <svl/poolitem.hxx> +#include <svl/itempool.hxx> +#include "editeng/editengdllapi.h" + +#include <list> + +struct ESelection; +struct EFieldInfo; +struct EBulletInfo; +class OutputDevice; +class String; +class SfxItemSet; +class SvxTextForwarder; +class SvxViewForwarder; +class SvxEditViewForwarder; +class SvxFieldItem; +class SfxBroadcaster; +class SvxUnoTextRangeBase; + +typedef std::list< SvxUnoTextRangeBase* > SvxUnoTextRangeBaseList; + +/** Wrapper class for unified EditEngine/Outliner access + + This class wraps a textual object, which might or might not + contain an EditEngine/Outliner. Is used e.g. for filling an + EditEngine with the content of a cell, note page or page template. +*/ +class EDITENG_DLLPUBLIC SvxEditSource +{ +public: + virtual ~SvxEditSource(); + + /// Returns a new reference to the same object. This is a shallow copy + virtual SvxEditSource* Clone() const = 0; + + /** Query the text forwarder + + @return the text forwarder, or NULL if the underlying object is dead + */ + virtual SvxTextForwarder* GetTextForwarder() = 0; + + /** Query the view forwarder + + @return the view forwarder, or NULL if the underlying object + is dead, or if no view is available + + @derive default implementation provided, overriding is optional + */ + virtual SvxViewForwarder* GetViewForwarder(); + + /** Query the edit view forwarder + + @param bCreate + Determines whether an EditView should be created, if there is + none active. If set to sal_True, and the underlying object is + not in EditMode, the text forwarder changes and the object is + set to EditMode. + + @return the edit view forwarder, or NULL if the underlying + object is dead, or if no view is available (if bCreate is + sal_False, NULL is also returned if the object is not in + EditMode) + + @derive default implementation provided, overriding is optional + + @attention If this method is called with bCreate equal to + sal_True, all previously returned text forwarder can become + invalid + */ + virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate = sal_False ); + + /// Write back data to model + virtual void UpdateData() = 0; + + /** Returns broadcaster the underlying edit engine's events are sent from + + @derive default implementation provided, overriding is optional + */ + virtual SfxBroadcaster& GetBroadcaster() const; + + /** adds the given SvxUnoTextRangeBase to the text object + capsulated by this SvxEditSource. This allows the text + object to inform all created text ranges about changes + and also allows to re use already created instances. + All SvxUnoTextRangeBase must remove itself with + removeRange() before theire deleted. */ + virtual void addRange( SvxUnoTextRangeBase* pNewRange ); + + /** removes the given SvxUnoTextRangeBase from the text + object capsulated by this SvxEditSource. This text range + will not be informed any longer of changes on the underlying + text and will also not re used anymore. */ + virtual void removeRange( SvxUnoTextRangeBase* pOldRange ); + + /** returns a const list of all text ranges that are registered + for the underlying text object. */ + virtual const SvxUnoTextRangeBaseList& getRanges() const; +}; + + +/** Contains an EditEngine or an Outliner and unifies access to them. + + The EditEngine-UNO objects use this class only. To reflect changes + not only in the EditEngine, but also in the model data, call + SvxEditSource::UpdateData(). This copies back the data to the model's + EditTextObject/OutlinerParaObject. + */ +class EDITENG_DLLPUBLIC SvxTextForwarder +{ +public: + virtual ~SvxTextForwarder(); + + virtual sal_uInt16 GetParagraphCount() const = 0; + virtual sal_uInt16 GetTextLen( sal_uInt16 nParagraph ) const = 0; + virtual String GetText( const ESelection& rSel ) const = 0; + virtual SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = 0 ) const = 0; + virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const = 0; + virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ) = 0; + virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ) = 0; + virtual void GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ) const = 0; + + virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const = 0; + virtual sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const = 0; + + virtual void QuickInsertText( const String& rText, const ESelection& rSel ) = 0; + virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ) = 0; + virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ) = 0; + virtual void QuickInsertLineBreak( const ESelection& rSel ) = 0; + + virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ) = 0; + virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos ) = 0; + + virtual SfxItemPool* GetPool() const = 0; + + virtual const SfxItemSet* GetEmptyItemSetPtr() = 0; + + // implementation functions for XParagraphAppend and XTextPortionAppend + virtual void AppendParagraph() = 0; + virtual xub_StrLen AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet &rSet ) = 0; + + // XTextCopy + virtual void CopyText(const SvxTextForwarder& rSource) = 0; + + /** Query state of forwarder + + @return sal_False, if no longer valid + */ + virtual sal_Bool IsValid() const = 0; + + /** Query language of character at given position on the underlying edit engine + + @param nPara[0 .. n-1] + Index of paragraph to query language in + + @param nIndex[0 .. m-1] + Index of character to query language of + */ + virtual LanguageType GetLanguage( sal_uInt16 nPara, sal_uInt16 nIndex ) const = 0; + + /** Query number of fields in the underlying edit engine + + @param nPara[0 .. n-1] + Index of paragraph to query field number in + */ + virtual sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const = 0; + + /** Query information for given field number in the underlying edit engine + + @param nPara[0 .. n-1] + Index of paragraph to query field info in + + @param nField[0 .. m-1] + Index of field to query information of + */ + virtual EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const = 0; + + /** Query information regarding bullets for given paragraph on the underlying edit engine + + @param nPara[0 .. n-1] + Index of paragraph to query bullet info on + */ + virtual EBulletInfo GetBulletInfo( sal_uInt16 nPara ) const = 0; + + /** Query the bounding rectangle of the given character + + @param nPara[0 .. n] + Index of paragraph to query the bounds in. <p>The virtual + character after the last character of the represented text, + i.e. the one at position n is a special case. Because it does + not represent an existing character its bounding box is + defined in relation to preceding characters. It should be + rougly equivalent to the bounding box of some character when + inserted at the end of the text. Its height typically being + the maximal height of all the characters in the text or the + height of the preceding character, its width being at least + one pixel so that the bounding box is not degenerate.<br> + + @param nIndex[0 .. m-1] + Index of character to query the bounds of + + @return rectangle in logical coordinates, relative to upper + left corner of text. The coordinates returned here are to be + interpreted in the map mode given by GetMapMode(). + */ + virtual Rectangle GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const = 0; + + /** Query the bounding rectangle of the given paragraph + + @param nPara[0 .. n-1] + Index of paragraph to query the bounds of + + @return rectangle in logical coordinates, relative to upper + left corner of text. The coordinates returned here are to be + interpreted in the map mode given by GetMapMode(). + */ + virtual Rectangle GetParaBounds( sal_uInt16 nPara ) const = 0; + + /** Query the map mode of the underlying EditEngine/Outliner + + @return the map mode used on the EditEngine/Outliner. The + values returned by GetParaBounds() and GetCharBounds() are to + be interpreted in this map mode, the point given to + GetIndexAtPoint() is interpreted in this map mode. + */ + virtual MapMode GetMapMode() const = 0; + + /** Query the reference output device of the underlying EditEngine/Outliner + + @return the OutputDevice used from the EditEngine/Outliner to + format the text. It should be used when performing e.g. font + calculations, since this is usually a printer with fonts and + resolution different from the screen. + */ + virtual OutputDevice* GetRefDevice() const = 0; + + /** Query paragraph and character index of the character at the + given point. Returns sal_True on success, sal_False otherwise + + @param rPoint + Point to query text position of. Is interpreted in logical + coordinates, relativ to the upper left corner of the text, and + in the map mode given by GetMapMode() + + @param rPara[0 .. n-1] + Index of paragraph the point is within + + @param rIndex[0 .. m-1] + Index of character the point is over + + @return sal_True, if the point is over any text and both rPara and rIndex are valid + + */ + virtual sal_Bool GetIndexAtPoint( const Point& rPoint, sal_uInt16& rPara, sal_uInt16& rIndex ) const = 0; + + /** Get the start and the end index of the word at the given index + + An index value on a word leads from the first character of + that word up to and including the last space before the next + word. The index values returned do not contain any leading or + trailing white-space. If the input indices are invalid, + sal_False is returned. + + @param nPara[0 .. n-1] + Index of paragraph to start the search in + + @param nIndex[0 .. m-1] + Index of character to query the search on + + @param rStart + Start index (in the same paragraph) + + @param rEnd + End index (in the same paragraph), this point to the last + character still contained in the query + + @return sal_True, if the result is non-empty + */ + virtual sal_Bool GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& rStart, sal_uInt16& rEnd ) const = 0; + + /** Query range of similar attributes + + Please note that the range returned is half-open: [nStartIndex,nEndIndex) + + @param nStartIndex + Herein, the start index of the range of similar attributes is returned + + @param nEndIndex + Herein, the end index (exclusive) of the range of similar attributes is returned + + @param nIndex + The character index from which the range of similar attributed characters is requested + + @return sal_True, if the range has been successfully determined + */ + virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const = 0; + + /** Query number of lines in the formatted paragraph + + @param nPara[0 .. n-1] + Index of paragraph to query number of lines in + + @return number of lines in given paragraph + + */ + virtual sal_uInt16 GetLineCount( sal_uInt16 nPara ) const = 0; + + /** Query line length + + @param nPara[0 .. n-1] + Index of paragraph to query line length in + + @param nLine[0 .. m-1] + Index of line in paragraph to query line length of + + */ + virtual sal_uInt16 GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const = 0; + + /** Query bounds of line in paragraph + + @param rStart [output param; 0 .. text_len] + The index in the paragraph text that belongs to the chara at the start of the line + + @param rEnd [output param; 0 .. text_len] + The index in the paragraph text that follows the last chara in the line + + @param nParagraph[0 .. n-1] + Index of paragraph to query line length in + + @param nLine[0 .. m-1] + Index of line in paragraph to query line length of + + */ + virtual void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const = 0; + + /** Query the line number for a index in the paragraphs text + + @param nPara[0 .. n-1] + Index of paragraph to query line length in + + @param nIndex[0 .. m-1] + Index of of the chara in the paragraph text + + @returns [0 .. k-1] + The line number of the chara in the paragraph + */ + virtual sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const = 0; + + /** Delete given text range and reformat text + + @param rSelection + The text range to be deleted + + @return sal_True if text has been successfully deleted + */ + virtual sal_Bool Delete( const ESelection& rSelection ) = 0; + + /** Insert/Replace given text in given range and reformat text + + @param rText + Text to insert/replace + + @param rSel + Selection where text should be replaced. The empty selection inserts + + @return sal_True if text has been successfully inserted + */ + virtual sal_Bool InsertText( const String& rText, const ESelection& rSel ) = 0; + + /** Updates the formatting + + @see EditEngine::QuickFormatDoc() for details + + @return sal_True if text have been successfully reformatted + */ + virtual sal_Bool QuickFormatDoc( sal_Bool bFull=sal_False ) = 0; + + /** Get the outline depth of given paragraph + + @param nPara + Index of the paragraph to query the depth of + + @return the outline level of the given paragraph. The range is + [0,n), where n is the maximal outline level. + */ + virtual sal_Int16 GetDepth( sal_uInt16 nPara ) const = 0; + + /** Set the outline depth of given paragraph + + @param nPara + Index of the paragraph to set the depth of + + @param nNewDepth + The depth to set on the given paragraph. The range is + [0,n), where n is the maximal outline level. + + @return sal_True, if depth could be successfully set. Reasons for + failure are e.g. the text does not support outline level + (EditEngine), or the depth range is exceeded. + */ + virtual sal_Bool SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth ) = 0; + + virtual sal_Int16 GetNumberingStartValue( sal_uInt16 nPara ); + virtual void SetNumberingStartValue( sal_uInt16 nPara, sal_Int16 nNumberingStartValue ); + + virtual sal_Bool IsParaIsNumberingRestart( sal_uInt16 nPara ); + virtual void SetParaIsNumberingRestart( sal_uInt16 nPara, sal_Bool bParaIsNumberingRestart ); +}; + +/** Encapsulates the document view for the purpose of unified + EditEngine/Outliner access. + + This one has to be different from the SvxEditViewForwarder, since + the latter is only valid in edit mode. + */ +class EDITENG_DLLPUBLIC SvxViewForwarder +{ +public: + virtual ~SvxViewForwarder(); + + /** Query state of forwarder + + @return sal_False, if no longer valid + */ + virtual sal_Bool IsValid() const = 0; + + /** Query visible area of the view containing the text + + @return the visible rectangle of the text, i.e. the part of + the EditEngine or Outliner that is currently on screen. The + values are already in screen coordinates (pixel), and have to + be relative to the EditEngine/Outliner's upper left corner. + */ + virtual Rectangle GetVisArea() const = 0; + + /** Convert from logical, EditEngine-relative coordinates to screen coordinates + + @param rPoint + Point in logical, EditEngine-relative coordinates. + + @param rMapMode + The map mode to interpret the coordinates in. + + @return the point in screen coordinates + */ + virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const = 0; + + /** Convert from screen to logical, EditEngine-relative coordinates + + @param rPoint + Point in screen coordinates + + @param rMapMode + The map mode to interpret the coordinates in. + + @return the point in logical coordinates. + */ + virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const = 0; + +}; + + +/** Encapsulates EditView and OutlinerView for the purpose of unified + EditEngine/Outliner access + */ +class SvxEditViewForwarder : public SvxViewForwarder +{ +public: + + /** Query current selection. + + @param rSelection + Contains the current selection after method call + + @return sal_False, if there is no view or no selection (the empty selection _is_ a selection) + + */ + virtual sal_Bool GetSelection( ESelection& rSelection ) const = 0; + + /** Set selection in view. + + @param rSelection + The selection to set + + @return sal_False, if there is no view or selection is invalid + */ + virtual sal_Bool SetSelection( const ESelection& rSelection ) = 0; + + /** Copy current selection to clipboard. + + @return sal_False if no selection or no view (the empty selection _is_ a selection) + */ + virtual sal_Bool Copy() = 0; + + /** Cut current selection to clipboard. + + @eturn sal_False if no selection or no view (the empty selection _is_ a selection) + */ + virtual sal_Bool Cut() = 0; + + /** Paste clipboard into current selection. + + @return sal_False if no view or no selection (the empty selection _is_ a selection) + */ + virtual sal_Bool Paste() = 0; + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/unofdesc.hxx b/include/editeng/unofdesc.hxx new file mode 100644 index 000000000000..711affaf2c1e --- /dev/null +++ b/include/editeng/unofdesc.hxx @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SVX_UNOFDESC_HXX +#define SVX_UNOFDESC_HXX + +#include <com/sun/star/awt/FontDescriptor.hpp> +#include <com/sun/star/beans/PropertyState.hpp> +#include <svl/itemset.hxx> +#include <vcl/font.hxx> +#include "editeng/editengdllapi.h" + +class EDITENG_DLLPUBLIC SvxUnoFontDescriptor +{ +public: + static void ConvertToFont( const ::com::sun::star::awt::FontDescriptor& rDesc, Font& rFont ); + static void ConvertFromFont( const Font& rFont, ::com::sun::star::awt::FontDescriptor& rDesc ); + + static void FillItemSet( const ::com::sun::star::awt::FontDescriptor& rDesc, SfxItemSet& rSet ); + static void FillFromItemSet( const SfxItemSet& rSet, ::com::sun::star::awt::FontDescriptor& rDesc ); + + static void setPropertyToDefault( SfxItemSet& rSet ); + static ::com::sun::star::uno::Any getPropertyDefault( SfxItemPool* pPool ); + +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/unofield.hxx b/include/editeng/unofield.hxx new file mode 100644 index 000000000000..d496e7217efc --- /dev/null +++ b/include/editeng/unofield.hxx @@ -0,0 +1,113 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SVX_UNOFIELD_HXX +#define _SVX_UNOFIELD_HXX + +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertySetInfo.hpp> +#include <com/sun/star/text/XTextField.hpp> +#include <com/sun/star/text/textfield/Type.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/component.hxx> +#include "editeng/editengdllapi.h" + +#include <comphelper/servicehelper.hxx> + +#include <editeng/mutxhelp.hxx> + +class SvxUnoFieldData_Impl; +class SfxItemPropertySet; +class SvxFieldData; + +com::sun::star::uno::Reference< com::sun::star::uno::XInterface > EDITENG_DLLPUBLIC SAL_CALL SvxUnoTextCreateTextField( + const OUString& ServiceSpecifier ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + +class EDITENG_DLLPUBLIC SvxUnoTextField : public SvxMutexHelper, + public ::cppu::OComponentHelper, + public ::com::sun::star::text::XTextField, + public ::com::sun::star::beans::XPropertySet, + public ::com::sun::star::lang::XServiceInfo, + public ::com::sun::star::lang::XUnoTunnel +{ +private: + ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > mxAnchor; + const SfxItemPropertySet* mpPropSet; + sal_Int32 mnServiceId; + SvxUnoFieldData_Impl* mpImpl; + +protected: + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence; + +public: + SvxUnoTextField( sal_Int32 nServiceId ) throw(); + SvxUnoTextField( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xAnchor, const OUString& rPresentation, const SvxFieldData* pFieldData ) throw(); + virtual ~SvxUnoTextField() throw(); + + // Internal + SvxFieldData* CreateFieldData() const throw(); + void SetAnchor( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xAnchor ) { mxAnchor = xAnchor; } + + static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::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(); + + // ::com::sun::star::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); + + // XTextField + virtual OUString SAL_CALL getPresentation( sal_Bool bShowCommand ) throw(::com::sun::star::uno::RuntimeException); + + // XTextContent + virtual void SAL_CALL attach( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xTextRange ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XComponent + virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) 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 void SAL_CALL setPropertyValue( const 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); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const 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); + virtual void SAL_CALL removePropertyChangeListener( const 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); + virtual void SAL_CALL addVetoableChangeListener( const 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); + virtual void SAL_CALL removeVetoableChangeListener( const 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); + + // OComponentHelper + virtual void SAL_CALL disposing(); + + // XServiceInfo + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/unofored.hxx b/include/editeng/unofored.hxx new file mode 100644 index 000000000000..5c88119f3a8f --- /dev/null +++ b/include/editeng/unofored.hxx @@ -0,0 +1,93 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SVX_UNOFORED_HXX +#define _SVX_UNOFORED_HXX + +#include <editeng/editeng.hxx> +#include <editeng/unoedsrc.hxx> +#include "editeng/editengdllapi.h" + +// SvxEditEngineForwarder - SvxTextForwarder for EditEngine + +class EDITENG_DLLPUBLIC SvxEditEngineForwarder : public SvxTextForwarder +{ +private: + EditEngine& rEditEngine; + +public: + SvxEditEngineForwarder( EditEngine& rEngine ); + virtual ~SvxEditEngineForwarder(); + + virtual sal_uInt16 GetParagraphCount() const; + virtual sal_uInt16 GetTextLen( sal_uInt16 nParagraph ) const; + virtual String GetText( const ESelection& rSel ) const; + virtual SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = EditEngineAttribs_All ) const; + virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const; + virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ); + virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ); + virtual void GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ) const; + + virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const; + virtual sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 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, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ); + virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos ); + virtual sal_Bool IsValid() const; + + virtual LanguageType GetLanguage( sal_uInt16, sal_uInt16 ) const; + virtual sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const; + virtual EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const; + virtual EBulletInfo GetBulletInfo( sal_uInt16 nPara ) const; + virtual Rectangle GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const; + virtual Rectangle GetParaBounds( sal_uInt16 nPara ) const; + virtual MapMode GetMapMode() const; + virtual OutputDevice* GetRefDevice() const; + virtual sal_Bool GetIndexAtPoint( const Point&, sal_uInt16& nPara, sal_uInt16& nIndex ) const; + virtual sal_Bool GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const; + virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const; + virtual sal_uInt16 GetLineCount( sal_uInt16 nPara ) const; + virtual sal_uInt16 GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const; + virtual void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const; + virtual sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const; + virtual sal_Bool Delete( const ESelection& ); + virtual sal_Bool InsertText( const String&, const ESelection& ); + virtual sal_Bool QuickFormatDoc( sal_Bool bFull=sal_False ); + virtual sal_Int16 GetDepth( sal_uInt16 nPara ) const; + virtual sal_Bool SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth ); + + virtual const SfxItemSet* GetEmptyItemSetPtr(); + + // implementation functions for XParagraphAppend and XTextPortionAppend + virtual void AppendParagraph(); + virtual xub_StrLen AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet &rSet ); + //XTextCopy + virtual void CopyText(const SvxTextForwarder& rSource); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/unoforou.hxx b/include/editeng/unoforou.hxx new file mode 100644 index 000000000000..68ee89160944 --- /dev/null +++ b/include/editeng/unoforou.hxx @@ -0,0 +1,122 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SVX_UNOFOROU_HXX +#define _SVX_UNOFOROU_HXX + +#include <editeng/unoedsrc.hxx> +#include "editeng/editengdllapi.h" + +#include <editeng/editdata.hxx> + +class Outliner; + +// SvxOutlinerForwarder - SvxTextForwarder for Outliner + +class EDITENG_DLLPUBLIC SvxOutlinerForwarder : public SvxTextForwarder +{ +private: + Outliner& rOutliner; + sal_Bool bOutlinerText; + + /** this pointer may be null or point to an item set for the attribs of + the selection maAttribsSelection */ + mutable SfxItemSet* mpAttribsCache; + + /** if we have a chached attribute item set, this is the selection of it */ + mutable ESelection maAttribCacheSelection; + + /** this pointer may be null or point to an item set for the paragraph + mnParaAttribsCache */ + mutable SfxItemSet* mpParaAttribsCache; + + /** if we have a cached para attribute item set, this is the paragraph of it */ + mutable sal_uInt16 mnParaAttribsCache; + +public: + SvxOutlinerForwarder( Outliner& rOutl, sal_Bool bOutlText = sal_False ); + virtual ~SvxOutlinerForwarder(); + + virtual sal_uInt16 GetParagraphCount() const; + virtual sal_uInt16 GetTextLen( sal_uInt16 nParagraph ) const; + virtual String GetText( const ESelection& rSel ) const; + virtual SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = 0 ) const; + virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const; + virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ); + virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ); + virtual void GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ) const; + + virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const; + virtual sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 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, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ); + virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos ); + + virtual sal_Bool IsValid() const; + + Outliner& GetOutliner() const { return rOutliner; } + + virtual LanguageType GetLanguage( sal_uInt16, sal_uInt16 ) const; + virtual sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const; + virtual EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const; + virtual EBulletInfo GetBulletInfo( sal_uInt16 nPara ) const; + virtual Rectangle GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const; + virtual Rectangle GetParaBounds( sal_uInt16 nPara ) const; + virtual MapMode GetMapMode() const; + virtual OutputDevice* GetRefDevice() const; + virtual sal_Bool GetIndexAtPoint( const Point&, sal_uInt16& nPara, sal_uInt16& nIndex ) const; + virtual sal_Bool GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const; + virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const; + virtual sal_uInt16 GetLineCount( sal_uInt16 nPara ) const; + virtual sal_uInt16 GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const; + virtual void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nPara, sal_uInt16 nLine ) const; + virtual sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const; + virtual sal_Bool Delete( const ESelection& ); + virtual sal_Bool InsertText( const String&, const ESelection& ); + virtual sal_Bool QuickFormatDoc( sal_Bool bFull=sal_False ); + virtual sal_Int16 GetDepth( sal_uInt16 nPara ) const; + virtual sal_Bool SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth ); + virtual sal_Int16 GetNumberingStartValue( sal_uInt16 nPara ); + virtual void SetNumberingStartValue( sal_uInt16 nPara, sal_Int16 nNumberingStartValue ); + + virtual sal_Bool IsParaIsNumberingRestart( sal_uInt16 nPara ); + virtual void SetParaIsNumberingRestart( sal_uInt16 nPara, sal_Bool bParaIsNumberingRestart ); + + /* this method flushes internal caches for this forwarder */ + void flushCache(); + + virtual const SfxItemSet* GetEmptyItemSetPtr(); + + // implementation functions for XParagraphAppend and XTextPortionAppend + virtual void AppendParagraph(); + virtual xub_StrLen AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet &rSet ); + //XTextCopy + virtual void CopyText(const SvxTextForwarder& rSource); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/unoipset.hxx b/include/editeng/unoipset.hxx new file mode 100644 index 000000000000..584eb367f5a1 --- /dev/null +++ b/include/editeng/unoipset.hxx @@ -0,0 +1,78 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SVX_UNOIPSET_HXX_ +#define _SVX_UNOIPSET_HXX_ + +#include <com/sun/star/beans/XPropertySetInfo.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include "editeng/editengdllapi.h" +#include <svl/itemprop.hxx> +#include <vector> + +class SdrItemPool; +class SfxItemSet; +class SvxShape; +struct SvxIDPropertyCombine; + +#define SFX_METRIC_ITEM (0x40) + +class EDITENG_DLLPUBLIC SvxItemPropertySet +{ + SfxItemPropertyMap m_aPropertyMap; + mutable com::sun::star::uno::Reference<com::sun::star::beans::XPropertySetInfo> m_xInfo; + const SfxItemPropertyMapEntry* _pMap; + ::std::vector< SvxIDPropertyCombine* > aCombineList; + sal_Bool mbConvertTwips; + SfxItemPool& mrItemPool; + +public: + SvxItemPropertySet( const SfxItemPropertyMapEntry *pMap, SfxItemPool& rPool, sal_Bool bConvertTwips = sal_False ); + ~SvxItemPropertySet(); + + // Methods, which work directly with the ItemSet + ::com::sun::star::uno::Any getPropertyValue( const SfxItemPropertySimpleEntry* pMap, const SfxItemSet& rSet, bool bSearchInParent, bool bDontConvertNegativeValues ) const; + void setPropertyValue( const SfxItemPropertySimpleEntry* pMap, const ::com::sun::star::uno::Any& rVal, SfxItemSet& rSet, bool bDontConvertNegativeValues ) const; + + // Methods that use Any instead + ::com::sun::star::uno::Any getPropertyValue( const SfxItemPropertySimpleEntry* pMap ) const; + void setPropertyValue( const SfxItemPropertySimpleEntry* pMap, const ::com::sun::star::uno::Any& rVal ) const; + + sal_Bool AreThereOwnUsrAnys() const { return ( aCombineList.empty() ? sal_False : sal_True ); } + ::com::sun::star::uno::Any* GetUsrAnyForID(sal_uInt16 nWID) const; + void AddUsrAnyForID(const ::com::sun::star::uno::Any& rAny, sal_uInt16 nWID); + void ClearAllUsrAny(); + + com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > getPropertySetInfo() const; + const SfxItemPropertyMapEntry* getPropertyMapEntries() const {return _pMap;} + const SfxItemPropertyMap* getPropertyMap()const { return &m_aPropertyMap;} + const SfxItemPropertySimpleEntry* getPropertyMapEntry(const OUString &rName) const; + + static com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > getPropertySetInfo( const SfxItemPropertyMapEntry* pMap ); +}; + +/** converts the given any with a metric to 100th/mm if needed */ +EDITENG_DLLPUBLIC void SvxUnoConvertToMM( const SfxMapUnit eSourceMapUnit, com::sun::star::uno::Any & rMetric ) throw(); + +/** converts the given any with a metric from 100th/mm to the given metric if needed */ +EDITENG_DLLPUBLIC void SvxUnoConvertFromMM( const SfxMapUnit eDestinationMapUnit, com::sun::star::uno::Any & rMetric ) throw(); + +#endif // _SVX_UNOIPSET_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/unolingu.hxx b/include/editeng/unolingu.hxx new file mode 100644 index 000000000000..09f570228f95 --- /dev/null +++ b/include/editeng/unolingu.hxx @@ -0,0 +1,192 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _UNO_LINGU_HXX +#define _UNO_LINGU_HXX + +#include <i18nlangtag/lang.h> +#include <tools/string.hxx> +#include <com/sun/star/util/Language.hpp> +#include <com/sun/star/linguistic2/XLinguServiceManager2.hpp> +#include <com/sun/star/linguistic2/XSpellChecker1.hpp> +#include <com/sun/star/linguistic2/XHyphenator.hpp> +#include <com/sun/star/linguistic2/XThesaurus.hpp> +#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include "editeng/editengdllapi.h" + +class LinguMgrExitLstnr; + +class Window; + +/////////////////////////////////////////////////////////////////////////// + +class EDITENG_DLLPUBLIC LinguMgr +{ + friend class LinguMgrExitLstnr; + + static ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XLinguServiceManager2 > xLngSvcMgr; + static ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XSpellChecker1 > xSpell; + static ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XHyphenator > xHyph; + static ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XThesaurus > xThes; + static ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XSearchableDictionaryList > xDicList; + static ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > xProp; + + static ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XDictionary > xIgnoreAll; + static ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XDictionary > xChangeAll; + + static LinguMgrExitLstnr *pExitLstnr; + static sal_Bool bExiting; + + static ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XSpellChecker1 > GetSpell(); + static ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XHyphenator > GetHyph(); + static ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XThesaurus > GetThes(); + static ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XSearchableDictionaryList > GetDicList(); + static ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > GetProp(); + static ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XDictionary > GetStandard(); + static ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XDictionary > GetIgnoreAll(); + static ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XDictionary > GetChangeAll(); + + // disallow access to copy-constructor and assignment-operator + LinguMgr(const LinguMgr &); + LinguMgr & operator = (const LinguMgr &); + +public: + + static ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XSpellChecker1 > GetSpellChecker(); + static ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XHyphenator > GetHyphenator(); + static ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XThesaurus > GetThesaurus(); + static ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XSearchableDictionaryList > GetDictionaryList(); + static ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > GetLinguPropertySet(); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XLinguServiceManager2 > GetLngSvcMgr(); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XDictionary > GetStandardDic(); + static ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XDictionary > GetIgnoreAllList(); + static ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XDictionary > GetChangeAllList(); +}; + +/////////////////////////////////////////////////////////////////////////// + +namespace com { namespace sun { namespace star { namespace linguistic2 { + class XHyphenatedWord; +}}}} + + +struct SvxAlternativeSpelling +{ + String aReplacement; + ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XHyphenatedWord > xHyphWord; + sal_Int16 nChangedPos, + nChangedLength; + sal_Bool bIsAltSpelling; + + inline SvxAlternativeSpelling(); +}; + +inline SvxAlternativeSpelling::SvxAlternativeSpelling() : + nChangedPos(-1), nChangedLength(-1), bIsAltSpelling(sal_False) +{ +} + + +EDITENG_DLLPUBLIC SvxAlternativeSpelling SvxGetAltSpelling( + const ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XHyphenatedWord > & rHyphWord ); + + +/////////////////////////////////////////////////////////////////////////// + +class EDITENG_DLLPUBLIC SvxDicListChgClamp +{ +private: + ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XSearchableDictionaryList > xDicList; + + // disallow access to copy-constructor and assignment-operator + EDITENG_DLLPRIVATE SvxDicListChgClamp(const SvxDicListChgClamp &); + EDITENG_DLLPRIVATE SvxDicListChgClamp & operator = (const SvxDicListChgClamp &); + +public: + SvxDicListChgClamp( ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XSearchableDictionaryList > &rxDicList ); + ~SvxDicListChgClamp(); +}; + +/////////////////////////////////////////////////////////////////////////// + +//TODO: remove those functions or make them inline +EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XSpellChecker1 > SvxGetSpellChecker(); +EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XHyphenator > SvxGetHyphenator(); +EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XThesaurus > SvxGetThesaurus(); +EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XSearchableDictionaryList > SvxGetDictionaryList(); +EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > SvxGetLinguPropertySet(); +//TODO: remove argument or provide SvxGetIgnoreAllList with the same one +EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XDictionary > SvxGetOrCreatePosDic( + ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XSearchableDictionaryList > xDicList ); +EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XDictionary > SvxGetIgnoreAllList(); +EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< + ::com::sun::star::linguistic2::XDictionary > SvxGetChangeAllList(); + +/////////////////////////////////////////////////////////////////////////// +// misc functions +// + +EDITENG_DLLPUBLIC short SvxDicError( Window *pParent, sal_Int16 nError ); + + +#endif + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/unonames.hxx b/include/editeng/unonames.hxx new file mode 100644 index 000000000000..3a5984452773 --- /dev/null +++ b/include/editeng/unonames.hxx @@ -0,0 +1,43 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +// Common across fields +#define UNO_TC_PROP_ANCHOR "Anchor" +#define UNO_TC_PROP_TEXTFIELD_TYPE "TextFieldType" +#define UNO_TC_PROP_IS_FIXED "IsFixed" +#define UNO_TC_PROP_CURRENT_PRESENTATION "CurrentPresentation" + +// Date & Time +#define UNO_TC_PROP_IS_DATE "IsDate" +#define UNO_TC_PROP_DATE_TIME "DateTime" +#define UNO_TC_PROP_NUMFORMAT "NumberFormat" + +// URL +#define UNO_TC_PROP_URL_FORMAT "Format" +#define UNO_TC_PROP_URL_REPRESENTATION "Representation" +#define UNO_TC_PROP_URL_TARGET "TargetFrame" +#define UNO_TC_PROP_URL "URL" + +// Table +#define UNO_TC_PROP_TABLE_POSITION "TablePosition" + +// File +#define UNO_TC_PROP_FILE_FORMAT "FileFormat" + +// Author +#define UNO_TC_PROP_AUTHOR_CONTENT "Content" +#define UNO_TC_PROP_AUTHOR_FORMAT "AuthorFormat" +#define UNO_TC_PROP_AUTHOR_FULLNAME "FullName" + +// Measure +#define UNO_TC_PROP_MEASURE_KIND "Kind" + +#define UNO_TR_PROP_SELECTION "Selection" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/unonrule.hxx b/include/editeng/unonrule.hxx new file mode 100644 index 000000000000..985e3e9193bb --- /dev/null +++ b/include/editeng/unonrule.hxx @@ -0,0 +1,87 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SVX_UNONRULE_HXX +#define _SVX_UNONRULE_HXX + +#include <com/sun/star/container/XIndexReplace.hpp> +#include <com/sun/star/ucb/XAnyCompare.hpp> +#include "editeng/editengdllapi.h" +#include <cppuhelper/implbase5.hxx> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include <editeng/numitem.hxx> +#include <comphelper/servicehelper.hxx> +#include <com/sun/star/beans/PropertyValue.hpp> + +EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace > SvxCreateNumRule( const SvxNumRule* pRule ) throw(); +EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace > SvxCreateNumRule() throw(); +const SvxNumRule& SvxGetNumRule( ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace > xRule ) throw( ::com::sun::star::lang::IllegalArgumentException ); +EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompare > SvxCreateNumRuleCompare() throw(); + +class SvxUnoNumberingRules : public ::cppu::WeakAggImplHelper5< com::sun::star::container::XIndexReplace, com::sun::star::ucb::XAnyCompare, + com::sun::star::lang::XUnoTunnel, com::sun::star::util::XCloneable, com::sun::star::lang::XServiceInfo > +{ +private: + SvxNumRule maRule; +public: + SvxUnoNumberingRules( const SvxNumRule& rRule ) throw(); + virtual ~SvxUnoNumberingRules() throw(); + + UNO3_GETIMPLEMENTATION_DECL( SvxUnoNumberingRules ) + + //XIndexReplace + virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const com::sun::star::uno::Any& Element ) throw( + com::sun::star::lang::IllegalArgumentException, com::sun::star::lang::IndexOutOfBoundsException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException); + + //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); + + //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); + + // XAnyCompare + virtual sal_Int16 SAL_CALL compare( const com::sun::star::uno::Any& Any1, const com::sun::star::uno::Any& Any2 ) throw(com::sun::star::uno::RuntimeException); + + // XCloneable + virtual com::sun::star::uno::Reference< com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) throw(com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(com::sun::star::uno::RuntimeException); + virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(com::sun::star::uno::RuntimeException); + + // internal + com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> getNumberingRuleByIndex( sal_Int32 nIndex) const throw(); + void setNumberingRuleByIndex( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rProperties, sal_Int32 nIndex) throw( com::sun::star::uno::RuntimeException, com::sun::star::lang::IllegalArgumentException ); + + static sal_Int16 Compare( const com::sun::star::uno::Any& rAny1, const com::sun::star::uno::Any& rAny2 ); + + const SvxNumRule& getNumRule() const { return maRule; } +}; + + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/unopracc.hxx b/include/editeng/unopracc.hxx new file mode 100644 index 000000000000..c2d3fdc746f3 --- /dev/null +++ b/include/editeng/unopracc.hxx @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SVX_UNOPRACC_HXX +#define _SVX_UNOPRACC_HXX + +#include <editeng/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 OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const OUString& ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< 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 + OUString SAL_CALL getServiceName() throw (::com::sun::star::uno::RuntimeException); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/unoprnms.hxx b/include/editeng/unoprnms.hxx new file mode 100644 index 000000000000..38ba3bdb4961 --- /dev/null +++ b/include/editeng/unoprnms.hxx @@ -0,0 +1,372 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SVX_UNOPRNMS_HXX +#define _SVX_UNOPRNMS_HXX + +#define UNO_NAME_SHAPE_SIZE "Size" +#define UNO_NAME_SHAPE_POSITION "Position" + +#define UNO_NAME_CHAR_COLOR "CharColor" +#define UNO_NAME_CHAR_FONT "CharFont" +#define UNO_NAME_CHAR_HEIGHT "CharHeight" +#define UNO_NAME_CHAR_POSTURE "CharPosture" +#define UNO_NAME_CHAR_SHADOWED "CharShadowed" +#define UNO_NAME_CHAR_UNDERLINE "CharUnderline" +#define UNO_NAME_CHAR_WEIGHT "CharWeight" + +#define UNO_NAME_FILLSTYLE "FillStyle" +#define UNO_NAME_FILLCOLOR "FillColor" +#define UNO_NAME_FILLGRADIENT "FillGradient" +#define UNO_NAME_FILLHATCH "FillHatch" +#define UNO_NAME_FILLBITMAP "FillBitmap" +#define UNO_NAME_FILLBACKGROUND "FillBackground" +#define UNO_NAME_FILLCOLOR_2 "FillColor2" + +#define UNO_NAME_EDGEKIND "EdgeKind" +#define UNO_NAME_EDGELINE1DELTA "EdgeLine1Delta" +#define UNO_NAME_EDGELINE2DELTA "EdgeLine2Delta" +#define UNO_NAME_EDGELINE3DELTA "EdgeLine3Delta" +#define UNO_NAME_EDGENODE1HORZDIST "EdgeNode1HorzDist" +#define UNO_NAME_EDGENODE1VERTDIST "EdgeNode1VertDist" +#define UNO_NAME_EDGENODE2HORZDIST "EdgeNode2HorzDist" +#define UNO_NAME_EDGENODE2VERTDIST "EdgeNode2VertDist" + +#define UNO_NAME_FILLBMP_OFFSET_X "FillBitmapOffsetX" +#define UNO_NAME_FILLBMP_OFFSET_Y "FillBitmapOffsetY" +#define UNO_NAME_FILLBMP_POSITION_OFFSET_X "FillBitmapPositionOffsetX" +#define UNO_NAME_FILLBMP_POSITION_OFFSET_Y "FillBitmapPositionOffsetY" +#define UNO_NAME_FILLBMP_RECTANGLE_POINT "FillBitmapRectanglePoint" +#define UNO_NAME_FILLBMP_TILE "FillBitmapTile" +#define UNO_NAME_FILLBMP_STRETCH "FillBitmapStretch" +#define UNO_NAME_FILLBMP_LOGICAL_SIZE "FillBitmapLogicalSize" +#define UNO_NAME_FILLBMP_SIZE_X "FillBitmapSizeX" +#define UNO_NAME_FILLBMP_SIZE_Y "FillBitmapSizeY" +#define UNO_NAME_FILL_TRANSPARENCE "FillTransparence" +#define UNO_NAME_FILLBMP_MODE "FillBitmapMode" + +#define UNO_NAME_FILL_GRADIENT_STYLE "FillGradientStyle" +#define UNO_NAME_FILL_GRADIENT_START_COLOR "FillGradientStartColor" +#define UNO_NAME_FILL_GRADIENT_END_COLOR "FillGradientEndColor" +#define UNO_NAME_FILL_GRADIENT_ANGLE "FillGradientAngle" +#define UNO_NAME_FILL_GRADIENT_BORDER "FillGradientBorder" +#define UNO_NAME_FILL_GRADIENT_OFFSET_X "FillGradientOffsetX" +#define UNO_NAME_FILL_GRADIENT_OFFSET_Y "FillGradientOffsetY" +#define UNO_NAME_FILL_GRADIENT_START_INTENSITY "FillGradientStartIntensity" +#define UNO_NAME_FILL_GRADIENT_END_INTENSITY "FillGradientEndIntensity" +#define UNO_NAME_FILL_GRADIENT_STEPS "FillGradientSteps" + +#define UNO_NAME_FILL_HATCH_STYLE "FillHatchStyle" +#define UNO_NAME_FILL_HATCH_COLOR "FillHatchColor" +#define UNO_NAME_FILL_HATCH_DISTANCE "FillHatchDistance" +#define UNO_NAME_FILL_HATCH_ANGLE "FillHatchAngle" + +#define UNO_NAME_LINESTYLE "LineStyle" +#define UNO_NAME_LINEDASH "LineDash" +#define UNO_NAME_LINEWIDTH "LineWidth" +#define UNO_NAME_LINECOLOR "LineColor" +#define UNO_NAME_LINEJOINT "LineJoint" +#define UNO_NAME_LINESTART "LineStart" +#define UNO_NAME_LINEEND "LineEnd" +#define UNO_NAME_LINESTARTWIDTH "LineStartWidth" +#define UNO_NAME_LINEENDWIDTH "LineEndWidth" +#define UNO_NAME_LINESTARTCENTER "LineStartCenter" +#define UNO_NAME_LINEENDCENTER "LineEndCenter" +#define UNO_NAME_LINETRANSPARENCE "LineTransparence" +#define UNO_NAME_LINECAP "LineCap" + +#define UNO_NAME_SHADOW "Shadow" +#define UNO_NAME_SHADOWCOLOR "ShadowColor" +#define UNO_NAME_SHADOWXDIST "ShadowXDistance" +#define UNO_NAME_SHADOWYDIST "ShadowYDistance" +#define UNO_NAME_SHADOWTRANSPARENCE "ShadowTransparence" + +#define UNO_NAME_EDGERADIUS "CornerRadius" + +#define UNO_NAME_TEXT_MINFRAMEHEIGHT "TextMinimumFrameHeight" +#define UNO_NAME_TEXT_AUTOGROWHEIGHT "TextAutoGrowHeight" +#define UNO_NAME_TEXT_FITTOSIZE "TextFitToSize" +#define UNO_NAME_TEXT_LEFTDIST "TextLeftDistance" +#define UNO_NAME_TEXT_RIGHTDIST "TextRightDistance" +#define UNO_NAME_TEXT_UPPERDIST "TextUpperDistance" +#define UNO_NAME_TEXT_LOWERDIST "TextLowerDistance" +#define UNO_NAME_TEXT_VERTADJUST "TextVerticalAdjust" +#define UNO_NAME_TEXT_MAXFRAMEHEIGHT "TextMaximumFrameHeight" +#define UNO_NAME_TEXT_MINFRAMEWIDTH "TextMinimumFrameWidth" +#define UNO_NAME_TEXT_MAXFRAMEWIDTH "TextMaximumFrameWidth" +#define UNO_NAME_TEXT_AUTOGROWWIDTH "TextAutoGrowWidth" +#define UNO_NAME_TEXT_HORZADJUST "TextHorizontalAdjust" +#define UNO_NAME_TEXT_ANIKIND "TextAnimationKind" +#define UNO_NAME_TEXT_ANIDIRECTION "TextAnimationDirection" +#define UNO_NAME_TEXT_ANISTARTINSIDE "TextAnimationStartInside" +#define UNO_NAME_TEXT_ANISTOPINSIDE "TextAnimationStopInside" +#define UNO_NAME_TEXT_ANICOUNT "TextAnimationCount" +#define UNO_NAME_TEXT_ANIDELAY "TextAnimationDelay" +#define UNO_NAME_TEXT_ANIAMOUNT "TextAnimationAmount" +#define UNO_NAME_TEXT_CONTOURFRAME "TextContourFrame" +#define UNO_NAME_TEXT_WRITINGMODE "TextWritingMode" +#define UNO_NAME_TEXT_FONTINDEPENDENTLINESPACING "FontIndependentLineSpacing" +#define UNO_NAME_TEXT_WORDWRAP "TextWordWrap" + +#define UNO_NAME_MEASUREKIND "MeasureKind" +#define UNO_NAME_MEASURETEXTHPOS "MeasureTextHorizontalPosition" +#define UNO_NAME_MEASURETEXTVPOS "MeasureTextVerticalPosition" +#define UNO_NAME_MEASURELINEDIST "MeasureLineDistance" +#define UNO_NAME_MEASUREHELPLINEOVERHANG "MeasureHelpLineOverhang" +#define UNO_NAME_MEASUREHELPLINEDIST "MeasureHelpLineDistance" +#define UNO_NAME_MEASUREHELPLINE1LEN "MeasureHelpLine1Length" +#define UNO_NAME_MEASUREHELPLINE2LEN "MeasureHelpLine2Length" +#define UNO_NAME_MEASUREBELOWREFEDGE "MeasureBelowReferenceEdge" +#define UNO_NAME_MEASURETEXTROTA90 "MeasureTextRotate90" +#define UNO_NAME_MEASURETEXTUPSIDEDOWN "MeasureTextUpsideDown" +#define UNO_NAME_MEASUREOVERHANG "MeasureOverhang" +#define UNO_NAME_MEASUREUNIT "MeasureUnit" +#define UNO_NAME_MEASURESCALE "MeasureScale" +#define UNO_NAME_MEASURESHOWUNIT "MeasureShowUnit" +#define UNO_NAME_MEASUREFORMATSTRING "MeasureFormatString" +#define UNO_NAME_MEASURETEXTAUTOANGLE "MeasureTextAutoAngle" +#define UNO_NAME_MEASURETEXTAUTOANGLEVIEW "MeasureTextAutoAngleView" +#define UNO_NAME_MEASURETEXTISFIXEDANGLE "MeasureTextIsFixedAngle" +#define UNO_NAME_MEASURETEXTFIXEDANGLE "MeasureTextFixedAngle" + +#define UNO_NAME_CIRCKIND "CircleKind" +#define UNO_NAME_CIRCSTARTANGLE "CircleStartAngle" +#define UNO_NAME_CIRCENDANGLE "CircleEndAngle" + +#define UNO_NAME_POLYGONKIND "PolygonKind" +#define UNO_NAME_POLYPOLYGON "PolyPolygon" +#define UNO_NAME_POLYPOLYGONBEZIER "PolyPolygonBezier" +#define UNO_NAME_POLYGON "Polygon" + +#define UNO_NAME_MISC_OBJ_ZORDER "ZOrder" +#define UNO_NAME_MISC_OBJ_MOVEPROTECT "MoveProtect" +#define UNO_NAME_MISC_OBJ_SIZEPROTECT "SizeProtect" +#define UNO_NAME_MISC_OBJ_PRINTABLE "Printable" +#define UNO_NAME_MISC_OBJ_LAYERID "LayerID" +#define UNO_NAME_MISC_OBJ_LAYERNAME "LayerName" +#define UNO_NAME_MISC_OBJ_NAME "Name" +#define UNO_NAME_MISC_OBJ_ROTATEANGLE "RotateAngle" +#define UNO_NAME_MISC_OBJ_SHEARANGLE "ShearAngle" +#define UNO_NAME_MISC_OBJ_ROTATION_POINT_X "RotationPointX" +#define UNO_NAME_MISC_OBJ_ROTATION_POINT_Y "RotationPointY" +#define UNO_NAME_MISC_OBJ_FRAMERECT "FrameRect" +#define UNO_NAME_MISC_OBJ_BOUNDRECT "BoundRect" + +// #i68101# +#define UNO_NAME_MISC_OBJ_TITLE "Title" +#define UNO_NAME_MISC_OBJ_DESCRIPTION "Description" + +#define UNO_NAME_GRAPHOBJ_FILLBITMAP "GraphicObjectFillBitmap" +#define UNO_NAME_GRAPHOBJ_GRAFURL "GraphicURL" +#define UNO_NAME_GRAPHOBJ_REPLACEMENTGRAFURL "ReplacementGraphicURL" +#define UNO_NAME_GRAPHOBJ_GRAFSTREAMURL "GraphicStreamURL" +#define UNO_NAME_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:" +#define UNO_NAME_GRAPHOBJ_URLPKGPREFIX "vnd.sun.star.Package:" +#define UNO_NAME_GRAPHOBJ_GRAPHIC "Graphic" + +#define UNO_NAME_OLE2_METAFILE "MetaFile" +#define UNO_NAME_OLE2_PERSISTNAME "PersistName" + +#define UNO_NAME_3D_SCENE_PERSPECTIVE "D3DScenePerspective" +#define UNO_NAME_3D_SCENE_DISTANCE "D3DSceneDistance" +#define UNO_NAME_3D_SCENE_FOCAL_LENGTH "D3DSceneFocalLength" +#define UNO_NAME_3D_SCENE_TWO_SIDED_LIGHTING "D3DSceneTwoSidedLighting" +#define UNO_NAME_3D_SCENE_LIGHTCOLOR_1 "D3DSceneLightColor1" +#define UNO_NAME_3D_SCENE_LIGHTCOLOR_2 "D3DSceneLightColor2" +#define UNO_NAME_3D_SCENE_LIGHTCOLOR_3 "D3DSceneLightColor3" +#define UNO_NAME_3D_SCENE_LIGHTCOLOR_4 "D3DSceneLightColor4" +#define UNO_NAME_3D_SCENE_LIGHTCOLOR_5 "D3DSceneLightColor5" +#define UNO_NAME_3D_SCENE_LIGHTCOLOR_6 "D3DSceneLightColor6" +#define UNO_NAME_3D_SCENE_LIGHTCOLOR_7 "D3DSceneLightColor7" +#define UNO_NAME_3D_SCENE_LIGHTCOLOR_8 "D3DSceneLightColor8" +#define UNO_NAME_3D_SCENE_LIGHTON_1 "D3DSceneLightOn1" +#define UNO_NAME_3D_SCENE_LIGHTON_2 "D3DSceneLightOn2" +#define UNO_NAME_3D_SCENE_LIGHTON_3 "D3DSceneLightOn3" +#define UNO_NAME_3D_SCENE_LIGHTON_4 "D3DSceneLightOn4" +#define UNO_NAME_3D_SCENE_LIGHTON_5 "D3DSceneLightOn5" +#define UNO_NAME_3D_SCENE_LIGHTON_6 "D3DSceneLightOn6" +#define UNO_NAME_3D_SCENE_LIGHTON_7 "D3DSceneLightOn7" +#define UNO_NAME_3D_SCENE_LIGHTON_8 "D3DSceneLightOn8" +#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_1 "D3DSceneLightDirection1" +#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_2 "D3DSceneLightDirection2" +#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_3 "D3DSceneLightDirection3" +#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_4 "D3DSceneLightDirection4" +#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_5 "D3DSceneLightDirection5" +#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_6 "D3DSceneLightDirection6" +#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_7 "D3DSceneLightDirection7" +#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_8 "D3DSceneLightDirection8" +#define UNO_NAME_3D_SCENE_AMBIENTCOLOR "D3DSceneAmbientColor" +#define UNO_NAME_3D_SCENE_SHADOW_SLANT "D3DSceneShadowSlant" +#define UNO_NAME_3D_SCENE_SHADE_MODE "D3DSceneShadeMode" + +#define UNO_NAME_3D_DOUBLE_SIDED "D3DDoubleSided" +#define UNO_NAME_3D_NORMALS_KIND "D3DNormalsKind" +#define UNO_NAME_3D_NORMALS_INVERT "D3DNormalsInvert" +#define UNO_NAME_3D_TEXTURE_PROJ_X "D3DTextureProjectionX" +#define UNO_NAME_3D_TEXTURE_PROJ_Y "D3DTextureProjectionY" +#define UNO_NAME_3D_SHADOW_3D "D3DShadow3D" +#define UNO_NAME_3D_MAT_COLOR "D3DMaterialColor" +#define UNO_NAME_3D_MAT_EMISSION "D3DMaterialEmission" +#define UNO_NAME_3D_MAT_SPECULAR "D3DMaterialSpecular" +#define UNO_NAME_3D_MAT_SPECULAR_INTENSITY "D3DMaterialSpecularIntensity" +#define UNO_NAME_3D_TEXTURE_KIND "D3DTextureKind" +#define UNO_NAME_3D_TEXTURE_MODE "D3DTextureMode" +#define UNO_NAME_3D_TEXTURE_FILTER "D3DTextureFilter" + +// #i28528# +// Added extra Item (Bool) for chart2 to be able to show reduced line geometry +#define UNO_NAME_3D_REDUCED_LINE_GEOMETRY "D3DReducedLineGeometry" + +#define UNO_NAME_3D_HORZ_SEGS "D3DHorizontalSegments" +#define UNO_NAME_3D_VERT_SEGS "D3DVerticalSegments" + +#define UNO_NAME_3D_PERCENT_DIAGONAL "D3DPercentDiagonal" +#define UNO_NAME_3D_BACKSCALE "D3DBackscale" +#define UNO_NAME_3D_LATHE_END_ANGLE "D3DEndAngle" + +#define UNO_NAME_3D_EXTRUDE_DEPTH "D3DDepth" + +#define UNO_NAME_3D_TRANSFORM_MATRIX "D3DTransformMatrix" +#define UNO_NAME_3D_CAMERA_GEOMETRY "D3DCameraGeometry" +#define UNO_NAME_3D_POS "D3DPosition" +#define UNO_NAME_3D_SIZE "D3DSize" +#define UNO_NAME_3D_POS_IS_CENTER "D3DPositionIsCenter" +#define UNO_NAME_3D_POLYPOLYGON3D "D3DPolyPolygon3D" +#define UNO_NAME_3D_NORMALSPOLYGON3D "D3DNormalsPolygon3D" +#define UNO_NAME_3D_TEXTUREPOLYGON3D "D3DTexturePolygon3D" +#define UNO_NAME_3D_LINEONLY "D3DLineOnly" + +// New 3D properties which are possible for lathe and extrude 3d objects +#define UNO_NAME_3D_SMOOTH_NORMALS "D3DSmoothNormals" +#define UNO_NAME_3D_SMOOTH_LIDS "D3DSmoothLids" +#define UNO_NAME_3D_CHARACTER_MODE "D3DCharacterMode" +#define UNO_NAME_3D_CLOSE_FRONT "D3DCloseFront" +#define UNO_NAME_3D_CLOSE_BACK "D3DCloseBack" + +#define UNO_NAME_NUMBERING "NumberingIsNumber" +#define UNO_NAME_NUMBERING_RULES "NumberingRules" +#define UNO_NAME_NUMBERING_LEVEL "NumberingLevel" + +#define UNO_NAME_NRULE_NUMBERINGTYPE "NumberingType" +#define UNO_NAME_NRULE_PREFIX "Prefix" +#define UNO_NAME_NRULE_SUFFIX "Suffix" +#define UNO_NAME_NRULE_BULLETID "BulletId" +#define UNO_NAME_NRULE_BULLET_COLOR "BulletColor" +#define UNO_NAME_NRULE_BULLET_RELSIZE "BulletRelSize" +#define UNO_NAME_NRULE_BULLET_FONT "BulletFont" +#define UNO_NAME_NRULE_GRAPHICURL "GraphicURL" +#define UNO_NAME_NRULE_START_WITH "StartWith" +#define UNO_NAME_NRULE_LEFT_MARGIN "LeftMargin" +#define UNO_NAME_NRULE_FIRST_LINE_OFFSET "FirstLineOffset" +#define UNO_NAME_NRULE_ADJUST "Adjust" + +#define UNO_NAME_EDIT_FONT_DESCRIPTOR "FontDescriptor" +#define UNO_NAME_EDIT_FONT_STYLENAME "FontStyleName" + +#define UNO_NAME_EDIT_PARA_ADJUST "ParaAdjust" +#define UNO_NAME_EDIT_PARA_BMARGIN "ParaBottomMargin" +#define UNO_NAME_EDIT_PARA_LASTLINEADJ "ParaLastLineAdjust" +#define UNO_NAME_EDIT_PARA_LMARGIN "ParaLeftMargin" +#define UNO_NAME_EDIT_PARA_LRPARAMARGIN "ParaLeftRightParaMargin" +#define UNO_NAME_EDIT_PARA_LINESPACING "ParaLineSpacing" +#define UNO_NAME_EDIT_PARA_RMARGIN "ParaRightMargin" +#define UNO_NAME_EDIT_PARA_TAPSTOPS "ParaTabStops" +#define UNO_NAME_EDIT_PARA_TBMARGIN "ParaTopBottomMargin" +#define UNO_NAME_EDIT_PARA_TMARGIN "ParaTopMargin" +#define UNO_NAME_EDIT_PARA_IS_HYPHEN "ParaIsHyphenation" +#define UNO_NAME_EDIT_PARA_IS_HANGING_PUNCTUATION "ParaIsHangingPunctuation" +#define UNO_NAME_EDIT_PARA_IS_CHARACTER_DISTANCE "ParaIsCharacterDistance" +#define UNO_NAME_EDIT_PARA_IS_FORBIDDEN_RULES "ParaIsForbiddenRules" +#define UNO_NAME_EDIT_PARA_FIRST_LINE_INDENT "ParaFirstLineIndent" + +#define UNO_NAME_EDIT_CHAR_HEIGHT "CharHeight" +#define UNO_NAME_EDIT_CHAR_FONTNAME "CharFontName" +#define UNO_NAME_EDIT_CHAR_FONTSTYLENAME "CharFontStyleName" +#define UNO_NAME_EDIT_CHAR_FONTFAMILY "CharFontFamily" +#define UNO_NAME_EDIT_CHAR_FONTCHARSET "CharFontCharSet" +#define UNO_NAME_EDIT_CHAR_FONTPITCH "CharFontPitch" +#define UNO_NAME_EDIT_CHAR_POSTURE "CharPosture" +#define UNO_NAME_EDIT_CHAR_WEIGHT "CharWeight" +#define UNO_NAME_EDIT_CHAR_LOCALE "CharLocale" + +#define UNO_NAME_EDIT_CHAR_HEIGHT_ASIAN "CharHeightAsian" +#define UNO_NAME_EDIT_CHAR_FONTNAME_ASIAN "CharFontNameAsian" +#define UNO_NAME_EDIT_CHAR_FONTSTYLENAME_ASIAN "CharFontStyleNameAsian" +#define UNO_NAME_EDIT_CHAR_FONTFAMILY_ASIAN "CharFontFamilyAsian" +#define UNO_NAME_EDIT_CHAR_FONTCHARSET_ASIAN "CharFontCharSetAsian" +#define UNO_NAME_EDIT_CHAR_FONTPITCH_ASIAN "CharFontPitchAsian" +#define UNO_NAME_EDIT_CHAR_POSTURE_ASIAN "CharPostureAsian" +#define UNO_NAME_EDIT_CHAR_WEIGHT_ASIAN "CharWeightAsian" +#define UNO_NAME_EDIT_CHAR_LOCALE_ASIAN "CharLocaleAsian" + +#define UNO_NAME_EDIT_CHAR_HEIGHT_COMPLEX "CharHeightComplex" +#define UNO_NAME_EDIT_CHAR_FONTNAME_COMPLEX "CharFontNameComplex" +#define UNO_NAME_EDIT_CHAR_FONTSTYLENAME_COMPLEX "CharFontStyleNameComplex" +#define UNO_NAME_EDIT_CHAR_FONTFAMILY_COMPLEX "CharFontFamilyComplex" +#define UNO_NAME_EDIT_CHAR_FONTCHARSET_COMPLEX "CharFontCharSetComplex" +#define UNO_NAME_EDIT_CHAR_FONTPITCH_COMPLEX "CharFontPitchComplex" +#define UNO_NAME_EDIT_CHAR_POSTURE_COMPLEX "CharPostureComplex" +#define UNO_NAME_EDIT_CHAR_WEIGHT_COMPLEX "CharWeightComplex" +#define UNO_NAME_EDIT_CHAR_LOCALE_COMPLEX "CharLocaleComplex" + +#define UNO_NAME_EDIT_CHAR_COLOR "CharColor" +#define UNO_NAME_EDIT_CHAR_CROSSEDOUT "CharCrossedOut" +#define UNO_NAME_EDIT_CHAR_STRIKEOUT "CharStrikeout" +#define UNO_NAME_EDIT_CHAR_ESCAPEMENT "CharEscapement" +#define UNO_NAME_EDIT_CHAR_FONTNAME "CharFontName" +#define UNO_NAME_EDIT_CHAR_SHADOWED "CharShadowed" +#define UNO_NAME_EDIT_CHAR_UNDERLINE "CharUnderline" +#define UNO_NAME_EDIT_CHAR_OVERLINE "CharOverline" + +#define UNO_NAME_BITMAP "Bitmap" + +#define UNO_NAME_LINKDISPLAYNAME "LinkDisplayName" +#define UNO_NAME_LINKDISPLAYBITMAP "LinkDisplayBitmap" + +#define UNO_NAME_GRAPHIC_LUMINANCE "AdjustLuminance" +#define UNO_NAME_GRAPHIC_CONTRAST "AdjustContrast" +#define UNO_NAME_GRAPHIC_RED "AdjustRed" +#define UNO_NAME_GRAPHIC_GREEN "AdjustGreen" +#define UNO_NAME_GRAPHIC_BLUE "AdjustBlue" +#define UNO_NAME_GRAPHIC_GAMMA "Gamma" +#define UNO_NAME_GRAPHIC_TRANSPARENCY "Transparency" +#define UNO_NAME_GRAPHIC_COLOR_MODE "GraphicColorMode" +#define UNO_NAME_GRAPHIC_GRAPHICCROP "GraphicCrop" + +#define UNO_NAME_CUSTOMSHAPE_ADJUSTMENT "CustomShapeAdjustment" + +// The following properties are obsolete and can eventually be removed +#define UNO_NAME_EDIT_FONT_COLOR "FontColor" +#define UNO_NAME_EDIT_FONT_ESCAPEMENT "FontEscapement" +#define UNO_NAME_EDIT_FONT_HEIGHT "FontHeight" +#define UNO_NAME_EDIT_FONT_SHADOWED "FontShadowed" +#define UNO_NAME_EDIT_FONT_SLANT "FontSlant" +#define UNO_NAME_EDIT_FONT_STRIKEOUT "FontStrikeout" +#define UNO_NAME_EDIT_FONT_UNDERLINE "FontUnderline" +#define UNO_NAME_EDIT_FONT_WEIGHT "FontWeight" +#define UNO_NAME_EDIT_CHAR_STYLE "CharStyle" +#define UNO_NAME_EDIT_FONT_FAMILY "FontFamily" +#define UNO_NAME_EDIT_FONT_NAME "FontName" +#define UNO_NAME_EDIT_FONT_CHARSET "FontCharset" +// End of the obsolete properties + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx new file mode 100644 index 000000000000..b5a5e02a8c1b --- /dev/null +++ b/include/editeng/unotext.hxx @@ -0,0 +1,661 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SVX_UNOTEXT_HXX +#define _SVX_UNOTEXT_HXX + +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/text/XTextRange.hpp> +#include <com/sun/star/text/XText.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/text/XTextRangeMover.hpp> +#include <com/sun/star/text/XTextCursor.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/beans/XMultiPropertySet.hpp> +#include <com/sun/star/text/XTextRangeCompare.hpp> +#include <com/sun/star/beans/XMultiPropertyStates.hpp> +#include <com/sun/star/text/XTextAppend.hpp> +#include <com/sun/star/text/XTextCopy.hpp> +#include <com/sun/star/text/XTextField.hpp> +#include <com/sun/star/container/XIndexReplace.hpp> +#include <com/sun/star/awt/FontSlant.hpp> +#include <com/sun/star/awt/FontDescriptor.hpp> +#include <com/sun/star/style/LineSpacing.hpp> +#include <com/sun/star/style/TabStop.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <cppuhelper/interfacecontainer.h> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/weakagg.hxx> +#include <osl/diagnose.hxx> +#include <osl/mutex.hxx> +#include <comphelper/servicehelper.hxx> +#include <tools/link.hxx> +#include <svl/itemprop.hxx> +#include <svl/itemset.hxx> +#include <svl/itempool.hxx> +#include <svl/solar.hrc> +#include <editeng/editdata.hxx> +#include <editeng/unoedsrc.hxx> +#include <editeng/eeitem.hxx> +#include <editeng/editengdllapi.h> +#include <editeng/memberids.hrc> + +class SvxItemPropertySet; + +#ifndef SEQTYPE + #if defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500) + #define SEQTYPE(x) (new ::com::sun::star::uno::Type( x )) + #else + #define SEQTYPE(x) &(x) + #endif +#endif + +#define WID_FONTDESC OWN_ATTR_VALUE_START +#define WID_NUMLEVEL OWN_ATTR_VALUE_START+1 +#define WID_PORTIONTYPE OWN_ATTR_VALUE_START+2 +#define WID_NUMBERINGSTARTVALUE OWN_ATTR_VALUE_START+3 +#define WID_PARAISNUMBERINGRESTART OWN_ATTR_VALUE_START+4 + +#define SVX_UNOEDIT_NUMBERING_PROPERTIE \ + {MAP_CHAR_LEN(UNO_NAME_NUMBERING_RULES), EE_PARA_NUMBULLET, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace>*)0), 0, 0 }, \ + {MAP_CHAR_LEN(UNO_NAME_NUMBERING), EE_PARA_BULLETSTATE,&::getBooleanCppuType(), 0, 0 } + +#define SVX_UNOEDIT_OUTLINER_PROPERTIES \ + SVX_UNOEDIT_NUMBERING_PROPERTIE, \ + {MAP_CHAR_LEN(UNO_NAME_NUMBERING_LEVEL), WID_NUMLEVEL, &::getCppuType((const sal_Int16*)0), 0, 0 }, \ + {MAP_CHAR_LEN("NumberingStartValue"), WID_NUMBERINGSTARTVALUE, &::getCppuType((const sal_Int16*)0), 0, 0 }, \ + {MAP_CHAR_LEN("ParaIsNumberingRestart"), WID_PARAISNUMBERINGRESTART, &::getBooleanCppuType(), 0, 0 } + +#define SVX_UNOEDIT_CHAR_PROPERTIES \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_HEIGHT), EE_CHAR_FONTHEIGHT, &::getCppuType((const float*)0), 0, MID_FONTHEIGHT|CONVERT_TWIPS }, \ + { MAP_CHAR_LEN("CharScaleWidth"), EE_CHAR_FONTWIDTH, &::getCppuType((const sal_Int16*)0), 0, 0 }, \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTNAME), EE_CHAR_FONTINFO, &::getCppuType((const OUString*)0), 0, MID_FONT_FAMILY_NAME },\ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTSTYLENAME),EE_CHAR_FONTINFO, &::getCppuType((const OUString*)0), 0, MID_FONT_STYLE_NAME }, \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTFAMILY), EE_CHAR_FONTINFO, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_FAMILY }, \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTCHARSET), EE_CHAR_FONTINFO, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_CHAR_SET }, \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTPITCH), EE_CHAR_FONTINFO, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_PITCH }, \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_POSTURE), EE_CHAR_ITALIC, &::getCppuType((const ::com::sun::star::awt::FontSlant*)0),0, MID_POSTURE }, \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_WEIGHT), EE_CHAR_WEIGHT, &::getCppuType((const float*)0), 0, MID_WEIGHT }, \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_LOCALE), EE_CHAR_LANGUAGE, &::getCppuType((const ::com::sun::star::lang::Locale*)0),0, MID_LANG_LOCALE }, \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_COLOR), EE_CHAR_COLOR, &::getCppuType((const sal_Int32*)0), 0, 0 }, \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_ESCAPEMENT), EE_CHAR_ESCAPEMENT, &::getCppuType((const sal_Int16*)0), 0, MID_ESC }, \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_UNDERLINE), EE_CHAR_UNDERLINE, &::getCppuType((const sal_Int16*)0), 0, MID_TL_STYLE }, \ + { MAP_CHAR_LEN("CharUnderlineColor"), EE_CHAR_UNDERLINE, &::getCppuType((const sal_Int32*)0), 0, MID_TL_COLOR }, \ + { MAP_CHAR_LEN("CharUnderlineHasColor"), EE_CHAR_UNDERLINE, &::getBooleanCppuType(), 0, MID_TL_HASCOLOR } , \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_OVERLINE), EE_CHAR_OVERLINE, &::getCppuType((const sal_Int16*)0), 0, MID_TL_STYLE }, \ + { MAP_CHAR_LEN("CharOverlineColor"), EE_CHAR_OVERLINE, &::getCppuType((const sal_Int32*)0), 0, MID_TL_COLOR }, \ + { MAP_CHAR_LEN("CharOverlineHasColor"), EE_CHAR_OVERLINE, &::getBooleanCppuType(), 0, MID_TL_HASCOLOR } , \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_CROSSEDOUT), EE_CHAR_STRIKEOUT, &::getBooleanCppuType(), 0, MID_CROSSED_OUT }, \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_STRIKEOUT), EE_CHAR_STRIKEOUT, &::getCppuType((const sal_Int16*)0), 0, MID_CROSS_OUT}, \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_SHADOWED), EE_CHAR_SHADOW, &::getBooleanCppuType(), 0, 0 }, \ + { MAP_CHAR_LEN("CharContoured"), EE_CHAR_OUTLINE, &::getBooleanCppuType(), 0, 0 }, \ + { MAP_CHAR_LEN("CharEscapementHeight"), EE_CHAR_ESCAPEMENT, &::getCppuType((const sal_Int8*)0), 0, MID_ESC_HEIGHT },\ + { MAP_CHAR_LEN("CharAutoKerning"), EE_CHAR_PAIRKERNING,&::getBooleanCppuType(), 0, 0 } , \ + { MAP_CHAR_LEN("CharKerning"), EE_CHAR_KERNING, &::getCppuType((const sal_Int16*)0) , 0, 0 }, \ + { MAP_CHAR_LEN("CharWordMode"), EE_CHAR_WLM, &::getBooleanCppuType(), 0, 0 }, \ + { MAP_CHAR_LEN("CharEmphasis"), EE_CHAR_EMPHASISMARK,&::getCppuType((const sal_Int16*)0), 0, MID_EMPHASIS},\ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_HEIGHT_ASIAN), EE_CHAR_FONTHEIGHT_CJK, &::getCppuType((const float*)0), 0, MID_FONTHEIGHT|CONVERT_TWIPS }, \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTNAME_ASIAN), EE_CHAR_FONTINFO_CJK, &::getCppuType((const OUString*)0), 0, MID_FONT_FAMILY_NAME },\ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTSTYLENAME_ASIAN), EE_CHAR_FONTINFO_CJK, &::getCppuType((const OUString*)0), 0, MID_FONT_STYLE_NAME }, \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTFAMILY_ASIAN), EE_CHAR_FONTINFO_CJK, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_FAMILY }, \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTCHARSET_ASIAN), EE_CHAR_FONTINFO_CJK, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_CHAR_SET }, \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTPITCH_ASIAN), EE_CHAR_FONTINFO_CJK, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_PITCH }, \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_POSTURE_ASIAN), EE_CHAR_ITALIC_CJK, &::getCppuType((const ::com::sun::star::awt::FontSlant*)0),0, MID_POSTURE }, \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_WEIGHT_ASIAN), EE_CHAR_WEIGHT_CJK, &::getCppuType((const float*)0), 0, MID_WEIGHT }, \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_LOCALE_ASIAN), EE_CHAR_LANGUAGE_CJK, &::getCppuType((const ::com::sun::star::lang::Locale*)0),0, MID_LANG_LOCALE }, \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_HEIGHT_COMPLEX), EE_CHAR_FONTHEIGHT_CTL, &::getCppuType((const float*)0), 0, MID_FONTHEIGHT|CONVERT_TWIPS }, \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTNAME_COMPLEX), EE_CHAR_FONTINFO_CTL, &::getCppuType((const OUString*)0), 0, MID_FONT_FAMILY_NAME },\ + {MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTSTYLENAME_COMPLEX),EE_CHAR_FONTINFO_CTL, &::getCppuType((const OUString*)0), 0, MID_FONT_STYLE_NAME }, \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTFAMILY_COMPLEX), EE_CHAR_FONTINFO_CTL, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_FAMILY }, \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTCHARSET_COMPLEX), EE_CHAR_FONTINFO_CTL, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_CHAR_SET }, \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTPITCH_COMPLEX), EE_CHAR_FONTINFO_CTL, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_PITCH }, \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_POSTURE_COMPLEX), EE_CHAR_ITALIC_CTL, &::getCppuType((const ::com::sun::star::awt::FontSlant*)0),0, MID_POSTURE }, \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_WEIGHT_COMPLEX), EE_CHAR_WEIGHT_CTL, &::getCppuType((const float*)0), 0, MID_WEIGHT }, \ + { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_LOCALE_COMPLEX), EE_CHAR_LANGUAGE_CTL, &::getCppuType((const ::com::sun::star::lang::Locale*)0),0, MID_LANG_LOCALE }, \ + { MAP_CHAR_LEN("CharRelief" ), EE_CHAR_RELIEF, &::getCppuType((const sal_Int16*)0), 0, MID_RELIEF } + +#define SVX_UNOEDIT_FONT_PROPERTIES \ + {MAP_CHAR_LEN(UNO_NAME_EDIT_FONT_DESCRIPTOR), WID_FONTDESC, &::getCppuType((const ::com::sun::star::awt::FontDescriptor*)0), 0, MID_FONT_FAMILY_NAME } + +#define SVX_UNOEDIT_PARA_PROPERTIES \ + {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_ADJUST), EE_PARA_JUST, &::getCppuType((const sal_Int16*)0), 0, MID_PARA_ADJUST }, \ + {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_BMARGIN), EE_PARA_ULSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_LO_MARGIN|SFX_METRIC_ITEM }, \ + {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_IS_HYPHEN), EE_PARA_HYPHENATE, &::getBooleanCppuType(), 0, 0 }, \ + {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_LASTLINEADJ), EE_PARA_JUST, &::getCppuType((const sal_Int16*)0), 0, MID_LAST_LINE_ADJUST }, \ + {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_LMARGIN), EE_PARA_LRSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_TXT_LMARGIN|SFX_METRIC_ITEM }, \ + {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_LINESPACING), EE_PARA_SBL, &::getCppuType((const ::com::sun::star::style::LineSpacing*)0), 0, 0 }, \ + {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_RMARGIN), EE_PARA_LRSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_R_MARGIN|SFX_METRIC_ITEM }, \ + {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_TAPSTOPS), EE_PARA_TABS, SEQTYPE(::getCppuType((const ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop >*)0)), 0, 0 }, \ + {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_TMARGIN), EE_PARA_ULSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_UP_MARGIN|SFX_METRIC_ITEM },\ + {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_FIRST_LINE_INDENT), EE_PARA_LRSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_FIRST_LINE_INDENT|SFX_METRIC_ITEM}, \ + {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_IS_HANGING_PUNCTUATION),EE_PARA_HANGINGPUNCTUATION, &::getBooleanCppuType(), 0 ,0 }, \ + {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_IS_CHARACTER_DISTANCE), EE_PARA_ASIANCJKSPACING, &::getBooleanCppuType(), 0 ,0 }, \ + {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_IS_FORBIDDEN_RULES), EE_PARA_FORBIDDENRULES, &::getBooleanCppuType(), 0 ,0 },\ + {MAP_CHAR_LEN("WritingMode"), EE_PARA_WRITINGDIR, &::getCppuType((const sal_Int16*)0), 0, 0 } + +class SvxEditSource; +class SvxTextForwarder; +class SvxFieldItem; +class SvxTextEditSource; +class SvxFieldData; +struct ESelection; + +EDITENG_DLLPUBLIC void GetSelection( struct ESelection& rSel, SvxTextForwarder* pForwarder ) throw(); +EDITENG_DLLPUBLIC void CheckSelection( struct ESelection& rSel, SvxTextForwarder* pForwarder ) throw(); + +// ==================================================================== +// This class implements a SvxEditSource and SvxTextForwarder and does +// nothing otherwise +// ==================================================================== + +class SvxDummyTextSource : public SvxEditSource, public SvxTextForwarder +{ +public: + + // SvxEditSource + virtual ~SvxDummyTextSource(); + virtual SvxEditSource* Clone() const; + virtual SvxTextForwarder* GetTextForwarder(); + virtual void UpdateData(); + + // SvxTextForwarder + virtual sal_uInt16 GetParagraphCount() const; + virtual sal_uInt16 GetTextLen( sal_uInt16 nParagraph ) const; + virtual String GetText( const ESelection& rSel ) const; + virtual SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = 0 ) const; + virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const; + virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ); + virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ); + virtual void GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ) const; + + sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const; + sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const; + + virtual SfxItemPool* GetPool() 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 XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ); + virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos ); + + virtual sal_Bool IsValid() const; + + virtual void SetNotifyHdl( const Link& ); + virtual LanguageType GetLanguage( sal_uInt16, sal_uInt16 ) const; + virtual sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const; + virtual EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const; + virtual EBulletInfo GetBulletInfo( sal_uInt16 nPara ) const; + virtual Rectangle GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const; + virtual Rectangle GetParaBounds( sal_uInt16 nPara ) const; + virtual MapMode GetMapMode() const; + virtual OutputDevice* GetRefDevice() const; + virtual sal_Bool GetIndexAtPoint( const Point&, sal_uInt16& nPara, sal_uInt16& nIndex ) const; + virtual sal_Bool GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const; + virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const; + virtual sal_uInt16 GetLineCount( sal_uInt16 nPara ) const; + virtual sal_uInt16 GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const; + virtual void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const; + virtual sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const; + virtual sal_Bool Delete( const ESelection& ); + virtual sal_Bool InsertText( const String&, const ESelection& ); + virtual sal_Bool QuickFormatDoc( sal_Bool bFull=sal_False ); + virtual sal_Int16 GetDepth( sal_uInt16 nPara ) const; + virtual sal_Bool SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth ); + + virtual const SfxItemSet* GetEmptyItemSetPtr(); + + // implementation functions for XParagraphAppend and XTextPortionAppend + virtual void AppendParagraph(); + virtual xub_StrLen AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet &rSet ); + //XTextCopy + virtual void CopyText(const SvxTextForwarder& rSource); +}; + +namespace accessibility +{ + class AccessibleEditableTextPara; +} + +// ==================================================================== +class EDITENG_DLLPUBLIC SvxUnoTextRangeBase : public ::com::sun::star::text::XTextRange, + public ::com::sun::star::beans::XPropertySet, + public ::com::sun::star::beans::XMultiPropertySet, + public ::com::sun::star::beans::XMultiPropertyStates, + public ::com::sun::star::beans::XPropertyState, + public ::com::sun::star::lang::XServiceInfo, + public ::com::sun::star::text::XTextRangeCompare, + public ::com::sun::star::lang::XUnoTunnel, + private osl::DebugBase<SvxUnoTextRangeBase> + +{ + friend class SvxUnoTextRangeEnumeration; + friend class ::accessibility::AccessibleEditableTextPara; + +protected: + SvxEditSource* mpEditSource; + ESelection maSelection; + const SvxItemPropertySet* mpPropSet; + + virtual void SAL_CALL _setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue, sal_Int32 nPara = -1 ) 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); + virtual ::com::sun::star::uno::Any SAL_CALL _getPropertyValue( const OUString& PropertyName, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL _setPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues, sal_Int32 nPara = -1 ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL _getPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, sal_Int32 nPara = -1 ) throw (::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::beans::PropertyState SAL_CALL _getPropertyState( const SfxItemPropertySimpleEntry* pMap, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::beans::PropertyState SAL_CALL _getPropertyState( const OUString& PropertyName, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL _getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + // returns true if property found or false if unknown property + virtual sal_Bool _getOnePropertyStates(const SfxItemSet* pSet, const SfxItemPropertySimpleEntry* pMap, ::com::sun::star::beans::PropertyState& rState); + + virtual void SAL_CALL _setPropertyToDefault( const OUString& PropertyName, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + virtual void _setPropertyToDefault( SvxTextForwarder* pForwarder, const SfxItemPropertySimpleEntry* pMap, sal_Int32 nPara ) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException ); + void SetEditSource( SvxEditSource* _pEditSource ) throw(); + + virtual void getPropertyValue( const SfxItemPropertySimpleEntry* pMap, com::sun::star::uno::Any& rAny, const SfxItemSet& rSet ) throw(::com::sun::star::beans::UnknownPropertyException ); + virtual void setPropertyValue( const SfxItemPropertySimpleEntry* pMap, const com::sun::star::uno::Any& rValue, const ESelection& rSelection, const SfxItemSet& rOldSet, SfxItemSet& rNewSet ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::IllegalArgumentException ); + +public: + SvxUnoTextRangeBase( const SvxItemPropertySet* _pSet ) throw(); + SvxUnoTextRangeBase( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet ) throw(); + SvxUnoTextRangeBase( const SvxUnoTextRangeBase& rRange ) throw(); + virtual ~SvxUnoTextRangeBase() throw(); + + // Internal + const ESelection& GetSelection() const throw() { CheckSelection( ((SvxUnoTextRangeBase*)this)->maSelection, mpEditSource->GetTextForwarder() ); return maSelection; }; + void SetSelection( const ESelection& rSelection ) throw(); + + virtual void CollapseToStart(void) throw(); + virtual void CollapseToEnd(void) throw(); + virtual sal_Bool IsCollapsed(void) throw(); + virtual sal_Bool GoLeft(sal_Int16 nCount, sal_Bool Expand) throw(); + virtual sal_Bool GoRight(sal_Int16 nCount, sal_Bool Expand) throw(); + virtual void GotoStart(sal_Bool Expand) throw(); + virtual void GotoEnd(sal_Bool Expand) throw(); + + //const SfxItemPropertyMapEntry* getPropertyMapEntries() const throw() { return maPropSet.getPropertyMapEntries(); } + const SvxItemPropertySet* getPropertySet() const throw() { return mpPropSet; } + SvxEditSource* GetEditSource() const throw() { return mpEditSource; } + + static sal_Bool SetPropertyValueHelper( const SfxItemSet& rOldSet, const SfxItemPropertySimpleEntry* pMap, const ::com::sun::star::uno::Any& aValue, SfxItemSet& rNewSet, const ESelection* pSelection = NULL, SvxEditSource* pEditSource = NULL ); + static sal_Bool GetPropertyValueHelper( SfxItemSet& rSet, const SfxItemPropertySimpleEntry* pMap, ::com::sun::star::uno::Any& aAny, const ESelection* pSelection = NULL, SvxEditSource* pEditSource = NULL ) throw( ::com::sun::star::uno::RuntimeException ); + + void attachField( const SvxFieldData* pData ) throw(); + + UNO3_GETIMPLEMENTATION_DECL( SvxUnoTextRangeBase ) + + // ::com::sun::star::text::XTextRange + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getStart() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getEnd() throw(::com::sun::star::uno::RuntimeException); + virtual OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setString( const OUString& aString ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::beans::XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const 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); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const 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); + virtual void SAL_CALL removePropertyChangeListener( const 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); + virtual void SAL_CALL addVetoableChangeListener( const 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); + virtual void SAL_CALL removeVetoableChangeListener( const 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); + + // XMultiPropertySet + virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::beans::XPropertyState + virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::beans::XMultiPropertyStates + //virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setAllPropertiesToDefault( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertiesToDefault( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyDefaults( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XTextRangeCompare + virtual ::sal_Int16 SAL_CALL compareRegionStarts( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xR1, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xR2 ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL compareRegionEnds( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xR1, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xR2 ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames_Static( ) SAL_THROW(()); +}; + +// ==================================================================== + +class SvxUnoTextBase; +class EDITENG_DLLPUBLIC SvxUnoTextRange : public SvxUnoTextRangeBase, + public ::com::sun::star::lang::XTypeProvider, + public ::cppu::OWeakAggObject +{ + friend class SvxUnoTextRangeEnumeration; +private: + ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParentText; + sal_Bool mbPortion; + +public: + SvxUnoTextRange( const SvxUnoTextBase& rParent, sal_Bool bPortion = sal_False ) throw(); + virtual ~SvxUnoTextRange() throw(); + + // ::com::sun::star::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(); + + // ::com::sun::star::text::XTextRange + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::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); +}; + +class EDITENG_DLLPUBLIC SvxUnoTextBase : public SvxUnoTextRangeBase, + public ::com::sun::star::text::XTextAppend, + public ::com::sun::star::text::XTextCopy, + public ::com::sun::star::container::XEnumerationAccess, + public ::com::sun::star::text::XTextRangeMover, + public ::com::sun::star::lang::XTypeProvider +{ +protected: + ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParentText; + +public: + SvxUnoTextBase( ) throw(); + SvxUnoTextBase( const SvxItemPropertySet* _pSet ) throw(); + SvxUnoTextBase( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet, ::com::sun::star::uno::Reference < ::com::sun::star::text::XText > xParent ) throw(); + SvxUnoTextBase( const SvxUnoTextBase& rText ) throw(); + virtual ~SvxUnoTextBase() throw(); + + UNO3_GETIMPLEMENTATION_DECL( SvxUnoTextBase ) + + ESelection InsertField( const SvxFieldItem& rField ) throw(); + static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getStaticTypes() throw(); + + ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > createTextCursorBySelection( const ESelection& rSel ); + + // ::com::sun::star::uno::XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::text::XSimpleText + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursor( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursorByRange( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& aTextPosition ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertString( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, const OUString& aString, sal_Bool bAbsorb ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertControlCharacter( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::text::XText + virtual void SAL_CALL insertTextContent( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >& xContent, sal_Bool bAbsorb ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeTextContent( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >& xContent ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setString( const OUString& aString ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::text::XTextRange + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getStart() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getEnd() 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::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::text::XTextRangeMover + virtual void SAL_CALL moveTextRange( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, sal_Int16 nParagraphs ) throw(::com::sun::star::uno::RuntimeException); + + // com::sun::star::text::XParagraphAppend (new import API) + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL finishParagraph( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& CharacterAndParagraphProperties ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL finishParagraphInsert( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& CharacterAndParagraphProperties, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xInsertPosition ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + + // com::sun::star::text::XTextPortionAppend (new import API) + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL appendTextPortion( const OUString& Text, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& CharacterAndParagraphProperties ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL insertTextPortion( const OUString& Text, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& CharacterAndParagraphProperties, const com::sun::star::uno::Reference< com::sun::star::text::XTextRange>& rTextRange ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + + // com::sun::star::text::XTextCopy + virtual void SAL_CALL copyText( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCopy >& xSource ) throw (::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames_Static( ) SAL_THROW(()); + + // ::com::sun::star::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); +}; + +// ==================================================================== +class EDITENG_DLLPUBLIC SvxUnoText : public SvxUnoTextBase, + public ::cppu::OWeakAggObject +{ +public: + SvxUnoText( ) throw(); + SvxUnoText( const SvxItemPropertySet* _pSet ) throw(); + SvxUnoText( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet, ::com::sun::star::uno::Reference < ::com::sun::star::text::XText > xParent ) throw(); + SvxUnoText( const SvxUnoText& rText ) throw(); + virtual ~SvxUnoText() throw(); + + // Internal + static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::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(); + + // ::com::sun::star::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); +}; + +// ==================================================================== + +class SvxUnoTextContentEnumeration : public ::cppu::WeakAggImplHelper1< ::com::sun::star::container::XEnumeration > +{ +private: + ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxParentText; + SvxEditSource* mpEditSource; + sal_uInt16 mnNextParagraph; + const SvxUnoTextBase& mrText; + +public: + SvxUnoTextContentEnumeration( const SvxUnoTextBase& _rText ) throw(); + virtual ~SvxUnoTextContentEnumeration() throw(); + + // ::com::sun::star::container::XEnumeration + virtual sal_Bool SAL_CALL hasMoreElements( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL nextElement( ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); +}; + +// ==================================================================== +#include <com/sun/star/text/XTextContent.hpp> + +class SvxUnoTextContent : public SvxUnoTextRangeBase, + public ::com::sun::star::text::XTextContent, + public ::com::sun::star::container::XEnumerationAccess, + public ::com::sun::star::lang::XTypeProvider, + public ::cppu::OWeakAggObject +{ + friend class SvxUnoTextContentEnumeration; +private: + ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxParentText; + sal_uInt16 mnParagraph; + const SvxUnoTextBase& mrParentText; + + // for xComponent + ::osl::Mutex maDisposeContainerMutex; + ::cppu::OInterfaceContainerHelper maDisposeListeners; + bool mbDisposing; + +protected: + using SvxUnoTextRangeBase::setPropertyValue; + using SvxUnoTextRangeBase::getPropertyValue; + +public: + SvxUnoTextContent( const SvxUnoTextBase& rText, sal_uInt16 nPara ) throw(); + SvxUnoTextContent( const SvxUnoTextContent& rContent ) throw(); + virtual ~SvxUnoTextContent() throw(); + + // ::com::sun::star::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(); + + // ::com::sun::star::text::XTextRange + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::text::XTextContent -> ::com::sun::star::lang::XComponent + virtual void SAL_CALL attach( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xTextRange ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XComponent + virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) 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::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::beans::XPropertySet + virtual void SAL_CALL setPropertyValue( const 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); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XMultiPropertySet + virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::beans::XPropertyState + virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::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); +}; + +// ==================================================================== + +class SvxUnoTextRangeEnumeration : public ::cppu::WeakAggImplHelper1< ::com::sun::star::container::XEnumeration > +{ +private: + SvxEditSource* mpEditSource; + ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxParentText; + const SvxUnoTextBase& mrParentText; + sal_uInt16 mnParagraph; + std::vector<sal_uInt16>* mpPortions; + sal_uInt16 mnNextPortion; + +public: + SvxUnoTextRangeEnumeration( const SvxUnoTextBase& rText, sal_uInt16 nPara ) throw(); + virtual ~SvxUnoTextRangeEnumeration() throw(); + + // ::com::sun::star::container::XEnumeration + virtual sal_Bool SAL_CALL hasMoreElements( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL nextElement( ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); +}; + +// ==================================================================== + +class EDITENG_DLLPUBLIC SvxUnoTextCursor : public SvxUnoTextRangeBase, + public ::com::sun::star::text::XTextCursor, + public ::com::sun::star::lang::XTypeProvider, + public ::cppu::OWeakAggObject +{ +private: + ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxParentText; + +public: + SvxUnoTextCursor( const SvxUnoTextBase& rText ) throw(); + SvxUnoTextCursor( const SvxUnoTextCursor& rCursor ) throw(); + virtual ~SvxUnoTextCursor() throw(); + + // ::com::sun::star::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(); + + // ::com::sun::star::text::XTextRange + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText() throw(::com::sun::star::uno::RuntimeException); + virtual OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setString( const OUString& aString ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getStart() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getEnd() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::text::XTextCursor -> ::com::sun::star::text::XTextRange + virtual void SAL_CALL collapseToStart( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL collapseToEnd( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCollapsed( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL goLeft( sal_Int16 nCount, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL goRight( sal_Int16 nCount, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL gotoStart( sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL gotoEnd( sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL gotoRange( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::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); + +}; + +EDITENG_DLLPUBLIC const SvxItemPropertySet* ImplGetSvxUnoOutlinerTextCursorSvxPropertySet(); +EDITENG_DLLPUBLIC const SfxItemPropertyMapEntry* ImplGetSvxUnoOutlinerTextCursorPropertyMap(); +EDITENG_DLLPUBLIC const SvxItemPropertySet* ImplGetSvxTextPortionSvxPropertySet(); +EDITENG_DLLPUBLIC const SfxItemPropertyMapEntry* ImplGetSvxTextPortionPropertyMap(); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/unoviwou.hxx b/include/editeng/unoviwou.hxx new file mode 100644 index 000000000000..24031f93c847 --- /dev/null +++ b/include/editeng/unoviwou.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SVX_UNOVIWOU_HXX +#define _SVX_UNOVIWOU_HXX + +#include <editeng/unoedsrc.hxx> +#include <editeng/editengdllapi.h> + +class OutlinerView; + +/// Specialization for Draw/Impress +class EDITENG_DLLPUBLIC SvxDrawOutlinerViewForwarder : public SvxEditViewForwarder +{ +private: + OutlinerView& mrOutlinerView; + Point maTextShapeTopLeft; + + EDITENG_DLLPRIVATE Point GetTextOffset() const; + +public: + explicit SvxDrawOutlinerViewForwarder( OutlinerView& rOutl ); + SvxDrawOutlinerViewForwarder( OutlinerView& rOutl, const Point& rShapePosTopLeft ); + virtual ~SvxDrawOutlinerViewForwarder(); + + virtual sal_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; + + 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(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/wghtitem.hxx b/include/editeng/wghtitem.hxx new file mode 100644 index 000000000000..b10d74361dc8 --- /dev/null +++ b/include/editeng/wghtitem.hxx @@ -0,0 +1,76 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_WGHTITEM_HXX +#define _SVX_WGHTITEM_HXX + +#include <vcl/vclenum.hxx> +#include <svl/eitem.hxx> +#include <editeng/editengdllapi.h> + +class SvXMLUnitConverter; + +// class SvxWeightItem --------------------------------------------------- + +/* [Description] + + This item describes the font weight. +*/ + +class EDITENG_DLLPUBLIC SvxWeightItem : public SfxEnumItem +{ +public: + TYPEINFO(); + + SvxWeightItem( const FontWeight eWght /*= WEIGHT_NORMAL*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + SfxEnumItem + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const; + virtual sal_uInt16 GetValueCount() const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + virtual int HasBoolValue() const; + virtual sal_Bool GetBoolValue() const; + virtual void SetBoolValue( sal_Bool bVal ); + + inline SvxWeightItem& operator=(const SvxWeightItem& rWeight) { + SetValue( rWeight.GetValue() ); + return *this; + } + + // enum cast + FontWeight GetWeight() const + { return (FontWeight)GetValue(); } + void SetWeight( FontWeight eNew ) + { SetValue( (sal_uInt16)eNew ); } +}; + +#endif // #ifndef _SVX_WGHTITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/widwitem.hxx b/include/editeng/widwitem.hxx new file mode 100644 index 000000000000..8602702a00f7 --- /dev/null +++ b/include/editeng/widwitem.hxx @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_WIDWITEM_HXX +#define _SVX_WIDWITEM_HXX + +#include <svl/intitem.hxx> +#include <editeng/editengdllapi.h> + +class SvXMLUnitConverter; + +// class SvxWidowsItem --------------------------------------------------- + +/* [Description] + + This item describes the number of lines for the widows control. +*/ + +class EDITENG_DLLPUBLIC SvxWidowsItem: public SfxByteItem +{ + friend SvStream & operator<<( SvStream & aS, SvxWidowsItem & ); +public: + TYPEINFO(); + + SvxWidowsItem( const sal_uInt8 nL /*= 0*/, const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create( SvStream &, sal_uInt16 ) const; + virtual SvStream& Store( SvStream & , sal_uInt16 nItemVersion ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + inline SvxWidowsItem& operator=( const SvxWidowsItem& rWidows ) + { + SetValue( rWidows.GetValue() ); + return *this; + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/writingmodeitem.hxx b/include/editeng/writingmodeitem.hxx new file mode 100644 index 000000000000..c1ad81587f42 --- /dev/null +++ b/include/editeng/writingmodeitem.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_WRITINGMODEITEM_HXX +#define _SVX_WRITINGMODEITEM_HXX + +#include <com/sun/star/text/WritingMode.hpp> +#include <svl/intitem.hxx> +#include "editeng/editengdllapi.h" + +// class SvxWritingModeItem ---------------------------------------------- + +class EDITENG_DLLPUBLIC SvxWritingModeItem : public SfxUInt16Item +{ +public: + TYPEINFO(); + + SvxWritingModeItem( ::com::sun::star::text::WritingMode eValue /*= com::sun::star::text::WritingMode_LR_TB*/, + sal_uInt16 nWhich /*= SDRATTR_TEXTDIRECTION*/ ); + virtual ~SvxWritingModeItem(); + + SvxWritingModeItem& operator=( const SvxWritingModeItem& rItem ); + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream & rStrm, sal_uInt16 nIVer) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; + virtual int operator==( const SfxPoolItem& ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, + const IntlWrapper * = 0 ) const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); +}; + +#endif // #ifndef _SVX_WRITINGMODEITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/wrlmitem.hxx b/include/editeng/wrlmitem.hxx new file mode 100644 index 000000000000..b74b2f406a71 --- /dev/null +++ b/include/editeng/wrlmitem.hxx @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_WRLMITEM_HXX +#define _SVX_WRLMITEM_HXX + +#include <svl/eitem.hxx> +#include <editeng/editengdllapi.h> + +class SvXMLUnitConverter; + +// class SvxWordLineModeItem --------------------------------------------- + +/* [Description] + + This item describes, whether underlined and strikethrough is limited + to word boundaries. +*/ + +class EDITENG_DLLPUBLIC SvxWordLineModeItem : public SfxBoolItem +{ +public: + TYPEINFO(); + + SvxWordLineModeItem( const sal_Bool bWordLineMode /*= sal_False*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + OUString &rText, const IntlWrapper * = 0 ) const; + + inline SvxWordLineModeItem& operator=( const SvxWordLineModeItem& rWLM ) + { + SetValue( rWLM.GetValue() ); + return *this; + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/xmlcnitm.hxx b/include/editeng/xmlcnitm.hxx new file mode 100644 index 000000000000..d361ab79c8d0 --- /dev/null +++ b/include/editeng/xmlcnitm.hxx @@ -0,0 +1,83 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SVX_XMLCNITM_HXX +#define _SVX_XMLCNITM_HXX + +#include <svl/poolitem.hxx> +#include "editeng/editengdllapi.h" + +class SvXMLNamespaceMap; + +//============================================================================ + +class SvXMLAttrContainerData; + +class EDITENG_DLLPUBLIC SvXMLAttrContainerItem: public SfxPoolItem +{ + SvXMLAttrContainerData *pImpl; + +public: + TYPEINFO(); + + SvXMLAttrContainerItem( sal_uInt16 nWhich = 0 ); + SvXMLAttrContainerItem( const SvXMLAttrContainerItem& ); + virtual ~SvXMLAttrContainerItem(); + + virtual int operator==( const SfxPoolItem& ) const; + using SfxPoolItem::Compare; + virtual int Compare( const SfxPoolItem &rWith ) const; + + virtual SfxItemPresentation GetPresentation( + SfxItemPresentation ePresentation, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresentationMetric, + OUString &rText, + const IntlWrapper *pIntlWrapper = 0 ) const; + + virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + virtual SfxPoolItem *Clone( SfxItemPool * = 0) const + { return new SvXMLAttrContainerItem( *this ); } + + sal_Bool AddAttr( const OUString& rLName, + const OUString& rValue ); + sal_Bool AddAttr( const OUString& rPrefix, + const OUString& rNamespace, + const OUString& rLName, + const OUString& rValue ); + + sal_uInt16 GetAttrCount() const; + OUString GetAttrNamespace( sal_uInt16 i ) const; + OUString GetAttrPrefix( sal_uInt16 i ) const; + const OUString& GetAttrLName( sal_uInt16 i ) const; + const OUString& GetAttrValue( sal_uInt16 i ) const; + + sal_uInt16 GetFirstNamespaceIndex() const; + sal_uInt16 GetNextNamespaceIndex( sal_uInt16 nIdx ) const; + const OUString& GetNamespace( sal_uInt16 i ) const; + const OUString& GetPrefix( sal_uInt16 i ) const; +}; + +#endif // _SVX_XMLCNITM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |