diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
commit | ed5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch) | |
tree | 7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /include/editeng | |
parent | Initial commit. (diff) | |
download | libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip |
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'include/editeng')
125 files changed, 16507 insertions, 0 deletions
diff --git a/include/editeng/AccessibleComponentBase.hxx b/include/editeng/AccessibleComponentBase.hxx new file mode 100644 index 000000000..80b0c2b95 --- /dev/null +++ b/include/editeng/AccessibleComponentBase.hxx @@ -0,0 +1,109 @@ +/* -*- 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_EDITENG_ACCESSIBLECOMPONENTBASE_HXX +#define INCLUDED_EDITENG_ACCESSIBLECOMPONENTBASE_HXX + +#include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp> +#include <editeng/editengdllapi.h> + +namespace com::sun::star::accessibility +{ +class XAccessible; +} + +namespace accessibility +{ +/** @descr + This base class provides (will provide) a base implementation of the + XAccessibleComponent and the + XAccessibleExtendedComponent for all shapes. For + more detailed documentation about the methods refer to the interface + descriptions of XAccessible, + XAccessibleContext, <type>XInterface</type>, + XServiceInfo, and <type>XTypeProvider</type>. +*/ +class EDITENG_DLLPUBLIC AccessibleComponentBase + : public css::accessibility::XAccessibleExtendedComponent +{ +public: + //===== internal ======================================================== + AccessibleComponentBase(); + virtual ~AccessibleComponentBase(); + + //===== 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 css::awt::Point& aPoint) override; + + /** The default implementation returns an empty reference. + */ + virtual css::uno::Reference<css::accessibility::XAccessible> + SAL_CALL getAccessibleAtPoint(const css::awt::Point& aPoint) override; + + /** The default implementation returns an empty rectangle. + */ + virtual css::awt::Rectangle SAL_CALL getBounds() override; + + /** The default implementation uses the result of + <member>getBounds</member> to determine the location. + */ + virtual css::awt::Point SAL_CALL getLocation() override; + + /** The default implementation returns an empty position, i.e. the + * result of the default constructor of css::awt::Point. + */ + virtual css::awt::Point SAL_CALL getLocationOnScreen() override; + + /** The default implementation uses the result of + <member>getBounds</member> to determine the size. + */ + virtual css::awt::Size SAL_CALL getSize() override; + + /** The default implementation does nothing. + */ + virtual void SAL_CALL grabFocus() override; + + /** Returns black as the default foreground color. + */ + virtual sal_Int32 SAL_CALL getForeground() override; + + /** Returns white as the default background color. + */ + virtual sal_Int32 SAL_CALL getBackground() override; + + //===== XAccessibleExtendedComponent ==================================== + virtual css::uno::Reference<css::awt::XFont> SAL_CALL getFont() override; + virtual OUString SAL_CALL getTitledBorderText() override; + virtual OUString SAL_CALL getToolTipText() override; + + //===== XTypeProvider =================================================== + + /// @throws css::uno::RuntimeException + virtual css::uno::Sequence<css::uno::Type> SAL_CALL getTypes(); +}; + +} // 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 000000000..69ef3151c --- /dev/null +++ b/include/editeng/AccessibleContextBase.hxx @@ -0,0 +1,341 @@ +/* -*- 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_EDITENG_ACCESSIBLECONTEXTBASE_HXX +#define INCLUDED_EDITENG_ACCESSIBLECONTEXTBASE_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/uno/Reference.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/compbase.hxx> +#include <cppuhelper/basemutex.hxx> +#include <editeng/editengdllapi.h> +#include <rtl/ref.hxx> + +namespace com::sun::star::accessibility { class XAccessibleStateSet; } +namespace com::sun::star::accessibility { class XAccessibleRelationSet; } +namespace com::sun::star::accessibility { struct AccessibleEventObject; } +namespace utl { class AccessibleStateSetHelper; } + +namespace accessibility { + +/** @descr + This base class provides an implementation of the + AccessibleContext service. Apart from the + <type>XXAccessible<type> and XAccessibleContextContext + interfaces it supports the XServiceInfo interface. +*/ +class EDITENG_DLLPUBLIC AccessibleContextBase + : public cppu::BaseMutex, + public cppu::WeakComponentImplHelper< + css::accessibility::XAccessible, + css::accessibility::XAccessibleContext, + css::accessibility::XAccessibleEventBroadcaster, + css::lang::XServiceInfo + > +{ +public: + + //===== internal ======================================================== + + /** The origin of the accessible name or description. + */ + enum StringOrigin { + ManuallySet, + FromShape, + AutomaticallyCreated, + NotSet + }; + + AccessibleContextBase ( + css::uno::Reference< css::accessibility::XAccessible> xParent, + const sal_Int16 aRole); + virtual ~AccessibleContextBase() override; + + + /** Call all accessibility 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 css::uno::Any& rNewValue, + const css::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. + @throws css::uno::RuntimeException + */ + void SetAccessibleDescription ( + const OUString& rsDescription, + StringOrigin eDescriptionOrigin); + + /** 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. + @throws css::uno::RuntimeException + */ + void SetAccessibleName ( + const OUString& rsName, + StringOrigin eNameOrigin); + + /** 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 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 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. + */ + 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. + + @throws css::uno::RuntimeException + */ + void SetRelationSet ( + const css::uno::Reference< css::accessibility::XAccessibleRelationSet>& rxRelationSet); + + + //===== XAccessible ===================================================== + + /// Return the XAccessibleContext. + virtual css::uno::Reference< css::accessibility::XAccessibleContext> SAL_CALL + getAccessibleContext() override; + + + //===== XAccessibleContext ============================================== + + /// Return the number of currently visible children. + virtual sal_Int32 SAL_CALL + getAccessibleChildCount() override; + + /// Return the specified child or throw exception. + virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL + getAccessibleChild (sal_Int32 nIndex) override; + + /// Return a reference to the parent. + virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL + getAccessibleParent() override; + + /// Return this objects index among the parents children. + virtual sal_Int32 SAL_CALL + getAccessibleIndexInParent() override; + + /// Return this object's role. + virtual sal_Int16 SAL_CALL + getAccessibleRole() override; + + /// Return this object's description. + virtual OUString SAL_CALL + getAccessibleDescription() override; + + /// Return the object's current name. + virtual OUString SAL_CALL + getAccessibleName() override; + + /// Return NULL to indicate that an empty relation set. + virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet> SAL_CALL + getAccessibleRelationSet() override; + + /// Return the set of current states. + virtual css::uno::Reference< css::accessibility::XAccessibleStateSet> SAL_CALL + getAccessibleStateSet() override; + + /** Return the parents locale or throw exception if this object has no + parent yet/anymore. + */ + virtual css::lang::Locale SAL_CALL + getLocale() override; + + //===== XAccessibleEventBroadcaster ======================================== + + virtual void SAL_CALL + addAccessibleEventListener ( + const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener) override; + + virtual void SAL_CALL + removeAccessibleEventListener ( + const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener) override; + + + //===== XServiceInfo ==================================================== + + /** Returns an identifier for the implementation of this object. + */ + virtual OUString SAL_CALL + getImplementationName() override; + + /** Return whether the specified service is supported by this class. + */ + virtual sal_Bool SAL_CALL + supportsService (const OUString& sServiceName) override; + + /** Returns a list of all supported services. In this case that is just + the AccessibleContext service. + */ + virtual css::uno::Sequence< OUString> SAL_CALL + getSupportedServiceNames() override; + + + //===== XTypeProvider =================================================== + + /** Returns an implementation id. + */ + virtual css::uno::Sequence<sal_Int8> SAL_CALL + getImplementationId() override; + + /** Check whether or not the object has been disposed (or is in the + state of being disposed). + + @return TRUE, if the object is disposed or in the course + of being disposed. Otherwise, FALSE is returned. + */ + bool IsDisposed() const; + +protected: + /** The state set. + */ + rtl::Reference<::utl::AccessibleStateSetHelper> mxStateSet; + + /** The relation set. Relations can be set or removed by calling the + <member>AddRelation</member> and <member>RemoveRelation</member> methods. + */ + css::uno::Reference< css::accessibility::XAccessibleRelationSet> mxRelationSet; + + // This method is called from the component helper base class while disposing. + virtual void SAL_CALL disposing() override; + + /** 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. + @throws css::uno::RuntimeException + */ + virtual OUString CreateAccessibleName(); + + void FireEvent (const css::accessibility::AccessibleEventObject& aEvent); + + /** Check whether or not the object has been disposed (or is in the + state of being disposed). If that is the case then + DisposedException is thrown to inform the (indirect) caller of the + foul deed. + @throws css::lang::DisposedException + */ + void ThrowIfDisposed(); + + /** 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. + css::uno::Reference< css::accessibility::XAccessible> mxParent; + + /** Description of this object. This is not a constant because it can + be set from the outside. Furthermore, it changes according to 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 000000000..d81cc6cd5 --- /dev/null +++ b/include/editeng/AccessibleEditableTextPara.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 INCLUDED_EDITENG_ACCESSIBLEEDITABLETEXTPARA_HXX +#define INCLUDED_EDITENG_ACCESSIBLEEDITABLETEXTPARA_HXX + +#include <config_options.h> +#include <rtl/ref.hxx> +#include <rtl/ustring.hxx> +#include <tools/gen.hxx> +#include <comphelper/compbase.hxx> + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/accessibility/AccessibleScrollType.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 <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> + +#include <comphelper/accessibletexthelper.hxx> +#include <editeng/AccessibleParaManager.hxx> +#include <editeng/editdata.hxx> +#include <editeng/editengdllapi.h> + +class SvxViewForwarder; +class MapMode; +class SvxAccessibleTextAdapter; +class SvxAccessibleTextEditViewAdapter; +namespace accessibility { class AccessibleImageBullet; } +namespace utl { class AccessibleStateSetHelper; } + +namespace accessibility +{ + typedef ::comphelper::WeakComponentImplHelper< css::accessibility::XAccessible, + css::accessibility::XAccessibleContext, + css::accessibility::XAccessibleComponent, + css::accessibility::XAccessibleEditableText, + css::accessibility::XAccessibleEventBroadcaster, + css::accessibility::XAccessibleTextAttributes, + css::accessibility::XAccessibleHypertext, + css::accessibility::XAccessibleMultiLineText, + css::lang::XServiceInfo > AccessibleTextParaInterfaceBase; + + /** This class implements the actual text paragraphs for the EditEngine/Outliner UAA + */ + class UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) AccessibleEditableTextPara final : public AccessibleTextParaInterfaceBase, private ::comphelper::OCommonAccessibleText + { + + // override OCommonAccessibleText methods + virtual OUString implGetText() override; + virtual css::lang::Locale implGetLocale() override; + virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) override; + virtual void implGetParagraphBoundary( const OUString& rtext, css::i18n::Boundary& rBoundary, sal_Int32 nIndex ) override; + virtual void implGetLineBoundary( const OUString& rtext, css::i18n::Boundary& rBoundary, sal_Int32 nIndex ) override; + + 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 ( css::uno::Reference< css::accessibility::XAccessible > xParent, + const AccessibleParaManager* _pParaManager = nullptr ); + + virtual ~AccessibleEditableTextPara () override; + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface (const css::uno::Type & rType) override; + + // XAccessible + virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount() override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override; + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() override; + virtual sal_Int16 SAL_CALL getAccessibleRole() override; + /// Maximal length of text returned by getAccessibleDescription() + enum { MaxDescriptionLen = 40 }; + virtual OUString SAL_CALL getAccessibleDescription() override; + virtual OUString SAL_CALL getAccessibleName() override; + virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override; + virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override; + virtual css::lang::Locale SAL_CALL getLocale() override; + + // XAccessibleEventBroadcaster + virtual void SAL_CALL addAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override; + virtual void SAL_CALL removeAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override; + + // XAccessibleComponent + virtual sal_Bool SAL_CALL containsPoint( const css::awt::Point& aPoint ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override; + virtual css::awt::Rectangle SAL_CALL getBounds( ) override; + virtual css::awt::Point SAL_CALL getLocation( ) override; + virtual css::awt::Point SAL_CALL getLocationOnScreen( ) override; + virtual css::awt::Size SAL_CALL getSize( ) override; + virtual void SAL_CALL grabFocus( ) override; + virtual sal_Int32 SAL_CALL getForeground( ) override; + virtual sal_Int32 SAL_CALL getBackground( ) override; + + // XAccessibleText (this comes implicitly inherited by XAccessibleEditableText AND by XAccessibleMultiLineText) + virtual sal_Int32 SAL_CALL getCaretPosition() override; + virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) override; + virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) override; + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& aRequestedAttributes ) override; + virtual css::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) override; + virtual sal_Int32 SAL_CALL getCharacterCount() override; + virtual sal_Int32 SAL_CALL getIndexAtPoint( const css::awt::Point& aPoint ) override; + virtual OUString SAL_CALL getSelectedText() override; + virtual sal_Int32 SAL_CALL getSelectionStart() override; + virtual sal_Int32 SAL_CALL getSelectionEnd() override; + virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; + virtual OUString SAL_CALL getText() override; + virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; + /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine) + virtual css::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override; + /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine) + virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override; + /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine) + virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override; + virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; + virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override; + + // XAccessibleEditableText + virtual sal_Bool SAL_CALL cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; + virtual sal_Bool SAL_CALL pasteText( sal_Int32 nIndex ) override; + virtual sal_Bool SAL_CALL deleteText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; + virtual sal_Bool SAL_CALL insertText( const OUString& sText, sal_Int32 nIndex ) override; + virtual sal_Bool SAL_CALL replaceText( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const OUString& sReplacement ) override; + virtual sal_Bool SAL_CALL setAttributes( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const css::uno::Sequence< css::beans::PropertyValue >& aAttributeSet ) override; + virtual sal_Bool SAL_CALL setText( const OUString& sText ) override; + + // XAccessibleTextAttributes + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getDefaultAttributes( const css::uno::Sequence< OUString >& RequestedAttributes ) override; + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getRunAttributes( ::sal_Int32 Index, const css::uno::Sequence< OUString >& RequestedAttributes ) override; + + // XAccessibleHypertext + virtual ::sal_Int32 SAL_CALL getHyperLinkCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleHyperlink > SAL_CALL getHyperLink( ::sal_Int32 nLinkIndex ) override; + virtual ::sal_Int32 SAL_CALL getHyperLinkIndex( ::sal_Int32 nCharIndex ) override; + + // XAccessibleMultiLineText + virtual ::sal_Int32 SAL_CALL getLineNumberAtIndex( ::sal_Int32 nIndex ) override; + virtual css::accessibility::TextSegment SAL_CALL getTextAtLineNumber( ::sal_Int32 nLineNo ) override; + virtual css::accessibility::TextSegment SAL_CALL getTextAtLineWithCaret( ) override; + virtual ::sal_Int32 SAL_CALL getNumberOfLineWithCaret( ) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService (const OUString& sServiceName) override; + virtual css::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames() override; + + /** 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 { return mnIndexInParent; } + + /** 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 { return mnParagraphIndex; } + + /** 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! + void FireEvent(const sal_Int16 nEventId, const css::uno::Any& rNewValue = css::uno::Any(), const css::uno::Any& rOldValue = css::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 tools::Rectangle LogicToPixel( const tools::Rectangle& rRect, const MapMode& rMapMode, SvxViewForwarder const & rForwarder ); + + SvxEditSourceAdapter& GetEditSource() 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. + */ + SvxAccessibleTextAdapter& GetTextForwarder() const; + + /** 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; + + /** 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. + */ + 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( bool bCreate = false ) const; + + /** 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: + AccessibleEditableTextPara( const AccessibleEditableTextPara& ) = delete; + AccessibleEditableTextPara& operator= ( const AccessibleEditableTextPara& ) = delete; + + /** 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 false, if the method was not able to determine the range + */ + bool GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, sal_Int32 nIndex ); + + int getNotifierClientId() const { return mnNotifierClientId; } + + /// Do we have children? This is the case for image bullets + bool HaveChildren(); + + const Point& GetEEOffset() const { return maEEOffset; } + + // Get text from forwarder + OUString GetTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ); + sal_Int32 GetTextLen() const; + + /** Get the current selection of this paragraph + + @return sal_False, if nothing in this paragraph is selected + */ + bool GetSelection(sal_Int32& nStartPos, sal_Int32& nEndPos ); + + /** 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 ); + /// Check whether 0<=nIndex<=n + void CheckPosition( sal_Int32 nIndex ); + /// Check whether 0<=nStart<=n and 0<=nEnd<=n + void CheckRange( sal_Int32 nStart, sal_Int32 nEnd ); + + void _correctValues( css::uno::Sequence< css::beans::PropertyValue >& rValues ); + sal_Int32 SkipField(sal_Int32 nIndex, bool bForward); + // get overlapped field, extend return string. Only extend forward for now + void ExtendByField( css::accessibility::TextSegment& Segment ); + OUString GetFieldTypeNameAtIndex(sal_Int32 nIndex); + // 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 < css::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) + rtl::Reference< ::utl::AccessibleStateSetHelper > mxStateSet; + + /// The shape we're the accessible for (unguarded) + css::uno::Reference< css::accessibility::XAccessible > mxParent; + + /// Our listeners (guarded by maMutex) + int mnNotifierClientId; +private: + // 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/AccessibleParaManager.hxx b/include/editeng/AccessibleParaManager.hxx new file mode 100644 index 000000000..0eceac19c --- /dev/null +++ b/include/editeng/AccessibleParaManager.hxx @@ -0,0 +1,272 @@ +/* -*- 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_EDITENG_ACCESSIBLEPARAMANAGER_HXX +#define INCLUDED_EDITENG_ACCESSIBLEPARAMANAGER_HXX + +#include <config_options.h> +#include <vector> +#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 <rtl/ref.hxx> +#include <editeng/editengdllapi.h> + +namespace com::sun::star::accessibility { class XAccessible; } + +class SvxEditSourceAdapter; + +namespace accessibility +{ + class AccessibleEditableTextPara; + + /** 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; + + WeakCppRef() : maWeakRef(), maUnsafeRef( nullptr ) {} + + WeakCppRef(rtl::Reference<InterfaceType> const & rImpl): + maWeakRef(rImpl.get()), + maUnsafeRef(rImpl.get()) + { + } + + // get object with c++ object and hard reference (which + // prevents the c++ object from destruction during use) + rtl::Reference<InterfaceType> get() const { + css::uno::Reference<UnoInterfaceType> ref(maWeakRef); + return ref.is() ? maUnsafeRef : rtl::Reference<InterfaceType>(); + } + + // default copy constructor and assignment will do + // WeakCppRef( const WeakCppRef& ); + // WeakCppRef& operator= ( const WeakCppRef& ); + + private: + + // the interface, hold weakly + css::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 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) AccessibleParaManager + { + public: + typedef WeakCppRef < css::accessibility::XAccessible, AccessibleEditableTextPara > WeakPara; + typedef ::std::pair< WeakPara, css::awt::Rectangle > WeakChild; + typedef ::std::pair< css::uno::Reference< + css::accessibility::XAccessible > , css::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 + css::accessibility::AccessibleStateType. + */ + void SetAdditionalChildStates( 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_Int32 GetNum() const; + + // iterators + VectorOfChildren::iterator begin(); + VectorOfChildren::iterator end(); + + /// Set focus to given child + void SetFocus( sal_Int32 nChild ); + + void FireEvent( sal_Int32 nPara, + const sal_Int16 nEventId ) const; + + static bool IsReferencable(rtl::Reference<AccessibleEditableTextPara> const & aChild); + bool IsReferencable( sal_Int32 nChild ) const; + static void ShutdownPara( const WeakChild& rChild ); + + Child CreateChild( sal_Int32 nChild, + const css::uno::Reference< css::accessibility::XAccessible >& xFrontEnd, + SvxEditSourceAdapter& rEditSource, + sal_Int32 nParagraphIndex ); + + WeakChild GetChild( sal_Int32 nParagraphIndex ) const; + bool HasCreatedChild( sal_Int32 nParagraphIndex ) const; + + // forwarder to all paragraphs + /// Make all children active and editable (or off) + void SetActive( bool bActive = 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_Int32 nStartPara, sal_Int32 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_Int32 nStartPara, + sal_Int32 nEndPara, + const sal_Int16 nEventId, + const css::uno::Any& rNewValue = css::uno::Any(), + const css::uno::Any& rOldValue = css::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: + WeakChildAdapter( Functor& rFunctor ) : mrFunctor(rFunctor) {} + void operator()( const WeakChild& rPara ) + { + // retrieve hard reference from weak one + auto 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: + 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 + auto aHardRef( rPara.first.get() ); + + if( aHardRef.is() ) + (*aHardRef.*maFunPtr)( maArg ); + } + + private: + FunctionPointer maFunPtr; + Argument maArg; + }; + + 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_Int32 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 + 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 000000000..25746ddc5 --- /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 INCLUDED_EDITENG_ACCESSIBLESELECTIONBASE_HXX +#define INCLUDED_EDITENG_ACCESSIBLESELECTIONBASE_HXX + +#include <comphelper/accessibleselectionhelper.hxx> +#include <editeng/editengdllapi.h> + +namespace accessibility +{ +/** @descr + This base class provides a base implementation of the + XAccessibleSelection 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 css::accessibility::XAccessibleSelection + { + protected: + + virtual ::osl::Mutex& implGetMutex() = 0; + + public: + + // XAccessibleSelection - default implementations + virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) override; + virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) override; + virtual void SAL_CALL clearAccessibleSelection( ) override; + virtual void SAL_CALL selectAllAccessibleChildren( ) override; + virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) override; + virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) override; + + public: + + AccessibleSelectionBase(); + virtual ~AccessibleSelectionBase(); + }; + +} + +#endif // INCLUDED_EDITENG_ACCESSIBLESELECTIONBASE_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 000000000..2f2095f07 --- /dev/null +++ b/include/editeng/AccessibleStaticTextBase.hxx @@ -0,0 +1,233 @@ +/* -*- 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_EDITENG_ACCESSIBLESTATICTEXTBASE_HXX +#define INCLUDED_EDITENG_ACCESSIBLESTATICTEXTBASE_HXX + +#include <memory> +#include <tools/gen.hxx> +#include <cppuhelper/implbase2.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/accessibility/AccessibleScrollType.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> + +namespace com::sun::star::accessibility { class XAccessible; } + +class SvxEditSource; + +namespace accessibility +{ + + class AccessibleStaticTextBase_Impl; + + typedef ::cppu::ImplHelper2< + css::accessibility::XAccessibleText, + css::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. + + */ + explicit AccessibleStaticTextBase( ::std::unique_ptr< SvxEditSource > && pEditSource ); + + virtual ~AccessibleStaticTextBase(); + + private: + AccessibleStaticTextBase( const AccessibleStaticTextBase& ) = delete; + AccessibleStaticTextBase& operator= ( const AccessibleStaticTextBase& ) = delete; + + public: + + /** 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: SfxHintId::EditSourceParasMoved, + SfxHintId::EditSourceSelectionChanged, SfxHintId::TextModified, + SfxHintId::TextParaInserted, SfxHintId::TextParaRemoved, + SfxHintId::TextHeightChanged, + SfxHintId::TextViewScrolled. 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 SfxHintId::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::unique_ptr<SvxEditSource>()) in + your dispose() method. + + @param pEditSource + The new edit source to set. Object ownership is transferred + from the caller to the callee. + */ + void SetEditSource( ::std::unique_ptr< SvxEditSource > && pEditSource ); + + /** 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. + */ + void SetEventSource( const css::uno::Reference< css::accessibility::XAccessible >& rInterface ); + + /** 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) + */ + void SetOffset( const Point& rPoint ); + + /** 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). + */ + void Dispose(); + + // XAccessibleText interface implementation + virtual sal_Int32 SAL_CALL getCaretPosition() override; + virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) override; + virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) override; + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& aRequestedAttributes ) override; + virtual css::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) override; + virtual sal_Int32 SAL_CALL getCharacterCount() override; + virtual sal_Int32 SAL_CALL getIndexAtPoint( const css::awt::Point& aPoint ) override; + virtual OUString SAL_CALL getSelectedText() override; + virtual sal_Int32 SAL_CALL getSelectionStart() override; + virtual sal_Int32 SAL_CALL getSelectionEnd() override; + /// 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 ) override; + virtual OUString SAL_CALL getText() override; + virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; + /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine) + virtual css::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override; + /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine) + virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override; + /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine) + virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override; + /// 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 ) override; + virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override; + + // XAccessibleTextAttributes + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getDefaultAttributes( const css::uno::Sequence< OUString >& RequestedAttributes ) override; + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getRunAttributes( sal_Int32 Index, const css::uno::Sequence< OUString >& RequestedAttributes ) override; + + // child-related methods from XAccessibleContext + /// @throws css::uno::RuntimeException + virtual sal_Int32 SAL_CALL getAccessibleChildCount(); + /// @throws css::lang::IndexOutOfBoundsException + /// @throws css::uno::RuntimeException + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ); + + // child-related methods from XAccessibleComponent + /// @throws css::uno::RuntimeException + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ); + + protected: + tools::Rectangle GetParagraphBoundingBox() const; + + private: + + /// @dyn + const std::unique_ptr< AccessibleStaticTextBase_Impl > mpImpl; + + }; + +} // end of namespace accessibility + +#endif // INCLUDED_EDITENG_ACCESSIBLESTATICTEXTBASE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/CustomPropertyField.hxx b/include/editeng/CustomPropertyField.hxx new file mode 100644 index 000000000..38f3119a0 --- /dev/null +++ b/include/editeng/CustomPropertyField.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/. + * + */ + +#ifndef INCLUDED_EDITENG_CUSTOMPROPERTYFIELD_HXX +#define INCLUDED_EDITENG_CUSTOMPROPERTYFIELD_HXX + +#include <editeng/editengdllapi.h> + +#include <editeng/flditem.hxx> + +#include <com/sun/star/text/textfield/Type.hpp> + +namespace com::sun::star::document { class XDocumentProperties; } + + +namespace editeng +{ + +class EDITENG_DLLPUBLIC CustomPropertyField final : public SvxFieldData +{ +private: + OUString msName; + OUString msCurrentPresentation; + +public: + explicit CustomPropertyField(OUString aName, OUString aCurrentPresentation); + + virtual ~CustomPropertyField() override; + + virtual sal_Int32 GetClassId() const override { return css::text::textfield::Type::DOCINFO_CUSTOM; } + + virtual std::unique_ptr<SvxFieldData> Clone() const override; + virtual bool operator==(const SvxFieldData&) const override; + + virtual MetaAction* createBeginComment() const override; + + OUString GetFormatted(css::uno::Reference<css::document::XDocumentProperties> const & xDocumentProperties); + + OUString const & GetName() const + { + return msName; + } + + OUString const & GetCurrentPresentation() const + { + return msCurrentPresentation; + } +}; + +} // end editeng namespace + +#endif // INCLUDED_EDITENG_CUSTOMPROPERTYFIELD_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 000000000..75f625438 --- /dev/null +++ b/include/editeng/SpellPortions.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 INCLUDED_EDITENG_SPELLPORTIONS_HXX +#define INCLUDED_EDITENG_SPELLPORTIONS_HXX + +#include <i18nlangtag/lang.h> +#include <rtl/ustring.hxx> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/linguistic2/SingleProofreadingError.hpp> +#include <vector> + +namespace com::sun::star::linguistic2 { + class XSpellAlternatives; +} + +namespace com::sun::star::linguistic2 { class XProofreader; } + +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; + /** for wrong words this reference is filled with the error information otherwise + it's an empty reference + */ + css::uno::Reference< css::linguistic2::XSpellAlternatives> xAlternatives; + /** provides access to the grammar checker interface + */ + css::uno::Reference< css::linguistic2::XProofreader > xGrammarChecker; + /** contains the proposed dialog title if the proof reading component provides one. + */ + OUString sDialogTitle; + /** contains the grammar error information + */ + css::linguistic2::SingleProofreadingError aGrammarError; + /** contains the language applied to the text. It has to match the script type. + */ + LanguageType eLanguage; + /** 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; + /** determines whether the error type is a grammar error + */ + bool bIsGrammarError; + /** marks portion as to-be-ignored. This is a return parameter. + */ + bool bIgnoreThisError; + + SpellPortion() : + eLanguage(LANGUAGE_DONTKNOW), + bIsField(false), + bIsHidden(false), + 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/Trie.hxx b/include/editeng/Trie.hxx new file mode 100644 index 000000000..e6ee659c3 --- /dev/null +++ b/include/editeng/Trie.hxx @@ -0,0 +1,39 @@ +/* -*- 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 INCLUDED_EDITENG_TRIE_HXX +#define INCLUDED_EDITENG_TRIE_HXX + +#include <rtl/ustring.hxx> +#include <editeng/editengdllapi.h> +#include <memory> +#include <vector> + +namespace editeng +{ +struct TrieNode; + +class EDITENG_DLLPUBLIC Trie final +{ +private: + std::unique_ptr<TrieNode> mRoot; + +public: + Trie(); + ~Trie(); + + void insert(const OUString& sInputString) const; + void findSuggestions(const OUString& sWordPart, std::vector<OUString>& rSuggestionList) const; + size_t size() const; +}; +} + +#endif // INCLUDED_EDITENG_TRIE_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 000000000..625198dad --- /dev/null +++ b/include/editeng/UnoForbiddenCharsTable.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 INCLUDED_EDITENG_UNOFORBIDDENCHARSTABLE_HXX +#define INCLUDED_EDITENG_UNOFORBIDDENCHARSTABLE_HXX + +#include <com/sun/star/i18n/XForbiddenCharacters.hpp> +#include <com/sun/star/linguistic2/XSupportedLocales.hpp> +#include <cppuhelper/implbase.hxx> +#include <editeng/editengdllapi.h> +#include <memory> + +class SvxForbiddenCharactersTable; + +class EDITENG_DLLPUBLIC SvxUnoForbiddenCharsTable : public cppu::WeakImplHelper< + css::i18n::XForbiddenCharacters, + css::linguistic2::XSupportedLocales> +{ +protected: + /** this virtual function is called if the forbidden characters are changed */ + virtual void onChange(); + + std::shared_ptr<SvxForbiddenCharactersTable> mxForbiddenChars; + +public: + SvxUnoForbiddenCharsTable(std::shared_ptr<SvxForbiddenCharactersTable> xForbiddenChars); + virtual ~SvxUnoForbiddenCharsTable() override; + + // XForbiddenCharacters + virtual css::i18n::ForbiddenCharacters SAL_CALL getForbiddenCharacters( const css::lang::Locale& rLocale ) override; + virtual sal_Bool SAL_CALL hasForbiddenCharacters( const css::lang::Locale& rLocale ) override; + virtual void SAL_CALL setForbiddenCharacters( const css::lang::Locale& rLocale, const css::i18n::ForbiddenCharacters& rForbiddenCharacters ) override; + virtual void SAL_CALL removeForbiddenCharacters( const css::lang::Locale& rLocale ) override; + + // XSupportedLocales + virtual css::uno::Sequence< css::lang::Locale > SAL_CALL getLocales( ) override; + virtual sal_Bool SAL_CALL hasLocale( const css::lang::Locale& aLocale ) override; +}; + +#endif // INCLUDED_EDITENG_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 000000000..900cc2601 --- /dev/null +++ b/include/editeng/acorrcfg.hxx @@ -0,0 +1,123 @@ +/* -*- 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_EDITENG_ACORRCFG_HXX +#define INCLUDED_EDITENG_ACORRCFG_HXX + +#include <editeng/editengdllapi.h> +#include <unotools/configitem.hxx> +#include <memory> + +class SvxAutoCorrect; +class SvxAutoCorrCfg; + +class SvxBaseAutoCorrCfg final : public utl::ConfigItem +{ +private: + SvxAutoCorrCfg& rParent; + static css::uno::Sequence<OUString> GetPropertyNames(); + + virtual void ImplCommit() override; + +public: + SvxBaseAutoCorrCfg(SvxAutoCorrCfg& rParent); + virtual ~SvxBaseAutoCorrCfg() override; + + void Load(bool bInit); + virtual void Notify( const css::uno::Sequence<OUString>& aPropertyNames) override; + using ConfigItem::SetModified; +}; + +class SvxSwAutoCorrCfg final : public utl::ConfigItem +{ +private: + SvxAutoCorrCfg& rParent; + static css::uno::Sequence<OUString> GetPropertyNames(); + + virtual void ImplCommit() override; + +public: + SvxSwAutoCorrCfg(SvxAutoCorrCfg& rParent); + virtual ~SvxSwAutoCorrCfg() override; + + void Load(bool bInit); + virtual void Notify( const css::uno::Sequence<OUString>& aPropertyNames) override; + using ConfigItem::SetModified; +}; +/*-------------------------------------------------------------------- + Description: Configuration for Auto Correction + --------------------------------------------------------------------*/ +class EDITENG_DLLPUBLIC SvxAutoCorrCfg final +{ + friend class SvxBaseAutoCorrCfg; + friend class SvxSwAutoCorrCfg; + + std::unique_ptr<SvxAutoCorrect> pAutoCorrect; + + SvxBaseAutoCorrCfg aBaseConfig; + SvxSwAutoCorrCfg aSwConfig; + + // Flags for Autotext: + bool bFileRel; + bool bNetRel; + // Help tip for Autotext as you type + bool bAutoTextTip; + bool bAutoTextPreview; + bool bAutoFmtByInput; + bool bSearchInAllCategories; + +public: + void SetModified() + { + aBaseConfig.SetModified(); + aSwConfig.SetModified(); + } + void Commit() + { + aBaseConfig.Commit(); + aSwConfig.Commit(); + } + + SvxAutoCorrect* GetAutoCorrect() { return pAutoCorrect.get(); } + const SvxAutoCorrect* GetAutoCorrect() const { return pAutoCorrect.get(); } + // the pointer is transferred to the possession of the ConfigItems! + void SetAutoCorrect( SvxAutoCorrect* ); + + bool IsAutoFormatByInput() const { return bAutoFmtByInput; } + void SetAutoFormatByInput( bool bSet ) { bAutoFmtByInput = bSet;aSwConfig.SetModified();} + + bool IsSaveRelFile() const { return bFileRel; } + void SetSaveRelFile( bool bSet ) { bFileRel = bSet; aSwConfig.SetModified(); } + + bool IsSaveRelNet() const { return bNetRel; } + void SetSaveRelNet( bool bSet ) { bNetRel = bSet; aSwConfig.SetModified();} + + bool IsAutoTextTip() const { return bAutoTextTip; } + void SetAutoTextTip(bool bSet ) { bAutoTextTip = bSet;aSwConfig.SetModified();} + + bool IsSearchInAllCategories() const { return bSearchInAllCategories;} + + SvxAutoCorrCfg(); + ~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 000000000..e27939077 --- /dev/null +++ b/include/editeng/adjustitem.hxx @@ -0,0 +1,143 @@ +/* -*- 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_EDITENG_ADJUSTITEM_HXX +#define INCLUDED_EDITENG_ADJUSTITEM_HXX + +#include <svl/cenumitm.hxx> +#include <svl/poolitem.hxx> +#include <editeng/svxenum.hxx> +#include <editeng/editengdllapi.h> + +// class SvxAdjustItem --------------------------------------------------- + +/* +[Description] +This item describes the row orientation. +*/ +constexpr sal_uInt16 ADJUST_LASTBLOCK_VERSION = 0x0001; + +class EDITENG_DLLPUBLIC SvxAdjustItem final : public SfxEnumItemInterface +{ + bool bLeft : 1; + bool bRight : 1; + bool bCenter : 1; + bool bBlock : 1; + + // only active when bBlock + bool bOneBlock : 1; + bool bLastCenter : 1; + bool bLastBlock : 1; + +public: + static SfxPoolItem* CreateDefault(); + + SvxAdjustItem( const SvxAdjust eAdjst /*= SvxAdjust::Left*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + virtual sal_uInt16 GetValueCount() const override; + static OUString GetValueTextByPos( sal_uInt16 nPos ); + virtual sal_uInt16 GetEnumValue() const override; + virtual void SetEnumValue( sal_uInt16 nNewVal ) override; + virtual SvxAdjustItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + void SetOneWord( const SvxAdjust eType ) + { + bOneBlock = eType == SvxAdjust::Block; + } + + void SetLastBlock( const SvxAdjust eType ) + { + bLastBlock = eType == SvxAdjust::Block; + bLastCenter = eType == SvxAdjust::Center; + } + + void SetAdjust( const SvxAdjust eType ) + { + bLeft = eType == SvxAdjust::Left; + bRight = eType == SvxAdjust::Right; + bCenter = eType == SvxAdjust::Center; + bBlock = eType == SvxAdjust::Block; + } + + SvxAdjust GetLastBlock() const + { + SvxAdjust eRet = SvxAdjust::Left; + + if ( bLastBlock ) + eRet = SvxAdjust::Block; + else if( bLastCenter ) + eRet = SvxAdjust::Center; + return eRet; + } + + SvxAdjust GetOneWord() const + { + SvxAdjust eRet = SvxAdjust::Left; + + if ( bBlock && bOneBlock ) + eRet = SvxAdjust::Block; + return eRet; + } + + SvxAdjust GetAdjust() const + { + SvxAdjust eRet = SvxAdjust::Left; + + if ( bRight ) + eRet = SvxAdjust::Right; + else if ( bCenter ) + eRet = SvxAdjust::Center; + else if ( bBlock ) + eRet = SvxAdjust::Block; + return eRet; + } + + sal_Int8 GetAsFlags() const + { + sal_Int8 nFlags = 0; + if ( bOneBlock ) + nFlags |= 0x0001; + if ( bLastCenter ) + nFlags |= 0x0002; + if ( bLastBlock ) + nFlags |= 0x0004; + return nFlags; + } + + void SetAsFlags(sal_Int8 nFlags) + { + bOneBlock = 0 != (nFlags & 0x0001); + bLastCenter = 0 != (nFlags & 0x0002); + bLastBlock = 0 != (nFlags & 0x0004); + } +}; + +#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 000000000..798aab04b --- /dev/null +++ b/include/editeng/autokernitem.hxx @@ -0,0 +1,51 @@ +/* -*- 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_EDITENG_AUTOKERNITEM_HXX +#define INCLUDED_EDITENG_AUTOKERNITEM_HXX + +#include <svl/eitem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxAutoKernItem ------------------------------------------------- + +/* + [Description] + Attribute for Pair-Kerning. +*/ + +class EDITENG_DLLPUBLIC SvxAutoKernItem final : public SfxBoolItem +{ +public: + static SfxPoolItem* CreateDefault(); + + SvxAutoKernItem( const bool bAutoKern /*= false*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual SvxAutoKernItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; +}; + +#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 000000000..4a4af0e62 --- /dev/null +++ b/include/editeng/blinkitem.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 INCLUDED_EDITENG_BLINKITEM_HXX +#define INCLUDED_EDITENG_BLINKITEM_HXX + +#include <svl/poolitem.hxx> +#include <svl/eitem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxBlinkItem ------------------------------------------------- + +/* + [Description] + This item describes, whether to flash. +*/ + +class EDITENG_DLLPUBLIC SvxBlinkItem final : public SfxBoolItem +{ +public: + SvxBlinkItem( const bool bBlink /*= false*/, const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual SvxBlinkItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; +}; + +#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 000000000..6cf1c4512 --- /dev/null +++ b/include/editeng/borderline.hxx @@ -0,0 +1,246 @@ +/* -*- 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_EDITENG_BORDERLINE_HXX +#define INCLUDED_EDITENG_BORDERLINE_HXX + +#include <com/sun/star/table/BorderLineStyle.hpp> + +#include <tools/color.hxx> +#include <tools/long.hxx> +#include <tools/mapunit.hxx> +#include <editeng/editengdllapi.h> +#include <svtools/borderline.hxx> + +class IntlWrapper; + +// Line width defaults in twips +// Thin matches Excel's default values +// See tdf#48622 for the discussion leading to these defaults. +class SvxBorderLineWidth +{ +public: + static const sal_Int16 Hairline = 1; // 0.05pt + static const sal_Int16 VeryThin = 10; // 0.5pt + static const sal_Int16 Thin = 15; // 0.75pt + static const sal_Int16 Medium = 30; // 1.5pt + static const sal_Int16 Thick = 45; // 2.25pt + static const sal_Int16 ExtraThick = 90; // 4.5pt +}; + +// Abstracts over values from css::table::BorderLineStyle +enum class SvxBorderLineStyle : sal_Int16 +{ + /** No border line + */ + NONE = css::table::BorderLineStyle::NONE, + + /** Solid border line. + */ + SOLID = css::table::BorderLineStyle::SOLID, + + /** Dotted border line. + */ + DOTTED = css::table::BorderLineStyle::DOTTED, + + /** Dashed border line. + */ + DASHED = css::table::BorderLineStyle::DASHED, + + /** Double border line. Widths of the lines and the gap are all equal, + and vary equally with the total width. + */ + DOUBLE = css::table::BorderLineStyle::DOUBLE, + + /** Double border line with a thin line outside and a thick line + inside separated by a small gap. + */ + THINTHICK_SMALLGAP = css::table::BorderLineStyle::THINTHICK_SMALLGAP, + + /** Double border line with a thin line outside and a thick line + inside separated by a medium gap. + */ + THINTHICK_MEDIUMGAP = css::table::BorderLineStyle::THINTHICK_MEDIUMGAP, + + /** Double border line with a thin line outside and a thick line + inside separated by a large gap. + */ + THINTHICK_LARGEGAP = css::table::BorderLineStyle::THINTHICK_LARGEGAP, + + /** Double border line with a thick line outside and a thin line + inside separated by a small gap. + */ + THICKTHIN_SMALLGAP = css::table::BorderLineStyle::THICKTHIN_SMALLGAP, + + /** Double border line with a thick line outside and a thin line + inside separated by a medium gap. + */ + THICKTHIN_MEDIUMGAP = css::table::BorderLineStyle::THICKTHIN_MEDIUMGAP, + + /** Double border line with a thick line outside and a thin line + inside separated by a large gap. + */ + THICKTHIN_LARGEGAP = css::table::BorderLineStyle::THICKTHIN_LARGEGAP, + + /** 3D embossed border line. + */ + EMBOSSED = css::table::BorderLineStyle::EMBOSSED, + + /** 3D engraved border line. + */ + ENGRAVED = css::table::BorderLineStyle::ENGRAVED, + + /** Outset border line. + */ + OUTSET = css::table::BorderLineStyle::OUTSET, + + /** Inset border line. + */ + INSET = css::table::BorderLineStyle::INSET, + + /** Finely dashed border line. + */ + FINE_DASHED = css::table::BorderLineStyle::FINE_DASHED, + + /** Double border line consisting of two fixed thin lines separated by a + variable gap. + */ + DOUBLE_THIN = css::table::BorderLineStyle::DOUBLE_THIN, + + /** Line consisting of a repetition of one dash and one dot. */ + DASH_DOT = css::table::BorderLineStyle::DASH_DOT, + + /** Line consisting of a repetition of one dash and 2 dots. */ + DASH_DOT_DOT = css::table::BorderLineStyle::DASH_DOT_DOT, + + /** Maximum valid border line style value. + */ + BORDER_LINE_STYLE_MAX = css::table::BorderLineStyle::BORDER_LINE_STYLE_MAX, +}; + +namespace editeng +{ + +// convert border style between Word formats and LO +SvxBorderLineStyle EDITENG_DLLPUBLIC ConvertBorderStyleFromWord(int); +/// convert border width in twips between Word formats and LO +double EDITENG_DLLPUBLIC ConvertBorderWidthToWord(SvxBorderLineStyle, double); +double EDITENG_DLLPUBLIC ConvertBorderWidthFromWord(SvxBorderLineStyle, + double, int); + +class EDITENG_DLLPUBLIC SvxBorderLine final +{ + tools::Long m_nWidth; + tools::Long m_nMult; + tools::Long m_nDiv; + Color (*m_pColorOutFn)(Color); + Color (*m_pColorInFn)(Color); + Color (*m_pColorGapFn)(Color); + BorderWidthImpl m_aWidthImpl; + Color aColor; + SvxBorderLineStyle m_nStyle; + bool m_bMirrorWidths; + bool m_bUseLeftTop; + +public: + SvxBorderLine( const Color *pCol = nullptr, + tools::Long nWidth = 0, + SvxBorderLineStyle nStyle = SvxBorderLineStyle::SOLID, + Color (*pColorOutFn)( Color ) = &darkColor, + Color (*pColorInFn)( Color ) = &darkColor ); + + const Color& GetColor() const { return aColor; } + Color GetColorOut( bool bLeftOrTop = true ) const; + Color GetColorIn( bool bLeftOrTop = true ) const; + bool HasGapColor() const { return m_pColorGapFn != nullptr; } + Color GetColorGap() const; + + void SetWidth( tools::Long 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( SvxBorderLineStyle 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() { m_bMirrorWidths = true; } + tools::Long GetWidth( ) const { return m_nWidth; } + sal_uInt16 GetOutWidth() const; + sal_uInt16 GetInWidth() const; + sal_uInt16 GetDistance() const; + + SvxBorderLineStyle GetBorderLineStyle() const { return m_nStyle; } + + void SetColor( const Color &rColor ) { aColor = rColor; } + void SetBorderLineStyle( SvxBorderLineStyle nNew ); + void ScaleMetrics( tools::Long nMult, tools::Long nDiv ); + + bool operator==( const SvxBorderLine &rCmp ) const; + + OUString GetValueString( MapUnit eSrcUnit, MapUnit eDestUnit, + const IntlWrapper* pIntl, + bool bMetricStr = false ) const; + + bool HasPriority( const SvxBorderLine& rOtherLine ) const; + + bool isEmpty() const { + return m_aWidthImpl.IsEmpty() + || m_nStyle == SvxBorderLineStyle::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( SvxBorderLineStyle nStyle ); +}; + +EDITENG_DLLPUBLIC bool operator!=( const SvxBorderLine& rLeft, const SvxBorderLine& rRight ); + +} // namespace editeng + +#endif + diff --git a/include/editeng/boxitem.hxx b/include/editeng/boxitem.hxx new file mode 100644 index 000000000..786821c02 --- /dev/null +++ b/include/editeng/boxitem.hxx @@ -0,0 +1,271 @@ +/* -*- 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_EDITENG_BOXITEM_HXX +#define INCLUDED_EDITENG_BOXITEM_HXX + +#include <svl/poolitem.hxx> +#include <editeng/editengdllapi.h> +#include <com/sun/star/table/BorderLine2.hpp> +#include <o3tl/typed_flags_set.hxx> +#include <memory> + + +namespace editeng { class SvxBorderLine; } + +// class SvxBoxItem ------------------------------------------------------ + +/* [Description] + + This item describes a border attribute + (all four edges and the inward distance) +*/ +enum class SvxBoxItemLine +{ + TOP, BOTTOM, LEFT, RIGHT, LAST = RIGHT +}; + +/** +This version causes SvxBoxItem to store the 4 cell spacing distances separately +when serializing to stream. +*/ +constexpr sal_uInt16 BOX_4DISTS_VERSION = 1; +/** +This version causes SvxBoxItem to store the styles for its border lines when +serializing to stream. +*/ +constexpr sal_uInt16 BOX_BORDER_STYLE_VERSION = 2; + +class EDITENG_DLLPUBLIC SvxBoxItem final : public SfxPoolItem +{ + std::unique_ptr<editeng::SvxBorderLine> + pTop, + pBottom, + pLeft, + pRight; + sal_Int16 nTopDist, + nBottomDist, + nLeftDist, + nRightDist; + bool bRemoveAdjCellBorder; + +public: + static SfxPoolItem* CreateDefault(); + + explicit SvxBoxItem( const sal_uInt16 nId ); + SvxBoxItem( const SvxBoxItem &rCpy ); + virtual ~SvxBoxItem() override; + + // "pure virtual Methods" from SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + virtual SvxBoxItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual void ScaleMetrics( tools::Long nMult, tools::Long nDiv ) override; + virtual bool HasMetrics() const override; + + const editeng::SvxBorderLine* GetTop() const { return pTop.get(); } + const editeng::SvxBorderLine* GetBottom() const { return pBottom.get(); } + const editeng::SvxBorderLine* GetLeft() const { return pLeft.get(); } + const editeng::SvxBorderLine* GetRight() const { return pRight.get(); } + + const editeng::SvxBorderLine* GetLine( SvxBoxItemLine nLine ) const; + + //The Pointers are being copied! + void SetLine( const editeng::SvxBorderLine* pNew, SvxBoxItemLine nLine ); + + sal_Int16 GetDistance( SvxBoxItemLine nLine, bool bAllowNegative = false ) const; + sal_uInt16 GetSmallestDistance() const; + + bool IsRemoveAdjacentCellBorder() const { return bRemoveAdjCellBorder; } + + void SetDistance( sal_Int16 nNew, SvxBoxItemLine nLine ); + inline void SetAllDistances( sal_Int16 nNew ); + + void SetRemoveAdjacentCellBorder( bool bSet ) { bRemoveAdjCellBorder = bSet; } + + // Line width plus Space plus inward distance + // bEvenIfNoLine = TRUE -> Also return distance, when no Line is set + sal_uInt16 CalcLineWidth( SvxBoxItemLine nLine ) const; + sal_Int16 CalcLineSpace( SvxBoxItemLine nLine, bool bEvenIfNoLine = false, bool bAllowNegative = false ) const; + bool HasBorder( bool bTreatPaddingAsBorder ) const; + static css::table::BorderLine2 SvxLineToLine( const editeng::SvxBorderLine* pLine, bool bConvert ); + static bool LineToSvxLine(const css::table::BorderLine& rLine, editeng::SvxBorderLine& rSvxLine, bool bConvert); + static bool LineToSvxLine(const css::table::BorderLine2& rLine, editeng::SvxBorderLine& rSvxLine, bool bConvert); + + virtual boost::property_tree::ptree dumpAsJSON() const override; + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +inline void SvxBoxItem::SetAllDistances(sal_Int16 const 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. +*/ + +enum class SvxBoxInfoItemLine +{ + HORI, VERT, LAST = VERT +}; + +enum class SvxBoxInfoItemValidFlags +{ + NONE = 0x00, + TOP = 0x01, + BOTTOM = 0x02, + LEFT = 0x04, + RIGHT = 0x08, + HORI = 0x10, + VERT = 0x20, + DISTANCE = 0x40, + DISABLE = 0x80, + ALL = 0xff +}; +namespace o3tl +{ + template<> struct typed_flags<SvxBoxInfoItemValidFlags> : is_typed_flags<SvxBoxInfoItemValidFlags, 0xff> {}; +} + +class EDITENG_DLLPUBLIC SvxBoxInfoItem final : public SfxPoolItem +{ + std::unique_ptr<editeng::SvxBorderLine> pHori; //inner horizontal Line + std::unique_ptr<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. + */ + + bool bDist :1; // TRUE, Unlock Distance. + bool bMinDist :1; // TRUE, Going below minimum Distance is prohibited + + SvxBoxInfoItemValidFlags nValidFlags; + sal_uInt16 nDefDist; // The default or minimum distance. + +public: + static SfxPoolItem* CreateDefault(); + + explicit SvxBoxInfoItem( const sal_uInt16 nId ); + SvxBoxInfoItem( const SvxBoxInfoItem &rCpy ); + virtual ~SvxBoxInfoItem() override; + + // "pure virtual Methods" from SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + virtual SvxBoxInfoItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual void ScaleMetrics( tools::Long nMult, tools::Long nDiv ) override; + virtual bool HasMetrics() const override; + + const editeng::SvxBorderLine* GetHori() const { return pHori.get(); } + const editeng::SvxBorderLine* GetVert() const { return pVert.get(); } + + //The Pointers are being copied! + void SetLine( const editeng::SvxBorderLine* pNew, SvxBoxInfoItemLine nLine ); + + bool IsTable() const { return mbEnableHor && mbEnableVer; } + void SetTable( bool bNew ) { mbEnableHor = mbEnableVer = bNew; } + + bool IsHorEnabled() const { return mbEnableHor; } + void EnableHor( bool bEnable ) { mbEnableHor = bEnable; } + bool IsVerEnabled() const { return mbEnableVer; } + void EnableVer( bool bEnable ) { mbEnableVer = bEnable; } + + bool IsDist() const { return bDist; } + void SetDist( bool bNew ) { bDist = bNew; } + bool IsMinDist() const { return bMinDist; } + void SetMinDist( bool bNew ) { bMinDist = bNew; } + sal_uInt16 GetDefDist() const { return nDefDist; } + void SetDefDist( sal_uInt16 nNew ) { nDefDist = nNew; } + + bool IsValid( SvxBoxInfoItemValidFlags nValid ) const + { return bool( nValidFlags & nValid ); } + void SetValid( SvxBoxInfoItemValidFlags nValid, bool bValid = true ) + { + if (bValid) + nValidFlags |= nValid; + else + nValidFlags &= ~nValid; + } + void ResetFlags(); + + virtual boost::property_tree::ptree dumpAsJSON() const override; +}; + +namespace editeng +{ + +void EDITENG_DLLPUBLIC BorderDistanceFromWord(bool bFromEdge, sal_Int32& nMargin, + sal_Int32& nBorderDistance, sal_Int32 nBorderWidth); + +struct EDITENG_DLLPUBLIC WordPageMargins final +{ + sal_uInt16 nLeft = 0; + sal_uInt16 nRight = 0; + sal_uInt16 nTop = 0; + sal_uInt16 nBottom = 0; +}; + +struct EDITENG_DLLPUBLIC WordBorderDistances final +{ + bool bFromEdge = false; + sal_uInt16 nLeft = 0; + sal_uInt16 nRight = 0; + sal_uInt16 nTop = 0; + sal_uInt16 nBottom = 0; +}; + +// Heuristics to decide if we need to use "from edge" offset of borders. All sizes in twips +void EDITENG_DLLPUBLIC BorderDistancesToWord(const SvxBoxItem& rBox, const WordPageMargins& rMargins, + WordBorderDistances& rDistances); + +} + +#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 000000000..850ff7d10 --- /dev/null +++ b/include/editeng/brushitem.hxx @@ -0,0 +1,123 @@ +/* -*- 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_EDITENG_BRUSHITEM_HXX +#define INCLUDED_EDITENG_BRUSHITEM_HXX + +#include <tools/color.hxx> +#include <svl/poolitem.hxx> +#include <editeng/editengdllapi.h> +#include <memory> + +// class SvxBrushItem ---------------------------------------------------- + +class Graphic; +class GraphicObject; + +constexpr sal_uInt16 BRUSH_GRAPHIC_VERSION = 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 +}; + +class EDITENG_DLLPUBLIC SvxBrushItem final : public SfxPoolItem +{ + Color aColor; + Color aFilterColor; + sal_Int32 nShadingValue; + mutable std::unique_ptr<GraphicObject> xGraphicObject; + sal_Int8 nGraphicTransparency; //contains a percentage value which is + //copied to the GraphicObject when necessary + OUString maStrLink; + OUString maStrFilter; + SvxGraphicPosition eGraphicPos; + mutable bool bLoadAgain; + + void ApplyGraphicTransparency_Impl(); + +public: + static SfxPoolItem* CreateDefault(); + + 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( OUString rLink, OUString aFilter, + SvxGraphicPosition ePos, sal_uInt16 nWhich ); + SvxBrushItem( const SvxBrushItem& ); + SvxBrushItem(SvxBrushItem&&); + + virtual ~SvxBrushItem() override; + +public: + // check if it's used + bool isUsed() const; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + virtual bool operator==( const SfxPoolItem& ) const override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + virtual SvxBrushItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + const Color& GetColor() const { return aColor; } + Color& GetColor() { return aColor; } + void SetColor( const Color& rCol) { aColor = rCol; } + + const Color& GetFiltColor() const { return aFilterColor; } + Color& GetFiltColor() { return aFilterColor; } + void SetFiltColor( const Color& rCol) { aFilterColor = rCol; } + + SvxGraphicPosition GetGraphicPos() const { return eGraphicPos; } + + sal_Int32 GetShadingValue() const { return nShadingValue; } + const Graphic* GetGraphic(OUString const & referer = OUString()/*TODO*/) const; + const GraphicObject* GetGraphicObject(OUString const & referer = OUString()/*TODO*/) const; + const OUString& GetGraphicLink() const { return maStrLink; } + const OUString& GetGraphicFilter() const { return maStrFilter; } + + // get graphic transparency in percent + sal_Int8 getGraphicTransparency() const { return nGraphicTransparency; } + void setGraphicTransparency(sal_Int8 nNew); + + void SetGraphicPos( SvxGraphicPosition eNew ); + void SetGraphic( const Graphic& rNew ); + void SetGraphicObject( const GraphicObject& rNewObj ); + void SetGraphicLink( const OUString& rNew ); + void SetGraphicFilter( const OUString& rNew ); + + static sal_Int8 TransparencyToPercent(sal_Int32 nTrans); + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +#endif // INCLUDED_EDITENG_BRUSHITEM_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 000000000..4e736b776 --- /dev/null +++ b/include/editeng/bulletitem.hxx @@ -0,0 +1,94 @@ +/* -*- 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_EDITENG_BULLETITEM_HXX +#define INCLUDED_EDITENG_BULLETITEM_HXX + +#include <memory> +#include <editeng/editengdllapi.h> +#include <svl/poolitem.hxx> +#include <vcl/GraphicObject.hxx> +#include <vcl/font.hxx> + + +/** + * these must match the values in css::style::NumberingType + */ +enum class SvxBulletStyle +{ + ABC_BIG = 0, + ABC_SMALL = 1, + ROMAN_BIG = 2, + ROMAN_SMALL = 3, + N123 = 4, + NONE = 5, + BULLET = 6, + BMP = 128 +}; + +// class SvxBulletItem --------------------------------------------------- + +class EDITENG_DLLPUBLIC SvxBulletItem final : public SfxPoolItem +{ + vcl::Font aFont; + std::unique_ptr<GraphicObject> + pGraphicObject; + OUString aPrevText; + OUString aFollowText; + sal_uInt16 nStart; + SvxBulletStyle nStyle; + tools::Long nWidth; + sal_uInt16 nScale; + sal_Unicode cSymbol; + +public: + explicit SvxBulletItem( sal_uInt16 nWhich ); + SvxBulletItem( const SvxBulletItem& ); + virtual ~SvxBulletItem() override; + + virtual SvxBulletItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + OUString GetFullText() const; + + tools::Long GetWidth() const { return nWidth; } + const vcl::Font& GetFont() const { return aFont; } + + const GraphicObject& GetGraphicObject() const; + void SetGraphicObject( const GraphicObject& rGraphicObject ); + + void SetSymbol( sal_Unicode c) { cSymbol = c; } + + void SetStart( sal_uInt16 nNew ) { nStart = nNew; } + void SetWidth( tools::Long nNew ) { nWidth = nNew; } + void SetStyle( SvxBulletStyle nNew ) { nStyle = nNew; } + void SetFont( const vcl::Font& rNew) { aFont = rNew; } + void SetScale( sal_uInt16 nNew ) { nScale = nNew; } + + virtual bool operator==( const SfxPoolItem& ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + 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 000000000..ed72e08dc --- /dev/null +++ b/include/editeng/charhiddenitem.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 INCLUDED_EDITENG_CHARHIDDENITEM_HXX +#define INCLUDED_EDITENG_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 final : public SfxBoolItem +{ +public: + SvxCharHiddenItem( const bool bHidden /*= false*/, const sal_uInt16 nId ); + + virtual SvxCharHiddenItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; +}; + +#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 000000000..78b57fa7d --- /dev/null +++ b/include/editeng/charreliefitem.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 INCLUDED_EDITENG_CHARRELIEFITEM_HXX +#define INCLUDED_EDITENG_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 final : public SfxEnumItem<FontRelief> +{ +public: + static SfxPoolItem* CreateDefault(); + + SvxCharReliefItem( FontRelief eValue /*= FontRelief::NONE*/, + const sal_uInt16 nId ); + + virtual SvxCharReliefItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + static OUString GetValueTextByPos( sal_uInt16 nPos ); + virtual sal_uInt16 GetValueCount() const override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; +}; + +#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 000000000..49fb3f345 --- /dev/null +++ b/include/editeng/charrotateitem.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 INCLUDED_EDITENG_CHARROTATEITEM_HXX +#define INCLUDED_EDITENG_CHARROTATEITEM_HXX + +#include <svl/intitem.hxx> +#include <tools/degree.hxx> +#include <editeng/editengdllapi.h> + + // class SvxTextRotateItem ---------------------------------------------- + + /* [Description] + + This item defines a text rotation value. Currently + text can only be rotated 90,0 and 270,0 degrees. + + */ + +class EDITENG_DLLPUBLIC SvxTextRotateItem : public SfxUInt16Item +{ +public: + SvxTextRotateItem(Degree10 nValue, const sal_uInt16 nId); + + virtual SvxTextRotateItem* Clone(SfxItemPool *pPool = nullptr) const override; + + virtual bool GetPresentation(SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper&) const override; + + virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; + virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override; + + Degree10 GetValue() const { return Degree10(SfxUInt16Item::GetValue()); } + void SetValue(Degree10 val) { SfxUInt16Item::SetValue(val.get()); } + + // our currently only degree values + void SetTopToBottom() { SetValue(2700_deg10); } + void SetBottomToTop() { SetValue(900_deg10); } + bool IsTopToBottom() const { return 2700_deg10 == GetValue(); } + bool IsBottomToTop() const { return 900_deg10 == GetValue(); } + bool IsVertical() const { return IsTopToBottom() || IsBottomToTop(); } + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + + +// 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 final : public SvxTextRotateItem +{ + bool bFitToLine; +public: + static SfxPoolItem* CreateDefault(); + + SvxCharRotateItem( Degree10 nValue /*= 0*/, + bool bFitIntoLine /*= false*/, + const sal_uInt16 nId ); + + virtual SvxCharRotateItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + virtual bool operator==( const SfxPoolItem& ) const override; + + bool IsFitToLine() const { return bFitToLine; } + void SetFitToLine( bool b ) { bFitToLine = b; } + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +#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 000000000..fff4fa8ef --- /dev/null +++ b/include/editeng/charscaleitem.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 INCLUDED_EDITENG_CHARSCALEITEM_HXX +#define INCLUDED_EDITENG_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 final : public SfxUInt16Item +{ +public: + static SfxPoolItem* CreateDefault(); + + SvxCharScaleWidthItem( sal_uInt16 nValue /*= 100*/, + const sal_uInt16 nId ); + + virtual SvxCharScaleWidthItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; +}; + +#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 000000000..d0b4bff25 --- /dev/null +++ b/include/editeng/cmapitem.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 INCLUDED_EDITENG_CMAPITEM_HXX +#define INCLUDED_EDITENG_CMAPITEM_HXX + +#include <svl/eitem.hxx> +#include <editeng/svxenum.hxx> +#include <editeng/editengdllapi.h> + +// class SvxCaseMapItem -------------------------------------------------- + +/* [Description] + + This item describe the font type (uppercase, small caps ,...). +*/ + +class EDITENG_DLLPUBLIC SvxCaseMapItem final : public SfxEnumItem<SvxCaseMap> +{ +public: + static SfxPoolItem* CreateDefault(); + + SvxCaseMapItem( const SvxCaseMap eMap /*= SvxCaseMap::NotMapped*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + SfxEnumItem + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + virtual SvxCaseMapItem* Clone( SfxItemPool *pPool = nullptr ) const override; + static OUString GetValueTextByPos( sal_uInt16 nPos ); + virtual sal_uInt16 GetValueCount() const override; + + // enum cast + SvxCaseMap GetCaseMap() const { return GetValue(); } + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; +}; + +#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 000000000..cbd52844b --- /dev/null +++ b/include/editeng/colritem.hxx @@ -0,0 +1,115 @@ +/* -*- 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_EDITENG_COLRITEM_HXX +#define INCLUDED_EDITENG_COLRITEM_HXX + +#include <svl/poolitem.hxx> +#include <tools/color.hxx> +#include <editeng/editengdllapi.h> + +#define VERSION_USEAUTOCOLOR 1 + +/// Represents theme metadata for a (tools) Color. +class EDITENG_DLLPUBLIC SvxThemeColor +{ + sal_Int16 maThemeIndex; + /// Luminance Modulation: 100th percentage, defaults to 100%. + sal_Int16 mnLumMod; + /// Luminance Offset: 100th percentage, defaults to 0%. + sal_Int16 mnLumOff; + +public: + explicit SvxThemeColor(); + bool operator==(const SvxThemeColor& rThemeColor) const; + + sal_Int16 GetThemeIndex() const + { + return maThemeIndex; + } + + void SetThemeIndex(sal_Int16 nIndex) + { + maThemeIndex = nIndex; + } + + void SetLumMod(sal_Int16 nLumMod) { mnLumMod = nLumMod; } + + sal_Int16 GetLumMod() const { return mnLumMod; } + + void SetLumOff(sal_Int16 nLumOff) { mnLumOff = nLumOff; } + + sal_Int16 GetLumOff() const { return mnLumOff; } + + void dumpAsXml(xmlTextWriterPtr pWriter) const; +}; + +/** SvxColorItem item describes a color. +*/ +class EDITENG_DLLPUBLIC SvxColorItem final : public SfxPoolItem +{ +private: + Color mColor; + SvxThemeColor maThemeColor; + sal_Int16 maTintShade; + +public: + static SfxPoolItem* CreateDefault(); + + explicit SvxColorItem(const sal_uInt16 nId); + SvxColorItem(const Color& aColor, const sal_uInt16 nId); + virtual ~SvxColorItem() override; + + // "pure virtual Methods" from SfxPoolItem + virtual bool operator==(const SfxPoolItem& rPoolItem) const override; + virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; + virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override; + + virtual bool GetPresentation(SfxItemPresentation ePres, + MapUnit eCoreMetric, MapUnit ePresMetric, + OUString &rText, const IntlWrapper& rIntlWrapper) const override; + + virtual SvxColorItem* Clone(SfxItemPool* pPool = nullptr) const override; + SvxColorItem(SvxColorItem const &) = default; // SfxPoolItem copy function dichotomy + + const Color& GetValue() const + { + return mColor; + } + void SetValue(const Color& rNewColor); + + sal_Int16 GetTintOrShade() const + { + return maTintShade; + } + + void SetTintOrShade(sal_Int16 nTintOrShade) + { + maTintShade = nTintOrShade; + } + + SvxThemeColor& GetThemeColor() { return maThemeColor; } + + const SvxThemeColor& GetThemeColor() const { return maThemeColor; } + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +#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 000000000..9c67384fc --- /dev/null +++ b/include/editeng/contouritem.hxx @@ -0,0 +1,50 @@ +/* -*- 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_EDITENG_CONTOURITEM_HXX +#define INCLUDED_EDITENG_CONTOURITEM_HXX + +#include <svl/eitem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxContourItem -------------------------------------------------- + +/* [Description] + This item describes, if contour is employed. +*/ + +class EDITENG_DLLPUBLIC SvxContourItem final : public SfxBoolItem +{ +public: + static SfxPoolItem* CreateDefault(); + + SvxContourItem( const bool bContoured /*= false*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual SvxContourItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; +}; + +#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 000000000..5d8b18fe2 --- /dev/null +++ b/include/editeng/crossedoutitem.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 INCLUDED_EDITENG_CROSSEDOUTITEM_HXX +#define INCLUDED_EDITENG_CROSSEDOUTITEM_HXX + +#include <tools/fontenum.hxx> +#include <svl/eitem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxCrossedOutItem ----------------------------------------------- + +/* [Description] + This item describes, whether and how it is striked out. +*/ + +class EDITENG_DLLPUBLIC SvxCrossedOutItem final : public SfxEnumItem<FontStrikeout> +{ +public: + static SfxPoolItem* CreateDefault(); + + SvxCrossedOutItem( const FontStrikeout eSt /*= STRIKEOUT_NONE*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + virtual SvxCrossedOutItem* Clone( SfxItemPool *pPool = nullptr ) const override; + static OUString GetValueTextByPos( sal_uInt16 nPos ); + virtual sal_uInt16 GetValueCount() const override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + using SfxEnumItem::SetValue; + + virtual bool HasBoolValue() const override; + virtual bool GetBoolValue() const override; + virtual void SetBoolValue( bool bVal ) override; + + SvxCrossedOutItem(SvxCrossedOutItem const &) = default; // SfxPoolItem copy function dichotomy + + // enum cast + FontStrikeout GetStrikeout() const + { return GetValue(); } +}; + +#endif // INCLUDED_EDITENG_CROSSEDOUTITEM_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 000000000..1762fd86e --- /dev/null +++ b/include/editeng/editdata.hxx @@ -0,0 +1,359 @@ +/* -*- 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 INCLUDED_EDITENG_EDITDATA_HXX +#define INCLUDED_EDITENG_EDITDATA_HXX + +#include <rtl/ustring.hxx> +#include <editeng/editengdllapi.h> +#include <i18nlangtag/lang.h> +#include <memory> +#include <ostream> + +class SfxPoolItem; +template<typename T> class SvParser; +class SvxFieldItem; +enum class HtmlTokenId : sal_Int16; + +enum class EETextFormat { Text = 0x20, Rtf, Html = 0x32, Xml }; +enum class EEHorizontalTextDirection { Default, L2R, R2L }; +enum class EESelectionMode { Std, Hidden }; + // EESelectionMode::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 class EESpellState { Ok, NoSpeller, ErrorFound }; +enum class EEAnchorMode { + TopLeft, TopHCenter, TopRight, + VCenterLeft, VCenterHCenter, VCenterRight, + BottomLeft, BottomHCenter, BottomRight }; + +enum class EERemoveParaAttribsMode { RemoveAll, RemoveCharItems, RemoveNone }; + +#define EE_PARA_NOT_FOUND SAL_MAX_INT32 +#define EE_PARA_APPEND SAL_MAX_INT32 +#define EE_PARA_ALL SAL_MAX_INT32 +#define EE_PARA_MAX_COUNT SAL_MAX_INT32 + +#define EE_INDEX_NOT_FOUND SAL_MAX_INT32 +#define EE_TEXTPOS_ALL SAL_MAX_INT32 +#define EE_TEXTPOS_MAX_COUNT SAL_MAX_INT32 + +EDITENG_DLLPUBLIC extern const size_t EE_APPEND; + +// Error messages for Read / Write Method +#define EE_READWRITE_WRONGFORMAT ErrCode(ErrCodeArea::Svx, 1) + +#define EDITUNDO_REMOVECHARS 100 +#define EDITUNDO_CONNECTPARAS 101 +#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_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_RESETATTRIBS 121 +#define EDITUNDO_INDENTBLOCK 122 +#define EDITUNDO_UNINDENTBLOCK 123 +#define EDITUNDO_MARKSELECTION 124 +#define EDITUNDO_TRANSLITERATE 125 + +#define EDITUNDO_USER 200 + +struct EPosition +{ + sal_Int32 nPara; + sal_Int32 nIndex; + + EPosition() + : nPara( EE_PARA_NOT_FOUND ) + , nIndex( EE_INDEX_NOT_FOUND ) + { } + + EPosition( sal_Int32 nPara_, sal_Int32 nPos_ ) + : nPara( nPara_ ) + , nIndex( nPos_ ) + { } +}; + +template<typename charT, typename traits> +inline std::basic_ostream<charT, traits> & operator <<( + std::basic_ostream<charT, traits> & stream, EPosition const& pos) +{ + return stream << "EPosition(" << pos.nPara << ',' << pos.nIndex << ")"; +} + +struct ESelection +{ + sal_Int32 nStartPara; + sal_Int32 nStartPos; + sal_Int32 nEndPara; + sal_Int32 nEndPos; + + ESelection() : nStartPara( 0 ), nStartPos( 0 ), nEndPara( 0 ), nEndPos( 0 ) {} + + ESelection( sal_Int32 nStPara, sal_Int32 nStPos, + sal_Int32 nEPara, sal_Int32 nEPos ) + : nStartPara( nStPara ) + , nStartPos( nStPos ) + , nEndPara( nEPara ) + , nEndPos( nEPos ) + { } + + ESelection( sal_Int32 nPara, sal_Int32 nPos ) + : nStartPara( nPara ) + , nStartPos( nPos ) + , nEndPara( nPara ) + , nEndPos( nPos ) + { } + + void Adjust(); + bool operator==( const ESelection& rS ) const; + bool operator!=( const ESelection& rS ) const { return !operator==(rS); } + bool operator<( const ESelection& rS ) const; + bool operator>( const ESelection& rS ) const; + bool IsZero() const; + bool HasRange() const; +}; + +template<typename charT, typename traits> +inline std::basic_ostream<charT, traits> & operator <<( + std::basic_ostream<charT, traits> & stream, ESelection const& sel) +{ + return stream << "ESelection(" << sel.nStartPara << ',' << sel.nStartPos << "," << sel.nEndPara << "," << sel.nEndPos << ")"; +} + +inline bool ESelection::HasRange() const +{ + return ( nStartPara != nEndPara ) || ( nStartPos != nEndPos ); +} + +inline bool ESelection::IsZero() const +{ + return ( ( nStartPara == 0 ) && ( nStartPos == 0 ) && + ( nEndPara == 0 ) && ( nEndPos == 0 ) ); +} + +inline bool ESelection::operator==( const ESelection& rS ) const +{ + return ( ( nStartPara == rS.nStartPara ) && ( nStartPos == rS.nStartPos ) && + ( nEndPara == rS.nEndPara ) && ( nEndPos == rS.nEndPos ) ); +} + +inline bool ESelection::operator<( const ESelection& rS ) const +{ + // The selection must be adjusted. + // => Only check if end of 'this' < Start of rS + return ( nEndPara < rS.nStartPara ) || + ( ( nEndPara == rS.nStartPara ) && ( nEndPos < rS.nStartPos ) && !operator==( rS ) ); +} + +inline bool ESelection::operator>( const ESelection& rS ) const +{ + // The selection must be adjusted. + // => Only check if end of 'this' < Start of rS + return ( nStartPara > rS.nEndPara ) || + ( ( nStartPara == rS.nEndPara ) && ( nStartPos > rS.nEndPos ) && !operator==( rS ) ); +} + +inline void ESelection::Adjust() +{ + bool bSwap = false; + if ( nStartPara > nEndPara ) + bSwap = true; + else if ( ( nStartPara == nEndPara ) && ( nStartPos > nEndPos ) ) + bSwap = true; + + if ( bSwap ) + { + sal_Int32 nSPar = nStartPara; sal_Int32 nSPos = nStartPos; + nStartPara = nEndPara; nStartPos = nEndPos; + nEndPara = nSPar; nEndPos = nSPos; + } +} + +struct EDITENG_DLLPUBLIC EFieldInfo +{ + std::unique_ptr<SvxFieldItem> pFieldItem; + OUString aCurrentText; + EPosition aPosition; + + EFieldInfo(); + EFieldInfo( const SvxFieldItem& rFieldItem, sal_Int32 nPara, sal_Int32 nPos ); + ~EFieldInfo(); + + EFieldInfo( const EFieldInfo& ); + EFieldInfo& operator= ( const EFieldInfo& ); +}; + +enum class RtfImportState { + Start, End, // only pParser, nPara, nIndex + NextToken, UnknownAttr, // nToken+nTokenValue + SetAttr, // pAttrs + InsertText, // aText + InsertPara, // - + }; +enum class HtmlImportState { + Start, End, // only pParser, nPara, nIndex + NextToken, // nToken + SetAttr, // pAttrs + InsertText, // aText + InsertPara, InsertField // - + }; + +struct HtmlImportInfo +{ + SvParser<HtmlTokenId>* pParser; + ESelection aSelection; + HtmlImportState eState; + + HtmlTokenId nToken; + + OUString aText; + + HtmlImportInfo( HtmlImportState eState, SvParser<HtmlTokenId>* pPrsrs, const ESelection& rSel ); + ~HtmlImportInfo(); +}; + +struct RtfImportInfo +{ + SvParser<int>* pParser; + ESelection aSelection; + RtfImportState eState; + + int nToken; + short nTokenValue; + + RtfImportInfo( RtfImportState eState, SvParser<int>* pPrsrs, const ESelection& rSel ); +}; + +struct ParagraphInfos +{ + ParagraphInfos() + : nFirstLineHeight( 0 ) + , nFirstLineTextHeight ( 0 ) + , nFirstLineMaxAscent( 0 ) + , bValid( false ) + {} + + sal_uInt16 nFirstLineHeight; + sal_uInt16 nFirstLineTextHeight; + sal_uInt16 nFirstLineMaxAscent; + + bool bValid; // A query during formatting is not valid! +}; + +struct EECharAttrib +{ + const SfxPoolItem* pAttr; + + sal_Int32 nStart; + sal_Int32 nEnd; + EECharAttrib(sal_Int32 nSt, sal_Int32 nE, const SfxPoolItem* pA = nullptr) + : pAttr(pA) + , nStart(nSt) + , nEnd(nE) + { + } +}; + +struct MoveParagraphsInfo +{ + sal_Int32 nStartPara; + sal_Int32 nEndPara; + sal_Int32 nDestPara; + + MoveParagraphsInfo( sal_Int32 nS, sal_Int32 nE, sal_Int32 nD ) + { nStartPara = nS; nEndPara = nE; nDestPara = nD; } +}; + +struct PasteOrDropInfos +{ + sal_Int32 nStartPara; + sal_Int32 nEndPara; + + PasteOrDropInfos() : nStartPara(-1), nEndPara(-1) {} +}; + +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, + + /// The EditEngine is in a valid state again. Process pending notifications. + EE_NOTIFY_PROCESSNOTIFICATIONS, + + EE_NOTIFY_TEXTVIEWSELECTIONCHANGED_ENDD_PARA +}; + +struct EENotify +{ + EENotifyType eNotificationType; + + sal_Int32 nParagraph; // only valid in PARAGRAPHINSERTED/EE_NOTIFY_PARAGRAPHREMOVED + + sal_Int32 nParam1; + sal_Int32 nParam2; + + EENotify( EENotifyType eType ) + { eNotificationType = eType; nParagraph = EE_PARA_NOT_FOUND; nParam1 = 0; nParam2 = 0; } +}; + +namespace editeng +{ + +struct LanguageSpan +{ + LanguageType nLang = LANGUAGE_DONTKNOW; + sal_Int32 nStart = -1; + sal_Int32 nEnd = -1; +}; + +} + +#endif // INCLUDED_EDITENG_EDITDATA_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 000000000..a0ce29ca2 --- /dev/null +++ b/include/editeng/editeng.hxx @@ -0,0 +1,655 @@ +/* -*- 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 INCLUDED_EDITENG_EDITENG_HXX +#define INCLUDED_EDITENG_EDITENG_HXX + +#include <memory> +#include <vector> + +#include <optional> + +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/i18n/WordType.hpp> +#include <com/sun/star/i18n/CharacterIteratorMode.hpp> + +#include <o3tl/span.hxx> +#include <svl/typedwhich.hxx> +#include <editeng/editdata.hxx> +#include <editeng/editstat.hxx> +#include <editeng/editobj.hxx> +#include <editeng/editengdllapi.h> +#include <i18nlangtag/lang.h> + +#include <tools/lineend.hxx> +#include <tools/degree.hxx> +#include <tools/long.hxx> + +#include <editeng/eedata.hxx> +#include <o3tl/typed_flags_set.hxx> +#include <svl/languageoptions.hxx> +#include <vcl/errcode.hxx> +#include <functional> + +template <typename Arg, typename Ret> class Link; + +namespace com::sun::star { + namespace linguistic2 { + class XSpellChecker1; + class XHyphenator; + } + namespace datatransfer { + class XTransferable; + } + namespace lang { + struct Locale; + } +} + +namespace svx { +struct SpellPortion; +typedef std::vector<SpellPortion> SpellPortions; +} + +class SfxUndoManager; +namespace basegfx { class B2DPolyPolygon; } +namespace editeng { + struct MisspellRanges; +} + +class ImpEditEngine; +class EditView; +class OutputDevice; +class SvxFont; +class SfxItemPool; +class SfxStyleSheet; +class SfxStyleSheetPool; +class SvxSearchItem; +class SvxFieldItem; +class MapMode; +class Color; +namespace vcl { class Font; } +class KeyEvent; +class Size; +class Point; +namespace tools { class Rectangle; } +class SvStream; +namespace vcl { class Window; } +class SvKeyValueIterator; +class SvxForbiddenCharactersTable; +class SvxNumberFormat; +class SvxFieldData; +class ContentNode; +class ParaPortion; +class EditSelection; +class EditPaM; +class EditLine; +class InternalEditStatus; +class EditSelectionEngine; +class EditDoc; +class Range; +struct EPaM; +class DeletedNodeInfo; +class ParaPortionList; +enum class CharCompressType; +enum class TransliterationFlags; +class LinkParamNone; + +/** values for: + SfxItemSet GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs::All ); +*/ +enum class EditEngineAttribs { + All, /// returns all attributes even when they are not set + OnlyHard /// returns only attributes hard set on portions +}; + +/** values for: + SfxItemSet GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, sal_uInt8 nFlags = 0xFF ) const; +*/ +enum class GetAttribsFlags +{ + NONE = 0x00, + STYLESHEET = 0x01, + PARAATTRIBS = 0x02, + CHARATTRIBS = 0x04, + ALL = 0x07, +}; +namespace o3tl +{ + template<> struct typed_flags<GetAttribsFlags> : is_typed_flags<GetAttribsFlags, 0x07> {}; +} + +enum class SetAttribsMode { + NONE, WholeWord, Edge +}; + +class EDITENG_DLLPUBLIC EditEngine +{ + friend class EditView; + friend class ImpEditView; + friend class Outliner; + friend class TextChainingUtils; + + +public: + typedef std::vector<EditView*> ViewsType; + + EditSelection InsertText( + css::uno::Reference<css::datatransfer::XTransferable > const & rxDataObj, + const OUString& rBaseURL, const EditPaM& rPaM, bool bUseSpecial); + +private: + std::unique_ptr<ImpEditEngine> pImpEditEngine; + + EditEngine( const EditEngine& ) = delete; + EditEngine& operator=( const EditEngine& ) = delete; + EDITENG_DLLPRIVATE bool PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pView, vcl::Window const * pFrameWin ); + + EDITENG_DLLPRIVATE void CursorMoved(const ContentNode* pPrevNode); + EDITENG_DLLPRIVATE void CheckIdleFormatter(); + EDITENG_DLLPRIVATE bool IsIdleFormatterActive() const; + EDITENG_DLLPRIVATE ParaPortion* FindParaPortion(ContentNode const * pNode); + EDITENG_DLLPRIVATE const ParaPortion* FindParaPortion(ContentNode const * pNode) const; + EDITENG_DLLPRIVATE const ParaPortion* GetPrevVisPortion(const ParaPortion* pCurPortion) const; + + EDITENG_DLLPRIVATE css::uno::Reference< + css::datatransfer::XTransferable> + CreateTransferable(const EditSelection& rSelection); + + EDITENG_DLLPRIVATE EditPaM EndOfWord(const EditPaM& rPaM); + + EDITENG_DLLPRIVATE EditPaM GetPaM(const Point& aDocPos, bool bSmart = true); + + EDITENG_DLLPRIVATE EditSelection SelectWord( + const EditSelection& rCurSelection, + sal_Int16 nWordType = css::i18n::WordType::ANYWORD_IGNOREWHITESPACES); + + EDITENG_DLLPRIVATE tools::Long GetXPos( + const ParaPortion* pParaPortion, const EditLine* pLine, sal_Int32 nIndex, bool bPreferPortionStart = false) const; + + EDITENG_DLLPRIVATE Range GetLineXPosStartEnd( + const ParaPortion* pParaPortion, const EditLine* pLine) 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() const; + + void SetDefTab( sal_uInt16 nDefTab ); + + void SetRefDevice( OutputDevice* pRefDef ); + OutputDevice* GetRefDevice() const; + + void SetRefMapMode( const MapMode& rMapMode ); + MapMode const & GetRefMapMode() const; + + /// Change the update mode per bUpdate and potentially trigger FormatAndUpdate. + /// bRestoring is used for LOK to update cursor visibility, specifically, + /// when true, it means we are restoring the update mode after internally + /// disabling it (f.e. during SetText to set/delete default text in Impress). + /// @return previous value of update + bool SetUpdateLayout(bool bUpdate, bool bRestoring = false); + bool IsUpdateLayout() const; + + void SetBackgroundColor( const Color& rColor ); + Color const & GetBackgroundColor() const; + Color GetAutoColor() const; + void EnableAutoColor( bool b ); + void ForceAutoColor( bool b ); + bool IsForceAutoColor() const; + + void InsertView(EditView* pEditView, size_t nIndex = EE_APPEND); + EditView* RemoveView( EditView* pEditView ); + void RemoveView(size_t nIndex); + EditView* GetView(size_t nIndex = 0) const; + size_t GetViewCount() const; + 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 IsEffectivelyVertical() const; + bool IsTopToBottom() const; + bool GetVertical() const; + void SetRotation(TextRotation nRotation); + TextRotation GetRotation() const; + + void SetTextColumns(sal_Int16 nColumns, sal_Int32 nSpacing); + + void SetFixedCellHeight( bool bUseFixedCellHeight ); + + void SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir ); + EEHorizontalTextDirection GetDefaultHorizontalTextDirection() const; + + SvtScriptType GetScriptType( const ESelection& rSelection ) const; + editeng::LanguageSpan GetLanguage(const EditPaM& rPaM) const; + editeng::LanguageSpan GetLanguage( sal_Int32 nPara, sal_Int32 nPos ) const; + + void TransliterateText( const ESelection& rSelection, TransliterationFlags nTransliterationMode ); + EditSelection TransliterateText( const EditSelection& rSelection, TransliterationFlags nTransliterationMode ); + + void SetAsianCompressionMode( CharCompressType nCompression ); + + void SetKernAsianPunctuation( bool bEnabled ); + + void SetAddExtLeading( 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 ); + + void SetMinColumnWrapHeight(tools::Long nVal); + + OUString GetText( LineEnd eEnd = LINEEND_LF ) const; + OUString GetText( const ESelection& rSelection ) const; + sal_Int32 GetTextLen() const; + sal_uInt32 GetTextHeight() const; + sal_uInt32 GetTextHeightNTP() const; + sal_uInt32 CalcTextWidth(); + + OUString GetText( sal_Int32 nParagraph ) const; + sal_Int32 GetTextLen( sal_Int32 nParagraph ) const; + sal_uInt32 GetTextHeight( sal_Int32 nParagraph ) const; + + sal_Int32 GetParagraphCount() const; + + sal_Int32 GetLineCount( sal_Int32 nParagraph ) const; + sal_Int32 GetLineLen( sal_Int32 nParagraph, sal_Int32 nLine ) const; + void GetLineBoundaries( /*out*/sal_Int32& rStart, /*out*/sal_Int32& rEnd, sal_Int32 nParagraph, sal_Int32 nLine ) const; + sal_Int32 GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const; + sal_uInt32 GetLineHeight( sal_Int32 nParagraph ); + tools::Rectangle GetParaBounds( sal_Int32 nPara ); + ParagraphInfos GetParagraphInfos( sal_Int32 nPara ); + sal_Int32 FindParagraph( tools::Long nDocPosY ); + EPosition FindDocPosition( const Point& rDocPos ) const; + tools::Rectangle GetCharacterBounds( const EPosition& rPos ) const; + + OUString GetWord(sal_Int32 nPara, sal_Int32 nIndex); + + ESelection GetWord( const ESelection& rSelection, sal_uInt16 nWordType ) const; + + void Clear(); + void SetText( const OUString& rStr ); + + std::unique_ptr<EditTextObject> CreateTextObject(); + std::unique_ptr<EditTextObject> GetEmptyTextObject() const; + std::unique_ptr<EditTextObject> CreateTextObject( sal_Int32 nPara, sal_Int32 nParas = 1 ); + std::unique_ptr<EditTextObject> CreateTextObject( const ESelection& rESelection ); + void SetText( const EditTextObject& rTextObject ); + + void RemoveParagraph(sal_Int32 nPara); + void InsertParagraph(sal_Int32 nPara, const EditTextObject& rTxtObj, const bool bAppend = false); + void InsertParagraph(sal_Int32 nPara, const OUString& rText); + + void SetText(sal_Int32 nPara, const OUString& rText); + + virtual void SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet ); + const SfxItemSet& GetParaAttribs( sal_Int32 nPara ) const; + + /// Set attributes from rSet an all characters of nPara. + void SetCharAttribs(sal_Int32 nPara, const SfxItemSet& rSet); + void GetCharAttribs( sal_Int32 nPara, std::vector<EECharAttrib>& rLst ) const; + + SfxItemSet GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, GetAttribsFlags nFlags = GetAttribsFlags::ALL ) const; + SfxItemSet GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs::All ); + + bool HasParaAttrib( sal_Int32 nPara, sal_uInt16 nWhich ) const; + const SfxPoolItem& GetParaAttrib( sal_Int32 nPara, sal_uInt16 nWhich ) const; + template<class T> + const T& GetParaAttrib( sal_Int32 nPara, TypedWhichId<T> nWhich ) const + { + return static_cast<const T&>(GetParaAttrib(nPara, sal_uInt16(nWhich))); + } + + vcl::Font GetStandardFont( sal_Int32 nPara ); + SvxFont GetStandardSvxFont( sal_Int32 nPara ); + + void RemoveAttribs( const ESelection& rSelection, bool bRemoveParaAttribs, sal_uInt16 nWhich ); + + void ShowParagraph( sal_Int32 nParagraph, bool bShow ); + + SfxUndoManager& GetUndoManager(); + SfxUndoManager* SetUndoManager(SfxUndoManager* pNew); + void UndoActionStart( sal_uInt16 nId ); + void UndoActionStart(sal_uInt16 nId, const ESelection& rSel); + void UndoActionEnd(); + bool IsInUndo() const; + + void EnableUndo( bool bEnable ); + bool IsUndoEnabled() const; + + /** 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(); + bool IsModified() const; + + void SetModifyHdl( const Link<LinkParamNone*,void>& rLink ); + Link<LinkParamNone*,void> const & GetModifyHdl() const; + + bool IsInSelectionMode() const; + + void StripPortions(); + void GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList ); + + tools::Long GetFirstLineStartX( sal_Int32 nParagraph ); + Point GetDocPosTopLeft( sal_Int32 nParagraph ); + Point GetDocPos( const Point& rPaperPos ) const; + bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder ); + + // StartDocPos corresponds to VisArea.TopLeft(). + void Draw( OutputDevice& rOutDev, const tools::Rectangle& rOutRect ); + void Draw( OutputDevice& rOutDev, const tools::Rectangle& rOutRect, const Point& rStartDocPos ); + void Draw( OutputDevice& rOutDev, const tools::Rectangle& rOutRect, const Point& rStartDocPos, bool bClip ); + void Draw( OutputDevice& rOutDev, const Point& rStartPos, Degree10 nOrientation = 0_deg10 ); + + ErrCode Read( SvStream& rInput, const OUString& rBaseURL, EETextFormat, SvKeyValueIterator* pHTTPHeaderAttrs = nullptr ); + void Write( SvStream& rOutput, EETextFormat ); + + void SetStatusEventHdl( const Link<EditStatus&,void>& rLink ); + Link<EditStatus&,void> const & GetStatusEventHdl() const; + + void SetNotifyHdl( const Link<EENotify&,void>& rLink ); + Link<EENotify&,void> const & GetNotifyHdl() const; + + void SetRtfImportHdl( const Link<RtfImportInfo&,void>& rLink ); + const Link<RtfImportInfo&,void>& GetRtfImportHdl() const; + + void SetHtmlImportHdl( const Link<HtmlImportInfo&,void>& rLink ); + const Link<HtmlImportInfo&,void>& GetHtmlImportHdl() const; + + // Do not evaluate font formatting => For Outliner + bool IsFlatMode() const; + void SetFlatMode( bool bFlat ); + + void SetControlWord( EEControlBits nWord ); + EEControlBits GetControlWord() const; + + void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ); + void QuickMarkInvalid( const ESelection& rSel ); + void QuickFormatDoc( bool bFull = false ); + void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ); + void QuickInsertLineBreak( const ESelection& rSel ); + void QuickInsertText(const OUString& rText, const ESelection& rSel); + void QuickDelete( const ESelection& rSel ); + void QuickMarkToBeRepainted( sal_Int32 nPara ); + + void SetGlobalCharStretching( sal_uInt16 nX, sal_uInt16 nY ); + 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_Int32 nPara, SfxStyleSheet* pStyle ); + const SfxStyleSheet* GetStyleSheet( sal_Int32 nPara ) const; + SfxStyleSheet* GetStyleSheet( sal_Int32 nPara ); + + void SetWordDelimiters( const OUString& rDelimiters ); + const OUString& GetWordDelimiters() const; + + void EraseVirtualDevice(); + + void SetSpeller( css::uno::Reference< + css::linguistic2::XSpellChecker1 > const &xSpeller ); + css::uno::Reference< + css::linguistic2::XSpellChecker1 > const & + GetSpeller(); + void SetHyphenator( css::uno::Reference< + css::linguistic2::XHyphenator > const & xHyph ); + + void GetAllMisspellRanges( std::vector<editeng::MisspellRanges>& rRanges ) const; + void SetAllMisspellRanges( const std::vector<editeng::MisspellRanges>& rRanges ); + + static void SetForbiddenCharsTable(const std::shared_ptr<SvxForbiddenCharactersTable>& xForbiddenChars); + + void SetDefaultLanguage( LanguageType eLang ); + LanguageType GetDefaultLanguage() const; + + bool HasOnlineSpellErrors() const; + void CompleteOnlineSpelling(); + + bool ShouldCreateBigTextObject() const; + + // For fast Pre-Test without view: + EESpellState HasSpellErrors(); + void ClearSpellErrors(); + bool HasText( const SvxSearchItem& rSearchItem ); + + //spell and return a sentence + bool SpellSentence(EditView const & rEditView, svx::SpellPortions& rToFill ); + // put spell position to start of current sentence + void PutSpellingToSentenceStart( EditView const & rEditView ); + //applies a changed sentence + void ApplyChangedSentence(EditView const & rEditView, const svx::SpellPortions& rNewPortions, bool bRecheck ); + + // for text conversion (see also HasSpellErrors) + bool HasConvertibleTextPortion( LanguageType nLang ); + virtual bool ConvertNextDocument(); + + bool UpdateFields(); + bool UpdateFieldsOnly(); + void RemoveFields( const std::function<bool ( const SvxFieldData* )>& isFieldData = [] (const SvxFieldData* ){return true;} ); + + sal_uInt16 GetFieldCount( sal_Int32 nPara ) const; + EFieldInfo GetFieldInfo( sal_Int32 nPara, sal_uInt16 nField ) const; + + bool IsRightToLeft( sal_Int32 nPara ) const; + + css::uno::Reference< css::datatransfer::XTransferable > + CreateTransferable( const ESelection& rSelection ) const; + + // MT: Can't create new virtual functions like for ParagraphInserted/Deleted, must be compatible in SRC638, change later... + void SetBeginMovingParagraphsHdl( const Link<MoveParagraphsInfo&,void>& rLink ); + void SetEndMovingParagraphsHdl( const Link<MoveParagraphsInfo&,void>& rLink ); + void SetBeginPasteOrDropHdl( const Link<PasteOrDropInfos&,void>& rLink ); + void SetEndPasteOrDropHdl( const Link<PasteOrDropInfos&,void>& rLink ); + + virtual void PaintingFirstLine(sal_Int32 nPara, const Point& rStartPos, const Point& rOrigin, Degree10 nOrientation, OutputDevice& rOutDev); + virtual void ParagraphInserted( sal_Int32 nNewParagraph ); + virtual void ParagraphDeleted( sal_Int32 nDeletedParagraph ); + virtual void ParagraphConnected( sal_Int32 nLeftParagraph, sal_Int32 nRightParagraph ); + virtual void ParaAttribsChanged( sal_Int32 nParagraph ); + virtual void StyleSheetChanged( SfxStyleSheet* pStyle ); + void ParagraphHeightChanged( sal_Int32 nPara ); + + virtual void DrawingText( const Point& rStartPos, const OUString& rText, + sal_Int32 nTextStart, sal_Int32 nTextLen, + o3tl::span<const sal_Int32> pDXArray, const SvxFont& rFont, + sal_Int32 nPara, sal_uInt8 nRightToLeft, + const EEngineData::WrongSpellVector* pWrongSpellVector, + const SvxFieldData* pFieldData, + bool bEndOfLine, + bool bEndOfParagraph, + const css::lang::Locale* pLocale, + const Color& rOverlineColor, + const Color& rTextLineColor); + + virtual void DrawingTab( const Point& rStartPos, tools::Long nWidth, const OUString& rChar, + const SvxFont& rFont, sal_Int32 nPara, sal_uInt8 nRightToLeft, + bool bEndOfLine, + bool bEndOfParagraph, + const Color& rOverlineColor, + const Color& rTextLineColor); + virtual OUString GetUndoComment( sal_uInt16 nUndoId ) const; + virtual bool SpellNextDocument(); + /** @return true, when click was consumed. false otherwise. */ + virtual bool FieldClicked( const SvxFieldItem& rField ); + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rTxtColor, std::optional<Color>& rFldColor ); + + // override this if access to bullet information needs to be provided + virtual const SvxNumberFormat * GetNumberFormat( sal_Int32 nPara ) const; + + virtual tools::Rectangle GetBulletArea( sal_Int32 nPara ); + + static rtl::Reference<SfxItemPool> CreatePool(); + static SfxItemPool& GetGlobalItemPool(); + static bool DoesKeyChangeText( const KeyEvent& rKeyEvent ); + static bool DoesKeyMoveCursor( const KeyEvent& rKeyEvent ); + static bool IsSimpleCharInput( const KeyEvent& rKeyEvent ); + static void SetFontInfoInItemSet( SfxItemSet& rItemSet, const vcl::Font& rFont ); + static void SetFontInfoInItemSet( SfxItemSet& rItemSet, const SvxFont& rFont ); + static vcl::Font CreateFontFromItemSet( const SfxItemSet& rItemSet, SvtScriptType nScriptType ); + static SvxFont CreateSvxFontFromItemSet( const SfxItemSet& rItemSet ); + static bool IsPrintable( sal_Unicode c ) { return ( ( c >= 32 ) && ( c != 127 ) ); } + static bool HasValidData( const css::uno::Reference< css::datatransfer::XTransferable >& rTransferable ); + /** sets a link that is called at the beginning of a drag operation at an edit view */ + void SetBeginDropHdl( const Link<EditView*,void>& rLink ); + Link<EditView*,void> const & GetBeginDropHdl() const; + + /** sets a link that is called at the end of a drag operation at an edit view */ + void SetEndDropHdl( const Link<EditView*,void>& rLink ); + Link<EditView*,void> const & GetEndDropHdl() const; + + /// specifies if auto-correction should capitalize the first word or not (default is on) + void SetFirstWordCapitalization( bool bCapitalize ); + + /** specifies if auto-correction should replace a leading single quotation + mark (apostrophe) or not (default is on) */ + void SetReplaceLeadingSingleQuotationMark( bool bReplace ); + + EditDoc& GetEditDoc(); + const EditDoc& GetEditDoc() const; + void dumpAsXmlEditDoc(xmlTextWriterPtr pWriter) const; + + ParaPortionList& GetParaPortions(); + const ParaPortionList& GetParaPortions() const; + + bool IsFormatted() const; + bool IsHtmlImportHandlerSet() const; + bool IsRtfImportHandlerSet() const; + bool IsImportRTFStyleSheetsSet() const; + + void CallRtfImportHandler(RtfImportInfo& rInfo); + void CallHtmlImportHandler(HtmlImportInfo& rInfo); + + void ParaAttribsToCharAttribs(ContentNode* pNode); + + EditPaM CreateEditPaM(const EPaM& rEPaM); + EditPaM ConnectParagraphs( + ContentNode* pLeft, ContentNode* pRight, bool bBackward); + + EditPaM InsertField(const EditSelection& rEditSelection, const SvxFieldItem& rFld); + EditPaM InsertText(const EditSelection& aCurEditSelection, const OUString& rStr); + EditSelection InsertText(const EditTextObject& rTextObject, const EditSelection& rSel); + EditPaM InsertParaBreak(const EditSelection& rEditSelection); + EditPaM InsertLineBreak(const EditSelection& rEditSelection); + + EditPaM CursorLeft( + const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode = css::i18n::CharacterIteratorMode::SKIPCELL); + EditPaM CursorRight( + const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode = css::i18n::CharacterIteratorMode::SKIPCELL); + + void SeekCursor(ContentNode* pNode, sal_Int32 nPos, SvxFont& rFont); + + EditPaM DeleteSelection(const EditSelection& rSel); + + ESelection CreateESelection(const EditSelection& rSel) const; + EditSelection CreateSelection(const ESelection& rSel); + + const SfxItemSet& GetBaseParaAttribs(sal_Int32 nPara) const; + void SetParaAttribsOnly(sal_Int32 nPara, const SfxItemSet& rSet); + void SetAttribs(const EditSelection& rSel, const SfxItemSet& rSet, SetAttribsMode nSpecial = SetAttribsMode::NONE); + + OUString GetSelected(const EditSelection& rSel) const; + EditPaM DeleteSelected(const EditSelection& rSel); + + SvtScriptType GetScriptType(const EditSelection& rSel) const; + + void RemoveParaPortion(sal_Int32 nNode); + + void SetCallParaInsertedOrDeleted(bool b); + bool IsCallParaInsertedOrDeleted() const; + + void AppendDeletedNodeInfo(DeletedNodeInfo* pInfo); + void UpdateSelections(); + + void InsertContent(ContentNode* pNode, sal_Int32 nPos); + EditPaM SplitContent(sal_Int32 nNode, sal_Int32 nSepPos); + EditPaM ConnectContents(sal_Int32 nLeftNode, bool bBackward); + + void InsertFeature(const EditSelection& rEditSelection, const SfxPoolItem& rItem); + + EditSelection MoveParagraphs(const Range& rParagraphs, sal_Int32 nNewPos); + + void RemoveCharAttribs(sal_Int32 nPara, sal_uInt16 nWhich = 0, bool bRemoveFeatures = false); + void RemoveCharAttribs(const EditSelection& rSel, bool bRemoveParaAttribs, sal_uInt16 nWhich); + void RemoveCharAttribs(const EditSelection& rSel, EERemoveParaAttribsMode eMode, sal_uInt16 nWhich); + + ViewsType& GetEditViews(); + const ViewsType& GetEditViews() const; + + void SetUndoMode(bool b); + void FormatAndLayout(EditView* pCurView, bool bCalledFromUndo = false); + + void Undo(EditView* pView); + void Redo(EditView* pView); + + sal_Int32 GetOverflowingParaNum() const; + sal_Int32 GetOverflowingLineNum() const; + void ClearOverflowingParaNum(); + bool IsPageOverflow(); + + // tdf#132288 By default inserting an attribute beside another that is of + // the same type expands the original instead of inserting another. But the + // spell check dialog doesn't want that behaviour + void DisableAttributeExpanding(); + + // Optimization, if set, formatting will be done only for text lines that fit + // in given paper size and exceeding lines will be ignored. + void EnableSkipOutsideFormat(bool set); + + void SetLOKSpecialPaperSize(const Size& rSize); + const Size& GetLOKSpecialPaperSize() const; + +#ifdef DBG_UTIL + static void DumpData(const EditEngine* pEE, bool bInfoBox); +#endif +}; + +#endif // INCLUDED_EDITENG_EDITENG_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 000000000..5d77e453e --- /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_EDITENG_EDITENGDLLAPI_H +#define INCLUDED_EDITENG_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 000000000..e88b7b0f1 --- /dev/null +++ b/include/editeng/editerr.hxx @@ -0,0 +1,29 @@ +/* -*- 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_EDITENG_EDITERR_HXX +#define INCLUDED_EDITENG_EDITERR_HXX + +#include <vcl/errcode.hxx> + +#define ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS ErrCode(ErrCodeArea::Svx, 2) +#define ERRCODE_SVX_GRAPHIC_WRONG_FILEFORMAT ErrCode(ErrCodeArea::Svx, ErrCodeClass::Read, 8) + +#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 000000000..a418a3f88 --- /dev/null +++ b/include/editeng/editids.hrc @@ -0,0 +1,162 @@ +/* -*- 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_EDITENG_EDITIDS_HRC +#define INCLUDED_EDITENG_EDITIDS_HRC + +#include <svl/solar.hrc> + +class SfxGrabBagItem; +class SfxUInt16Item; +class SvxBrushItem; +class SvxFontItem; +class SvxKerningItem; +class SvxLanguageItem; +class SvxLineSpacingItem; +class SvxPageModelItem; +class SvxPostureItem; +class SvxTabStopItem; +class SvxUnderlineItem; +class SvxWeightItem; + +/* + These SID_SVX_START entries came from include/svx/svxids.hrc, avoid + accidentally colliding entries with include/svx/svxids.hrc and + include/sfx2/sfxsids.hrc. Only add new SID_SVX_START entries to + include/svx/svxids.hrc +*/ +#define SID_ATTR_BRUSH TypedWhichId<SvxBrushItem>( SID_SVX_START + 1 ) +#define SID_ATTR_TABSTOP TypedWhichId<SvxTabStopItem>( SID_SVX_START + 2 ) +#define SID_ATTR_TABSTOP_DEFAULTS TypedWhichId<SfxUInt16Item>( SID_SVX_START + 3 ) +#define SID_ATTR_TABSTOP_POS TypedWhichId<SfxUInt16Item>( SID_SVX_START + 4 ) +#define SID_ATTR_TABSTOP_OFFSET TypedWhichId<SfxInt32Item>( SID_SVX_START + 5 ) +#define SID_ATTR_CHAR ( SID_SVX_START + 6 ) +#define SID_ATTR_CHAR_FONT TypedWhichId<SvxFontItem>( SID_SVX_START + 7 ) +#define SID_ATTR_CHAR_POSTURE TypedWhichId<SvxPostureItem>( SID_SVX_START + 8 ) +#define SID_ATTR_CHAR_WEIGHT TypedWhichId<SvxWeightItem>( 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 TypedWhichId<SvxUnderlineItem>( SID_SVX_START + 14 ) +#define SID_ATTR_CHAR_FONTHEIGHT ( SID_SVX_START + 15 ) + // free +#define SID_ATTR_CHAR_COLOR ( SID_SVX_START + 17 ) +#define SID_ATTR_CHAR_KERNING TypedWhichId<SvxKerningItem>( 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_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_LINESPACE TypedWhichId<SvxLineSpacingItem>( 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_115 ( SID_SVX_START + 26 ) +#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_PARA_LEFTSPACE ( SID_SVX_START + 44 ) +#define SID_ATTR_PARA_RIGHTSPACE ( SID_SVX_START + 45 ) +#define SID_ATTR_PARA_FIRSTLINESPACE ( SID_SVX_START + 46 ) +#define SID_ATTR_PARA_BELOWSPACE ( SID_SVX_START + 47 ) +#define SID_ATTR_LRSPACE ( SID_SVX_START + 48 ) +#define SID_ATTR_ULSPACE ( SID_SVX_START + 49 ) +#define SID_ATTR_PARA_ABOVESPACE ( SID_SVX_START + 64 ) +#define SID_ATTR_PARA_MODEL TypedWhichId<SvxPageModelItem>( SID_SVX_START + 65 ) +#define SID_ATTR_PARA_KEEP ( SID_SVX_START + 66 ) +#define SID_ATTR_CHAR_AUTOKERN ( SID_SVX_START + 67 ) +#define SID_HANGING_INDENT ( SID_SVX_START + 68 ) +#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 ) // related to EE_FEATURE_FIELD +#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 TypedWhichId<SvxNumBulletItem>( 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 TypedWhichId<SvxLanguageItem>( 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 TypedWhichId<SvxLanguageItem>( 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_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_CHAR_GRABBAG TypedWhichId<SfxGrabBagItem>( SID_SVX_START + 1142 ) +#define SID_ATTR_CHAR_BACK_COLOR ( SID_SVX_START + 1153 ) + +// these ID didn't exist prior to the svx split, add new ids here +#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 TypedWhichId<SvxVerJustifyItem>( SID_EDIT_START + 72 ) +#define SID_ATTR_PARA_OUTLINE_LEVEL TypedWhichId<SfxUInt16Item>( SID_EDIT_START + 73 ) +#define SID_ATTR_CHAR_PREVIEW_FONT TypedWhichId<SvxFontItem>( SID_EDIT_START + 74 ) +#define SID_ATTR_CHAR_ENDPREVIEW_FONT TypedWhichId<SvxFontItem>( SID_EDIT_START + 75 ) +#define SID_ATTR_CHAR_BOX ( SID_EDIT_START + 76 ) +#define SID_ATTR_CHAR_SHADOW ( SID_EDIT_START + 77 ) +#define SID_ATTR_PARA_GRABBAG TypedWhichId<SfxGrabBagItem>( SID_EDIT_START + 78 ) + + +#if 95 > (SID_EDIT_END-SID_EDIT_START) +#error Resource-Overflow in #line, #file +#endif + +#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 000000000..5badaf8e8 --- /dev/null +++ b/include/editeng/editobj.hxx @@ -0,0 +1,138 @@ +/* -*- 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_EDITENG_EDITOBJ_HXX +#define INCLUDED_EDITENG_EDITOBJ_HXX + +#include <svl/style.hxx> +#include <editeng/editengdllapi.h> +#include <editeng/macros.hxx> +#include <svl/languageoptions.hxx> + +#include <com/sun/star/text/textfield/Type.hpp> + +#include <vector> +#include <memory> + +class SfxItemPool; +class SfxItemSet; +class SvxFieldItem; +class SvxFieldData; +enum class OutlinerMode; +struct EECharAttrib; +typedef struct _xmlTextWriter* xmlTextWriterPtr; + +namespace editeng { + +class FieldUpdater; +struct Section; + +} + +namespace svl { + +class SharedString; +class SharedStringPool; + +} + +enum class TextRotation { NONE, TOPTOBOTTOM, BOTTOMTOTOP }; + +class EDITENG_DLLPUBLIC EditTextObject +{ +public: + virtual ~EditTextObject(); + + /** + * Set paragraph strings to the shared string pool. + * + * @param rPool shared string pool. + */ + virtual void NormalizeString( svl::SharedStringPool& rPool ) = 0; + + virtual std::vector<svl::SharedString> GetSharedStrings() const = 0; + + virtual const SfxItemPool* GetPool() const = 0; + virtual OutlinerMode GetUserType() const = 0; // For OutlinerMode, it can however not save in compatible format + virtual void SetUserType( OutlinerMode n ) = 0; + + virtual bool IsEffectivelyVertical() const = 0; + virtual bool GetVertical() const = 0; + virtual bool IsTopToBottom() const = 0; + virtual void SetVertical( bool bVertical ) = 0; + virtual void SetRotation( TextRotation nRotation ) = 0; + virtual TextRotation GetRotation() const = 0; + + virtual SvtScriptType GetScriptType() const = 0; + + virtual std::unique_ptr<EditTextObject> Clone() const = 0; + + virtual sal_Int32 GetParagraphCount() const = 0; + + virtual OUString GetText(sal_Int32 nPara) const = 0; + + virtual void ClearPortionInfo() = 0; + + virtual bool HasOnlineSpellErrors() const = 0; + + virtual void GetCharAttribs( sal_Int32 nPara, std::vector<EECharAttrib>& rLst ) const = 0; + + virtual bool RemoveCharAttribs( sal_uInt16 nWhich ) = 0; + + /** + * Get all text sections in this content. Sections are non-overlapping + * segments of text split either by paragraph boundaries or format + * boundaries. Each section object contains all applied formats and/or a + * field item. + */ + virtual void GetAllSections( std::vector<editeng::Section>& rAttrs ) const = 0; + + virtual bool IsFieldObject() const = 0; + virtual const SvxFieldItem* GetField() const = 0; + virtual const SvxFieldData* GetFieldData(sal_Int32 nPara, size_t nPos, sal_Int32 nType) const = 0; + virtual bool HasField( sal_Int32 nType = css::text::textfield::Type::UNSPECIFIED ) const = 0; + + virtual const SfxItemSet& GetParaAttribs(sal_Int32 nPara) const = 0; + + virtual void GetStyleSheet(sal_Int32 nPara, OUString& rName, SfxStyleFamily& eFamily) const = 0; + virtual void SetStyleSheet(sal_Int32 nPara, const OUString& rName, const SfxStyleFamily& eFamily) = 0; + virtual bool ChangeStyleSheets( + std::u16string_view rOldName, SfxStyleFamily eOldFamily, const OUString& rNewName, SfxStyleFamily eNewFamily) = 0; + virtual void ChangeStyleSheetName(SfxStyleFamily eFamily, std::u16string_view rOldName, const OUString& rNewName) = 0; + + virtual editeng::FieldUpdater GetFieldUpdater() = 0; + + virtual bool operator==( const EditTextObject& rCompare ) const = 0; + + /** Compare, ignoring SfxItemPool pointer. + */ + bool Equals( const EditTextObject& rCompare ) const; + + // #i102062# + virtual bool isWrongListEqual(const EditTextObject& rCompare) const = 0; + +#if DEBUG_EDIT_ENGINE + virtual void Dump() const = 0; +#endif + virtual void dumpAsXml(xmlTextWriterPtr pWriter) const = 0; +}; + +#endif // INCLUDED_EDITENG_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 000000000..31ac07a1d --- /dev/null +++ b/include/editeng/editrids.hrc @@ -0,0 +1,318 @@ +/* -*- 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_INCLUDE_EDITENG_EDITRIDS_HRC +#define INCLUDED_INCLUDE_EDITENG_EDITRIDS_HRC + +#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) + +// enum SvxBreak ------------------------------------------------------------ +#define RID_SVXITEMS_BREAK_NONE NC_("RID_SVXITEMS_BREAK_NONE", "No break") +#define RID_SVXITEMS_BREAK_COLUMN_BEFORE NC_("RID_SVXITEMS_BREAK_COLUMN_BEFORE", "Break before new column") +#define RID_SVXITEMS_BREAK_COLUMN_AFTER NC_("RID_SVXITEMS_BREAK_COLUMN_AFTER", "Break after new column") +#define RID_SVXITEMS_BREAK_COLUMN_BOTH NC_("RID_SVXITEMS_BREAK_COLUMN_BOTH", "Break before and after new column") +#define RID_SVXITEMS_BREAK_PAGE_BEFORE NC_("RID_SVXITEMS_BREAK_PAGE_BEFORE", "Break before new page") +#define RID_SVXITEMS_BREAK_PAGE_AFTER NC_("RID_SVXITEMS_BREAK_PAGE_AFTER", "Break after new page") +#define RID_SVXITEMS_BREAK_PAGE_BOTH NC_("RID_SVXITEMS_BREAK_PAGE_BOTH", "Break before and after new page") + +// enum SvxShadowLocation --------------------------------------------------- +#define RID_SVXITEMS_SHADOW_NONE NC_("RID_SVXITEMS_SHADOW_NONE", "No Shadow") +#define RID_SVXITEMS_SHADOW_TOPLEFT NC_("RID_SVXITEMS_SHADOW_TOPLEFT", "Shadow top left") +#define RID_SVXITEMS_SHADOW_TOPRIGHT NC_("RID_SVXITEMS_SHADOW_TOPRIGHT", "Shadow top right") +#define RID_SVXITEMS_SHADOW_BOTTOMLEFT NC_("RID_SVXITEMS_SHADOW_BOTTOMLEFT", "Shadow bottom left") +#define RID_SVXITEMS_SHADOW_BOTTOMRIGHT NC_("RID_SVXITEMS_SHADOW_BOTTOMRIGHT", "Shadow bottom right") + +// enum ColorName ----------------------------------------------------------- +#define RID_SVXITEMS_COLOR_BLACK NC_("RID_SVXITEMS_COLOR_BLACK", "Black") +#define RID_SVXITEMS_COLOR_BLUE NC_("RID_SVXITEMS_COLOR_BLUE", "Blue") +#define RID_SVXITEMS_COLOR_GREEN NC_("RID_SVXITEMS_COLOR_GREEN", "Green") +#define RID_SVXITEMS_COLOR_CYAN NC_("RID_SVXITEMS_COLOR_CYAN", "Cyan") +#define RID_SVXITEMS_COLOR_RED NC_("RID_SVXITEMS_COLOR_RED", "Red") +#define RID_SVXITEMS_COLOR_MAGENTA NC_("RID_SVXITEMS_COLOR_MAGENTA", "Magenta") +#define RID_SVXITEMS_COLOR_BROWN NC_("RID_SVXITEMS_COLOR_BROWN", "Brown") +#define RID_SVXITEMS_COLOR_GRAY NC_("RID_SVXITEMS_COLOR_GRAY", "Gray") +#define RID_SVXITEMS_COLOR_LIGHTGRAY NC_("RID_SVXITEMS_COLOR_LIGHTGRAY", "Light Gray") +#define RID_SVXITEMS_COLOR_LIGHTBLUE NC_("RID_SVXITEMS_COLOR_LIGHTBLUE", "Light Blue") +#define RID_SVXITEMS_COLOR_LIGHTGREEN NC_("RID_SVXITEMS_COLOR_LIGHTGREEN", "Light Green") +#define RID_SVXITEMS_COLOR_LIGHTCYAN NC_("RID_SVXITEMS_COLOR_LIGHTCYAN", "Light Cyan") +#define RID_SVXITEMS_COLOR_LIGHTRED NC_("RID_SVXITEMS_COLOR_LIGHTRED", "Light Red") +#define RID_SVXITEMS_COLOR_LIGHTMAGENTA NC_("RID_SVXITEMS_COLOR_LIGHTMAGENTA", "Light Magenta") +#define RID_SVXITEMS_COLOR_YELLOW NC_("RID_SVXITEMS_COLOR_YELLOW", "Yellow") +#define RID_SVXITEMS_COLOR_WHITE NC_("RID_SVXITEMS_COLOR_WHITE", "White") + +// enum FontItalic ------------------------------------------------------- +#define RID_SVXITEMS_ITALIC_NONE NC_("RID_SVXITEMS_ITALIC_NONE", "Not Italic") +#define RID_SVXITEMS_ITALIC_OBLIQUE NC_("RID_SVXITEMS_ITALIC_OBLIQUE", "Oblique italic") +#define RID_SVXITEMS_ITALIC_NORMAL NC_("RID_SVXITEMS_ITALIC_NORMAL", "Italic") + +// enum FontWeight ------------------------------------------------------- +#define RID_SVXITEMS_WEIGHT_DONTKNOW NC_("RID_SVXITEMS_WEIGHT_DONTKNOW", "?") +#define RID_SVXITEMS_WEIGHT_THIN NC_("RID_SVXITEMS_WEIGHT_THIN", "thin") +#define RID_SVXITEMS_WEIGHT_ULTRALIGHT NC_("RID_SVXITEMS_WEIGHT_ULTRALIGHT", "ultra thin") +#define RID_SVXITEMS_WEIGHT_LIGHT NC_("RID_SVXITEMS_WEIGHT_LIGHT", "light") +#define RID_SVXITEMS_WEIGHT_SEMILIGHT NC_("RID_SVXITEMS_WEIGHT_SEMILIGHT", "semi light") +#define RID_SVXITEMS_WEIGHT_NORMAL NC_("RID_SVXITEMS_WEIGHT_NORMAL", "normal") +#define RID_SVXITEMS_WEIGHT_MEDIUM NC_("RID_SVXITEMS_WEIGHT_MEDIUM", "medium") +#define RID_SVXITEMS_WEIGHT_SEMIBOLD NC_("RID_SVXITEMS_WEIGHT_SEMIBOLD", "semi bold") +#define RID_SVXITEMS_WEIGHT_BOLD NC_("RID_SVXITEMS_WEIGHT_BOLD", "bold") +#define RID_SVXITEMS_WEIGHT_ULTRABOLD NC_("RID_SVXITEMS_WEIGHT_ULTRABOLD", "ultra bold") +#define RID_SVXITEMS_WEIGHT_BLACK NC_("RID_SVXITEMS_WEIGHT_BLACK", "black") + +// enum FontUnderline - used for underline ------------------------------ +#define RID_SVXITEMS_UL_NONE NC_("RID_SVXITEMS_UL_NONE", "No underline") +#define RID_SVXITEMS_UL_SINGLE NC_("RID_SVXITEMS_UL_SINGLE", "Single underline") +#define RID_SVXITEMS_UL_DOUBLE NC_("RID_SVXITEMS_UL_DOUBLE", "Double underline") +#define RID_SVXITEMS_UL_DOTTED NC_("RID_SVXITEMS_UL_DOTTED", "Dotted underline") +#define RID_SVXITEMS_UL_DONTKNOW NC_("RID_SVXITEMS_UL_DONTKNOW", "Underline") +#define RID_SVXITEMS_UL_DASH NC_("RID_SVXITEMS_UL_DASH", "Underline (dashes)") +#define RID_SVXITEMS_UL_LONGDASH NC_("RID_SVXITEMS_UL_LONGDASH", "Underline (long dashes)") +#define RID_SVXITEMS_UL_DASHDOT NC_("RID_SVXITEMS_UL_DASHDOT", "Underline (dot dash)") +#define RID_SVXITEMS_UL_DASHDOTDOT NC_("RID_SVXITEMS_UL_DASHDOTDOT", "Underline (dot dot dash)") +#define RID_SVXITEMS_UL_SMALLWAVE NC_("RID_SVXITEMS_UL_SMALLWAVE", "Underline (small wave)") +#define RID_SVXITEMS_UL_WAVE NC_("RID_SVXITEMS_UL_WAVE", "Underline (Wave)") +#define RID_SVXITEMS_UL_DOUBLEWAVE NC_("RID_SVXITEMS_UL_DOUBLEWAVE", "Underline (Double wave)") +#define RID_SVXITEMS_UL_BOLD NC_("RID_SVXITEMS_UL_BOLD", "Underlined (Bold)") +#define RID_SVXITEMS_UL_BOLDDOTTED NC_("RID_SVXITEMS_UL_BOLDDOTTED", "Dotted underline (Bold)") +#define RID_SVXITEMS_UL_BOLDDASH NC_("RID_SVXITEMS_UL_BOLDDASH", "Underline (Dash bold)") +#define RID_SVXITEMS_UL_BOLDLONGDASH NC_("RID_SVXITEMS_UL_BOLDLONGDASH", "Underline (long dash, bold)") +#define RID_SVXITEMS_UL_BOLDDASHDOT NC_("RID_SVXITEMS_UL_BOLDDASHDOT", "Underline (dot dash, bold)") +#define RID_SVXITEMS_UL_BOLDDASHDOTDOT NC_("RID_SVXITEMS_UL_BOLDDASHDOTDOT", "Underline (dot dot dash, bold)") +#define RID_SVXITEMS_UL_BOLDWAVE NC_("RID_SVXITEMS_UL_BOLDWAVE", "Underline (wave, bold)") + +// enum FontUnderline - used for overline ------------------------------- +#define RID_SVXITEMS_OL_NONE NC_("RID_SVXITEMS_OL_NONE", "No overline") +#define RID_SVXITEMS_OL_SINGLE NC_("RID_SVXITEMS_OL_SINGLE", "Single overline") +#define RID_SVXITEMS_OL_DOUBLE NC_("RID_SVXITEMS_OL_DOUBLE", "Double overline") +#define RID_SVXITEMS_OL_DOTTED NC_("RID_SVXITEMS_OL_DOTTED", "Dotted overline") +#define RID_SVXITEMS_OL_DONTKNOW NC_("RID_SVXITEMS_OL_DONTKNOW", "Overline") +#define RID_SVXITEMS_OL_DASH NC_("RID_SVXITEMS_OL_DASH", "Overline (dashes)") +#define RID_SVXITEMS_OL_LONGDASH NC_("RID_SVXITEMS_OL_LONGDASH", "Overline (long dashes)") +#define RID_SVXITEMS_OL_DASHDOT NC_("RID_SVXITEMS_OL_DASHDOT", "Overline (dot dash)") +#define RID_SVXITEMS_OL_DASHDOTDOT NC_("RID_SVXITEMS_OL_DASHDOTDOT", "Overline (dot dot dash)") +#define RID_SVXITEMS_OL_SMALLWAVE NC_("RID_SVXITEMS_OL_SMALLWAVE", "Overline (small wave)") +#define RID_SVXITEMS_OL_WAVE NC_("RID_SVXITEMS_OL_WAVE", "Overline (Wave)") +#define RID_SVXITEMS_OL_DOUBLEWAVE NC_("RID_SVXITEMS_OL_DOUBLEWAVE", "Overline (Double wave)") +#define RID_SVXITEMS_OL_BOLD NC_("RID_SVXITEMS_OL_BOLD", "Overlined (Bold)") +#define RID_SVXITEMS_OL_BOLDDOTTED NC_("RID_SVXITEMS_OL_BOLDDOTTED", "Dotted overline (Bold)") +#define RID_SVXITEMS_OL_BOLDDASH NC_("RID_SVXITEMS_OL_BOLDDASH", "Overline (Dash bold)") +#define RID_SVXITEMS_OL_BOLDLONGDASH NC_("RID_SVXITEMS_OL_BOLDLONGDASH", "Overline (long dash, bold)") +#define RID_SVXITEMS_OL_BOLDDASHDOT NC_("RID_SVXITEMS_OL_BOLDDASHDOT", "Overline (dot dash, bold)") +#define RID_SVXITEMS_OL_BOLDDASHDOTDOT NC_("RID_SVXITEMS_OL_BOLDDASHDOTDOT", "Overline (dot dot dash, bold)") +#define RID_SVXITEMS_OL_BOLDWAVE NC_("RID_SVXITEMS_OL_BOLDWAVE", "Overline (wave, bold)") + +// enum FontStrikeout ---------------------------------------------------- +#define RID_SVXITEMS_STRIKEOUT_NONE NC_("RID_SVXITEMS_STRIKEOUT_NONE", "No strikethrough") +#define RID_SVXITEMS_STRIKEOUT_SINGLE NC_("RID_SVXITEMS_STRIKEOUT_SINGLE", "Single strikethrough") +#define RID_SVXITEMS_STRIKEOUT_DOUBLE NC_("RID_SVXITEMS_STRIKEOUT_DOUBLE", "Double strikethrough") +#define RID_SVXITEMS_STRIKEOUT_DONTKNOW NC_("RID_SVXITEMS_STRIKEOUT_DONTKNOW", "Strikethrough") +#define RID_SVXITEMS_STRIKEOUT_BOLD NC_("RID_SVXITEMS_STRIKEOUT_BOLD", "Bold strikethrough") +#define RID_SVXITEMS_STRIKEOUT_SLASH NC_("RID_SVXITEMS_STRIKEOUT_SLASH", "Strike through with slash") +#define RID_SVXITEMS_STRIKEOUT_X NC_("RID_SVXITEMS_STRIKEOUT_X", "Strike through with Xes") + +// enum CASEMAP ---------------------------------------------------------- +#define RID_SVXITEMS_CASEMAP_NONE NC_("RID_SVXITEMS_CASEMAP_NONE", "None") +#define RID_SVXITEMS_CASEMAP_UPPERCASE NC_("RID_SVXITEMS_CASEMAP_VERSALIEN", "Caps") +#define RID_SVXITEMS_CASEMAP_LOWERCASE NC_("RID_SVXITEMS_CASEMAP_GEMEINE", "Lowercase") +#define RID_SVXITEMS_CASEMAP_TITLE NC_("RID_SVXITEMS_CASEMAP_TITEL", "Title") +#define RID_SVXITEMS_CASEMAP_SMALLCAPS NC_("RID_SVXITEMS_CASEMAP_KAPITAELCHEN", "Small caps") + +// enum ESCAPEMENT ------------------------------------------------------- +#define RID_SVXITEMS_ESCAPEMENT_OFF NC_("RID_SVXITEMS_ESCAPEMENT_OFF", "Normal position") +#define RID_SVXITEMS_ESCAPEMENT_SUPER NC_("RID_SVXITEMS_ESCAPEMENT_SUPER", "Superscript ") +#define RID_SVXITEMS_ESCAPEMENT_SUB NC_("RID_SVXITEMS_ESCAPEMENT_SUB", "Subscript ") +#define RID_SVXITEMS_ESCAPEMENT_AUTO NC_("RID_SVXITEMS_ESCAPEMENT_AUTO", "automatic") + +// enum SvxAdjust ----------------------------------------------------------- +#define RID_SVXITEMS_ADJUST_LEFT NC_("RID_SVXITEMS_ADJUST_LEFT", "Align left") +#define RID_SVXITEMS_ADJUST_RIGHT NC_("RID_SVXITEMS_ADJUST_RIGHT", "Align right") +#define RID_SVXITEMS_ADJUST_BLOCK NC_("RID_SVXITEMS_ADJUST_BLOCK", "Justify") +#define RID_SVXITEMS_ADJUST_CENTER NC_("RID_SVXITEMS_ADJUST_CENTER", "Centered") +#define RID_SVXITEMS_ADJUST_BLOCKLINE NC_("RID_SVXITEMS_ADJUST_BLOCKLINE", "Justify") +#define RID_SOLID NC_("RID_SOLID", "Single, solid") +#define RID_DOTTED NC_("RID_DOTTED", "Single, dotted") +#define RID_DASHED NC_("RID_DASHED", "Single, dashed") +#define RID_DOUBLE NC_("RID_DOUBLE", "Double") +#define RID_THINTHICK_SMALLGAP NC_("RID_THINTHICK_SMALLGAP", "Double, inside: fine, outside: thick, spacing: small") +#define RID_THINTHICK_MEDIUMGAP NC_("RID_THINTHICK_MEDIUMGAP", "Double, inside: fine, outside: thick, spacing: medium") +#define RID_THINTHICK_LARGEGAP NC_("RID_THINTHICK_LARGEGAP", "Double, inside: fine, outside: thick, spacing: large") +#define RID_THICKTHIN_SMALLGAP NC_("RID_THICKTHIN_SMALLGAP", "Double, inside: thick, outside: fine, spacing: small") +#define RID_THICKTHIN_MEDIUMGAP NC_("RID_THICKTHIN_MEDIUMGAP", "Double, inside: thick, outside: fine, spacing: medium") +#define RID_THICKTHIN_LARGEGAP NC_("RID_THICKTHIN_LARGEGAP", "Double, inside: thick, outside: fine, spacing: large") +#define RID_EMBOSSED NC_("RID_EMBOSSED", "3D embossed") +#define RID_ENGRAVED NC_("RID_ENGRAVED", "3D engraved") +#define RID_INSET NC_("RID_INSET", "Inset") +#define RID_OUTSET NC_("RID_OUTSET", "Outset") +#define RID_FINE_DASHED NC_("RID_FINE_DASHED", "Single, fine dashed") +#define RID_DOUBLE_THIN NC_("RID_DOUBLE_THIN", "Double, fixed thin lines") +#define RID_DASH_DOT NC_("RID_DASH_DOT", "Single, dash-dot") +#define RID_DASH_DOT_DOT NC_("RID_DASH_DOT_DOT", "Single, dash-dot-dot") +#define RID_SVXITEMS_METRIC_MM NC_("RID_SVXITEMS_METRIC_MM", "mm") +#define RID_SVXITEMS_METRIC_CM NC_("RID_SVXITEMS_METRIC_CM", "cm") +#define RID_SVXITEMS_METRIC_INCH NC_("RID_SVXITEMS_METRIC_INCH", "inch") +#define RID_SVXITEMS_METRIC_POINT NC_("RID_SVXITEMS_METRIC_POINT", "pt") +#define RID_SVXITEMS_METRIC_TWIP NC_("RID_SVXITEMS_METRIC_TWIP", "twip") +#define RID_SVXITEMS_METRIC_PIXEL NC_("RID_SVXITEMS_METRIC_PIXEL", "pixel") + +// GetValueText of BoolItems +#define RID_SVXITEMS_SHADOWED_TRUE NC_("RID_SVXITEMS_SHADOWED_TRUE", "Shadowed") +#define RID_SVXITEMS_SHADOWED_FALSE NC_("RID_SVXITEMS_SHADOWED_FALSE", "Not Shadowed") +#define RID_SVXITEMS_BLINK_TRUE NC_("RID_SVXITEMS_BLINK_TRUE", "Blinking") +#define RID_SVXITEMS_BLINK_FALSE NC_("RID_SVXITEMS_BLINK_FALSE", "Not Blinking") +#define RID_SVXITEMS_AUTOKERN_TRUE NC_("RID_SVXITEMS_AUTOKERN_TRUE", "Pair Kerning") +#define RID_SVXITEMS_AUTOKERN_FALSE NC_("RID_SVXITEMS_AUTOKERN_FALSE", "No pair kerning") +#define RID_SVXITEMS_WORDLINE_TRUE NC_("RID_SVXITEMS_WORDLINE_TRUE", "Individual words") +#define RID_SVXITEMS_WORDLINE_FALSE NC_("RID_SVXITEMS_WORDLINE_FALSE", "Not Words Only") +#define RID_SVXITEMS_CONTOUR_TRUE NC_("RID_SVXITEMS_CONTOUR_TRUE", "Outline") +#define RID_SVXITEMS_CONTOUR_FALSE NC_("RID_SVXITEMS_CONTOUR_FALSE", "No Outline") +#define RID_SVXITEMS_PRINT_TRUE NC_("RID_SVXITEMS_PRINT_TRUE", "Print") +#define RID_SVXITEMS_PRINT_FALSE NC_("RID_SVXITEMS_PRINT_FALSE", "Don't print") +#define RID_SVXITEMS_OPAQUE_TRUE NC_("RID_SVXITEMS_OPAQUE_TRUE", "Opaque") +#define RID_SVXITEMS_OPAQUE_FALSE NC_("RID_SVXITEMS_OPAQUE_FALSE", "Not Opaque") +#define RID_SVXITEMS_FMTKEEP_TRUE NC_("RID_SVXITEMS_FMTKEEP_TRUE", "Keep with next paragraph") +#define RID_SVXITEMS_FMTKEEP_FALSE NC_("RID_SVXITEMS_FMTKEEP_FALSE", "Don't Keep Paragraphs Together") +#define RID_SVXITEMS_FMTSPLIT_TRUE NC_("RID_SVXITEMS_FMTSPLIT_TRUE", "Split paragraph") +#define RID_SVXITEMS_FMTSPLIT_FALSE NC_("RID_SVXITEMS_FMTSPLIT_FALSE", "Don't split paragraph") +#define RID_SVXITEMS_PROT_CONTENT_TRUE NC_("RID_SVXITEMS_PROT_CONTENT_TRUE", "Contents protected") +#define RID_SVXITEMS_PROT_CONTENT_FALSE NC_("RID_SVXITEMS_PROT_CONTENT_FALSE", "Contents not protected") +#define RID_SVXITEMS_PROT_SIZE_TRUE NC_("RID_SVXITEMS_PROT_SIZE_TRUE", "Size protected") +#define RID_SVXITEMS_PROT_SIZE_FALSE NC_("RID_SVXITEMS_PROT_SIZE_FALSE", "Size not protected") +#define RID_SVXITEMS_PROT_POS_TRUE NC_("RID_SVXITEMS_PROT_POS_TRUE", "Position protected") +#define RID_SVXITEMS_PROT_POS_FALSE NC_("RID_SVXITEMS_PROT_POS_FALSE", "Position not protected") +#define RID_SVXITEMS_TRANSPARENT_TRUE NC_("RID_SVXITEMS_TRANSPARENT_TRUE", "Transparent") +#define RID_SVXITEMS_TRANSPARENT_FALSE NC_("RID_SVXITEMS_TRANSPARENT_FALSE", "Not Transparent") +#define RID_SVXITEMS_HYPHEN_TRUE NC_("RID_SVXITEMS_HYPHEN_TRUE", "Hyphenation") +#define RID_SVXITEMS_HYPHEN_FALSE NC_("RID_SVXITEMS_HYPHEN_FALSE", "No hyphenation") +#define RID_SVXITEMS_PAGE_END_TRUE NC_("RID_SVXITEMS_PAGE_END_TRUE", "Page End") +#define RID_SVXITEMS_PAGE_END_FALSE NC_("RID_SVXITEMS_PAGE_END_FALSE", "No Page End") +#define RID_SVXITEMS_SIZE_WIDTH NC_("RID_SVXITEMS_SIZE_WIDTH", "Width: ") +#define RID_SVXITEMS_SIZE_HEIGHT NC_("RID_SVXITEMS_SIZE_HEIGHT", "Height: ") +#define RID_SVXITEMS_LRSPACE_LEFT NC_("RID_SVXITEMS_LRSPACE_LEFT", "Indent left ") +#define RID_SVXITEMS_LRSPACE_FLINE NC_("RID_SVXITEMS_LRSPACE_FLINE", "First Line ") +#define RID_SVXITEMS_LRSPACE_RIGHT NC_("RID_SVXITEMS_LRSPACE_RIGHT", "Indent right ") +#define RID_SVXITEMS_SHADOW_COMPLETE NC_("RID_SVXITEMS_SHADOW_COMPLETE", "Shadow: ") +#define RID_SVXITEMS_BORDER_COMPLETE NC_("RID_SVXITEMS_BORDER_COMPLETE", "Borders ") +#define RID_SVXITEMS_BORDER_NONE NC_("RID_SVXITEMS_BORDER_NONE", "No border") +#define RID_SVXITEMS_BORDER_TOP NC_("RID_SVXITEMS_BORDER_TOP", "top ") +#define RID_SVXITEMS_BORDER_BOTTOM NC_("RID_SVXITEMS_BORDER_BOTTOM", "bottom ") +#define RID_SVXITEMS_BORDER_LEFT NC_("RID_SVXITEMS_BORDER_LEFT", "left ") +#define RID_SVXITEMS_BORDER_RIGHT NC_("RID_SVXITEMS_BORDER_RIGHT", "right ") +#define RID_SVXITEMS_BORDER_DISTANCE NC_("RID_SVXITEMS_BORDER_DISTANCE", "Spacing ") +#define RID_SVXITEMS_ULSPACE_UPPER NC_("RID_SVXITEMS_ULSPACE_UPPER", "From top ") +#define RID_SVXITEMS_ULSPACE_LOWER NC_("RID_SVXITEMS_ULSPACE_LOWER", "From bottom ") +#define RID_SVXITEMS_LINESPACING_SINGLE NC_("RID_SVXITEMS_LINESPACING_SINGLE", "Single") +#define RID_SVXITEMS_LINESPACING_115 NC_("RID_SVXITEMS_LINESPACING_115", "1.15 Lines") +#define RID_SVXITEMS_LINESPACING_15 NC_("RID_SVXITEMS_LINESPACING_15", "1.5 Lines") +#define RID_SVXITEMS_LINESPACING_DOUBLE NC_("RID_SVXITEMS_LINESPACING_DOUBLE", "Double") +#define RID_SVXITEMS_LINESPACING_PROPORTIONAL NC_("RID_SVXITEMS_LINESPACING_PROPORTIONAL", "Proportional") +#define RID_SVXITEMS_LINESPACING_MIN NC_("RID_SVXITEMS_LINESPACING_MIN", "At least") +#define RID_SVXITEMS_LINESPACING_LEADING NC_("RID_SVXITEMS_LINESPACING_LEADING", "Leading") +#define RID_SVXITEMS_LINESPACING_FIXED NC_("RID_SVXITEMS_LINESPACING_FIXED", "Fixed") +// To translators: %1 == will be replaced by the number of lines +#define RID_SVXITEMS_LINES NC_("RID_SVXITEMS_LINES", "%1 Lines") +#define RID_SVXITEMS_WIDOWS_COMPLETE NC_("RID_SVXITEMS_WIDOWS_COMPLETE", "Widow control") +#define RID_SVXITEMS_ORPHANS_COMPLETE NC_("RID_SVXITEMS_ORPHANS_COMPLETE", "Orphan control") +#define RID_SVXITEMS_HYPHEN_MINLEAD NC_("RID_SVXITEMS_HYPHEN_MINLEAD", "%1 characters at end of line") +#define RID_SVXITEMS_HYPHEN_MINTRAIL NC_("RID_SVXITEMS_HYPHEN_MINTRAIL", "%1 characters at beginning of line") +#define RID_SVXITEMS_HYPHEN_MAX NC_("RID_SVXITEMS_HYPHEN_MAX", "%1 hyphens") +#define RID_SVXITEMS_HYPHEN_NO_CAPS_TRUE NC_("RID_SVXITEMS_HYPHEN_NO_CAPS_TRUE", "Not hyphenated CAPS") +#define RID_SVXITEMS_HYPHEN_LAST_WORD_TRUE NC_("RID_SVXITEMS_HYPHEN_NO_CAPS_FALSE", "Not hyphenated last word") +#define RID_SVXITEMS_HYPHEN_MINWORDLEN NC_("RID_SVXITEMS_HYPHEN_MINWORDLEN", "%1 characters in words") +#define RID_SVXITEMS_HYPHEN_ZONE NC_("RID_SVXITEMS_HYPHEN_ZONE", "Hyphenation zone ") +#define RID_SVXITEMS_PAGEMODEL_COMPLETE NC_("RID_SVXITEMS_PAGEMODEL_COMPLETE", "Page Style: ") +#define RID_SVXITEMS_KERNING_COMPLETE NC_("RID_SVXITEMS_KERNING_COMPLETE", "Kerning ") +#define RID_SVXITEMS_KERNING_EXPANDED NC_("RID_SVXITEMS_KERNING_EXPANDED", "locked ") +#define RID_SVXITEMS_KERNING_CONDENSED NC_("RID_SVXITEMS_KERNING_CONDENSED", "Condensed ") +#define RID_SVXITEMS_GRAPHIC NC_("RID_SVXITEMS_GRAPHIC", "Graphic") +#define RID_SVXITEMS_EMPHASIS_NONE_STYLE NC_("RID_SVXITEMS_EMPHASIS_NONE_STYLE", "none") +#define RID_SVXITEMS_EMPHASIS_DOT_STYLE NC_("RID_SVXITEMS_EMPHASIS_DOT_STYLE", "Dots ") +#define RID_SVXITEMS_EMPHASIS_CIRCLE_STYLE NC_("RID_SVXITEMS_EMPHASIS_CIRCLE_STYLE", "Circle ") +// ??? disc == filled ring +#define RID_SVXITEMS_EMPHASIS_DISC_STYLE NC_("RID_SVXITEMS_EMPHASIS_DISC_STYLE", "Filled circle ") +#define RID_SVXITEMS_EMPHASIS_ACCENT_STYLE NC_("RID_SVXITEMS_EMPHASIS_ACCENT_STYLE", "Accent ") +#define RID_SVXITEMS_EMPHASIS_ABOVE_POS NC_("RID_SVXITEMS_EMPHASIS_ABOVE_POS", "Above") +#define RID_SVXITEMS_EMPHASIS_BELOW_POS NC_("RID_SVXITEMS_EMPHASIS_BELOW_POS", "Below") +#define RID_SVXITEMS_TWOLINES_OFF NC_("RID_SVXITEMS_TWOLINES_OFF", "Double-lined off") +#define RID_SVXITEMS_TWOLINES NC_("RID_SVXITEMS_TWOLINES", "Double-lined") +#define RID_SVXITEMS_SCRPTSPC_OFF NC_("RID_SVXITEMS_SCRPTSPC_OFF", "No automatic character spacing") +#define RID_SVXITEMS_SCRPTSPC_ON NC_("RID_SVXITEMS_SCRPTSPC_ON", "No automatic character spacing") +#define RID_SVXITEMS_HNGPNCT_OFF NC_("RID_SVXITEMS_HNGPNCT_OFF", "No hanging punctuation at line end") +#define RID_SVXITEMS_HNGPNCT_ON NC_("RID_SVXITEMS_HNGPNCT_ON", "Hanging punctuation at line end") +#define RID_SVXITEMS_FORBIDDEN_RULE_OFF NC_("RID_SVXITEMS_FORBIDDEN_RULE_OFF", "Apply list of forbidden characters to beginning and end of lines") +#define RID_SVXITEMS_FORBIDDEN_RULE_ON NC_("RID_SVXITEMS_FORBIDDEN_RULE_ON", "Don't apply list of forbidden characters to beginning and end of lines") +#define RID_SVXITEMS_CHARROTATE_OFF NC_("RID_SVXITEMS_CHARROTATE_OFF", "No rotated characters") +#define RID_SVXITEMS_CHARROTATE NC_("RID_SVXITEMS_CHARROTATE", "Character rotated by $(ARG1)°") +#define RID_SVXITEMS_CHARROTATE_FITLINE NC_("RID_SVXITEMS_CHARROTATE_FITLINE", "Fit to line") +#define RID_SVXITEMS_TEXTROTATE_OFF NC_("RID_SVXITEMS_TEXTROTATE_OFF", "Text is not rotated") +#define RID_SVXITEMS_TEXTROTATE NC_("RID_SVXITEMS_TEXTROTATE", "Text is rotated by $(ARG1)°") +#define RID_SVXITEMS_CHARSCALE NC_("RID_SVXITEMS_CHARSCALE", "Characters scaled $(ARG1)%") +#define RID_SVXITEMS_CHARSCALE_OFF NC_("RID_SVXITEMS_CHARSCALE_OFF", "No scaled characters") +#define RID_SVXITEMS_RELIEF_NONE NC_("RID_SVXITEMS_RELIEF_NONE", "No relief") +#define RID_SVXITEMS_RELIEF_EMBOSSED NC_("RID_SVXITEMS_RELIEF_EMBOSSED", "Relief") +#define RID_SVXITEMS_RELIEF_ENGRAVED NC_("RID_SVXITEMS_RELIEF_ENGRAVED", "Engraved") +#define RID_SVXITEMS_PARAVERTALIGN_AUTO NC_("RID_SVXITEMS_PARAVERTALIGN_AUTO", "Automatic text alignment") +#define RID_SVXITEMS_PARAVERTALIGN_BASELINE NC_("RID_SVXITEMS_PARAVERTALIGN_BASELINE", "Text aligned to base line") +#define RID_SVXITEMS_PARAVERTALIGN_TOP NC_("RID_SVXITEMS_PARAVERTALIGN_TOP", "Text aligned top") +#define RID_SVXITEMS_PARAVERTALIGN_CENTER NC_("RID_SVXITEMS_PARAVERTALIGN_CENTER", "Text aligned middle") +#define RID_SVXITEMS_PARAVERTALIGN_BOTTOM NC_("RID_SVXITEMS_PARAVERTALIGN_BOTTOM", "Text aligned bottom") +#define RID_SVXITEMS_FRMDIR_HORI_LEFT_TOP NC_("RID_SVXITEMS_FRMDIR_HORI_LEFT_TOP", "Text direction left-to-right (horizontal)") +#define RID_SVXITEMS_FRMDIR_HORI_RIGHT_TOP NC_("RID_SVXITEMS_FRMDIR_HORI_RIGHT_TOP", "Text direction right-to-left (horizontal)") +#define RID_SVXITEMS_FRMDIR_VERT_TOP_RIGHT NC_("RID_SVXITEMS_FRMDIR_VERT_TOP_RIGHT", "Text direction right-to-left (vertical)") +#define RID_SVXITEMS_FRMDIR_VERT_TOP_LEFT NC_("RID_SVXITEMS_FRMDIR_VERT_TOP_LEFT", "Text direction left-to-right (vertical)") +#define RID_SVXITEMS_FRMDIR_ENVIRONMENT NC_("RID_SVXITEMS_FRMDIR_ENVIRONMENT", "Use superordinate object text direction setting") +#define RID_SVXITEMS_FRMDIR_VERT_BOT_LEFT NC_("RID_SVXITEMS_FRMDIR_VERT_BOT_LEFT", "Text direction left-to-right (vertical from bottom)") +#define RID_SVXITEMS_PARASNAPTOGRID_ON NC_("RID_SVXITEMS_PARASNAPTOGRID_ON", "Paragraph snaps to text grid (if active)") +#define RID_SVXITEMS_PARASNAPTOGRID_OFF NC_("RID_SVXITEMS_PARASNAPTOGRID_OFF", "Paragraph does not snap to text grid") +#define RID_SVXITEMS_CHARHIDDEN_FALSE NC_("RID_SVXITEMS_CHARHIDDEN_FALSE", "Not hidden") +#define RID_SVXITEMS_CHARHIDDEN_TRUE NC_("RID_SVXITEMS_CHARHIDDEN_TRUE", "Hidden") + +#define RID_SVXSTR_PAPERBIN NC_("RID_SVXSTR_PAPERBIN", "Paper tray") +#define RID_SVXSTR_PAPERBIN_SETTINGS NC_("RID_SVXSTR_PAPERBIN_SETTINGS", "[From printer settings]") + +#define RID_EDITUNDO_DEL NC_("RID_EDITUNDO_DEL", "Delete") +#define RID_EDITUNDO_MOVE NC_("RID_EDITUNDO_MOVE", "Move") +#define RID_EDITUNDO_INSERT NC_("RID_EDITUNDO_INSERT", "Insert") +#define RID_EDITUNDO_REPLACE NC_("RID_EDITUNDO_REPLACE", "Replace") +#define RID_EDITUNDO_SETATTRIBS NC_("RID_EDITUNDO_SETATTRIBS", "Apply attributes") +#define RID_EDITUNDO_RESETATTRIBS NC_("RID_EDITUNDO_RESETATTRIBS", "Reset attributes") +#define RID_EDITUNDO_INDENT NC_("RID_EDITUNDO_INDENT", "Indent") +#define RID_EDITUNDO_SETSTYLE NC_("RID_EDITUNDO_SETSTYLE", "Apply Styles") +#define RID_EDITUNDO_TRANSLITERATE NC_("RID_EDITUNDO_TRANSLITERATE", "Change Case") +#define RID_STR_WORD NC_("RID_STR_WORD", "Word is %x") +#define RID_STR_PARAGRAPH NC_("RID_STR_PARAGRAPH", "Paragraph is %x") +#define RID_SVXSTR_AUTOMATIC NC_("RID_SVXSTR_AUTOMATIC", "Automatic") + +#define RID_SVXSTR_A11Y_IMAGEBULLET_DESCRIPTION NC_("RID_SVXSTR_A11Y_IMAGEBULLET_DESCRIPTION", "Image bullet in paragraph") +#define RID_SVXSTR_A11Y_IMAGEBULLET_NAME NC_("RID_SVXSTR_A11Y_IMAGEBULLET_NAME", "Image bullet") +#define RID_SVXSTR_A11Y_PARAGRAPH_DESCRIPTION NC_("RID_SVXSTR_A11Y_PARAGRAPH_DESCRIPTION", "Paragraph: $(ARG) ") + +#define RID_SVXSTR_QUERY_CONTINUE NC_("RID_SVXSTR_QUERY_CONTINUE", "Continue checking at beginning of document?") +#define RID_SVXSTR_QUERY_BW_CONTINUE NC_("RID_SVXSTR_QUERY_BW_CONTINUE", "Continue checking at end of document?") +#define RID_SVXSTR_DIC_ERR_UNKNOWN NC_("RID_SVXSTR_DIC_ERR_UNKNOWN", "Word cannot be added to dictionary\ndue to unknown reason.") +#define RID_SVXSTR_DIC_ERR_FULL NC_("RID_SVXSTR_DIC_ERR_FULL", "The dictionary is already full.") +#define RID_SVXSTR_DIC_ERR_READONLY NC_("RID_SVXSTR_DIC_ERR_READONLY", "The dictionary is read-only.") + +#define RID_OUTLUNDO_DEPTH NC_("RID_OUTLUNDO_DEPTH", "Indent") +#define RID_OUTLUNDO_EXPAND NC_("RID_OUTLUNDO_EXPAND", "Show subpoints") +#define RID_OUTLUNDO_COLLAPSE NC_("RID_OUTLUNDO_COLLAPSE", "Collapse") +#define RID_OUTLUNDO_ATTR NC_("RID_OUTLUNDO_ATTR", "Apply attributes") +#define RID_OUTLUNDO_INSERT NC_("RID_OUTLUNDO_INSERT", "Insert") + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/editstat.hxx b/include/editeng/editstat.hxx new file mode 100644 index 000000000..eec50ea67 --- /dev/null +++ b/include/editeng/editstat.hxx @@ -0,0 +1,144 @@ +/* -*- 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_EDITENG_EDITSTAT_HXX +#define INCLUDED_EDITENG_EDITSTAT_HXX + +#include <rtl/ustring.hxx> +#include <o3tl/typed_flags_set.hxx> +#include <utility> + +enum class EEControlBits +{ + NONE = 0x00000000, + USECHARATTRIBS = 0x00000001, // Use of hard character attributes + DOIDLEFORMAT = 0x00000008, // Formatting idle + PASTESPECIAL = 0x00000010, // Allow PasteSpecial + AUTOINDENTING = 0x00000020, // Automatic indenting + UNDOATTRIBS = 0x00000040, // Undo for Attributes... + ONECHARPERLINE = 0x00000080, // One character per line + NOCOLORS = 0x00000100, // Engine: No Color + OUTLINER = 0x00000200, // Special treatment Outliner/Outline mode + OUTLINER2 = 0x00000400, // Special treatment Outliner/Page + ALLOWBIGOBJS = 0x00000800, // Portion info in text object + ONLINESPELLING = 0x00001000, // During the edit Spelling + STRETCHING = 0x00002000, // Stretch mode + MARKNONURLFIELDS = 0x00004000, // Mark fields other than URL with color + MARKURLFIELDS = 0x00008000, // Mark URL fields with color + MARKFIELDS = (MARKNONURLFIELDS | MARKURLFIELDS), + RTFSTYLESHEETS = 0x00020000, // Use Stylesheets when imported + AUTOCORRECT = 0x00080000, // AutoCorrect + AUTOCOMPLETE = 0x00100000, // AutoComplete + AUTOPAGESIZEX = 0x00200000, // Adjust paper width to Text + AUTOPAGESIZEY = 0x00400000, // Adjust paper height to Text + AUTOPAGESIZE = (AUTOPAGESIZEX | AUTOPAGESIZEY), + FORMAT100 = 0x01000000, // Always format to 100% + ULSPACESUMMATION = 0x02000000, // MS Compat: sum SA and SB, not maximum value +}; +namespace o3tl +{ + template<> struct typed_flags<EEControlBits> : is_typed_flags<EEControlBits, 0x037afff9> {}; +} + +enum class EVControlBits +{ + AUTOSCROLL = 0x0001, // Auto scrolling horizontally + ENABLEPASTE = 0x0004, // Enable Paste + SINGLELINEPASTE = 0x0008, // View: Paste in input line ... + OVERWRITE = 0x0010, // Overwrite mode + INVONEMORE = 0x0020, // Invalidate one pixel more + AUTOSIZEX = 0x0040, // Automatically adapt to text width + AUTOSIZEY = 0x0080, // Automatically adapt to Text width + AUTOSIZE = (AUTOSIZEX|AUTOSIZEY) +}; +namespace o3tl +{ + template<> struct typed_flags<EVControlBits> : is_typed_flags<EVControlBits, 0xfd> {}; +} + +enum class EditStatusFlags +{ + NONE = 0x0000, + HSCROLL = 0x0001, + VSCROLL = 0x0002, + CURSOROUT = 0x0004, + TEXTWIDTHCHANGED = 0x0010, + TextHeightChanged = 0x0020, + WRONGWORDCHANGED = 0x0040 +}; +namespace o3tl +{ + template<> struct typed_flags<EditStatusFlags> : is_typed_flags<EditStatusFlags, 0x77> {}; +} + +inline void SetFlags( EVControlBits& rBits, EVControlBits nMask, bool bOn ) +{ + if ( bOn ) + rBits |= nMask; + else + rBits &= ~nMask; +} + +class EditStatus +{ +protected: + EditStatusFlags nStatusBits; + EEControlBits nControlBits; + +public: + EditStatus() { nStatusBits = EditStatusFlags::NONE; nControlBits = EEControlBits::NONE; } + + void Clear() { nStatusBits = EditStatusFlags::NONE; } + + EditStatusFlags GetStatusWord() const { return nStatusBits; } + EditStatusFlags& GetStatusWord() { return nStatusBits; } + + EEControlBits& GetControlWord() { return nControlBits; } +}; + +enum class SpellCallbackCommand +{ + IGNOREWORD = 0x0001, + STARTSPELLDLG = 0x0002, + ADDTODICTIONARY = 0x0003, + WORDLANGUAGE = 0x0004, + PARALANGUAGE = 0x0005, + AUTOCORRECT_OPTIONS = 0x0006, +}; + +struct SpellCallbackInfo +{ + SpellCallbackCommand nCommand; + OUString aWord; + + SpellCallbackInfo( SpellCallbackCommand nCMD, OUString _aWord ) + : aWord(std::move( _aWord )) + { + nCommand = nCMD; + } + + SpellCallbackInfo( SpellCallbackCommand nCMD ) + { + nCommand = nCMD; + } +}; + +#endif // INCLUDED_EDITENG_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 000000000..3f6975a3a --- /dev/null +++ b/include/editeng/editund2.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 INCLUDED_EDITENG_EDITUND2_HXX +#define INCLUDED_EDITENG_EDITUND2_HXX + +#include <editeng/editengdllapi.h> +#include <svl/undo.hxx> + +class EditEngine; + +class EDITENG_DLLPUBLIC EditUndoManager : public SfxUndoManager +{ + using SfxUndoManager::Undo; + using SfxUndoManager::Redo; + friend class ImpEditEngine; + + EditEngine* mpEditEngine; + void SetEditEngine(EditEngine* pNew); + +public: + EditUndoManager(sal_uInt16 nMaxUndoActionCount = 20); + + virtual bool Undo() override; + virtual bool Redo() override; +}; + +// EditUndo + +class EDITENG_DLLPUBLIC EditUndo : public SfxUndoAction +{ +private: + sal_uInt16 nId; + ViewShellId mnViewShellId; + EditEngine* mpEditEngine; + +public: + EditUndo(sal_uInt16 nI, EditEngine* pEE); + virtual ~EditUndo() override; + + EditEngine* GetEditEngine() { return mpEditEngine; } + + virtual void Undo() override = 0; + virtual void Redo() override = 0; + + virtual bool CanRepeat(SfxRepeatTarget&) const override; + virtual OUString GetComment() const override; + /// See SfxUndoAction::GetViewShellId(). + ViewShellId GetViewShellId() const override; + sal_uInt16 GetId() const; +}; + +#endif // INCLUDED_EDITENG_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 000000000..4f312b578 --- /dev/null +++ b/include/editeng/editview.hxx @@ -0,0 +1,382 @@ +/* -*- 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 INCLUDED_EDITENG_EDITVIEW_HXX +#define INCLUDED_EDITENG_EDITVIEW_HXX + +#include <memory> +#include <com/sun/star/i18n/WordType.hpp> + +#include <i18nlangtag/lang.h> +#include <tools/color.hxx> +#include <tools/gen.hxx> +#include <vcl/errcode.hxx> +#include <vcl/vclptr.hxx> +#include <editeng/editstat.hxx> +#include <editeng/flditem.hxx> +#include <svl/languageoptions.hxx> +#include <editeng/editdata.hxx> +#include <com/sun/star/uno/Reference.h> +#include <editeng/editengdllapi.h> + + +class EditTextObject; +class EditEngine; +class ImpEditEngine; +class ImpEditView; +class OutlinerViewShell; +class SvxSearchItem; +class SvxFieldItem; +namespace vcl { class Window; } +namespace weld { class Widget; } +class KeyEvent; +class MouseEvent; +class CommandEvent; +class SvStream; +class SvKeyValueIterator; +class SfxStyleSheet; +class SfxItemSet; +namespace vcl { class Cursor; } +namespace vcl { class Font; } +class FontList; +class InputContext; +class OutputDevice; +enum class TransliterationFlags; +enum class PointerStyle; + +namespace com { +namespace sun { +namespace star { +namespace datatransfer { + class XTransferable; + namespace clipboard { + class XClipboard; + } + namespace dnd { + class XDropTarget; + } +} +namespace linguistic2 { + class XSpellChecker1; + class XLanguageGuessing; +} +}}} + +template <typename Arg, typename Ret> class Link; + +enum class ScrollRangeCheck +{ + NoNegative = 1, // No negative VisArea when scrolling + PaperWidthTextSize = 2, // VisArea must be within paper width, Text Size +}; + +// Helper class that allows to set a callback at the EditView. When +// set, Invalidates and repaints are suppressed at the EditView, but +// EditViewInvalidate() will be triggered to allow the consumer to +// react itself as needed. +// Also Selection visualization is suppressed and EditViewSelectionChange +// is triggered when Selection changes and needs reaction. +class EDITENG_DLLPUBLIC EditViewCallbacks +{ +public: + virtual ~EditViewCallbacks(); + + // call this when text visualization changed in any way. It + // will also update selection, so no need to call this self + // additionally (but will also do no harm) + virtual void EditViewInvalidate(const tools::Rectangle& rRect) = 0; + + // call this when only selection is changed. Text change will + // then *not* be checked and not be reacted on. Still, when + // only the selection is changed, this is useful and faster + virtual void EditViewSelectionChange() = 0; + + // return the OutputDevice that the EditView will draw to + virtual OutputDevice& EditViewOutputDevice() const = 0; + + virtual weld::Widget* EditViewPopupParent() const + { + return nullptr; + } + + // return the Mouse Position + virtual Point EditViewPointerPosPixel() const = 0; + + // Triggered to update InputEngine context information + virtual void EditViewInputContext(const InputContext& rInputContext) = 0; + + // Triggered to update InputEngine cursor position + virtual void EditViewCursorRect(const tools::Rectangle& rRect, int nExtTextInputWidth) = 0; + + // Triggered if scroll bar state should change + virtual void EditViewScrollStateChange() + { + } + + // Access to clipboard + virtual css::uno::Reference<css::datatransfer::clipboard::XClipboard> GetClipboard() const = 0; + + // implemented if drag and drop support is wanted + virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> GetDropTarget() + { + return nullptr; + } +}; + +class EDITENG_DLLPUBLIC EditView final +{ + friend class EditEngine; + friend class ImpEditEngine; + friend class EditSelFunctionSet; + +public: + typedef std::vector<VclPtr<vcl::Window>> OutWindowSet; + +public: // Needed for Undo + ImpEditView* GetImpEditView() const { return pImpEditView.get(); } + ImpEditEngine* GetImpEditEngine() const; + +private: + std::unique_ptr<ImpEditView> + pImpEditView; + OUString aDicNameSingle; + + EditView( const EditView& ) = delete; + EditView& operator=( const EditView& ) = delete; + +public: + EditView( EditEngine* pEng, vcl::Window* pWindow ); + ~EditView(); + + // set EditViewCallbacks for external handling of Repaints/Visualization + void setEditViewCallbacks(EditViewCallbacks* pEditViewCallbacks); + EditViewCallbacks* getEditViewCallbacks() const; + + void SetEditEngine( EditEngine* pEditEngine ); + EditEngine* GetEditEngine() const; + + void SetWindow( vcl::Window* pWin ); + vcl::Window* GetWindow() const; + OutputDevice& GetOutputDevice() const; + + LanguageType GetInputLanguage() const; + + bool HasOtherViewWindow( vcl::Window* pWin ); + bool AddOtherViewWindow( vcl::Window* pWin ); + bool RemoveOtherViewWindow( vcl::Window* pWin ); + + void Paint( const tools::Rectangle& rRect, OutputDevice* pTargetDevice = nullptr ); + tools::Rectangle GetInvalidateRect() const; + void InvalidateWindow(const tools::Rectangle& rClipRect); + void InvalidateOtherViewWindows( const tools::Rectangle& rInvRect ); + void Invalidate(); + ::Pair Scroll( tools::Long nHorzScroll, tools::Long nVertScroll, ScrollRangeCheck nRangeCheck = ScrollRangeCheck::NoNegative ); + + void SetBroadcastLOKViewCursor(bool bSet); + tools::Rectangle GetEditCursor() const; + void ShowCursor( bool bGotoCursor = true, bool bForceVisCursor = true, bool bActivate = false ); + void HideCursor( bool bDeactivate = false ); + + void SetSelectionMode( EESelectionMode eMode ); + + void SetReadOnly( bool bReadOnly ); + bool IsReadOnly() const; + + bool HasSelection() const; + ESelection GetSelection() const; + void SetSelection( const ESelection& rNewSel ); + bool IsSelectionAtPoint(const Point& rPointPixel); + void SelectCurrentWord( sal_Int16 nWordType = css::i18n::WordType::ANYWORD_IGNOREWHITESPACES ); + /// Returns the rectangles of the current selection in TWIPs. + void GetSelectionRectangles(std::vector<tools::Rectangle>& rLogicRects) const; + + bool IsInsertMode() const; + void SetInsertMode( bool bInsert ); + + OUString GetSelected() const; + void DeleteSelected(); + + SvtScriptType GetSelectedScriptType() const; + + // VisArea position of the Output window. + // A size change also affects the VisArea + void SetOutputArea( const tools::Rectangle& rRect ); + const tools::Rectangle& GetOutputArea() const; + + // Document position. + // A size change also affects the VisArea + void SetVisArea( const tools::Rectangle& rRect ); + tools::Rectangle GetVisArea() const; + + PointerStyle GetPointer() const; + + vcl::Cursor* GetCursor() const; + + void InsertText( const OUString& rNew, bool bSelect = false , bool bLOKShowSelect = true); + void InsertParaBreak(); + + bool PostKeyEvent( const KeyEvent& rKeyEvent, vcl::Window const * pFrameWin = nullptr ); + + bool MouseButtonUp( const MouseEvent& rMouseEvent ); + bool MouseButtonDown( const MouseEvent& rMouseEvent ); + void ReleaseMouse(); + bool MouseMove( const MouseEvent& rMouseEvent ); + bool Command(const CommandEvent& rCEvt); + + void Cut(); + void Copy(); + void Paste(); + void PasteSpecial(); + + void Undo(); + void Redo(); + + // especially for Oliver Specht + Point GetWindowPosTopLeft( sal_Int32 nParagraph ); + void MoveParagraphs( Range aParagraphs, sal_Int32 nNewPos ); + void MoveParagraphs( tools::Long nDiff ); + + const SfxItemSet& GetEmptyItemSet() const; + SfxItemSet GetAttribs(); + void SetAttribs( const SfxItemSet& rSet ); + void RemoveAttribs( bool bRemoveParaAttribs = false, sal_uInt16 nWhich = 0 ); + void RemoveAttribs( EERemoveParaAttribsMode eMode, sal_uInt16 nWhich ); + void RemoveCharAttribs( sal_Int32 nPara, sal_uInt16 nWhich ); + void RemoveAttribsKeepLanguages( bool bRemoveParaAttribs ); + + ErrCode Read( SvStream& rInput, EETextFormat eFormat, SvKeyValueIterator* pHTTPHeaderAttrs ); + + void SetBackgroundColor( const Color& rColor ); + Color const & GetBackgroundColor() const; + + /// Informs this edit view about which view shell contains it. + void RegisterViewShell(OutlinerViewShell* pViewShell); + /// Informs this edit view about which other shell listens to it. + void RegisterOtherShell(OutlinerViewShell* pOtherShell); + + void SetControlWord( EVControlBits nWord ); + EVControlBits GetControlWord() const; + + std::unique_ptr<EditTextObject> CreateTextObject(); + void InsertText( const EditTextObject& rTextObject ); + void InsertText( css::uno::Reference< css::datatransfer::XTransferable > const & xDataObj, const OUString& rBaseURL, bool bUseSpecial ); + + css::uno::Reference<css::datatransfer::clipboard::XClipboard> GetClipboard() const; + css::uno::Reference<css::datatransfer::XTransferable> GetTransferable() const; + + // An EditView, so that when TRUE the update will be free from flickering: + // @return the previous bUpdateLayout state + bool SetEditEngineUpdateLayout( bool bUpdate ); + void ForceLayoutCalculation(); + + const SfxStyleSheet* GetStyleSheet() const; + SfxStyleSheet* GetStyleSheet(); + + void SetAnchorMode( EEAnchorMode eMode ); + EEAnchorMode GetAnchorMode() const; + + void CompleteAutoCorrect( vcl::Window const * pFrameWin = nullptr ); + + EESpellState StartSpeller(weld::Widget* pDialogParent, bool bMultipleDoc = false); + EESpellState StartThesaurus(weld::Widget* pDialogParent); + sal_Int32 StartSearchAndReplace( const SvxSearchItem& rSearchItem ); + + // for text conversion + void StartTextConversion(weld::Widget* pDialogParent, LanguageType nSrcLang, LanguageType nDestLang, const vcl::Font *pDestFont, sal_Int32 nOptions, bool bIsInteractive, bool bMultipleDoc); + + void TransliterateText( TransliterationFlags nTransliterationMode ); + + bool IsCursorAtWrongSpelledWord(); + bool IsWrongSpelledWordAtPos( const Point& rPosPixel, bool bMarkIfWrong = false ); + bool ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbackInfo&,void>& rCallBack); + OUString SpellIgnoreWord(); + + void InsertField( const SvxFieldItem& rFld ); + const SvxFieldItem* GetFieldUnderMousePointer() const; + const SvxFieldItem* GetFieldUnderMousePointer( sal_Int32& nPara, sal_Int32& nPos ) const; + const SvxFieldItem* GetField( const Point& rPos, sal_Int32* pnPara = nullptr, sal_Int32* pnPos = nullptr ) const; + + const SvxFieldItem* GetFieldAtSelection() const; + /// Select and return the field at the current cursor position + const SvxFieldData* GetFieldAtCursor() const; + void SelectFieldAtCursor(); + + 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 ); + + OUString GetSurroundingText() const; + Selection GetSurroundingTextSelection() const; + bool DeleteSurroundingText(const Selection& rRange); + + /** 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, + const css::uno::Reference< css::linguistic2::XSpellChecker1 >& xSpell, + const css::uno::Reference< css::linguistic2::XLanguageGuessing >& xLangGuess, + bool bIsParaText ); + /// Allows adjusting the point or mark of the selection to a document coordinate. + void SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark); + /// Trigger selection drawing callback in pOtherShell based on our shell's selection state. + void DrawSelectionXOR(OutlinerViewShell* pOtherShell); + + /** + * This is meant for Calc(LOK), but there may be other use-cases. + * In Calc, all logical positions are computed by + * doing independent pixel-alignment for each cell's size. The *LOKSpecial* methods + * can be used to set/get the output-area and visible-area in real logical + * units. This enables EditView to send cursor/selection messages in + * real logical units like it is done for Writer. + */ + void InitLOKSpecialPositioning(MapUnit eUnit, const tools::Rectangle& rOutputArea, + const Point& rVisDocStartPos); + void SetLOKSpecialOutputArea(const tools::Rectangle& rOutputArea); + const tools::Rectangle & GetLOKSpecialOutputArea() const; + void SetLOKSpecialVisArea(const tools::Rectangle& rVisArea); + tools::Rectangle GetLOKSpecialVisArea() const; + bool HasLOKSpecialPositioning() const; + + void SuppressLOKMessages(bool bSet); + bool IsSuppressLOKMessages() const; + + /// To inform editeng that negated x document coordinates are in use. + void SetNegativeX(bool bSet); + bool IsNegativeX() const; +}; + +#endif // INCLUDED_EDITENG_EDITVIEW_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 000000000..68783dc2d --- /dev/null +++ b/include/editeng/edtdlg.hxx @@ -0,0 +1,105 @@ +/* -*- 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_EDITENG_EDTDLG_HXX +#define INCLUDED_EDITENG_EDTDLG_HXX + +#include <rtl/ustring.hxx> +#include <editeng/editengdllapi.h> +#include <i18nlangtag/lang.h> +#include <vcl/abstdlg.hxx> +#include <editeng/hangulhanja.hxx> + +namespace com::sun::star::linguistic2 +{ + class XThesaurus; + class XHyphenator; +} + +template <typename Arg, typename Ret> class Link; + +class SvxSpellWrapper; +class LinkParamNone; + +namespace weld { class Button; } +namespace weld { class Toggleable; } + +class AbstractThesaurusDialog : public VclAbstractDialog +{ +protected: + virtual ~AbstractThesaurusDialog() override = default; +public: + virtual OUString GetWord() = 0; +}; + +class AbstractHyphenWordDialog : public VclAbstractDialog +{ +protected: + virtual ~AbstractHyphenWordDialog() override = default; +}; + +class AbstractHangulHanjaConversionDialog : public VclAbstractTerminatedDialog +{ +protected: + virtual ~AbstractHangulHanjaConversionDialog() override = default; +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<LinkParamNone*,void>& _rHdl ) = 0; + virtual void SetIgnoreHdl( const Link<weld::Button&,void>& _rHdl ) = 0; + virtual void SetIgnoreAllHdl( const Link<weld::Button&,void>& _rHdl ) = 0; + virtual void SetChangeHdl( const Link<weld::Button&,void>& _rHdl ) = 0; + virtual void SetChangeAllHdl( const Link<weld::Button&,void>& _rHdl ) = 0; + virtual void SetClickByCharacterHdl( const Link<weld::Toggleable&,void>& _rHdl ) = 0; + virtual void SetConversionFormatChangedHdl( const Link<weld::Toggleable&,void>& _rHdl ) = 0; + virtual void SetFindHdl( const Link<weld::Button&,void>& _rHdl ) = 0; + virtual bool GetUseBothDirections() const= 0; + virtual editeng::HangulHanjaConversion::ConversionDirection + GetDirection( editeng::HangulHanjaConversion::ConversionDirection _eDefaultDirection ) const = 0; + virtual void SetCurrentString( + const OUString& _rNewString, + const css::uno::Sequence< OUString >& _rSuggestions, + bool _bOriginatesFromDocument = true )=0; + virtual OUString GetCurrentString( ) const =0; + virtual editeng::HangulHanjaConversion::ConversionFormat + GetConversionFormat( ) const =0; + virtual void FocusSuggestion( )= 0; + virtual OUString GetCurrentSuggestion( ) const =0; +}; + +class EDITENG_DLLPUBLIC EditAbstractDialogFactory : virtual public VclAbstractDialogFactory +{ +public: + virtual ~EditAbstractDialogFactory() override; // needed for export of vtable + static EditAbstractDialogFactory* Create(); + virtual VclPtr<AbstractThesaurusDialog> CreateThesaurusDialog(weld::Widget*, + css::uno::Reference<css::linguistic2::XThesaurus> xThesaurus, + const OUString &rWord, LanguageType nLanguage) = 0; + + virtual VclPtr<AbstractHyphenWordDialog> CreateHyphenWordDialog(weld::Widget*, + const OUString &rWord, LanguageType nLang, + css::uno::Reference< css::linguistic2::XHyphenator > &xHyphen, + SvxSpellWrapper* pWrapper) = 0; + virtual VclPtr<AbstractHangulHanjaConversionDialog> CreateHangulHanjaConversionDialog(weld::Widget* pParent) = 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 000000000..ad0ab7b13 --- /dev/null +++ b/include/editeng/eedata.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 INCLUDED_EDITENG_EEDATA_HXX +#define INCLUDED_EDITENG_EEDATA_HXX + + +// extended data definitions for EditEngine portion stripping (StripPortions() +// support). These may be mapped to some primitive definitions from Drawinglayer +// later. +#include <vector> + +#include <sal/types.h> + +namespace EEngineData +{ + // spell checking wrong vector containing the redlining data + class WrongSpellClass + { + public: + sal_Int32 nStart; + sal_Int32 nEnd; + + WrongSpellClass(sal_Int32 nS, sal_Int32 nE) : nStart(nS), nEnd(nE) {} + }; + + typedef std::vector< WrongSpellClass > WrongSpellVector; + +} // end of namespace EditEngine + +#endif // INCLUDED_EDITENG_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 000000000..f86224486 --- /dev/null +++ b/include/editeng/eeitem.hxx @@ -0,0 +1,148 @@ +/* -*- 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_EDITENG_EEITEM_HXX +#define INCLUDED_EDITENG_EEITEM_HXX + +#include <svl/solar.hrc> +#include <svl/typedwhich.hxx> + +class SfxBoolItem; +class SfxGrabBagItem; +class SfxInt16Item; +class SvxAdjustItem; +class SvxAutoKernItem; +class SvxCaseMapItem; +class SvxCharReliefItem; +class SvxCharScaleWidthItem; +class SvxColorItem; +class SvxContourItem; +class SvxCrossedOutItem; +class SvxEmphasisMarkItem; +class SvxEscapementItem; +class SvxFieldItem; +class SvxFontHeightItem; +class SvxFontItem; +class SvxForbiddenRuleItem; +class SvxFrameDirectionItem; +class SvxHangingPunctuationItem; +class SvxKerningItem; +class SvxLanguageItem; +class SvxLineSpacingItem; +class SvxLRSpaceItem; +class SvxOverlineItem; +class SvxPostureItem; +class SvXMLAttrContainerItem; +class SvxScriptSpaceItem; +class SvxShadowedItem; +class SvxTabStopItem; +class SvxULSpaceItem; +class SvxUnderlineItem; +class SvxWeightItem; +class SvxWordLineModeItem; +class SvxBulletItem; +class SvxNumBulletItem; +class SvxJustifyMethodItem; +class SvxVerJustifyItem; +class SfxVoidItem; + +/* + * NOTE: Changes in this file will probably require + * consistent changes in eerdll.cxx and editdoc.cxx + * as well. +*/ + +constexpr sal_uInt16 EE_ITEMS_START(OWN_ATTR_VALUE_END + 1); + +// Paragraph attributes: +constexpr sal_uInt16 EE_PARA_START (EE_ITEMS_START + 0); +constexpr TypedWhichId<SvxFrameDirectionItem> EE_PARA_WRITINGDIR (EE_PARA_START+0); +constexpr TypedWhichId<SvXMLAttrContainerItem> EE_PARA_XMLATTRIBS (EE_PARA_START+1); +constexpr TypedWhichId<SvxHangingPunctuationItem> EE_PARA_HANGINGPUNCTUATION (EE_PARA_START+2); +constexpr TypedWhichId<SvxForbiddenRuleItem> EE_PARA_FORBIDDENRULES (EE_PARA_START+3); +constexpr TypedWhichId<SvxScriptSpaceItem> EE_PARA_ASIANCJKSPACING (EE_PARA_START+4); +constexpr TypedWhichId<SvxNumBulletItem> EE_PARA_NUMBULLET (EE_PARA_START+5); +constexpr TypedWhichId<SfxBoolItem> EE_PARA_HYPHENATE (EE_PARA_START+6); +constexpr TypedWhichId<SfxBoolItem> EE_PARA_HYPHENATE_NO_CAPS (EE_PARA_START+7); +constexpr TypedWhichId<SfxBoolItem> EE_PARA_HYPHENATE_NO_LAST_WORD (EE_PARA_START+8); +constexpr TypedWhichId<SfxBoolItem> EE_PARA_BULLETSTATE (EE_PARA_START+9); +constexpr TypedWhichId<SvxLRSpaceItem> EE_PARA_OUTLLRSPACE (EE_PARA_START+10); +constexpr TypedWhichId<SfxInt16Item> EE_PARA_OUTLLEVEL (EE_PARA_START+11); +constexpr TypedWhichId<SvxBulletItem> EE_PARA_BULLET (EE_PARA_START+12); +constexpr TypedWhichId<SvxLRSpaceItem> EE_PARA_LRSPACE (EE_PARA_START+13); +constexpr TypedWhichId<SvxULSpaceItem> EE_PARA_ULSPACE (EE_PARA_START+14); +constexpr TypedWhichId<SvxLineSpacingItem> EE_PARA_SBL (EE_PARA_START+15); +constexpr TypedWhichId<SvxAdjustItem> EE_PARA_JUST (EE_PARA_START+16); +constexpr TypedWhichId<SvxTabStopItem> EE_PARA_TABS (EE_PARA_START+17); +constexpr TypedWhichId<SvxJustifyMethodItem> EE_PARA_JUST_METHOD (EE_PARA_START+18); +constexpr TypedWhichId<SvxVerJustifyItem> EE_PARA_VER_JUST (EE_PARA_START+19); +constexpr sal_uInt16 EE_PARA_END (EE_PARA_START + 19); + +// Character attributes: +constexpr sal_uInt16 EE_CHAR_START (EE_PARA_END + 1); +constexpr TypedWhichId<SvxColorItem> EE_CHAR_COLOR (EE_CHAR_START+0); +constexpr TypedWhichId<SvxFontItem> EE_CHAR_FONTINFO (EE_CHAR_START+1); +constexpr TypedWhichId<SvxFontHeightItem> EE_CHAR_FONTHEIGHT (EE_CHAR_START+2); +constexpr TypedWhichId<SvxCharScaleWidthItem> EE_CHAR_FONTWIDTH (EE_CHAR_START+3); +constexpr TypedWhichId<SvxWeightItem> EE_CHAR_WEIGHT (EE_CHAR_START+4); +constexpr TypedWhichId<SvxUnderlineItem> EE_CHAR_UNDERLINE (EE_CHAR_START+5); +constexpr TypedWhichId<SvxCrossedOutItem> EE_CHAR_STRIKEOUT (EE_CHAR_START+6); +constexpr TypedWhichId<SvxPostureItem> EE_CHAR_ITALIC (EE_CHAR_START+7); +constexpr TypedWhichId<SvxContourItem> EE_CHAR_OUTLINE (EE_CHAR_START+8); +constexpr TypedWhichId<SvxShadowedItem> EE_CHAR_SHADOW (EE_CHAR_START+9); +constexpr TypedWhichId<SvxEscapementItem> EE_CHAR_ESCAPEMENT (EE_CHAR_START+10); +constexpr TypedWhichId<SvxAutoKernItem> EE_CHAR_PAIRKERNING (EE_CHAR_START+11); +constexpr TypedWhichId<SvxKerningItem> EE_CHAR_KERNING (EE_CHAR_START+12); +constexpr TypedWhichId<SvxWordLineModeItem> EE_CHAR_WLM (EE_CHAR_START+13); +constexpr TypedWhichId<SvxLanguageItem> EE_CHAR_LANGUAGE (EE_CHAR_START+14); +constexpr TypedWhichId<SvxLanguageItem> EE_CHAR_LANGUAGE_CJK (EE_CHAR_START+15); +constexpr TypedWhichId<SvxLanguageItem> EE_CHAR_LANGUAGE_CTL (EE_CHAR_START+16); +constexpr TypedWhichId<SvxFontItem> EE_CHAR_FONTINFO_CJK (EE_CHAR_START+17); +constexpr TypedWhichId<SvxFontItem> EE_CHAR_FONTINFO_CTL (EE_CHAR_START+18); +constexpr TypedWhichId<SvxFontHeightItem> EE_CHAR_FONTHEIGHT_CJK (EE_CHAR_START+19); +constexpr TypedWhichId<SvxFontHeightItem> EE_CHAR_FONTHEIGHT_CTL (EE_CHAR_START+20); +constexpr TypedWhichId<SvxWeightItem> EE_CHAR_WEIGHT_CJK (EE_CHAR_START+21); +constexpr TypedWhichId<SvxWeightItem> EE_CHAR_WEIGHT_CTL (EE_CHAR_START+22); +constexpr TypedWhichId<SvxPostureItem> EE_CHAR_ITALIC_CJK (EE_CHAR_START+23); +constexpr TypedWhichId<SvxPostureItem> EE_CHAR_ITALIC_CTL (EE_CHAR_START+24); +constexpr TypedWhichId<SvxEmphasisMarkItem> EE_CHAR_EMPHASISMARK (EE_CHAR_START+25); +constexpr TypedWhichId<SvxCharReliefItem> EE_CHAR_RELIEF (EE_CHAR_START+26); +constexpr TypedWhichId<SfxVoidItem> EE_CHAR_RUBI_DUMMY (EE_CHAR_START+27); +constexpr TypedWhichId<SvXMLAttrContainerItem> EE_CHAR_XMLATTRIBS (EE_CHAR_START+28); +constexpr TypedWhichId<SvxOverlineItem> EE_CHAR_OVERLINE (EE_CHAR_START+29); +constexpr TypedWhichId<SvxCaseMapItem> EE_CHAR_CASEMAP (EE_CHAR_START+30); +constexpr TypedWhichId<SfxGrabBagItem> EE_CHAR_GRABBAG (EE_CHAR_START+31); +constexpr TypedWhichId<SvxColorItem> EE_CHAR_BKGCOLOR (EE_CHAR_START+32); + +constexpr sal_uInt16 EE_CHAR_END (EE_CHAR_START + 32); + +constexpr sal_uInt16 EE_FEATURE_START (EE_CHAR_END + 1); +constexpr sal_uInt16 EE_FEATURE_TAB (EE_FEATURE_START + 0); +constexpr sal_uInt16 EE_FEATURE_LINEBR (EE_FEATURE_TAB + 1); +constexpr sal_uInt16 EE_FEATURE_NOTCONV (EE_FEATURE_LINEBR + 1); +constexpr TypedWhichId<SvxFieldItem> EE_FEATURE_FIELD (EE_FEATURE_NOTCONV + 1); +constexpr sal_uInt16 EE_FEATURE_END (EE_FEATURE_FIELD + 0); + +constexpr sal_uInt16 EE_ITEMS_END (EE_FEATURE_END); + +constexpr sal_uInt16 EDITITEMCOUNT (EE_ITEMS_END - EE_ITEMS_START + 1); + +#endif // _ INCLUDED_EDITENG_EEITEM_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 000000000..b77d6a0d4 --- /dev/null +++ b/include/editeng/eerdll.hxx @@ -0,0 +1,52 @@ +/* -*- 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_EDITENG_EERDLL_HXX +#define INCLUDED_EDITENG_EERDLL_HXX + +#include <editeng/editengdllapi.h> +#include <rtl/ustring.hxx> +#include <unotools/resmgr.hxx> +#include <memory> + +class GlobalEditData; +namespace editeng +{ +class SharedVclResources; +} + +OUString EDITENG_DLLPUBLIC EditResId(TranslateId aId); + +class EditDLL +{ + std::unique_ptr<GlobalEditData> pGlobalData; + std::weak_ptr<editeng::SharedVclResources> pSharedVcl; + +public: + EditDLL(); + ~EditDLL(); + + GlobalEditData* GetGlobalData() const { return pGlobalData.get(); } + std::shared_ptr<editeng::SharedVclResources> GetSharedVclResources(); + static EditDLL& Get(); +}; + +#endif // INCLUDED_EDITENG_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 000000000..f54c85735 --- /dev/null +++ b/include/editeng/emphasismarkitem.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 INCLUDED_EDITENG_EMPHASISMARKITEM_HXX +#define INCLUDED_EDITENG_EMPHASISMARKITEM_HXX + +#include <tools/fontenum.hxx> +#include <svl/intitem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxEmphasisMarkItem ---------------------------------------------- + +/* [Description] + + This item describes the Font emphasis. +*/ + +class EDITENG_DLLPUBLIC SvxEmphasisMarkItem final : public SfxUInt16Item +{ +public: + static SfxPoolItem* CreateDefault(); + + SvxEmphasisMarkItem( const FontEmphasisMark eVal /*= FontEmphasisMark::NONE*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + SfxEnumItem + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& ) const override; + + virtual SvxEmphasisMarkItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + // enum cast + FontEmphasisMark GetEmphasisMark() const + { return static_cast<FontEmphasisMark>(GetValue()); } +}; + +#endif // INCLUDED_EDITENG_EMPHASISMARKITEM_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 000000000..ea8f99e35 --- /dev/null +++ b/include/editeng/escapementitem.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 INCLUDED_EDITENG_ESCAPEMENTITEM_HXX +#define INCLUDED_EDITENG_ESCAPEMENTITEM_HXX + +#include <svl/cenumitm.hxx> +#include <editeng/svxenum.hxx> +#include <editeng/editengdllapi.h> + +// class SvxEscapementItem ----------------------------------------------- + +#define DFLT_ESC_SUPER 33 // 42% (100 - DFLT_ESC_PROP) of ascent (~80% of font height) = 33% of total font height +#define DFLT_ESC_SUB -8 // 42% of descent (~20% of font height) = -8%. previously -33% (pre-2020), previously 8/100 (pre-2000?) +#define DFLT_ESC_PROP 58 +#define MAX_ESC_POS 13999 +#define DFLT_ESC_AUTO_SUPER (MAX_ESC_POS+1) +#define DFLT_ESC_AUTO_SUB -DFLT_ESC_AUTO_SUPER + +/* [Description] + + This item describes the writing position. +*/ + +class EDITENG_DLLPUBLIC SvxEscapementItem final : public SfxEnumItemInterface +{ + short nEsc; + sal_uInt8 nProp; +public: + static SfxPoolItem* CreateDefault(); + + 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 bool operator==( const SfxPoolItem& ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + virtual SvxEscapementItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + void SetEscapement( const SvxEscapement eNew ) + { + if( SvxEscapement::Off == eNew ) + { + nEsc = 0; + nProp = 100; + } + else + { + nProp = DFLT_ESC_PROP; + if( SvxEscapement::Superscript == eNew ) + nEsc = DFLT_ESC_SUPER; + else + nEsc = DFLT_ESC_SUB; + } + } + SvxEscapement GetEscapement() const { return static_cast< SvxEscapement >( GetEnumValue() ); } + + short &GetEsc() { return nEsc; } + short GetEsc() const { return nEsc; } + + sal_uInt8 &GetProportionalHeight() { return nProp; } + sal_uInt8 GetProportionalHeight() const { return nProp; } + + virtual sal_uInt16 GetValueCount() const override; + static OUString GetValueTextByPos( sal_uInt16 nPos ); + virtual sal_uInt16 GetEnumValue() const override; + virtual void SetEnumValue( sal_uInt16 nNewVal ) override; +}; + +#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 000000000..efaad86bd --- /dev/null +++ b/include/editeng/fhgtitem.hxx @@ -0,0 +1,92 @@ +/* -*- 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_EDITENG_FHGTITEM_HXX +#define INCLUDED_EDITENG_FHGTITEM_HXX + +#include <svl/poolitem.hxx> +#include <tools/debug.hxx> +#include <editeng/editengdllapi.h> + +// class SvxFontHeightItem ----------------------------------------------- + +// Warning: twips values + +/* [Description] + + This item describes the font height +*/ + +constexpr sal_uInt16 FONTHEIGHT_16_VERSION = 0x0001; +constexpr sal_uInt16 FONTHEIGHT_UNIT_VERSION = 0x0002; + +class EDITENG_DLLPUBLIC SvxFontHeightItem final : public SfxPoolItem +{ + sal_uInt32 nHeight; + sal_uInt16 nProp; // default 100% + MapUnit ePropUnit; // Percent, Twip, ... + +private: + friend void Create_legacy_direct_set(SvxFontHeightItem& rItem, sal_uInt32 nH, sal_uInt16 nP, MapUnit eP); + void legacy_direct_set(sal_uInt32 nH, sal_uInt16 nP, MapUnit eP) { nHeight = nH; nProp = nP; ePropUnit = eP; } + +public: + static SfxPoolItem* CreateDefault(); + + SvxFontHeightItem( const sal_uInt32 nSz /*= 240*/, const sal_uInt16 nPropHeight /*= 100*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + virtual SvxFontHeightItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual void ScaleMetrics( tools::Long nMult, tools::Long nDiv ) override; + virtual bool HasMetrics() const override; + + void SetHeight( sal_uInt32 nNewHeight, const sal_uInt16 nNewProp = 100, + MapUnit eUnit = MapUnit::MapRelative ); + + void SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp, + MapUnit eUnit, MapUnit eCoreUnit ); + + sal_uInt32 GetHeight() const { return nHeight; } + + void SetProp( sal_uInt16 nNewProp, MapUnit eUnit ) + { + DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); + nProp = nNewProp; + ePropUnit = eUnit; + } + + sal_uInt16 GetProp() const { return nProp; } + + MapUnit GetPropUnit() const { return ePropUnit; } // Percent, Twip, ... + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +#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 000000000..e15754ffd --- /dev/null +++ b/include/editeng/fieldupdater.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/. + */ + +#ifndef INCLUDED_EDITENG_FIELDUPDATER_HXX +#define INCLUDED_EDITENG_FIELDUPDATER_HXX + +#include <editeng/editengdllapi.h> +#include <memory> + +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 +{ + std::unique_ptr<FieldUpdaterImpl> mpImpl; + +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 000000000..7dec33e9e --- /dev/null +++ b/include/editeng/flditem.hxx @@ -0,0 +1,438 @@ +/* -*- 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_EDITENG_FLDITEM_HXX +#define INCLUDED_EDITENG_FLDITEM_HXX + +#include <i18nlangtag/lang.h> +#include <tools/time.hxx> +#include <tools/date.hxx> +#include <svl/poolitem.hxx> +#include <editeng/editengdllapi.h> + +#include <com/sun/star/text/textfield/Type.hpp> + +namespace com::sun::star::text { + class XTextContent; +} + +class SvNumberFormatter; +class MetaAction; + +// class SvxFieldItem --------------------------------------------------- + + +class EDITENG_DLLPUBLIC SvxFieldData +{ +public: + + static SvxFieldData* Create(const css::uno::Reference<css::text::XTextContent>& xContent); + + static constexpr auto CLASS_ID = css::text::textfield::Type::UNSPECIFIED; + virtual sal_Int32 GetClassId() const { return CLASS_ID; } + + SvxFieldData(); + virtual ~SvxFieldData(); + + SvxFieldData(SvxFieldData const &) = default; + SvxFieldData(SvxFieldData &&) = default; + SvxFieldData & operator =(SvxFieldData const &) = default; + SvxFieldData & operator =(SvxFieldData &&) = default; + + virtual std::unique_ptr<SvxFieldData> Clone() const; + virtual bool operator==( const SvxFieldData& ) const; + + virtual MetaAction* createBeginComment() const; + static MetaAction* createEndComment(); +}; + +/** + * 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 final : public SfxPoolItem +{ + std::unique_ptr<SvxFieldData> mpField; +public: + SvxFieldItem( std::unique_ptr<SvxFieldData> pField, const sal_uInt16 nId ); + SvxFieldItem( const SvxFieldData& rField, const sal_uInt16 nId ); + SvxFieldItem( const SvxFieldItem& rItem ); + virtual ~SvxFieldItem() override; + + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SvxFieldItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + const SvxFieldData* GetField() const { return mpField.get(); } +}; + + +// The following are the derivatives of SvxFieldData ... + + +enum class SvxDateType { Fix, Var }; +enum class SvxDateFormat { + AppDefault = 0, // Set as in App + System, // Set as in System + StdSmall, + StdBig, + A, // 13.02.96 + B, // 13.02.1996 + C, // 13.Feb 1996 + D, // 13.February 1996 + E, // Tue, 13.February 1996 + F // Tuesday, 13.February 1996 +}; + +class EDITENG_DLLPUBLIC SvxDateField final : public SvxFieldData +{ + sal_Int32 nFixDate; + SvxDateType eType; + SvxDateFormat eFormat; + +public: + static constexpr auto CLASS_ID = css::text::textfield::Type::DATE; + virtual sal_Int32 GetClassId() const override { return CLASS_ID; } + + SvxDateField(); + explicit SvxDateField( const Date& rDate, + SvxDateType eType, + SvxDateFormat eFormat = SvxDateFormat::StdSmall ); + + sal_Int32 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 const & rDate, SvxDateFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage ); + + virtual std::unique_ptr<SvxFieldData> Clone() const override; + virtual bool operator==( const SvxFieldData& ) const override; + + virtual MetaAction* createBeginComment() const override; +}; + + +enum class SvxURLFormat { + AppDefault = 0, // Set as in App + Url, // Represent URL + Repr // Constitute representation +}; + +class EDITENG_DLLPUBLIC SvxURLField final : public SvxFieldData +{ +private: + SvxURLFormat eFormat; + OUString aURL; // URL-Address + OUString aRepresentation; // What is shown + OUString aTargetFrame; // In what Frame + +public: + static constexpr auto CLASS_ID = css::text::textfield::Type::URL; + virtual sal_Int32 GetClassId() const override { return CLASS_ID; } + + SvxURLField(); + SvxURLField( OUString aURL, OUString aRepres, 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 std::unique_ptr<SvxFieldData> Clone() const override; + virtual bool operator==( const SvxFieldData& ) const override; + + virtual MetaAction* createBeginComment() const override; +}; + +class EDITENG_DLLPUBLIC SvxPageField final: public SvxFieldData +{ +public: + virtual sal_Int32 GetClassId() const override { return css::text::textfield::Type::PAGE; } + SvxPageField(); + + virtual std::unique_ptr<SvxFieldData> Clone() const override; + virtual bool operator==( const SvxFieldData& ) const override; + + virtual MetaAction* createBeginComment() const override; +}; + +class EDITENG_DLLPUBLIC SvxPageTitleField final: public SvxFieldData +{ +public: + static constexpr auto CLASS_ID = css::text::textfield::Type::PAGE_NAME; + virtual sal_Int32 GetClassId() const override { return CLASS_ID; } + SvxPageTitleField(); + + virtual std::unique_ptr<SvxFieldData> Clone() const override; + virtual bool operator==( const SvxFieldData& ) const override; + + virtual MetaAction* createBeginComment() const override; +}; + +class EDITENG_DLLPUBLIC SvxPagesField final: public SvxFieldData +{ +public: + static constexpr auto CLASS_ID = css::text::textfield::Type::PAGES; + virtual sal_Int32 GetClassId() const override { return CLASS_ID; } + SvxPagesField(); + + virtual std::unique_ptr<SvxFieldData> Clone() const override; + virtual bool operator==( const SvxFieldData& ) const override; +}; + +class EDITENG_DLLPUBLIC SvxTimeField final: public SvxFieldData +{ +public: + static constexpr auto CLASS_ID = css::text::textfield::Type::TIME; + virtual sal_Int32 GetClassId() const override { return CLASS_ID; } + SvxTimeField(); + + virtual std::unique_ptr<SvxFieldData> Clone() const override; + virtual bool operator==( const SvxFieldData& ) const override; + + virtual MetaAction* createBeginComment() const override; +}; + +class EDITENG_DLLPUBLIC SvxFileField final: public SvxFieldData +{ +public: + static constexpr auto CLASS_ID = css::text::textfield::Type::DOCINFO_TITLE; + virtual sal_Int32 GetClassId() const override { return CLASS_ID; } + SvxFileField(); + + virtual std::unique_ptr<SvxFieldData> Clone() const override; + virtual bool operator==( const SvxFieldData& ) const override; +}; + +class EDITENG_DLLPUBLIC SvxTableField final: public SvxFieldData +{ + int mnTab; +public: + static constexpr auto CLASS_ID = css::text::textfield::Type::TABLE; + virtual sal_Int32 GetClassId() const override { return CLASS_ID; } + SvxTableField(); + explicit SvxTableField(int nTab); + + void SetTab(int nTab); + int GetTab() const { return mnTab;} + + virtual std::unique_ptr<SvxFieldData> Clone() const override; + virtual bool operator==( const SvxFieldData& ) const override; +}; + + +enum class SvxTimeType { + Fix, + Var +}; +enum class SvxTimeFormat { + AppDefault = 0, // Set as in App + System, // Set as in System + Standard, + HH24_MM, // 13:49 + HH24_MM_SS, // 13:49:38 + HH24_MM_SS_00, // 13:49:38.78 + HH12_MM, // 01:49 + HH12_MM_SS, // 01:49:38 + HH12_MM_SS_00, // 01:49:38.78 + HH12_MM_AMPM, // 01:49 PM + HH12_MM_SS_AMPM, // 01:49:38 PM + HH12_MM_SS_00_AMPM // 01:49:38.78 PM +}; + +class EDITENG_DLLPUBLIC SvxExtTimeField final : public SvxFieldData +{ +private: + sal_Int64 m_nFixTime; + SvxTimeType eType; + SvxTimeFormat eFormat; + +public: + static constexpr auto CLASS_ID = css::text::textfield::Type::EXTENDED_TIME; + virtual sal_Int32 GetClassId() const override { return CLASS_ID; } + SvxExtTimeField(); + explicit SvxExtTimeField( const tools::Time& rTime, + SvxTimeType eType, + SvxTimeFormat eFormat = SvxTimeFormat::Standard ); + + sal_Int64 GetFixTime() const { return m_nFixTime; } + void SetFixTime( const tools::Time& rTime ) { m_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( tools::Time const & rTime, SvxTimeFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage ); + + virtual std::unique_ptr<SvxFieldData> Clone() const override; + virtual bool operator==( const SvxFieldData& ) const override; + + virtual MetaAction* createBeginComment() const override; +}; + + +enum class SvxFileType { + Fix, + Var +}; +enum class SvxFileFormat { + NameAndExt = 0, // File name with Extension + PathFull, // full path + PathOnly, // only path + NameOnly // only file name +}; + + +class EDITENG_DLLPUBLIC SvxExtFileField final : public SvxFieldData +{ +private: + OUString aFile; + SvxFileType eType; + SvxFileFormat eFormat; + +public: + static constexpr auto CLASS_ID = css::text::textfield::Type::EXTENDED_FILE; + virtual sal_Int32 GetClassId() const override { return CLASS_ID; } + SvxExtFileField(); + explicit SvxExtFileField( const OUString& rString, + SvxFileType eType = SvxFileType::Var, + SvxFileFormat eFormat = SvxFileFormat::PathFull ); + + const 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 std::unique_ptr<SvxFieldData> Clone() const override; + virtual bool operator==( const SvxFieldData& ) const override; +}; + + +enum class SvxAuthorType { + Fix, Var +}; +enum class SvxAuthorFormat { + FullName, // full name + LastName, // Only Last name + FirstName, // Only first name + ShortName // Initials +}; + +class EDITENG_DLLPUBLIC SvxAuthorField final : public SvxFieldData +{ +private: + OUString aName; + OUString aFirstName; + OUString aShortName; + SvxAuthorType eType; + SvxAuthorFormat eFormat; + +public: + static constexpr auto CLASS_ID = css::text::textfield::Type::AUTHOR; + virtual sal_Int32 GetClassId() const override { return CLASS_ID; } + SvxAuthorField( + const OUString& rFirstName, + const OUString& rLastName, + const OUString& rShortName, + SvxAuthorType eType = SvxAuthorType::Var, + SvxAuthorFormat eFormat = SvxAuthorFormat::FullName ); + + 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 std::unique_ptr<SvxFieldData> Clone() const override; + virtual bool operator==( const SvxFieldData& ) const override; +}; + +/** 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 final: public SvxFieldData +{ +public: + static constexpr auto CLASS_ID = css::text::textfield::Type::PRESENTATION_HEADER; + virtual sal_Int32 GetClassId() const override { return CLASS_ID; } + SvxHeaderField(); + + virtual std::unique_ptr<SvxFieldData> Clone() const override; + virtual bool operator==( const SvxFieldData& ) const override; +}; + +/** 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 final: public SvxFieldData +{ +public: + static constexpr auto CLASS_ID = css::text::textfield::Type::PRESENTATION_FOOTER; + virtual sal_Int32 GetClassId() const override { return CLASS_ID; } + SvxFooterField(); + virtual std::unique_ptr<SvxFieldData> Clone() const override; + virtual bool operator==( const SvxFieldData& ) const override; +}; + +/** 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 final: public SvxFieldData +{ +public: + static constexpr auto CLASS_ID = css::text::textfield::Type::PRESENTATION_DATE_TIME; + virtual sal_Int32 GetClassId() const override { return CLASS_ID; } + SvxDateTimeField(); + + static OUString GetFormatted( Date const & rDate, tools::Time const & rTime, + SvxDateFormat eDateFormat, SvxTimeFormat eTimeFormat, + SvNumberFormatter& rFormatter, LanguageType eLanguage ); + + virtual std::unique_ptr<SvxFieldData> Clone() const override; + virtual bool operator==( const SvxFieldData& ) const override; +}; + + +#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 000000000..71756464e --- /dev/null +++ b/include/editeng/flstitem.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 INCLUDED_EDITENG_FLSTITEM_HXX +#define INCLUDED_EDITENG_FLSTITEM_HXX + +#include <svl/poolitem.hxx> +#include <rtl/ustring.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#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 final : public SfxPoolItem +{ +private: + const FontList* pFontList; + css::uno::Sequence< OUString > aFontNameSeq; + +public: + SvxFontListItem( const FontList* pFontLst, + const sal_uInt16 nId ); + + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SvxFontListItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + 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 000000000..deabf3101 --- /dev/null +++ b/include/editeng/fontitem.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 INCLUDED_EDITENG_FONTITEM_HXX +#define INCLUDED_EDITENG_FONTITEM_HXX + +#include <editeng/editengdllapi.h> +#include <rtl/ustring.hxx> +#include <tools/fontenum.hxx> +#include <svl/poolitem.hxx> + +/** This item describes a Font. +*/ +class EDITENG_DLLPUBLIC SvxFontItem final : public SfxPoolItem +{ + OUString aFamilyName; + OUString aStyleName; + FontFamily eFamily; + FontPitch ePitch; + rtl_TextEncoding eTextEncoding; + +public: + static SfxPoolItem* CreateDefault(); + + explicit SvxFontItem(const sal_uInt16 nId); + SvxFontItem(const FontFamily eFam, OUString aFamilyName, + OUString aStyleName, + const FontPitch eFontPitch /*= PITCH_DONTKNOW*/, + const rtl_TextEncoding eFontTextEncoding /*= RTL_TEXTENCODING_DONTKNOW*/, + const sal_uInt16 nId); + + // "pure virtual Methods" from SfxPoolItem + virtual bool operator==(const SfxPoolItem& rItem) const override; + bool operator<(const SfxPoolItem& rCmp) const override; + virtual SvxFontItem* Clone(SfxItemPool *pPool = nullptr) const override; + virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; + virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override; + + virtual bool GetPresentation(SfxItemPresentation ePres, + MapUnit eCoreMetric, MapUnit ePresMetric, + OUString &rText, const IntlWrapper&) const override; + + // Access methods: + void SetFamilyName(const OUString& rFamilyName) + { + aFamilyName = rFamilyName; + } + const OUString &GetFamilyName() const + { + return aFamilyName; + } + + void SetStyleName(const OUString &rStyleName) + { + aStyleName = rStyleName; + } + const OUString &GetStyleName() const + { + return aStyleName; + } + + void SetFamily(FontFamily _eFamily) + { + eFamily = _eFamily; + } + FontFamily GetFamily() const + { + return eFamily; + } + + void SetPitch(FontPitch _ePitch) + { + ePitch = _ePitch; + } + FontPitch GetPitch() const + { + return ePitch; + } + + void SetCharSet(rtl_TextEncoding _eEncoding) + { + eTextEncoding = _eEncoding; + } + rtl_TextEncoding GetCharSet() const + { + return eTextEncoding; + } + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +EDITENG_DLLPUBLIC void GetDefaultFonts(SvxFontItem& rLatin, + SvxFontItem& rAsian, + SvxFontItem& rComplex); + +#endif // INCLUDED_EDITENG_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 000000000..f91aade4a --- /dev/null +++ b/include/editeng/forbiddencharacterstable.hxx @@ -0,0 +1,52 @@ +/* -*- 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_EDITENG_FORBIDDENCHARACTERSTABLE_HXX +#define INCLUDED_EDITENG_FORBIDDENCHARACTERSTABLE_HXX + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/i18n/ForbiddenCharacters.hpp> +#include <editeng/editengdllapi.h> +#include <i18nlangtag/lang.h> +#include <map> +#include <memory> + +namespace com::sun::star::uno { class XComponentContext; } + +class EDITENG_DLLPUBLIC SvxForbiddenCharactersTable +{ +public: + typedef std::map<LanguageType, css::i18n::ForbiddenCharacters> Map; +private: + Map maMap; + css::uno::Reference< css::uno::XComponentContext > m_xContext; + SvxForbiddenCharactersTable(css::uno::Reference< css::uno::XComponentContext > xContext); + +public: + static std::shared_ptr<SvxForbiddenCharactersTable> makeForbiddenCharactersTable(const css::uno::Reference<css::uno::XComponentContext>& rxContext); + + Map& GetMap() { return maMap; } + const css::i18n::ForbiddenCharacters* GetForbiddenCharacters( LanguageType nLanguage, bool bGetDefault ); + void SetForbiddenCharacters( LanguageType nLanguage , const css::i18n::ForbiddenCharacters& ); + void ClearForbiddenCharacters( LanguageType nLanguage ); +}; + +#endif // INCLUDED_EDITENG_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 000000000..93e46b433 --- /dev/null +++ b/include/editeng/forbiddenruleitem.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 INCLUDED_EDITENG_FORBIDDENRULEITEM_HXX +#define INCLUDED_EDITENG_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 final : public SfxBoolItem +{ +public: + SvxForbiddenRuleItem( bool bOn /*= false*/, + const sal_uInt16 nId ); + + virtual SvxForbiddenRuleItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& ) const override; +}; + +#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 000000000..71f331769 --- /dev/null +++ b/include/editeng/formatbreakitem.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 INCLUDED_EDITENG_FORMATBREAKITEM_HXX +#define INCLUDED_EDITENG_FORMATBREAKITEM_HXX + +#include <svl/eitem.hxx> +#include <editeng/svxenum.hxx> +#include <editeng/editengdllapi.h> + + +// class SvxFormatBreakItem ------------------------------------------------- + +/* [Description] + + This item describes a wrap-attribute + Automatic?, Page or column break, before or after? +*/ +constexpr sal_uInt16 FMTBREAK_NOAUTO = 0x0001; + +class EDITENG_DLLPUBLIC SvxFormatBreakItem final : public SfxEnumItem<SvxBreak> +{ +public: + static SfxPoolItem* CreateDefault(); + + inline SvxFormatBreakItem( const SvxBreak eBrk /*= SvxBreak::NONE*/, + const sal_uInt16 nWhich ); + SvxFormatBreakItem(SvxFormatBreakItem const &) = default; // SfxPoolItem copy function dichotomy + + // "pure virtual Methods" from SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + static OUString GetValueTextByPos( sal_uInt16 nPos ); + + virtual SvxFormatBreakItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual sal_uInt16 GetValueCount() const override; + + SvxBreak GetBreak() const { return GetValue(); } +}; + + +inline SvxFormatBreakItem::SvxFormatBreakItem( const SvxBreak eBreak, + const sal_uInt16 _nWhich ) : + SfxEnumItem( _nWhich, eBreak ) +{} + + +#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 000000000..ef5275d26 --- /dev/null +++ b/include/editeng/frmdir.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 INCLUDED_EDITENG_FRMDIR_HXX +#define INCLUDED_EDITENG_FRMDIR_HXX + +#include <com/sun/star/text/WritingMode2.hpp> +#include <unotools/resmgr.hxx> + +/** + * Defines possible text directions in frames. + * A scoped enum over the constants in css::text:WritingMode2. + */ +enum class SvxFrameDirection +{ + /** used as an error return value in SW */ + Unknown = -1, + + /** Horizontal, from left to right, from top to bottom + (typical for western languages). */ + Horizontal_LR_TB = css::text::WritingMode2::LR_TB, + + /** Horizontal, from right to left, from top to bottom + (typical for arabic/hebrew languages). */ + Horizontal_RL_TB = css::text::WritingMode2::RL_TB, + + /** Vertical, from top to bottom, from right to left + (typical for asian languages). */ + Vertical_RL_TB = css::text::WritingMode2::TB_RL, + + /** Vertical, from top to bottom, from left to right + (typical for mongol language). */ + Vertical_LR_TB = css::text::WritingMode2::TB_LR, + + /** Use the value from the environment, can only be used in frames. */ + Environment = css::text::WritingMode2::CONTEXT, + + /** Vertical, from bottom to top, from left to right. */ + Vertical_LR_BT = css::text::WritingMode2::BT_LR, +}; + +TranslateId getFrmDirResId(size_t nIndex); + +#endif // INCLUDED_EDITENG_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 000000000..2a439aa50 --- /dev/null +++ b/include/editeng/frmdiritem.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 INCLUDED_EDITENG_FRMDIRITEM_HXX +#define INCLUDED_EDITENG_FRMDIRITEM_HXX + +#include <svl/eitem.hxx> +#include <editeng/frmdir.hxx> +#include <editeng/editengdllapi.h> + +/* 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 final : public SfxEnumItem<SvxFrameDirection> +{ +public: + SvxFrameDirectionItem( SvxFrameDirection nValue, sal_uInt16 nWhich ); + virtual ~SvxFrameDirectionItem() override; + + SvxFrameDirectionItem(SvxFrameDirectionItem const &) = default; + SvxFrameDirectionItem(SvxFrameDirectionItem &&) = default; + SvxFrameDirectionItem & operator =(SvxFrameDirectionItem const &) = delete; + SvxFrameDirectionItem & operator =(SvxFrameDirectionItem &&) = delete; + + virtual SvxFrameDirectionItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + virtual sal_uInt16 GetValueCount() const override + { + return sal_uInt16(SvxFrameDirection::Vertical_LR_BT) + 1; + } + + // SfxPoolItem copy function dichotomy + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +#endif // INCLUDED_EDITENG_FRMDIRITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/hangulhanja.hxx b/include/editeng/hangulhanja.hxx new file mode 100644 index 000000000..f2a5dcf99 --- /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 INCLUDED_EDITENG_HANGULHANJA_HXX +#define INCLUDED_EDITENG_HANGULHANJA_HXX + +#include <memory> +#include <editeng/editengdllapi.h> +#include <i18nlangtag/mslangid.hxx> + +namespace com::sun::star::lang { struct Locale; } +namespace com::sun::star::uno { class XComponentContext; } +namespace com::sun::star::uno { template <class E> class Sequence; } +namespace vcl { class Font; } +namespace weld { class Widget; } + + +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 syllabification 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 brackets 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: + ::std::unique_ptr< HangulHanjaConversion_Impl > m_pImpl; + + // used to set initial values of m_pImpl object from saved ones + static bool m_bUseSavedValues; // defines if the following two values should be used for initialization + static bool m_bTryBothDirectionsSave; + static ConversionDirection m_ePrimaryConversionDirectionSave; + + HangulHanjaConversion (const HangulHanjaConversion &) = delete; + HangulHanjaConversion & operator= (const HangulHanjaConversion &) = delete; + + public: + HangulHanjaConversion( + weld::Widget* pUIParent, + const css::uno::Reference< css::uno::XComponentContext >& rxContext, + const css::lang::Locale& _rSourceLocale, + const css::lang::Locale& _rTargetLocale, + const vcl::Font* _pTargetFont, + sal_Int32 nOptions, + bool _bIsInteractive + ); + + virtual ~HangulHanjaConversion() COVERITY_NOEXCEPT_FALSE; + + // converts the whole document + void ConvertDocument(); + + weld::Widget* GetUIParent() const; // the parent window for any UI we raise + LanguageType GetSourceLanguage() const; + LanguageType GetTargetLanguage() const; + const vcl::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 choosing 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 indices: They are always relative to the <em>previous + call</em> of ReplaceUnit. This means when you get a call to ReplaceUnit, and replace some text + in your document, then 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 reason 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 necessary 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 css::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); + } + +} + + +#endif // INCLUDED_EDITENG_HANGULHANJA_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 000000000..c59d4db0c --- /dev/null +++ b/include/editeng/hngpnctitem.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 INCLUDED_EDITENG_HNGPNCTITEM_HXX +#define INCLUDED_EDITENG_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 final : public SfxBoolItem +{ +public: + SvxHangingPunctuationItem( bool bOn /*= false*/, const sal_uInt16 nId ); + + virtual SvxHangingPunctuationItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& ) const override; +}; + +#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 000000000..7104d2d7d --- /dev/null +++ b/include/editeng/hyphenzoneitem.hxx @@ -0,0 +1,92 @@ +/* -*- 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_EDITENG_HYPHENZONEITEM_HXX +#define INCLUDED_EDITENG_HYPHENZONEITEM_HXX + +#include <svl/poolitem.hxx> +#include <editeng/editengdllapi.h> + +// 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 final : public SfxPoolItem +{ + bool bHyphen : 1; + bool bPageEnd : 1; + bool bNoCapsHyphenation : 1; + bool bNoLastWordHyphenation : 1; + sal_uInt8 nMinLead; + sal_uInt8 nMinTrail; + sal_uInt8 nMaxHyphens; // max. consecutive lines with hyphenation + sal_uInt8 nMinWordLength; // hyphenate only words with at least nMinWordLength characters + sal_uInt16 nTextHyphenZone; // don't force hyphenation at line end, allow this extra white space + +public: + static SfxPoolItem* CreateDefault(); + + SvxHyphenZoneItem( const bool bHyph /*= false*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + virtual SvxHyphenZoneItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + void SetHyphen( const bool bNew ) { bHyphen = bNew; } + bool IsHyphen() const { return bHyphen; } + + void SetPageEnd( const bool bNew ) { bPageEnd = bNew; } + bool IsPageEnd() const { return bPageEnd; } + + void SetNoCapsHyphenation( const bool bNew ) { bNoCapsHyphenation = bNew; } + bool IsNoCapsHyphenation() const { return bNoCapsHyphenation; } + void SetNoLastWordHyphenation( const bool bNew ) { bNoLastWordHyphenation = bNew; } + bool IsNoLastWordHyphenation() const { return bNoLastWordHyphenation; } + + sal_uInt8 &GetMinLead() { return nMinLead; } + sal_uInt8 GetMinLead() const { return nMinLead; } + + sal_uInt8 &GetMinTrail() { return nMinTrail; } + sal_uInt8 GetMinTrail() const { return nMinTrail; } + + sal_uInt8 &GetMaxHyphens() { return nMaxHyphens; } + sal_uInt8 GetMaxHyphens() const { return nMaxHyphens; } + + sal_uInt8 &GetMinWordLength() { return nMinWordLength; } + sal_uInt8 GetMinWordLength() const { return nMinWordLength; } + + sal_uInt16 &GetTextHyphenZone() { return nTextHyphenZone; } + sal_uInt16 GetTextHyphenZone() const { return nTextHyphenZone; } +}; + +#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 000000000..7f70a7073 --- /dev/null +++ b/include/editeng/itemtype.hxx @@ -0,0 +1,41 @@ +/* -*- 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_EDITENG_ITEMTYPE_HXX +#define INCLUDED_EDITENG_ITEMTYPE_HXX + +// forward --------------------------------------------------------------- +#include <rtl/ustring.hxx> +#include <tools/long.hxx> +#include <tools/mapunit.hxx> +#include <editeng/editengdllapi.h> +#include <unotools/resmgr.hxx> + +class Color; +class IntlWrapper; +// static and prototypes ------------------------------------------------- + +inline constexpr OUStringLiteral cpDelim = u", "; + +EDITENG_DLLPUBLIC OUString GetMetricText( tools::Long nVal, MapUnit eSrcUnit, MapUnit eDestUnit, const IntlWrapper * pIntl ); +OUString GetColorString( const Color& rCol ); +EDITENG_DLLPUBLIC TranslateId GetMetricId(MapUnit eUnit); + +#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 000000000..616427f46 --- /dev/null +++ b/include/editeng/justifyitem.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 INCLUDED_EDITENG_JUSTIFYITEM_HXX +#define INCLUDED_EDITENG_JUSTIFYITEM_HXX + +#include <editeng/editengdllapi.h> +#include <editeng/svxenum.hxx> +#include <svl/eitem.hxx> +#include <sal/types.h> + +class EDITENG_DLLPUBLIC SvxHorJustifyItem final : public SfxEnumItem<SvxCellHorJustify> +{ +public: + static SfxPoolItem* CreateDefault(); + + explicit SvxHorJustifyItem( const sal_uInt16 nId ); + + SvxHorJustifyItem( + const SvxCellHorJustify eJustify /*= SvxCellHorJustify::Standard*/, + const sal_uInt16 nId ); + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + virtual sal_uInt16 GetValueCount() const override; + static OUString GetValueText( SvxCellHorJustify nVal ); + virtual SvxHorJustifyItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + SvxHorJustifyItem(SvxHorJustifyItem const &) = default; // SfxPoolItem copy function dichotomy +}; + + +class EDITENG_DLLPUBLIC SvxVerJustifyItem final : public SfxEnumItem<SvxCellVerJustify> +{ +public: + static SfxPoolItem* CreateDefault(); + + explicit SvxVerJustifyItem( const sal_uInt16 nId ); + + SvxVerJustifyItem( + const SvxCellVerJustify eJustify, + const sal_uInt16 nId ); + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + virtual sal_uInt16 GetValueCount() const override; + static OUString GetValueText( SvxCellVerJustify nVal ); + virtual SvxVerJustifyItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + SvxVerJustifyItem(SvxVerJustifyItem const &) = default; // SfxPoolItem copy function dichotomy +}; + + +class EDITENG_DLLPUBLIC SvxJustifyMethodItem final : public SfxEnumItem<SvxCellJustifyMethod> +{ +public: + SvxJustifyMethodItem( + const SvxCellJustifyMethod eMethod, + const sal_uInt16 nId ); + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + virtual sal_uInt16 GetValueCount() const override; + static OUString GetValueText( SvxCellJustifyMethod nVal ); + virtual SvxJustifyMethodItem* Clone( SfxItemPool *pPool = nullptr ) const override; +}; + +#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 000000000..c108560ce --- /dev/null +++ b/include/editeng/keepitem.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 INCLUDED_EDITENG_KEEPITEM_HXX +#define INCLUDED_EDITENG_KEEPITEM_HXX + +#include <svl/eitem.hxx> +#include <editeng/editengdllapi.h> + + +// class SvxFormatKeepItem ------------------------------------------------ + +/* [Description] + + This item describes a logical variable "keep paragraphs together?". +*/ + +class EDITENG_DLLPUBLIC SvxFormatKeepItem final : public SfxBoolItem +{ +public: + static SfxPoolItem* CreateDefault(); + + inline SvxFormatKeepItem( const bool bKeep /*= false*/, + const sal_uInt16 _nWhich ); + SvxFormatKeepItem(SvxFormatKeepItem const &) = default; // SfxPoolItem copy function dichotomy + + // "pure virtual Methods" from SfxPoolItem + virtual SvxFormatKeepItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +inline SvxFormatKeepItem::SvxFormatKeepItem( const bool bKeep, const sal_uInt16 _nWhich ) : + SfxBoolItem( _nWhich, bKeep ) +{} + +#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 000000000..23a8c1909 --- /dev/null +++ b/include/editeng/kernitem.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 INCLUDED_EDITENG_KERNITEM_HXX +#define INCLUDED_EDITENG_KERNITEM_HXX + +#include <svl/intitem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxKerningItem -------------------------------------------------- + +// Note: Twips value +// Twips: 0 = no kerning + +/* [Description] + + This item describes the kerning. +*/ + +class EDITENG_DLLPUBLIC SvxKerningItem final : public SfxInt16Item +{ +public: + static SfxPoolItem* CreateDefault(); + + SvxKerningItem( const short nKern /*= 0*/, const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual SvxKerningItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual void ScaleMetrics( tools::Long nMult, tools::Long nDiv ) override; + virtual bool HasMetrics() const override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; +}; + +#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 000000000..4d3852141 --- /dev/null +++ b/include/editeng/langitem.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 INCLUDED_EDITENG_LANGITEM_HXX +#define INCLUDED_EDITENG_LANGITEM_HXX + +#include <svl/eitem.hxx> +#include <i18nlangtag/lang.h> +#include <editeng/editengdllapi.h> + +// class SvxLanguageItem ------------------------------------------------- + +/* [Description] + + This item describes a Language. +*/ + +// MSVC hack: +class SAL_DLLPUBLIC_RTTI SvxLanguageItem_Base: public SfxEnumItem<LanguageType> { +protected: + explicit SvxLanguageItem_Base(sal_uInt16 nWhich, LanguageType nValue): + SfxEnumItem(nWhich, nValue) + {} +}; + +class EDITENG_DLLPUBLIC SvxLanguageItem final : public SvxLanguageItem_Base +{ +public: + static SfxPoolItem* CreateDefault(); + + SvxLanguageItem( const LanguageType eLang /*= LANGUAGE_GERMAN*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual bool GetPresentation(SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper&) const override; + + virtual SvxLanguageItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual sal_uInt16 GetValueCount() const override; + + SvxLanguageItem(SvxLanguageItem const &) = default; // SfxPoolItem copy function dichotomy + + LanguageType GetLanguage() const + { return GetValue(); } + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/legacyitem.hxx b/include/editeng/legacyitem.hxx new file mode 100644 index 000000000..d92bcb59d --- /dev/null +++ b/include/editeng/legacyitem.hxx @@ -0,0 +1,193 @@ +/* -*- 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_EDITENG_LEGACYITEM_HXX +#define INCLUDED_EDITENG_LEGACYITEM_HXX + +#include <config_options.h> +#include <editeng/editengdllapi.h> + +////////////////////////////////////////////////////////////////////////////// +// // editeng +// SvxFontItem aFont; +// SvxFontHeightItem aHeight; +// SvxWeightItem aWeight; +// SvxPostureItem aPosture; +// SvxUnderlineItem aUnderline; +// SvxOverlineItem aOverline; +// SvxCrossedOutItem aCrossedOut; +// SvxContourItem aContour; +// SvxShadowedItem aShadowed; +// SvxColorItem aColor; +// SvxBoxItem aBox; +// SvxLineItem aTLBR; +// SvxBrushItem aBackground; +// SvxAdjustItem aAdjust; +// SvxHorJustifyItem aHorJustify; +// SvxVerJustifyItem aVerJustify; +// SvxFrameDirectionItem m_aTextOrientation; +////////////////////////////////////////////////////////////////////////////// + +class SvStream; +class SvxFontItem; +class SvxFontHeightItem; +class SvxWeightItem; +class SvxPostureItem; +class SvxTextLineItem; +class SvxCrossedOutItem; +class SvxShadowedItem; +class SvxColorItem; +class SvxBoxItem; +class SvxLineItem; +class SvxBrushItem; +class SvxAdjustItem; +class SvxHorJustifyItem; +class SvxVerJustifyItem; +class SvxFrameDirectionItem; +class SvxFormatBreakItem; +class SvxFormatKeepItem; +class SvxShadowItem; + +namespace legacy +{ + namespace SvxFont + { + sal_uInt16 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) GetVersion(sal_uInt16 nFileFormatVersion); + void UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) Create(SvxFontItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvStream& Store(const SvxFontItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxFontHeight + { + sal_uInt16 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) GetVersion(sal_uInt16 nFileFormatVersion); + void UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) Create(SvxFontHeightItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvStream& Store(const SvxFontHeightItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxWeight + { + sal_uInt16 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) GetVersion(sal_uInt16 nFileFormatVersion); + void UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) Create(SvxWeightItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvStream& Store(const SvxWeightItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxPosture + { + sal_uInt16 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) GetVersion(sal_uInt16 nFileFormatVersion); + void UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) Create(SvxPostureItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvStream& Store(const SvxPostureItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxTextLine // SvxUnderlineItem, SvxOverlineItem -> SvxTextLineItem + { + sal_uInt16 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) GetVersion(sal_uInt16 nFileFormatVersion); + void UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) Create(SvxTextLineItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvStream& Store(const SvxTextLineItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxCrossedOut + { + sal_uInt16 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) GetVersion(sal_uInt16 nFileFormatVersion); + void UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) Create(SvxCrossedOutItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvStream& Store(const SvxCrossedOutItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + // SvxContourItem -> SfxBoolItem + // SvxShadowedItem -> SfxBoolItem + + namespace SvxColor + { + sal_uInt16 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) GetVersion(sal_uInt16 nFileFormatVersion); + void UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) Create(SvxColorItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvStream& Store(const SvxColorItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxBox + { + sal_uInt16 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) GetVersion(sal_uInt16 nFileFormatVersion); + void UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) Create(SvxBoxItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvStream& Store(const SvxBoxItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxLine + { + sal_uInt16 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) GetVersion(sal_uInt16 nFileFormatVersion); + void UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) Create(SvxLineItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvStream& Store(const SvxLineItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxBrush + { + sal_uInt16 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) GetVersion(sal_uInt16 nFileFormatVersion); + void UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) Create(SvxBrushItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvStream& Store(const SvxBrushItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxAdjust + { + sal_uInt16 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) GetVersion(sal_uInt16 nFileFormatVersion); + void UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) Create(SvxAdjustItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvStream& Store(const SvxAdjustItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxHorJustify + { + sal_uInt16 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) GetVersion(sal_uInt16 nFileFormatVersion); + void UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) Create(SvxHorJustifyItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvStream& Store(const SvxHorJustifyItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxVerJustify + { + sal_uInt16 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) GetVersion(sal_uInt16 nFileFormatVersion); + void UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) Create(SvxVerJustifyItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvStream& Store(const SvxVerJustifyItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxFrameDirection + { + sal_uInt16 EDITENG_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion); + void EDITENG_DLLPUBLIC Create(SvxFrameDirectionItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + EDITENG_DLLPUBLIC SvStream& Store(const SvxFrameDirectionItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxFormatBreak + { + sal_uInt16 EDITENG_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion); + void EDITENG_DLLPUBLIC Create(SvxFormatBreakItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + EDITENG_DLLPUBLIC SvStream& Store(const SvxFormatBreakItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxFormatKeep + { + sal_uInt16 EDITENG_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion); + void EDITENG_DLLPUBLIC Create(SvxFormatKeepItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + EDITENG_DLLPUBLIC SvStream& Store(const SvxFormatKeepItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxShadow + { + sal_uInt16 EDITENG_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion); + void EDITENG_DLLPUBLIC Create(SvxShadowItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + EDITENG_DLLPUBLIC SvStream& Store(const SvxShadowItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } +} + +#endif // INCLUDED_EDITENG_LEGACYITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/lineitem.hxx b/include/editeng/lineitem.hxx new file mode 100644 index 000000000..0e481767a --- /dev/null +++ b/include/editeng/lineitem.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 INCLUDED_EDITENG_LINEITEM_HXX +#define INCLUDED_EDITENG_LINEITEM_HXX + +#include <memory> +#include <svl/poolitem.hxx> +#include <editeng/editengdllapi.h> + + +// class SvxLineItem ----------------------------------------------------- + + +/* +[Description] +This Item transports an editeng::SvxBorderLine. +*/ + +namespace editeng { + class SvxBorderLine; +} + +class EDITENG_DLLPUBLIC SvxLineItem final : public SfxPoolItem +{ +public: + static SfxPoolItem* CreateDefault(); + + explicit SvxLineItem( const sal_uInt16 nId ); + SvxLineItem( const SvxLineItem& rCpy ); + virtual ~SvxLineItem() override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + virtual bool operator==( const SfxPoolItem& ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + virtual SvxLineItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual void ScaleMetrics( tools::Long nMult, tools::Long nDiv ) override; + virtual bool HasMetrics() const override; + + const editeng::SvxBorderLine* + GetLine() const { return pLine.get(); } + void SetLine( const editeng::SvxBorderLine *pNew ); + +private: + std::unique_ptr<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 000000000..0510ee47d --- /dev/null +++ b/include/editeng/lrspitem.hxx @@ -0,0 +1,168 @@ +/* -*- 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_EDITENG_LRSPITEM_HXX +#define INCLUDED_EDITENG_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?) + SetTextLeft SetTxtFirst GetLeft GetTextLeft 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_TXTLEFT_VERSION (sal_uInt16(0x0002)) +#define LRSPACE_NEGATIVE_VERSION (sal_uInt16(0x0004)) + +class EDITENG_DLLPUBLIC SvxLRSpaceItem final : public SfxPoolItem +{ + tools::Long nTxtLeft; // We spend a sal_uInt16 + tools::Long nLeftMargin; // nLeft or the negative first-line indent + tools::Long nRightMargin; // The unproblematic right edge + /// The amount of extra space added to the left margin. + tools::Long m_nGutterMargin; + /// The amount of extra space added to the right margin, on mirrored pages. + tools::Long m_nRightGutterMargin; + + sal_uInt16 nPropFirstLineOffset, nPropLeftMargin, nPropRightMargin; + short nFirstLineOffset; // First-line indent _always_ relative to nTxtLeft + bool bAutoFirst; // Automatic calculation of the first line indent + bool bExplicitZeroMarginValRight; + bool bExplicitZeroMarginValLeft; + + void AdjustLeft(); // nLeftMargin and nTxtLeft are being adjusted. + +public: + + static SfxPoolItem* CreateDefault(); + + explicit SvxLRSpaceItem( const sal_uInt16 nId ); + SvxLRSpaceItem( const tools::Long nLeft, const tools::Long nRight, + const tools::Long nTLeft /*= 0*/, const short nOfset /*= 0*/, + const sal_uInt16 nId ); + SvxLRSpaceItem(SvxLRSpaceItem const &) = default; // SfxPoolItem copy function dichotomy + + // "pure virtual Methods" from SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + virtual SvxLRSpaceItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual void ScaleMetrics( tools::Long nMult, tools::Long nDiv ) override; + virtual bool HasMetrics() const override; + + // The "layout interface": + inline void SetLeft ( const tools::Long nL, const sal_uInt16 nProp = 100 ); + inline void SetRight( const tools::Long nR, const sal_uInt16 nProp = 100 ); + + // Query/direct setting of the absolute values + tools::Long GetLeft() const { return nLeftMargin; } + tools::Long GetRight() const { return nRightMargin;} + void SetLeftValue( const tools::Long nL ) { nTxtLeft = nLeftMargin = nL; } + void SetRightValue( const tools::Long nR ) { nRightMargin = nR; } + bool IsAutoFirst() const { return bAutoFirst; } + void SetAutoFirst( const bool bNew ) { bAutoFirst = bNew; } + + bool IsExplicitZeroMarginValRight() const { return bExplicitZeroMarginValRight; } + bool IsExplicitZeroMarginValLeft() const { return bExplicitZeroMarginValLeft; } + void SetExplicitZeroMarginValRight( const bool eR ) { bExplicitZeroMarginValRight = eR; } + void SetExplicitZeroMarginValLeft( const bool eL ) { bExplicitZeroMarginValLeft = eL; } + sal_uInt16 GetPropLeft() const { return nPropLeftMargin; } + sal_uInt16 GetPropRight() const { return nPropRightMargin;} + + // The UI/text interface: + inline void SetTextLeft( const tools::Long nL, const sal_uInt16 nProp = 100 ); + tools::Long GetTextLeft() const { return nTxtLeft; } + + inline void SetTextFirstLineOffset( const short nF, const sal_uInt16 nProp = 100 ); + short GetTextFirstLineOffset() const { return nFirstLineOffset; } + void SetPropTextFirstLineOffset( const sal_uInt16 nProp ) + { nPropFirstLineOffset = nProp; } + sal_uInt16 GetPropTextFirstLineOffset() const + { return nPropFirstLineOffset; } + void SetTextFirstLineOffsetValue( const short nValue ) + { nFirstLineOffset = nValue; } + void SetGutterMargin(const tools::Long nGutterMargin) { m_nGutterMargin = nGutterMargin; } + tools::Long GetGutterMargin() const { return m_nGutterMargin; } + void SetRightGutterMargin(const tools::Long nRightGutterMargin) { m_nRightGutterMargin = nRightGutterMargin; } + tools::Long GetRightGutterMargin() const { return m_nRightGutterMargin; } + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; + virtual boost::property_tree::ptree dumpAsJSON() const override; +}; + +inline void SvxLRSpaceItem::SetLeft( const tools::Long nL, const sal_uInt16 nProp ) +{ + nLeftMargin = (nL * nProp) / 100; + nTxtLeft = nLeftMargin; + nPropLeftMargin = nProp; +} +inline void SvxLRSpaceItem::SetRight( const tools::Long nR, const sal_uInt16 nProp ) +{ + if (0 == nR) + { + SetExplicitZeroMarginValRight(true); + } + nRightMargin = (nR * nProp) / 100; + nPropRightMargin = nProp; +} +inline void SvxLRSpaceItem::SetTextFirstLineOffset( const short nF, + const sal_uInt16 nProp ) +{ + nFirstLineOffset = short((tools::Long(nF) * nProp ) / 100); + nPropFirstLineOffset = nProp; + AdjustLeft(); +} + +inline void SvxLRSpaceItem::SetTextLeft( const tools::Long nL, const sal_uInt16 nProp ) +{ + if (0 == nL) + { + SetExplicitZeroMarginValLeft(true); + } + 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 000000000..e4c97cfcd --- /dev/null +++ b/include/editeng/lspcitem.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 INCLUDED_EDITENG_LSPCITEM_HXX +#define INCLUDED_EDITENG_LSPCITEM_HXX + +#include <svl/cenumitm.hxx> +#include <tools/mapunit.hxx> +#include <editeng/svxenum.hxx> +#include <editeng/editengdllapi.h> + +// class SvxLineSpacingItem ---------------------------------------------- + +/* [Description] + This item describes the distance between the lines. +*/ + +#define LINE_SPACE_DEFAULT_HEIGHT 200 +class EDITENG_DLLPUBLIC SvxLineSpacingItem final : public SfxEnumItemInterface +{ + short nInterLineSpace; + sal_uInt16 nLineHeight; + sal_uInt16 nPropLineSpace; + SvxLineSpaceRule eLineSpaceRule; + SvxInterLineSpaceRule eInterLineSpaceRule; + +public: + static SfxPoolItem* CreateDefault(); + + // 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 nLineHeight /*= LINE_SPACE_DEFAULT_HEIGHT*/, const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + virtual SvxLineSpacingItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + // Methods to query and edit. InterlineSpace is added to the height. + short GetInterLineSpace() const { return nInterLineSpace; } + void SetInterLineSpace( const short nSpace ) + { + nInterLineSpace = nSpace; + eInterLineSpaceRule = SvxInterLineSpaceRule::Fix; + } + + // Determines the absolute or minimum row height. + sal_uInt16 GetLineHeight() const { return nLineHeight; } + void SetLineHeight( const sal_uInt16 nHeight ) + { + nLineHeight = nHeight; + eLineSpaceRule = SvxLineSpaceRule::Min; + } + + // To increase or decrease the row height. + sal_uInt16 GetPropLineSpace() const { return nPropLineSpace; } + void SetPropLineSpace( const sal_uInt16 nProp ) + { + nPropLineSpace = nProp; + eInterLineSpaceRule = SvxInterLineSpaceRule::Prop; + } + + void SetLineSpaceRule(SvxLineSpaceRule e) { eLineSpaceRule = e; } + SvxLineSpaceRule GetLineSpaceRule() const { return eLineSpaceRule; } + + void SetInterLineSpaceRule(SvxInterLineSpaceRule e) { eInterLineSpaceRule = e; } + SvxInterLineSpaceRule GetInterLineSpaceRule() const { return eInterLineSpaceRule; } + + virtual sal_uInt16 GetValueCount() const override; + virtual sal_uInt16 GetEnumValue() const override; + virtual void SetEnumValue( sal_uInt16 nNewVal ) override; +}; + +#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 000000000..3bc26db60 --- /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 INCLUDED_EDITENG_MACROS_HXX +#define INCLUDED_EDITENG_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 000000000..10ed89b2f --- /dev/null +++ b/include/editeng/measfld.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 INCLUDED_EDITENG_MEASFLD_HXX +#define INCLUDED_EDITENG_MEASFLD_HXX + +#include <editeng/flditem.hxx> +#include <editeng/editengdllapi.h> +#include <com/sun/star/text/textfield/Type.hpp> + +enum class SdrMeasureFieldKind { Value, Unit, Rotate90Blanks }; + +class EDITENG_DLLPUBLIC SdrMeasureField final : public SvxFieldData { + SdrMeasureFieldKind eMeasureFieldKind; +public: + virtual sal_Int32 GetClassId() const override { return css::text::textfield::Type::MEASURE; } + SdrMeasureField(SdrMeasureFieldKind eNewKind): eMeasureFieldKind(eNewKind) {} + virtual ~SdrMeasureField() override; + virtual std::unique_ptr<SvxFieldData> Clone() const override; + virtual bool operator==(const SvxFieldData&) const override; + SdrMeasureFieldKind GetMeasureFieldKind() const { return eMeasureFieldKind; } + + SdrMeasureField(SdrMeasureField const &) = default; + SdrMeasureField(SdrMeasureField &&) = default; + SdrMeasureField & operator =(SdrMeasureField const &) = default; + SdrMeasureField & operator =(SdrMeasureField &&) = default; +}; + + +#endif // INCLUDED_EDITENG_MEASFLD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/memberids.h b/include/editeng/memberids.h new file mode 100644 index 000000000..9b89ebafa --- /dev/null +++ b/include/editeng/memberids.h @@ -0,0 +1,195 @@ +/* -*- 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_EDITENG_MEMBERIDS_H +#define INCLUDED_EDITENG_MEMBERIDS_H + +#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 + +// 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 +#define MID_HYPHEN_NO_CAPS 4 +#define MID_HYPHEN_NO_LAST_WORD 5 +#define MID_HYPHEN_MIN_WORD_LENGTH 6 +#define MID_HYPHEN_ZONE 7 + +// 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 + +//SvxEscapementItem +#define MID_ESC 0 +#define MID_ESC_HEIGHT 1 +#define MID_AUTO_ESC 2 + +//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 +#define MID_GUTTER_MARGIN 12 + +//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 2 +#define MID_GRAPHIC_TRANSPARENT 3 +#define MID_GRAPHIC_URL 4 +#define MID_GRAPHIC_FILTER 5 +#define MID_GRAPHIC_REPEAT 6 +#define MID_GRAPHIC_TRANSPARENCY 7 +#define MID_BACK_COLOR_R_G_B 8 +#define MID_BACK_COLOR_TRANSPARENCY 9 +#define MID_SHADING_VALUE 10 + +//SvxFormatBreakItem +#define MID_BREAK_BEFORE 0 +#define MID_BREAK_AFTER 1 + +// SvxHorJustifyItem +#define MID_HORJUST_HORJUST 0 +#define MID_HORJUST_ADJUST 1 + +// SvxShadowItem +#define MID_SHADOW_TRANSPARENCE 1 + +// SvxColorItem +#define MID_COLOR_RGB 0 +#define MID_COLOR_ALPHA 1 +//#define MID_GRAPHIC_TRANSPARENT 3 // used, but already defined above +#define MID_COLOR_THEME_INDEX 4 +#define MID_COLOR_TINT_OR_SHADE 5 +#define MID_COLOR_LUM_MOD 6 +#define MID_COLOR_LUM_OFF 7 + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/misspellrange.hxx b/include/editeng/misspellrange.hxx new file mode 100644 index 000000000..f46c25e22 --- /dev/null +++ b/include/editeng/misspellrange.hxx @@ -0,0 +1,38 @@ +/* -*- 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 INCLUDED_EDITENG_MISSPELLRANGE_HXX +#define INCLUDED_EDITENG_MISSPELLRANGE_HXX + +#include <sal/types.h> + +#include <vector> + +namespace editeng +{ +struct MisspellRange +{ + size_t mnStart; + size_t mnEnd; + + MisspellRange(size_t nStart, size_t nEnd); +}; + +struct MisspellRanges +{ + sal_Int32 mnParagraph; + std::vector<MisspellRange> maRanges; + + MisspellRanges(sal_Int32 nParagraph, std::vector<MisspellRange>&& rRanges); +}; +} + +#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 000000000..1078a055b --- /dev/null +++ b/include/editeng/nhypitem.hxx @@ -0,0 +1,42 @@ +/* -*- 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_EDITENG_NHYPITEM_HXX +#define INCLUDED_EDITENG_NHYPITEM_HXX + +#include <svl/eitem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxNoHyphenItem ------------------------------------------------- +class EDITENG_DLLPUBLIC SvxNoHyphenItem final : public SfxBoolItem +{ +public: + SvxNoHyphenItem( const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual SvxNoHyphenItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; +}; + +#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 000000000..6039ec555 --- /dev/null +++ b/include/editeng/numdef.hxx @@ -0,0 +1,28 @@ +/* -*- 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_EDITENG_NUMDEF_HXX +#define INCLUDED_EDITENG_NUMDEF_HXX + +#define SVX_MAX_NUM 10 // max. possible numbering level +#define SVX_DEF_BULLET (0xF000 + 149) // Character for lists + +#endif // INCLUDED_EDITENG_NUMDEF_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx new file mode 100644 index 000000000..baa6ad320 --- /dev/null +++ b/include/editeng/numitem.hxx @@ -0,0 +1,359 @@ +/* -*- 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_EDITENG_NUMITEM_HXX +#define INCLUDED_EDITENG_NUMITEM_HXX + +#include <rtl/ustring.hxx> +#include <svl/poolitem.hxx> +#include <editeng/svxenum.hxx> +#include <tools/gen.hxx> +#include <editeng/numdef.hxx> +#include <tools/color.hxx> +#include <com/sun/star/style/NumberingType.hpp> +#include <unotools/fontcvt.hxx> +#include <editeng/editengdllapi.h> +#include <o3tl/typed_flags_set.hxx> +#include <vcl/vclenum.hxx> +#include <vcl/font.hxx> +#include <memory> +#include <optional> +#include <algorithm> + +class SvxBrushItem; +class Graphic; +class SvxNodeNum; +namespace com::sun::star::text { class XNumberingFormatter; } + +namespace com::sun::star::lang { struct Locale; } + + +#define SVX_NO_NUM 200 // Marker for no numbering +#define SVX_NO_NUMLEVEL 0x20 +#define SVX_NUM_REL_SIZE_MIN 25 // Lower limit for numbering relative size + + +#define LINK_TOKEN 0x80 //indicate linked bitmaps - for use in dialog only + +typedef struct _xmlTextWriter* xmlTextWriterPtr; + +class EDITENG_DLLPUBLIC SvxNumberType +{ + static sal_Int32 nRefCount; + static css::uno::Reference<css::text::XNumberingFormatter> xFormatter; + + SvxNumType nNumType; + bool bShowSymbol; // Also show Symbol ? + +public: + explicit SvxNumberType(SvxNumType nType = SVX_NUM_ARABIC); + SvxNumberType(const SvxNumberType& rType); + ~SvxNumberType(); + SvxNumberType & operator =(SvxNumberType const &) = default; + + OUString GetNumStr( sal_Int32 nNo ) const; + OUString GetNumStr( sal_Int32 nNo, const css::lang::Locale& rLocale ) const; + + void SetNumberingType(SvxNumType nSet) {nNumType = nSet;} + SvxNumType GetNumberingType() const {return nNumType;} + + void SetShowSymbol(bool bSet) {bShowSymbol = bSet;} + bool IsShowSymbol()const{return bShowSymbol;} + + bool IsTextFormat() const + { + return css::style::NumberingType::NUMBER_NONE != nNumType && + css::style::NumberingType::CHAR_SPECIAL != nNumType && + css::style::NumberingType::BITMAP != nNumType; + } + + void dumpAsXml(xmlTextWriterPtr w) const; +}; + +class EDITENG_DLLPUBLIC SvxNumberFormat : public SvxNumberType +{ +public: + enum SvxNumPositionAndSpaceMode + { + LABEL_WIDTH_AND_POSITION, + LABEL_ALIGNMENT + }; + enum LabelFollowedBy + { + LISTTAB, + SPACE, + NOTHING, + NEWLINE + }; + +private: + OUString sPrefix; + OUString sSuffix; + std::optional<OUString> sListFormat; // Format string ">%1.%2<" can be used instead of prefix/suffix + // Right now it is optional value to distinguish empty list format + // and not set list format when we need to fallback to prefix/suffix. + + SvxAdjust eNumAdjust; + + sal_uInt8 nInclUpperLevels; // Take over numbers from the previous level. + sal_uInt16 nStart; // Start of counting + + sal_UCS4 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 + // 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; + + sal_Int32 nFirstLineOffset; // First line indent + sal_Int32 nAbsLSpace; // Distance Border<->Number + 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 + tools::Long mnListtabPos; + // specifies the first line indent + tools::Long mnFirstLineIndent; + // specifies the indent before the text, e.g. in L2R-layout the left margin + tools::Long mnIndentAt; + + std::unique_ptr<SvxBrushItem> + pGraphicBrush; + sal_Int16 eVertOrient; // vertical alignment of a bitmap + + Size aGraphicSize; // Always! in 1/100 mm + std::optional<vcl::Font> + pBulletFont; // Pointer to the bullet font + + OUString sCharStyleName; // Character Style + +public: + explicit SvxNumberFormat( SvxNumType nNumberingType ); + SvxNumberFormat(const SvxNumberFormat& rFormat); + SvxNumberFormat( SvStream & rStream ); + + virtual ~SvxNumberFormat(); + + void Store(SvStream &rStream, FontToSubsFontConverter pConverter); + + SvxNumberFormat& operator=( const SvxNumberFormat& ); + bool operator==( const SvxNumberFormat& ) const; + 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;} + // Based on prefix and suffix initialize them (for backward compatibility) and generate listformat string + void SetListFormat(const OUString& rPrefix, const OUString& rSuffix, int nLevel); + void SetListFormat(std::optional<OUString> oSet = std::nullopt); + bool HasListFormat() const { return sListFormat.has_value(); } + OUString GetListFormat(bool bIncludePrefixSuffix = true) const; + + void SetCharFormatName(const OUString& rSet){ sCharStyleName = rSet; } + virtual OUString GetCharFormatName()const; + + void SetBulletFont(const vcl::Font* pFont); + const std::optional<vcl::Font>& GetBulletFont() const { return pBulletFont; } + void SetBulletChar(sal_UCS4 cSet){cBullet = cSet;} + sal_UCS4 GetBulletChar()const {return cBullet;} + void SetBulletRelSize(sal_uInt16 nSet) {nBulletRelSize = std::max(nSet,sal_uInt16(SVX_NUM_REL_SIZE_MIN));} + sal_uInt16 GetBulletRelSize() const { return nBulletRelSize;} + void SetBulletColor(Color nSet){nBulletColor = nSet;} + const 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 = nullptr, const sal_Int16* pOrient = nullptr); + const SvxBrushItem* GetBrush() const {return pGraphicBrush.get();} + void SetGraphic( const OUString& rName ); + sal_Int16 GetVertOrient() const; + void SetGraphicSize(const Size& rSet) {aGraphicSize = rSet;} + const Size& GetGraphicSize() const {return aGraphicSize;} + + SvxNumPositionAndSpaceMode GetPositionAndSpaceMode() const { return mePositionAndSpaceMode;} + void SetPositionAndSpaceMode( SvxNumPositionAndSpaceMode ePositionAndSpaceMode ); + + void SetAbsLSpace(sal_Int32 nSet) {nAbsLSpace = nSet;} + sal_Int32 GetAbsLSpace() const; + void SetFirstLineOffset(sal_Int32 nSet) { nFirstLineOffset = nSet;} + sal_Int32 GetFirstLineOffset() const; + void SetCharTextDistance(short nSet) { nCharTextDistance = nSet; } + short GetCharTextDistance() const; + + void SetLabelFollowedBy( const LabelFollowedBy eLabelFollowedBy ); + LabelFollowedBy GetLabelFollowedBy() const { return meLabelFollowedBy;} + OUString GetLabelFollowedByAsString() const; + void SetListtabPos( const tools::Long nListtabPos ); + tools::Long GetListtabPos() const { return mnListtabPos;} + void SetFirstLineIndent( const tools::Long nFirstLineIndent ); + tools::Long GetFirstLineIndent() const { return mnFirstLineIndent;} + void SetIndentAt( const tools::Long nIndentAt ); + tools::Long GetIndentAt() const { return mnIndentAt;} + + static Size GetGraphicSizeMM100(const Graphic* pGraphic); + static OUString CreateRomanString( sal_Int32 nNo, bool bUpper ); +}; + +//Feature-Flags (only sal_uInt16!) +enum class SvxNumRuleFlags : sal_uInt16 +{ + NONE = 0x0000, + CONTINUOUS = 0x0001, // consecutive numbers possible? + CHAR_STYLE = 0x0004, // Character styles? + BULLET_REL_SIZE = 0x0008, // relative bullet size? + BULLET_COLOR = 0x0010, // Bullet color + NO_NUMBERS = 0x0080, // Numbering are not allowed + ENABLE_LINKED_BMP = 0x0100, // linked bitmaps are available + ENABLE_EMBEDDED_BMP = 0x0200 // embedded bitmaps are available +}; +namespace o3tl +{ + template<> struct typed_flags<SvxNumRuleFlags> : is_typed_flags<SvxNumRuleFlags, 0x039d> {}; +} + +enum class SvxNumRuleType : sal_uInt8 +{ + NUMBERING, + OUTLINE_NUMBERING, + PRESENTATION_NUMBERING +}; + +class EDITENG_DLLPUBLIC SvxNumRule final +{ + std::unique_ptr<SvxNumberFormat> aFmts[SVX_MAX_NUM]; + sal_uInt16 nLevelCount; // Number of supported levels + SvxNumRuleFlags nFeatureFlags; // What is supported? + SvxNumRuleType eNumberingType; // Type of numbering + bool bContinuousNumbering; // sequential numbering + bool aFmtsSet[SVX_MAX_NUM]; // Flags indicating valid levels + + static sal_Int32 nRefCount; +public: + SvxNumRule( SvxNumRuleFlags nFeatures, + sal_uInt16 nLevels, + bool bCont, + SvxNumRuleType eType = SvxNumRuleType::NUMBERING, + SvxNumberFormat::SvxNumPositionAndSpaceMode + eDefaultNumberFormatPositionAndSpaceMode + = SvxNumberFormat::LABEL_WIDTH_AND_POSITION ); + SvxNumRule(const SvxNumRule& rCopy); + SvxNumRule(SvxNumRule&&) noexcept; + SvxNumRule(SvStream &rStream); + ~SvxNumRule(); + + bool operator==( const SvxNumRule& ) const; + bool operator!=( const SvxNumRule& rRule ) const {return !(*this == rRule);} + + SvxNumRule& operator=( const SvxNumRule& ); + SvxNumRule& operator=( SvxNumRule&& ) noexcept; + + void Store(SvStream &rStream); + void dumpAsXml(xmlTextWriterPtr pWriter) const; + const SvxNumberFormat* Get(sal_uInt16 nLevel)const; + const SvxNumberFormat& GetLevel(sal_uInt16 nLevel)const; + void SetLevel(sal_uInt16 nLevel, const SvxNumberFormat& rFmt, bool bIsValid = true); + void SetLevel(sal_uInt16 nLevel, const SvxNumberFormat* pFmt); + + bool IsContinuousNumbering()const + {return bContinuousNumbering;} + void SetContinuousNumbering(bool bSet) + {bContinuousNumbering = bSet;} + + sal_uInt16 GetLevelCount() const {return nLevelCount;} + bool IsFeatureSupported(SvxNumRuleFlags nFeature) const + { return bool(nFeatureFlags & nFeature); } + SvxNumRuleFlags GetFeatureFlags() const {return nFeatureFlags;} + void SetFeatureFlag( SvxNumRuleFlags nFlag, bool bSet = true ) { if(bSet) nFeatureFlags |= nFlag; else nFeatureFlags &= ~nFlag; } + + OUString MakeNumString( const SvxNodeNum& ) const; + + SvxNumRuleType GetNumRuleType() const { return eNumberingType; } + + void UnLinkGraphics(); +}; + +class EDITENG_DLLPUBLIC SvxNumBulletItem final : public SfxPoolItem +{ + SvxNumRule maNumRule; +public: + explicit SvxNumBulletItem(SvxNumRule const & rRule); + explicit SvxNumBulletItem(SvxNumRule && rRule); + SvxNumBulletItem(SvxNumRule const & rRule, sal_uInt16 nWhich ); + SvxNumBulletItem(SvxNumRule && rRule, sal_uInt16 nWhich ); + SvxNumBulletItem(const SvxNumBulletItem& rCopy); + virtual ~SvxNumBulletItem() override; + + virtual SvxNumBulletItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool operator==( const SfxPoolItem& ) const override; + + const SvxNumRule& GetNumRule() const { return maNumRule; } + SvxNumRule& GetNumRule() { return maNumRule; } + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +class SvxNodeNum +{ + sal_uInt16 nLevelVal[ SVX_MAX_NUM ] = {}; // Numbers of all levels + sal_uInt8 nMyLevel = 0; // Current Level + +public: + explicit inline SvxNodeNum() = default; + inline SvxNodeNum& operator=( const SvxNodeNum& rCpy ); + + sal_uInt8 GetLevel() const { return nMyLevel; } + void SetLevel( sal_uInt8 nVal ) { nMyLevel = nVal; } + + const sal_uInt16* GetLevelVal() const { return nLevelVal; } + sal_uInt16* GetLevelVal() { return nLevelVal; } +}; + +inline SvxNodeNum& SvxNodeNum::operator=( const SvxNodeNum& rCpy ) +{ + if ( &rCpy != this) + { + nMyLevel = rCpy.nMyLevel; + + memcpy( nLevelVal, rCpy.nLevelVal, sizeof( nLevelVal ) ); + } + return *this; +} + +SvxNumRule SvxConvertNumRule( const SvxNumRule& rRule, 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 000000000..d38747747 --- /dev/null +++ b/include/editeng/opaqitem.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 INCLUDED_EDITENG_OPAQITEM_HXX +#define INCLUDED_EDITENG_OPAQITEM_HXX + +#include <svl/eitem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxOpaqueItem --------------------------------------------------- + + +/* [Description] + + This item describes a logical variable "Opaque yes or no." +*/ + +class EDITENG_DLLPUBLIC SvxOpaqueItem final : public SfxBoolItem +{ +public: + explicit SvxOpaqueItem( const sal_uInt16 nId , const bool bOpa = true ); + + // "pure virtual Methods" from SfxPoolItem + virtual SvxOpaqueItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; +}; + +inline SvxOpaqueItem::SvxOpaqueItem( const sal_uInt16 nId, const bool bOpa ) + : SfxBoolItem( nId, bOpa ) +{} + +#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 000000000..f4cbd2df8 --- /dev/null +++ b/include/editeng/optitems.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 INCLUDED_EDITENG_OPTITEMS_HXX +#define INCLUDED_EDITENG_OPTITEMS_HXX + +#include <svl/poolitem.hxx> +#include <editeng/editengdllapi.h> + + +// class SfxHyphenRegionItem --------------------------------------------- + +class EDITENG_DLLPUBLIC SfxHyphenRegionItem final : public SfxPoolItem +{ + sal_uInt8 nMinLead; + sal_uInt8 nMinTrail; + +public: + + SfxHyphenRegionItem( const sal_uInt16 nId ); + + virtual bool operator==( const SfxPoolItem& ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + virtual SfxHyphenRegionItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + sal_uInt8 &GetMinLead() { return nMinLead; } + sal_uInt8 GetMinLead() const { return nMinLead; } + + sal_uInt8 &GetMinTrail() { return nMinTrail; } + sal_uInt8 GetMinTrail() const { return nMinTrail; } +}; + +#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 000000000..4181e7c74 --- /dev/null +++ b/include/editeng/orphitem.hxx @@ -0,0 +1,50 @@ +/* -*- 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_EDITENG_ORPHITEM_HXX +#define INCLUDED_EDITENG_ORPHITEM_HXX + +#include <svl/intitem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxOrphansItem -------------------------------------------------- + +/* [Description] + + This item describes the number of lines for the orphans system. +*/ + +class EDITENG_DLLPUBLIC SvxOrphansItem final : public SfxByteItem +{ +public: + static SfxPoolItem* CreateDefault(); + + SvxOrphansItem( const sal_uInt8 nL /*= 0*/, const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual SvxOrphansItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; +}; + +#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 000000000..ab24be0b1 --- /dev/null +++ b/include/editeng/outliner.hxx @@ -0,0 +1,989 @@ +/* -*- 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_EDITENG_OUTLINER_HXX +#define INCLUDED_EDITENG_OUTLINER_HXX + +#include <editeng/editdata.hxx> +#include <editeng/editstat.hxx> +#include <editeng/overflowingtxt.hxx> +#include <i18nlangtag/lang.h> +#include <rtl/ustring.hxx> +#include <svl/SfxBroadcaster.hxx> +#include <svl/languageoptions.hxx> +#include <svl/undo.hxx> +#include <tools/gen.hxx> +#include <tools/color.hxx> +#include <utility> +#include <vcl/outdev.hxx> +#include <vcl/errcode.hxx> +#include <tools/link.hxx> +#include <editeng/editengdllapi.h> + +#include <vcl/GraphicObject.hxx> + +#include <editeng/svxfont.hxx> +#include <editeng/eedata.hxx> +#include <editeng/paragraphdata.hxx> +#include <o3tl/typed_flags_set.hxx> + +#include <optional> +#include <functional> +#include <memory> +#include <vector> + +class OutlinerEditEng; +class Outliner; +class EditView; +class EditUndo; +class ParagraphList; +class OutlinerParaObject; +class SvStream; +class SvxSearchItem; +class SvxFieldItem; +namespace vcl { class Window; } +namespace weld { class Widget; } +class KeyEvent; +class MouseEvent; +class CommandEvent; +class MapMode; +class SfxStyleSheetPool; +class SfxStyleSheet; +class SfxItemPool; +class SfxItemSet; +class SvxNumberFormat; +class EditEngine; +class SvKeyValueIterator; +class SvxForbiddenCharactersTable; +class OutlinerViewShell; +enum class CharCompressType; +enum class TransliterationFlags; +class SvxFieldData; +enum class PointerStyle; +class SvxNumRule; +enum class TextRotation; + +namespace com::sun::star::linguistic2 { + class XSpellChecker1; + class XHyphenator; +} +namespace svx{ + struct SpellPortion; + typedef std::vector<SpellPortion> SpellPortions; +} +namespace basegfx { class B2DPolyPolygon; } +namespace com::sun::star::lang { struct Locale; } + + + +// internal use only! +enum class ParaFlag +{ + NONE = 0x0000, + HOLDDEPTH = 0x4000, + SETBULLETTEXT = 0x8000, + ISPAGE = 0x0100, +}; +namespace o3tl +{ + template<> struct typed_flags<ParaFlag> : is_typed_flags<ParaFlag, 0xc100> {}; +} + +// 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 + +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 ) = delete; + + OUString aBulText; + Size aBulSize; + ParaFlag nFlags; + bool bVisible; + + bool IsVisible() const { return bVisible; } + void SetText( const OUString& rText ) { aBulText = rText; aBulSize.setWidth(-1); } + void Invalidate() { aBulSize.setWidth(-1); } + void SetDepth( sal_Int16 nNewDepth ) { nDepth = nNewDepth; aBulSize.setWidth(-1); } + const OUString& GetText() const { return aBulText; } + + Paragraph( sal_Int16 nDepth ); + Paragraph( const Paragraph& ) = delete; + Paragraph( const ParagraphData& ); + + sal_Int16 GetDepth() const { return nDepth; } + + sal_Int16 GetNumberingStartValue() const { return mnNumberingStartValue; } + void SetNumberingStartValue( sal_Int16 nNumberingStartValue ); + + bool IsParaIsNumberingRestart() const { return mbParaIsNumberingRestart; } + void SetParaIsNumberingRestart( bool bParaIsNumberingRestart ); + + void SetFlag( ParaFlag nFlag ) { nFlags |= nFlag; } + void RemoveFlag( ParaFlag nFlag ) { nFlags &= ~nFlag; } + bool HasFlag( ParaFlag nFlag ) const { return bool(nFlags & nFlag); } +public: + ~Paragraph(); + void dumpAsXml(xmlTextWriterPtr pWriter) const; +}; + +struct ParaRange +{ + sal_Int32 nStartPara; + sal_Int32 nEndPara; + + ParaRange( sal_Int32 nS, sal_Int32 nE ) : nStartPara(nS), nEndPara(nE) {} + + void Adjust(); +}; + +inline void ParaRange::Adjust() +{ + if ( nStartPara > nEndPara ) + { + std::swap(nStartPara, nEndPara); + } +} + +class EDITENG_DLLPUBLIC OutlinerView final +{ + friend class Outliner; + + Outliner* pOwner; + std::unique_ptr<EditView> pEditView; + + enum class MouseTarget { + Text = 0, + Bullet = 1, + Hypertext = 2, // Outside OutputArea + Outside = 3 // Outside OutputArea + }; + + EDITENG_DLLPRIVATE void ImplExpandOrCollaps( sal_Int32 nStartPara, sal_Int32 nEndPara, bool bExpand ); + + EDITENG_DLLPRIVATE sal_Int32 ImpCheckMousePos( const Point& rPosPixel, MouseTarget& reTarget); + EDITENG_DLLPRIVATE void ImpToggleExpand( Paragraph const * pParentPara ); + EDITENG_DLLPRIVATE ParaRange ImpGetSelectedParagraphs( bool bIncludeHiddenChildren ); + + EDITENG_DLLPRIVATE sal_Int32 ImpInitPaste( sal_Int32& rStart ); + EDITENG_DLLPRIVATE void ImpPasted( sal_Int32 nStart, sal_Int32 nPrevParaCount, sal_Int32 nSize); + EDITENG_DLLPRIVATE sal_Int32 ImpCalcSelectedPages( bool bIncludeFirstSelected ); + + Link<LinkParamNone*,void> aEndCutPasteLink; + +public: + OutlinerView( Outliner* pOut, vcl::Window* pWindow ); + ~OutlinerView(); + + EditView& GetEditView() const { return *pEditView; } + + void Scroll( tools::Long nHorzScroll, tools::Long nVertScroll ); + + void Paint( const tools::Rectangle& rRect, OutputDevice* pTargetDevice = nullptr ); + bool PostKeyEvent( const KeyEvent& rKEvt, vcl::Window const * pFrameWin = nullptr ); + bool MouseButtonDown( const MouseEvent& ); + bool MouseButtonUp( const MouseEvent& ); + void ReleaseMouse(); + bool MouseMove( const MouseEvent& ); + + void ShowCursor( bool bGotoCursor = true, bool bActivate = false ); + void HideCursor( bool bDeactivate = false ); + + Outliner* GetOutliner() const { return pOwner; } + + void SetWindow( vcl::Window* pWindow ); + vcl::Window* GetWindow() const; + + void SetReadOnly( bool bReadOnly ); + bool IsReadOnly() const; + + void SetOutputArea( const tools::Rectangle& rRect ); + tools::Rectangle const & GetOutputArea() const; + + tools::Rectangle GetVisArea() const; + + void CreateSelectionList (std::vector<Paragraph*> &aSelList) ; + + void Select( Paragraph const * pParagraph, bool bSelect = true); + + OUString GetSelected() const; + void SelectRange( sal_Int32 nFirst, sal_Int32 nCount ); + void SetAttribs( const SfxItemSet& ); + void Indent( short nDiff ); + void AdjustDepth( short nDX ); // Later replace with Indent! + + void AdjustHeight( tools::Long nDY ); + + void Read( SvStream& rInput, EETextFormat eFormat, SvKeyValueIterator* pHTTPHeaderAttrs ); + + void InsertText( const OUString& rNew, bool bSelect = false ); + void InsertText( const OutlinerParaObject& rParaObj ); + void Expand(); + void Collapse(); + void ExpandAll(); + void CollapseAll(); + + void SetBackgroundColor( const Color& rColor ); + Color const & GetBackgroundColor() const; + + /// Informs this edit view about which view shell contains it. + void RegisterViewShell(OutlinerViewShell* pViewShell); + + SfxItemSet GetAttribs(); + + void Cut(); + void Copy(); + void Paste( bool bUseSpecial = false ); + void PasteSpecial(); + + const SfxStyleSheet* GetStyleSheet() const; + SfxStyleSheet* GetStyleSheet(); + + void SetControlWord( EVControlBits nWord ); + EVControlBits GetControlWord() const; + + void SetAnchorMode( EEAnchorMode eMode ); + EEAnchorMode GetAnchorMode() const; + + PointerStyle GetPointer( const Point& rPosPixel ); + bool Command(const CommandEvent& rCEvt); + + void StartSpeller(weld::Widget* pDialogParent); + EESpellState StartThesaurus(weld::Widget* pDialogParent); + sal_Int32 StartSearchAndReplace( const SvxSearchItem& rSearchItem ); + + // for text conversion + void StartTextConversion(weld::Widget* pDialogParent, LanguageType nSrcLang, LanguageType nDestLang, const vcl::Font *pDestFont, sal_Int32 nOptions, bool bIsInteractive, bool bMultipleDoc); + + void TransliterateText( TransliterationFlags nTransliterationMode ); + + ESelection GetSelection() const; + + SvtScriptType GetSelectedScriptType() const; + + void SetVisArea( const tools::Rectangle& rRect ); + void SetSelection( const ESelection& ); + void GetSelectionRectangles(std::vector<tools::Rectangle>& rLogicRects) const; + + void RemoveAttribs( bool bRemoveParaAttribs, bool bKeepLanguages = false ); + void RemoveAttribsKeepLanguages( bool bRemoveParaAttribs ); + bool HasSelection() const; + + void InsertField( const SvxFieldItem& rFld ); + const SvxFieldItem* GetFieldUnderMousePointer() const; + const SvxFieldItem* GetFieldAtSelection() const; + /// Return the field at the current cursor position or nullptr if no field found + const SvxFieldData* GetFieldAtCursor() const; + /// Select the field at the current cursor position + void SelectFieldAtCursor(); + + /** enables bullets for the selected paragraphs if the bullets/numbering of the first paragraph is off + or disables bullets/numbering for the selected paragraphs if the bullets/numbering of the first paragraph is on + */ + void ToggleBullets(); + + void ToggleBulletsNumbering( + const bool bToggle, + const bool bHandleBullets, + const SvxNumRule* pNumRule ); + + /** apply bullets/numbering for paragraphs + + @param boolean bHandleBullets + true: handle bullets + false: handle numbering + + @param pNewNumRule + numbering rule which needs to be applied. can be 0. + + @param boolean bAtSelection + true: apply bullets/numbering at selected paragraphs + false: apply bullets/numbering at all paragraphs + */ + void ApplyBulletsNumbering( + const bool bHandleBullets, + const SvxNumRule* pNewNumRule, + const bool bCheckCurrentNumRuleBeforeApplyingNewNumRule, + const bool bAtSelection = false ); + + /** switch off bullets/numbering for paragraphs + + @param boolean bAtSelection + true: switch off bullets/numbering at selected paragraphs + false: switch off bullets/numbering at all paragraphs + */ + void SwitchOffBulletsNumbering( + const bool bAtSelection = false ); + + /** enables numbering for the selected paragraphs that are not enabled and ignore all selected + paragraphs that already have numbering enabled. + */ + void EnsureNumberingIsOn(); + + bool IsCursorAtWrongSpelledWord(); + bool IsWrongSpelledWordAtPos( const Point& rPosPixel ); + void ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbackInfo&,void>& rCallBack); + + void SetInvalidateMore( sal_uInt16 nPixel ); + sal_uInt16 GetInvalidateMore() const; + + OUString GetSurroundingText() const; + Selection GetSurroundingTextSelection() const; + bool DeleteSurroundingText(const Selection& rRange); + + void SetEndCutPasteLinkHdl(const Link<LinkParamNone*,void> &rLink) { aEndCutPasteLink = rLink; } +}; + +/// Interface class to not depend on SfxViewShell in editeng. +class SAL_NO_VTABLE SAL_DLLPUBLIC_RTTI OutlinerViewShell +{ +public: + virtual void libreOfficeKitViewCallback(int nType, const char* pPayload) const = 0; + virtual void libreOfficeKitViewCallbackWithViewId(int nType, const char* pPayload, int nViewId) const = 0; + virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart) const = 0; + virtual void libreOfficeKitViewUpdatedCallback(int nType) const = 0; + virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) const = 0; + virtual ViewShellId GetViewShellId() const = 0; + virtual ViewShellDocId GetDocId() const = 0; + /// Wrapper around SfxLokHelper::notifyOtherViews(). + virtual void NotifyOtherViews(int nType, const OString& rKey, const OString& rPayload) = 0; + /// Wrapper around SfxLokHelper::notifyOtherView(). + virtual void NotifyOtherView(OutlinerViewShell* pOtherShell, int nType, const OString& rKey, const OString& rPayload) = 0; + virtual vcl::Window* GetEditWindowForActiveOLEObj() const = 0; + +protected: + ~OutlinerViewShell() noexcept {} +}; + +// some thesaurus functionality to avoid code duplication in different projects... +bool EDITENG_DLLPUBLIC GetStatusValueForThesaurusFromContext( OUString &rStatusVal, LanguageType &rLang, const EditView &rEditView ); +void EDITENG_DLLPUBLIC ReplaceTextWithSynonym( EditView &rEditView, const OUString &rSynonmText ); + +typedef ::std::vector< OutlinerView* > ViewList; + +class EDITENG_DLLPUBLIC DrawPortionInfo +{ +public: + const Point& mrStartPos; + const OUString maText; + sal_Int32 mnTextStart; + sal_Int32 mnTextLen; + sal_Int32 mnPara; + const SvxFont& mrFont; + o3tl::span<const sal_Int32> mpDXArray; + + const EEngineData::WrongSpellVector* mpWrongSpellVector; + const SvxFieldData* mpFieldData; + const css::lang::Locale* mpLocale; + const Color maOverlineColor; + const Color maTextLineColor; + + sal_uInt8 mnBiDiLevel; + + bool mbFilled; + tools::Long mnWidthToFill; + + bool mbEndOfLine : 1; + bool mbEndOfParagraph : 1; + bool mbEndOfBullet : 1; + + bool IsRTL() const { return mnBiDiLevel % 2 == 1; } + + DrawPortionInfo( + const Point& rPos, + OUString aTxt, + sal_Int32 nTxtStart, + sal_Int32 nTxtLen, + const SvxFont& rFnt, + sal_Int32 nPar, + o3tl::span<const sal_Int32> pDXArr, + const EEngineData::WrongSpellVector* pWrongSpellVector, + const SvxFieldData* pFieldData, + const css::lang::Locale* pLocale, + const Color& rOverlineColor, + const Color& rTextLineColor, + sal_uInt8 nBiDiLevel, + bool bFilled, + tools::Long nWidthToFill, + bool bEndOfLine, + bool bEndOfParagraph, + bool bEndOfBullet) + : mrStartPos(rPos), + maText(std::move(aTxt)), + mnTextStart(nTxtStart), + mnTextLen(nTxtLen), + mnPara(nPar), + 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_Int32 mnPara; + const Point& mrStartPos; + VclPtr<OutputDevice> mpOutDev; + + PaintFirstLineInfo( sal_Int32 nPara, const Point& rStartPos, OutputDevice* pOutDev ) + : mnPara( nPara ), mrStartPos( rStartPos ), mpOutDev( pOutDev ) + {} +}; + +class SdrPage; + +class EditFieldInfo +{ +private: + Outliner* pOutliner; + const SvxFieldItem& rFldItem; + + std::optional<Color> mxTxtColor; + std::optional<Color> mxFldColor; + + OUString aRepresentation; + + sal_Int32 nPara; + sal_Int32 nPos; + + EditFieldInfo( const EditFieldInfo& ) = delete; + + SdrPage* mpSdrPage; + +public: + EditFieldInfo( Outliner* pOutl, const SvxFieldItem& rFItem, sal_Int32 nPa, sal_Int32 nPo ) + : rFldItem( rFItem ) + { + pOutliner = pOutl; + nPara = nPa; nPos = nPo; + mpSdrPage = nullptr; + } + + Outliner* GetOutliner() const { return pOutliner; } + + const SvxFieldItem& GetField() const { return rFldItem; } + + std::optional<Color> const & GetTextColor() const { return mxTxtColor; } + void SetTextColor( std::optional<Color> xCol ) { mxTxtColor = xCol; } + + std::optional<Color> const & GetFieldColor() const { return mxFldColor; } + void SetFieldColor( std::optional<Color> xCol ) { mxFldColor = xCol; } + + sal_Int32 GetPara() const { return nPara; } + sal_Int32 GetPos() const { return nPos; } + + const OUString& GetRepresentation() const { return aRepresentation; } + OUString& GetRepresentation() { return aRepresentation; } + void SetRepresentation( const OUString& rStr ){ aRepresentation = rStr; } + + void SetSdrPage( SdrPage* pPage ) { mpSdrPage = pPage; } + SdrPage* GetSdrPage() const { return mpSdrPage; } +}; + + struct EBulletInfo +{ + SvxFont aFont; + tools::Rectangle aBounds; + OUString aText; + sal_Int32 nParagraph; + sal_uInt16 nType; // see SvxNumberType + bool bVisible; + + EBulletInfo() : nParagraph( EE_PARA_NOT_FOUND ), nType( 0 ), bVisible( false ) {} +}; + +enum class OutlinerMode { + DontKnow = 0x0000, + TextObject = 0x0001, + TitleObject = 0x0002, + OutlineObject = 0x0003, + OutlineView = 0x0004 +}; + +class EDITENG_DLLPUBLIC Outliner : public SfxBroadcaster +{ +public: + struct ParagraphHdlParam { Outliner* pOutliner; Paragraph* pPara; }; + struct DepthChangeHdlParam { Outliner* pOutliner; Paragraph* pPara; ParaFlag nPrevFlags; }; +private: + friend class OutlinerView; + friend class OutlinerEditEng; + friend class OutlinerParaObject; + friend class OLUndoExpand; + friend class OutlinerUndoChangeDepth; + friend class OutlinerUndoCheckPara; + friend class OutlinerUndoChangeParaFlags; + + friend class TextChainingUtils; + + std::unique_ptr<OutlinerEditEng> pEditEngine; + + std::unique_ptr<ParagraphList> pParaList; + ViewList aViewList; + + sal_Int32 mnFirstSelPage; + Link<DrawPortionInfo*,void> aDrawPortionHdl; + Link<DrawBulletInfo*,void> aDrawBulletHdl; + Link<ParagraphHdlParam,void> aParaInsertedHdl; + Link<ParagraphHdlParam,void> aParaRemovingHdl; + Link<DepthChangeHdlParam,void> aDepthChangedHdl; + Link<Outliner*,void> aBeginMovingHdl; + Link<Outliner*,void> aEndMovingHdl; + Link<OutlinerView*,bool> aIndentingPagesHdl; + Link<OutlinerView*,bool> aRemovingPagesHdl; + Link<EditFieldInfo*,void> aCalcFieldValueHdl; + Link<PaintFirstLineInfo*,void> maPaintFirstLineHdl; + Link<PasteOrDropInfos*,void> maBeginPasteOrDropHdl; + Link<PasteOrDropInfos*,void> maEndPasteOrDropHdl; + + sal_Int32 nDepthChangedHdlPrevDepth; + sal_Int16 nMaxDepth; + static constexpr sal_Int16 gnMinDepth = -1; + + OutlinerMode nOutlinerMode; + + bool bFirstParaIsEmpty; + sal_uInt8 nBlockInsCallback; + bool bStrippingPortions; + bool bPasting; + + DECL_DLLPRIVATE_LINK( ParaVisibleStateChangedHdl, Paragraph&, void ); + DECL_DLLPRIVATE_LINK( BeginMovingParagraphsHdl, MoveParagraphsInfo&, void ); + DECL_DLLPRIVATE_LINK( EndMovingParagraphsHdl, MoveParagraphsInfo&, void ); + DECL_DLLPRIVATE_LINK( BeginPasteOrDropHdl, PasteOrDropInfos&, void ); + DECL_DLLPRIVATE_LINK( EndPasteOrDropHdl, PasteOrDropInfos&, void ); + DECL_DLLPRIVATE_LINK( EditEngineNotifyHdl, EENotify&, void ); + void ImplCheckParagraphs( sal_Int32 nStart, sal_Int32 nEnd ); + bool ImplHasNumberFormat( sal_Int32 nPara ) const; + Size ImplGetBulletSize( sal_Int32 nPara ); + sal_uInt16 ImplGetNumbering( sal_Int32 nPara, const SvxNumberFormat* pParaFmt ); + void ImplCalcBulletText( sal_Int32 nPara, bool bRecalcLevel, bool bRecalcChildren ); + OUString ImplGetBulletText( sal_Int32 nPara ); + void ImplCheckNumBulletItem( sal_Int32 nPara ); + void ImplInitDepth( sal_Int32 nPara, sal_Int16 nDepth, bool bCreateUndo ); + void ImplSetLevelDependentStyleSheet( sal_Int32 nPara ); + + void ImplBlockInsertionCallbacks( bool b ); + + void ImpFilterIndents( sal_Int32 nFirstPara, sal_Int32 nLastPara ); + bool ImpConvertEdtToOut( sal_Int32 nPara ); + + void ImpTextPasted( sal_Int32 nStartPara, sal_Int32 nCount ); + vcl::Font ImpCalcBulletFont( sal_Int32 nPara ) const; + tools::Rectangle ImpCalcBulletArea( sal_Int32 nPara, bool bAdjust, bool bReturnPaperPos ); + bool ImpCanIndentSelectedPages( OutlinerView* pCurView ); + bool ImpCanDeleteSelectedPages( OutlinerView* pCurView ); + bool ImpCanDeleteSelectedPages( OutlinerView* pCurView, sal_Int32 nFirstPage, sal_Int32 nPages ); + + void ImplCheckDepth( sal_Int16& rnDepth ) const; + +protected: + void ParagraphInserted( sal_Int32 nParagraph ); + void ParagraphDeleted( sal_Int32 nParagraph ); + void ParaAttribsChanged( sal_Int32 nParagraph ); + + void StyleSheetChanged( SfxStyleSheet const * pStyle ); + + void InvalidateBullet(sal_Int32 nPara); + void PaintBullet(sal_Int32 nPara, const Point& rStartPos, + const Point& rOrigin, Degree10 nOrientation, + OutputDevice& rOutDev); + + // used by OutlinerEditEng. Allows Outliner objects to provide + // bullet access to the EditEngine. + const SvxNumberFormat* GetNumberFormat( sal_Int32 nPara ) const; + +public: + + Outliner( SfxItemPool* pPool, OutlinerMode nMode ); + virtual ~Outliner() override; + + void dumpAsXml(xmlTextWriterPtr pWriter) const; + + void Init( OutlinerMode nMode ); + + void SetVertical( bool bVertical); + void SetRotation(TextRotation nRotation); + bool IsVertical() const; + bool IsTopToBottom() const; + + void SetTextColumns(sal_Int16 nColumns, sal_Int32 nSpacing); + + void SetFixedCellHeight( bool bUseFixedCellHeight ); + + void SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir ); + EEHorizontalTextDirection GetDefaultHorizontalTextDirection() const; + + LanguageType GetLanguage( sal_Int32 nPara, sal_Int32 nPos ) const; + + void SetAsianCompressionMode( CharCompressType nCompressionMode ); + + void SetKernAsianPunctuation( bool bEnabled ); + + void SetAddExtLeading( bool b ); + + size_t InsertView( OutlinerView* pView, size_t nIndex = size_t(-1) ); + void RemoveView( OutlinerView const * pView ); + void RemoveView( size_t nIndex ); + OutlinerView* GetView( size_t nIndex ) const; + size_t GetViewCount() const; + + Paragraph* Insert( const OUString& rText, sal_Int32 nAbsPos = EE_PARA_APPEND, sal_Int16 nDepth = 0 ); + void SetText( const OutlinerParaObject& ); + void AddText( const OutlinerParaObject&, bool bAppend = false ); + void SetText( const OUString& rText, Paragraph* pParagraph ); + OUString GetText( Paragraph const * pPara, sal_Int32 nParaCount=1 ) const; + + void SetToEmptyText(); + + std::optional<OutlinerParaObject> CreateParaObject( sal_Int32 nStartPara = 0, sal_Int32 nParaCount = EE_PARA_ALL ) const; + + const SfxItemSet& GetEmptyItemSet() const; + + void SetRefMapMode( const MapMode& ); + MapMode const & GetRefMapMode() const; + + void SetBackgroundColor( const Color& rColor ); + Color const & GetBackgroundColor() const; + + void SetMaxDepth( sal_Int16 nDepth ); + sal_Int16 GetMaxDepth() const { return nMaxDepth; } + + /// @return previous value of bUpdateLayout state + bool SetUpdateLayout( bool bUpdate ); + bool IsUpdateLayout() const; + + void Clear(); + + void RemoveAttribs( const ESelection& rSelection, bool bRemoveParaAttribs, sal_uInt16 nWhich ); + + sal_Int32 GetParagraphCount() const; + Paragraph* GetParagraph( sal_Int32 nAbsPos ) const; + + bool HasChildren( Paragraph const * pParagraph ) const; + sal_Int32 GetChildCount( Paragraph const * pParent ) const; + bool IsExpanded( Paragraph const * pPara ) const; + Paragraph* GetParent( Paragraph const * pParagraph ) const; + sal_Int32 GetAbsPos( Paragraph const * pPara ) const; + + sal_Int16 GetDepth( sal_Int32 nPara ) const; + void SetDepth( Paragraph* pParagraph, sal_Int16 nNewDepth ); + + void EnableUndo( bool bEnable ); + bool IsUndoEnabled() const; + void UndoActionStart( sal_uInt16 nId ); + void UndoActionEnd(); + void InsertUndo( std::unique_ptr<EditUndo> pUndo ); + bool IsInUndo() const; + + void ClearModifyFlag(); + bool IsModified() const; + + void ParagraphInsertedHdl(Paragraph*); + void SetParaInsertedHdl(const Link<ParagraphHdlParam,void>& rLink){aParaInsertedHdl=rLink;} + const Link<ParagraphHdlParam,void>& GetParaInsertedHdl() const { return aParaInsertedHdl; } + + void SetParaRemovingHdl(const Link<ParagraphHdlParam,void>& rLink){aParaRemovingHdl=rLink;} + const Link<ParagraphHdlParam,void>& GetParaRemovingHdl() const { return aParaRemovingHdl; } + + std::optional<NonOverflowingText> GetNonOverflowingText() const; + std::optional<OverflowingText> GetOverflowingText() const; + void ClearOverflowingParaNum(); + bool IsPageOverflow(); + + OutlinerParaObject GetEmptyParaObject() const; + + + void DepthChangedHdl(Paragraph*, ParaFlag nPrevFlags); + void SetDepthChangedHdl(const Link<DepthChangeHdlParam,void>& rLink){aDepthChangedHdl=rLink;} + const Link<DepthChangeHdlParam,void>& GetDepthChangedHdl() const { return aDepthChangedHdl; } + sal_Int16 GetPrevDepth() const { return static_cast<sal_Int16>(nDepthChangedHdlPrevDepth); } + + bool RemovingPagesHdl( OutlinerView* ); + void SetRemovingPagesHdl(const Link<OutlinerView*,bool>& rLink){aRemovingPagesHdl=rLink;} + bool IndentingPagesHdl( OutlinerView* ); + void SetIndentingPagesHdl(const Link<OutlinerView*,bool>& rLink){aIndentingPagesHdl=rLink;} + // valid only in the two upper handlers + sal_Int32 GetSelPageCount() const { return nDepthChangedHdlPrevDepth; } + + void SetCalcFieldValueHdl(const Link<EditFieldInfo*,void>& rLink ) { aCalcFieldValueHdl= rLink; } + const Link<EditFieldInfo*,void>& GetCalcFieldValueHdl() const { return aCalcFieldValueHdl; } + + void SetDrawPortionHdl(const Link<DrawPortionInfo*,void>& rLink){aDrawPortionHdl=rLink;} + + void SetDrawBulletHdl(const Link<DrawBulletInfo*,void>& rLink){aDrawBulletHdl=rLink;} + + void SetPaintFirstLineHdl(const Link<PaintFirstLineInfo*,void>& rLink) { maPaintFirstLineHdl = rLink; } + + void SetModifyHdl( const Link<LinkParamNone*,void>& rLink ); + Link<LinkParamNone*,void> const & GetModifyHdl() const; + + void SetNotifyHdl( const Link<EENotify&,void>& rLink ); + + void SetStatusEventHdl( const Link<EditStatus&, void>& rLink ); + Link<EditStatus&, void> const & GetStatusEventHdl() const; + + void Draw( OutputDevice& rOutDev, const tools::Rectangle& rOutRect ); + void Draw( OutputDevice& rOutDev, const Point& rStartPos ); + + const Size& GetPaperSize() const; + void SetPaperSize( const Size& rSize ); + + 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 SetMinColumnWrapHeight(tools::Long nVal); + + void SetDefTab( sal_uInt16 nTab ); + + bool IsFlatMode() const; + void SetFlatMode( bool bFlat ); + + void EnableAutoColor( bool b ); + + void ForceAutoColor( bool b ); + bool IsForceAutoColor() const; + + EBulletInfo GetBulletInfo( sal_Int32 nPara ); + + void SetWordDelimiters( const OUString& rDelimiters ); + OUString const & GetWordDelimiters() const; + OUString GetWord( sal_Int32 nPara, sal_Int32 nIndex ); + + void StripPortions(); + + void DrawingText( const Point& rStartPos, const OUString& rText, + sal_Int32 nTextStart, sal_Int32 nTextLen, + o3tl::span<const sal_Int32> pDXArray, const SvxFont& rFont, + sal_Int32 nPara, sal_uInt8 nRightToLeft, + const EEngineData::WrongSpellVector* pWrongSpellVector, + const SvxFieldData* pFieldData, + bool bEndOfLine, + bool bEndOfParagraph, + bool bEndOfBullet, + const css::lang::Locale* pLocale, + const Color& rOverlineColor, + const Color& rTextLineColor); + + void DrawingTab( const Point& rStartPos, tools::Long nWidth, const OUString& rChar, + const SvxFont& rFont, sal_Int32 nPara, sal_uInt8 nRightToLeft, + bool bEndOfLine, + bool bEndOfParagraph, + const Color& rOverlineColor, + const Color& rTextLineColor); + + Size CalcTextSize(); + Size CalcTextSizeNTP(); + + void SetStyleSheetPool( SfxStyleSheetPool* pSPool ); + SfxStyleSheetPool* GetStyleSheetPool(); + + bool IsInSelectionMode() const; + + void SetStyleSheet( sal_Int32 nPara, SfxStyleSheet* pStyle ); + SfxStyleSheet* GetStyleSheet( sal_Int32 nPara ); + + void SetParaAttribs( sal_Int32 nPara, const SfxItemSet& ); + SfxItemSet const & GetParaAttribs( sal_Int32 nPara ) const; + + void Remove( Paragraph const * pPara, sal_Int32 nParaCount ); + bool Expand( Paragraph const * ); + bool Collapse( Paragraph const * ); + + void SetParaFlag( Paragraph* pPara, ParaFlag nFlag ); + static bool HasParaFlag( const Paragraph* pPara, ParaFlag nFlag ); + + + void SetControlWord( EEControlBits nWord ); + EEControlBits GetControlWord() const; + + const Link<Outliner*,void>& GetBeginMovingHdl() const { return aBeginMovingHdl; } + void SetBeginMovingHdl(const Link<Outliner*,void>& rLink) {aBeginMovingHdl=rLink;} + const Link<Outliner*,void>& GetEndMovingHdl() const {return aEndMovingHdl;} + void SetEndMovingHdl( const Link<Outliner*,void>& rLink){aEndMovingHdl=rLink;} + + sal_uInt32 GetLineCount( sal_Int32 nParagraph ) const; + sal_Int32 GetLineLen( sal_Int32 nParagraph, sal_Int32 nLine ) const; + sal_uInt32 GetLineHeight( sal_Int32 nParagraph ); + + ErrCode Read( SvStream& rInput, const OUString& rBaseURL, EETextFormat, SvKeyValueIterator* pHTTPHeaderAttrs = nullptr ); + + SfxUndoManager& GetUndoManager(); + SfxUndoManager* SetUndoManager(SfxUndoManager* pNew); + + 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 OUString& rText, const ESelection& rSel ); + void QuickDelete( const ESelection& rSel ); + /// Set attributes from rSet an all characters of nPara. + void SetCharAttribs(sal_Int32 nPara, const SfxItemSet& rSet); + void RemoveCharAttribs( sal_Int32 nPara, sal_uInt16 nWhich = 0 ); + void QuickFormatDoc(); + + bool UpdateFields(); + void RemoveFields( const std::function<bool ( const SvxFieldData* )>& isFieldData = [] (const SvxFieldData* ){return true;} ); + + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rTxtColor, std::optional<Color>& rFldColor ); + + void SetSpeller( css::uno::Reference< css::linguistic2::XSpellChecker1 > const &xSpeller ); + css::uno::Reference< css::linguistic2::XSpellChecker1 > const & + GetSpeller(); + void SetHyphenator( css::uno::Reference< css::linguistic2::XHyphenator > const & xHyph ); + + static void SetForbiddenCharsTable(const std::shared_ptr<SvxForbiddenCharactersTable>& xForbiddenChars); + + // Deprecated + void SetDefaultLanguage( LanguageType eLang ); + + void CompleteOnlineSpelling(); + + EESpellState HasSpellErrors(); + bool HasText( const SvxSearchItem& rSearchItem ); + virtual bool SpellNextDocument(); + + // for text conversion + bool HasConvertibleTextPortion( LanguageType nLang ); + virtual bool ConvertNextDocument(); + + void SetEditTextObjectPool( SfxItemPool* pPool ); + SfxItemPool* GetEditTextObjectPool() const; + + void SetRefDevice( OutputDevice* pRefDev ); + OutputDevice* GetRefDevice() const; + + sal_uInt32 GetTextHeight() const; + tools::Rectangle GetParaBounds( sal_Int32 nParagraph ) const; + Point GetDocPos( const Point& rPaperPos ) const; + bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder ); + bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder, bool* pbBulletPos ); + + void SetGlobalCharStretching( sal_uInt16 nX = 100, sal_uInt16 nY = 100 ); + void GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ) const; + void EraseVirtualDevice(); + + bool ShouldCreateBigTextObject() const; + + const EditEngine& GetEditEngine() const; + + // this is needed for StarOffice Api + void SetLevelDependentStyleSheet( sal_Int32 nPara ); + + OutlinerMode GetOutlinerMode() const { return nOutlinerMode; } + + // spell and return a sentence + bool SpellSentence(EditView const & rEditView, svx::SpellPortions& rToFill ); + // put spell position to start of current sentence + void PutSpellingToSentenceStart( EditView const & rEditView ); + // applies a changed sentence + void ApplyChangedSentence(EditView const & 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<EditView*,void>& rLink ); + + /** sets a link that is called at the end of a drag operation at an edit view */ + void SetEndDropHdl( const Link<EditView*,void>& rLink ); + + /** sets a link that is called before a drop or paste operation. */ + void SetBeginPasteOrDropHdl( const Link<PasteOrDropInfos*,void>& rLink ); + + /** sets a link that is called after a drop or paste operation. */ + void SetEndPasteOrDropHdl( const Link<PasteOrDropInfos*,void>& rLink ); + + sal_Int16 GetNumberingStartValue( sal_Int32 nPara ) const; + void SetNumberingStartValue( sal_Int32 nPara, sal_Int16 nNumberingStartValue ); + + bool IsParaIsNumberingRestart( sal_Int32 nPara ) const; + void SetParaIsNumberingRestart( sal_Int32 nPara, bool bParaIsNumberingRestart ); + + /** determine the bullets/numbering status of the given paragraphs + + @param nParaStart + index of paragraph at which the check starts + + @param nParaEnd + index of paragraph at which the check ends + + @returns + 0 : all paragraphs have bullets + 1 : all paragraphs have numbering + 2 : otherwise + */ + sal_Int32 GetBulletsNumberingStatus( + const sal_Int32 nParaStart, + const sal_Int32 nParaEnd ) const; + + // convenient method to determine the bullets/numbering status for all paragraphs + sal_Int32 GetBulletsNumberingStatus() const; +}; + +#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 000000000..1703cf09c --- /dev/null +++ b/include/editeng/outlobj.hxx @@ -0,0 +1,204 @@ +/* -*- 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 . + */ + +#pragma once + +#include <editeng/paragraphdata.hxx> +#include <editeng/editengdllapi.h> +#include <rtl/ustring.hxx> +#include <svl/poolitem.hxx> +#include <svl/style.hxx> +#include <o3tl/cow_wrapper.hxx> +#include <stdexcept> +#include <memory> + +class EditTextObject; +enum class OutlinerMode; +enum class TextRotation; + +/** + * This is the guts of OutlinerParaObject, refcounted and shared among + * multiple instances of OutlinerParaObject. + */ +struct EDITENG_DLLPUBLIC OutlinerParaObjData +{ + // data members + std::unique_ptr<EditTextObject> mpEditTextObject; + ParagraphDataVector maParagraphDataVector; + bool mbIsEditDoc; + + // constructor + OutlinerParaObjData( std::unique_ptr<EditTextObject> pEditTextObject, ParagraphDataVector&& rParagraphDataVector, bool bIsEditDoc ); + + OutlinerParaObjData( const OutlinerParaObjData& r ); + + OutlinerParaObjData( OutlinerParaObjData&& r ) = default; + + // assignment operator + OutlinerParaObjData& operator=(const OutlinerParaObjData& rCandidate) = delete; + + // destructor + ~OutlinerParaObjData(); + + bool operator==(const OutlinerParaObjData& rCandidate) const; + + // #i102062# + bool isWrongListEqual(const OutlinerParaObjData& rCompare) const; +}; + +class EDITENG_DLLPUBLIC OutlinerParaObject +{ +friend class std::optional<OutlinerParaObject>; + ::o3tl::cow_wrapper< OutlinerParaObjData > mpImpl; + + OutlinerParaObject(std::nullopt_t) noexcept + : mpImpl(std::nullopt) {} + OutlinerParaObject( const OutlinerParaObject& other, std::nullopt_t ) noexcept + : mpImpl(other.mpImpl, std::nullopt) {} + +public: + // constructors/destructor + OutlinerParaObject(std::unique_ptr<EditTextObject>, ParagraphDataVector&&, bool bIsEditDoc); + OutlinerParaObject( std::unique_ptr<EditTextObject> ); + OutlinerParaObject( const OutlinerParaObject&); + OutlinerParaObject(OutlinerParaObject&&) noexcept; + ~OutlinerParaObject(); + + // assignment operator + OutlinerParaObject& operator=(const OutlinerParaObject& rCandidate); + OutlinerParaObject& operator=(OutlinerParaObject&&) noexcept; + + // 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 + OutlinerMode GetOutlinerMode() const; + void SetOutlinerMode(OutlinerMode nNew); + + // vertical access + bool IsEffectivelyVertical() const; + bool GetVertical() const; + bool IsTopToBottom() const; + void SetVertical(bool bNew); + void SetRotation(TextRotation nRotation); + TextRotation GetRotation() const; + + // data read access + sal_Int32 Count() const; + sal_Int16 GetDepth(sal_Int32 nPara) const; + const EditTextObject& GetTextObject() const; + const ParagraphData& GetParagraphData(sal_Int32 nIndex) const; + + // portion info support + void ClearPortionInfo(); + + // StyleSheet support + bool ChangeStyleSheets(std::u16string_view rOldName, SfxStyleFamily eOldFamily, + const OUString& rNewName, SfxStyleFamily eNewFamily); + void ChangeStyleSheetName(SfxStyleFamily eFamily, std::u16string_view rOldName, + const OUString& rNewName); + void SetStyleSheets(sal_uInt16 nLevel, const OUString& rNewName, + const SfxStyleFamily& rNewFamily); + + void dumpAsXml(xmlTextWriterPtr pWriter) const; +}; + +namespace std +{ + /** Specialise std::optional template for the case where we are wrapping a o3tl::cow_wrapper + type, and we can make the pointer inside the cow_wrapper act as an empty value, + and save ourselves some storage */ + template<> + class optional<OutlinerParaObject> + { + public: + optional() noexcept : maParaObject(std::nullopt) {} + optional(std::nullopt_t) noexcept : maParaObject(std::nullopt) {} + optional(const optional& other) : + maParaObject(other.maParaObject, std::nullopt) {} + optional(optional&& other) noexcept : + maParaObject(std::move(other.maParaObject)) {} + optional(OutlinerParaObject&& para) noexcept : + maParaObject(std::move(para)) {} + optional(const OutlinerParaObject& para) noexcept : + maParaObject(para) {} + template< class... Args > + explicit optional( std::in_place_t, Args&&... args ) : + maParaObject(std::forward<Args>(args)...) {} + + optional& operator=(optional const & other) + { + maParaObject = other.maParaObject; + return *this; + } + optional& operator=(optional&& other) noexcept + { + maParaObject = std::move(other.maParaObject); + return *this; + } + template< class... Args > + void emplace(Args&&... args ) + { + maParaObject = OutlinerParaObject(std::forward<Args>(args)...); + } + + bool has_value() const noexcept { return !maParaObject.mpImpl.empty(); } + explicit operator bool() const noexcept { return !maParaObject.mpImpl.empty(); } + void reset() { maParaObject.mpImpl.set_empty(); } + + OutlinerParaObject& value() + { + throwIfEmpty(); + return maParaObject; + } + OutlinerParaObject& operator*() + { + throwIfEmpty(); + return maParaObject; + } + const OutlinerParaObject& operator*() const + { + throwIfEmpty(); + return maParaObject; + } + OutlinerParaObject* operator->() + { + throwIfEmpty(); + return &maParaObject; + } + const OutlinerParaObject* operator->() const + { + throwIfEmpty(); + return &maParaObject; + } + private: + void throwIfEmpty() const + { + if (maParaObject.mpImpl.empty()) + throw std::logic_error("empty std::optional<OutlinerParaObject>"); + } + OutlinerParaObject maParaObject; + }; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/overflowingtxt.hxx b/include/editeng/overflowingtxt.hxx new file mode 100644 index 000000000..5b95f2d12 --- /dev/null +++ b/include/editeng/overflowingtxt.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 INCLUDED_EDITENG_OVERFLOWINGTXT_HXX +#define INCLUDED_EDITENG_OVERFLOWINGTXT_HXX + +#include <editeng/editengdllapi.h> +#include <editeng/editdata.hxx> + +#include <com/sun/star/uno/Reference.h> +#include <optional> + +namespace com::sun::star { + namespace datatransfer { class XTransferable; } +} + +class OutlinerParaObject; +class Outliner; + + +/* + * A collection of static methods for attaching text. + * Strongly coupled with some of the classes in this file. + */ +class TextChainingUtils +{ +public: + static css::uno::Reference< css::datatransfer::XTransferable> CreateTransferableFromText(Outliner const *); + + static std::optional<OutlinerParaObject> JuxtaposeParaObject( + css::uno::Reference< css::datatransfer::XTransferable > const & xOverflowingContent, + Outliner *, + OutlinerParaObject const *); + static std::optional<OutlinerParaObject> DeeplyMergeParaObject( + css::uno::Reference< css::datatransfer::XTransferable > const & xOverflowingContent, + Outliner *, + OutlinerParaObject const *); +}; + +/* + * The classes OverflowingText and NonOverflowingText handle the + * actual preparation of the OutlinerParaObjects to be used in destination + * and source box respectively. +*/ + +class OverflowingText +{ +public: + OverflowingText(css::uno::Reference< css::datatransfer::XTransferable > xOverflowingContent); + + std::optional<OutlinerParaObject> JuxtaposeParaObject(Outliner *, OutlinerParaObject const *); + std::optional<OutlinerParaObject> DeeplyMergeParaObject(Outliner *, OutlinerParaObject const *); + +private: + css::uno::Reference< css::datatransfer::XTransferable > mxOverflowingContent; +}; + +class NonOverflowingText +{ +public: + NonOverflowingText(const ESelection &aSel, bool bLastParaInterrupted); + + std::optional<OutlinerParaObject> RemoveOverflowingText(Outliner *) const; + ESelection GetOverflowPointSel() const; + bool IsLastParaInterrupted() const; + +private: + ESelection maContentSel; + bool mbLastParaInterrupted; +}; + + +/* + * classes OFlowChainedText and UFlowChainedText: + * contain and handle the state of a broken up text _after_ a flow event + * (respectively after Overflow and Underflow). + * + */ +class EDITENG_DLLPUBLIC OFlowChainedText +{ +public: + OFlowChainedText(Outliner const *, bool ); + ~OFlowChainedText(); + + std::optional<OutlinerParaObject> InsertOverflowingText(Outliner *, OutlinerParaObject const *); + std::optional<OutlinerParaObject> RemoveOverflowingText(Outliner *); + + ESelection GetOverflowPointSel() const; + + bool IsLastParaInterrupted() const; + +private: + std::optional<NonOverflowingText> mpNonOverflowingTxt; + std::optional<OverflowingText> mpOverflowingTxt; + + bool mbIsDeepMerge; +}; + +// UFlowChainedText is a simpler class than OFlowChainedText: it almost only joins para-objects +class EDITENG_DLLPUBLIC UFlowChainedText +{ +public: + UFlowChainedText(Outliner const *, bool); + std::optional<OutlinerParaObject> CreateMergedUnderflowParaObject(Outliner *, OutlinerParaObject const *); + +private: + css::uno::Reference< css::datatransfer::XTransferable > mxUnderflowingTxt; + + bool mbIsDeepMerge; +}; + +#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 000000000..2ccc8fbf9 --- /dev/null +++ b/include/editeng/paperinf.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 INCLUDED_EDITENG_PAPERINF_HXX +#define INCLUDED_EDITENG_PAPERINF_HXX + +// INCLUDE --------------------------------------------------------------- + +#include <rtl/ustring.hxx> +#include <tools/mapunit.hxx> +#include <i18nutil/paper.hxx> +#include <tools/gen.hxx> +#include <editeng/editengdllapi.h> + +// forward --------------------------------------------------------------- + +class Printer; + +// class SvxPaperInfo ----------------------------------------------------- + +class EDITENG_DLLPUBLIC SvxPaperInfo +{ +public: + static Size GetDefaultPaperSize( MapUnit eUnit = MapUnit::MapTwip ); + static Size GetPaperSize( Paper ePaper, MapUnit eUnit = MapUnit::MapTwip ); + static Size GetPaperSize( const Printer* pPrinter ); + static Paper GetSvxPaper( const Size &rSize, MapUnit eUnit ); + static tools::Long GetSloppyPaperDimension( tools::Long nSize ); + static OUString GetName( Paper ePaper ); +}; + +// INLINE ----------------------------------------------------------------- + +inline Size &Swap(Size &rSize) +{ + const tools::Long lVal = rSize.Width(); + rSize.setWidth( rSize.Height() ); + rSize.setHeight( 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 000000000..f0e859d6f --- /dev/null +++ b/include/editeng/paragraphdata.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 INCLUDED_EDITENG_PARAGRAPHDATA_HXX +#define INCLUDED_EDITENG_PARAGRAPHDATA_HXX + +#include <vector> +#include <sal/types.h> + +class ParagraphData +{ + friend class Paragraph; + friend class OutlinerParaObject; + +protected: + sal_Int16 nDepth; + sal_Int16 mnNumberingStartValue; + bool mbParaIsNumberingRestart; + +public: + ParagraphData(); + + bool operator==(const ParagraphData& rCandidate) const; + + sal_Int16 getDepth() const { return nDepth; } +}; + +typedef ::std::vector< ParagraphData > ParagraphDataVector; + +#endif // INCLUDED_EDITENG_PARAGRAPHDATA_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 000000000..335b15f37 --- /dev/null +++ b/include/editeng/paravertalignitem.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 INCLUDED_EDITENG_PARAVERTALIGNITEM_HXX +#define INCLUDED_EDITENG_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 final : public SfxUInt16Item +{ +public: + enum class Align { Automatic, Baseline, Top, Center, Bottom }; + static SfxPoolItem* CreateDefault(); + + SvxParaVertAlignItem( Align nValue /*= 0*/, + const sal_uInt16 nId ); + + virtual SvxParaVertAlignItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + Align GetValue() const { return static_cast<Align>(SfxUInt16Item::GetValue()); } + void SetValue(Align n) { SfxUInt16Item::SetValue(static_cast<sal_uInt16>(n)); } +}; + +#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 000000000..d6bf7229b --- /dev/null +++ b/include/editeng/pbinitem.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 INCLUDED_EDITENG_PBINITEM_HXX +#define INCLUDED_EDITENG_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 final : public SfxByteItem +{ +public: + static SfxPoolItem* CreateDefault(); + + explicit inline SvxPaperBinItem( const sal_uInt16 nId , + const sal_uInt8 nTray = PAPERBIN_PRINTER_SETTINGS ); + + // "pure virtual Methods" from SfxPoolItem + virtual SvxPaperBinItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; +}; + +inline SvxPaperBinItem::SvxPaperBinItem( const sal_uInt16 nId, const sal_uInt8 nT ) + : SfxByteItem( nId, nT ) +{} + +#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 000000000..ef8c24e66 --- /dev/null +++ b/include/editeng/pgrditem.hxx @@ -0,0 +1,51 @@ +/* -*- 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_EDITENG_PGRDITEM_HXX +#define INCLUDED_EDITENG_PGRDITEM_HXX + +#include <svl/eitem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxParaGridItem ------------------------------------------------- + + +/* [Description] + + Paragraph snap to grid +*/ + +class EDITENG_DLLPUBLIC SvxParaGridItem final : public SfxBoolItem +{ +public: + SvxParaGridItem( const bool bSnapToGrid /*= true*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual SvxParaGridItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; +}; + +#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 000000000..f4bfa53c4 --- /dev/null +++ b/include/editeng/pmdlitem.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 INCLUDED_EDITENG_PMDLITEM_HXX +#define INCLUDED_EDITENG_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 final : public SfxStringItem +{ +private: + bool bAuto; + +public: + static SfxPoolItem* CreateDefault(); + + explicit inline SvxPageModelItem( sal_uInt16 nWh ); + inline SvxPageModelItem( const OUString& rModel, bool bA /*= false*/, + sal_uInt16 nWh ); + + virtual SvxPageModelItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + virtual bool operator==( const SfxPoolItem& ) const override; +}; + +inline SvxPageModelItem::SvxPageModelItem( sal_uInt16 nWh ) + : bAuto( false ) +{ + SetWhich( nWh ); +} + +inline SvxPageModelItem::SvxPageModelItem( const OUString& rModel, bool bA, + sal_uInt16 nWh ) : + SfxStringItem( nWh, rModel ), + bAuto( bA ) +{} + +#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 000000000..93ed44b6b --- /dev/null +++ b/include/editeng/postitem.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 INCLUDED_EDITENG_POSTITEM_HXX +#define INCLUDED_EDITENG_POSTITEM_HXX + +#include <svl/eitem.hxx> +#include <editeng/editengdllapi.h> +#include <tools/fontenum.hxx> + +// class SvxPostureItem -------------------------------------------------- + +/* [Description] + + This item describes the font setting (Italic) +*/ + +class EDITENG_DLLPUBLIC SvxPostureItem final : public SfxEnumItem<FontItalic> +{ +public: + static SfxPoolItem* CreateDefault(); + + SvxPostureItem( const FontItalic ePost /*= ITALIC_NONE*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + SwEnumItem + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + virtual SvxPostureItem* Clone( SfxItemPool *pPool = nullptr ) const override; + static OUString GetValueTextByPos( sal_uInt16 nPos ); + virtual sal_uInt16 GetValueCount() const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + virtual bool HasBoolValue() const override; + virtual bool GetBoolValue() const override; + virtual void SetBoolValue( bool bVal ) override; + + // enum cast + FontItalic GetPosture() const + { return GetValue(); } + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +#endif // INCLUDED_EDITENG_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 000000000..8f0e6a8fc --- /dev/null +++ b/include/editeng/prntitem.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 INCLUDED_EDITENG_PRNTITEM_HXX +#define INCLUDED_EDITENG_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 final : public SfxBoolItem +{ +public: + explicit SvxPrintItem( const sal_uInt16 nId , const bool bPrt = true ); + + // "pure virtual Methods" from SfxPoolItem + virtual SvxPrintItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; +}; + +inline SvxPrintItem::SvxPrintItem( const sal_uInt16 nId, const bool bPrt ) + : SfxBoolItem( nId, bPrt ) +{} + +#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 000000000..4f3f1c4ac --- /dev/null +++ b/include/editeng/protitem.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 INCLUDED_EDITENG_PROTITEM_HXX +#define INCLUDED_EDITENG_PROTITEM_HXX + +#include <svl/poolitem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxProtectItem -------------------------------------------------- + + +/* [Description] + + This item describes, if content, size or position should be protected. +*/ + +class EDITENG_DLLPUBLIC SvxProtectItem final : public SfxPoolItem +{ + bool bCntnt :1; // Content protected + bool bSize :1; // Size protected + bool bPos :1; // Position protected + +public: + static SfxPoolItem* CreateDefault(); + + explicit inline SvxProtectItem( const sal_uInt16 nId ); + SvxProtectItem(SvxProtectItem const &) = default; // SfxPoolItem copy function dichotomy + + // "pure virtual Methods" from SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + + virtual SvxProtectItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + bool IsContentProtected() const { return bCntnt; } + bool IsSizeProtected() const { return bSize; } + bool IsPosProtected() const { return bPos; } + void SetContentProtect( bool bNew ) { bCntnt = bNew; } + void SetSizeProtect ( bool bNew ) { bSize = bNew; } + void SetPosProtect ( bool bNew ) { bPos = bNew; } + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +inline SvxProtectItem::SvxProtectItem( const sal_uInt16 nId ) + : SfxPoolItem( nId ) +{ + bCntnt = bSize = bPos = false; +} + +#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 000000000..78ab9b8bf --- /dev/null +++ b/include/editeng/rsiditem.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/. + */ +#ifndef INCLUDED_EDITENG_RSIDITEM_HXX +#define INCLUDED_EDITENG_RSIDITEM_HXX + +#include <svl/intitem.hxx> +#include <editeng/editengdllapi.h> + + +// SvxRsidItem + + +class EDITENG_DLLPUBLIC SvxRsidItem final : public SfxUInt32Item +{ +public: + SvxRsidItem( sal_uInt32 nRsid, sal_uInt16 nId ) : SfxUInt32Item( nId, nRsid ) {} + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + virtual SvxRsidItem* Clone( SfxItemPool* pPool = nullptr ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +#endif // INCLUDED_EDITENG_RSIDITEM_HXX diff --git a/include/editeng/scriptspaceitem.hxx b/include/editeng/scriptspaceitem.hxx new file mode 100644 index 000000000..9a4cac3de --- /dev/null +++ b/include/editeng/scriptspaceitem.hxx @@ -0,0 +1,50 @@ +/* -*- 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_EDITENG_SCRIPTSPACEITEM_HXX +#define INCLUDED_EDITENG_SCRIPTSPACEITEM_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 final : public SfxBoolItem +{ +public: + SvxScriptSpaceItem( bool bOn /*= false*/, + const sal_uInt16 nId ); + + virtual SvxScriptSpaceItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& ) const override; +}; + +#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 000000000..bfe84f5f6 --- /dev/null +++ b/include/editeng/scripttypeitem.hxx @@ -0,0 +1,52 @@ +/* -*- 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_EDITENG_SCRIPTTYPEITEM_HXX +#define INCLUDED_EDITENG_SCRIPTTYPEITEM_HXX + +#include <svl/languageoptions.hxx> +#include <svl/setitem.hxx> +#include <editeng/editengdllapi.h> + +class EDITENG_DLLPUBLIC SvxScriptSetItem final : public SfxSetItem +{ +public: + SvxScriptSetItem( sal_uInt16 nSlotId, SfxItemPool& rPool ); + + virtual SvxScriptSetItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + static const SfxPoolItem* GetItemOfScriptSet( const SfxItemSet& rSet, + sal_uInt16 nWhich ); + + static const SfxPoolItem* GetItemOfScript( sal_uInt16 nSlotId, const SfxItemSet& rSet, SvtScriptType nScript ); + + const SfxPoolItem* GetItemOfScript( SvtScriptType nScript ) const; + + void PutItemForScriptType( SvtScriptType 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 ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/section.hxx b/include/editeng/section.hxx new file mode 100644 index 000000000..d14189c24 --- /dev/null +++ b/include/editeng/section.hxx @@ -0,0 +1,35 @@ +/* -*- 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 INCLUDED_EDITENG_SECTION_HXX +#define INCLUDED_EDITENG_SECTION_HXX + +#include <sal/types.h> + +#include <vector> + +class SfxPoolItem; + +namespace editeng +{ +struct Section +{ + sal_Int32 mnParagraph; + sal_Int32 mnStart; + sal_Int32 mnEnd; + + std::vector<const SfxPoolItem*> maAttributes; + + Section(sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd); +}; +} + +#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 000000000..bed848215 --- /dev/null +++ b/include/editeng/shaditem.hxx @@ -0,0 +1,84 @@ +/* -*- 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_EDITENG_SHADITEM_HXX +#define INCLUDED_EDITENG_SHADITEM_HXX + +#include <tools/color.hxx> +#include <tools/mapunit.hxx> +#include <svl/cenumitm.hxx> + +#include <editeng/svxenum.hxx> +#include <editeng/editengdllapi.h> + + +// class SvxShadowItem --------------------------------------------------- + +/* [Description] + + This item describes the shadow attribute (color, width and position). +*/ +enum class SvxShadowItemSide { TOP, BOTTOM, LEFT, RIGHT }; + +class EDITENG_DLLPUBLIC SvxShadowItem final : public SfxEnumItemInterface +{ + Color aShadowColor; + sal_uInt16 nWidth; + SvxShadowLocation eLocation; +public: + static SfxPoolItem* CreateDefault(); + + explicit SvxShadowItem( const sal_uInt16 nId , + const Color *pColor = nullptr, const sal_uInt16 nWidth = 100 /*5pt*/, + const SvxShadowLocation eLoc = SvxShadowLocation::NONE ); + + // "pure virtual Methods" from SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + virtual SvxShadowItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual void ScaleMetrics( tools::Long nMult, tools::Long nDiv ) override; + virtual bool HasMetrics() const override; + + 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( SvxShadowItemSide nShadow ) const; + + virtual sal_uInt16 GetValueCount() const override; + virtual sal_uInt16 GetEnumValue() const override; + virtual void SetEnumValue( sal_uInt16 nNewVal ) override; + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +#endif // INCLUDED_EDITENG_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 000000000..dbe30a672 --- /dev/null +++ b/include/editeng/shdditem.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 INCLUDED_EDITENG_SHDDITEM_HXX +#define INCLUDED_EDITENG_SHDDITEM_HXX + +#include <svl/eitem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxShadowedItem ------------------------------------------------- + +/* [Description] + + This item describes, whether and how it is shaded. +*/ + +class EDITENG_DLLPUBLIC SvxShadowedItem final : public SfxBoolItem +{ +public: + static SfxPoolItem* CreateDefault(); + + SvxShadowedItem( const bool bShadowed /*= false*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual SvxShadowedItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + SvxShadowedItem(SvxShadowedItem const &) = default; // SfxPoolItem copy function dichotomy +}; + +#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 000000000..2247c76d9 --- /dev/null +++ b/include/editeng/sizeitem.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 INCLUDED_EDITENG_SIZEITEM_HXX +#define INCLUDED_EDITENG_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 m_aSize; + +public: + static SfxPoolItem* CreateDefault(); + + explicit SvxSizeItem( const sal_uInt16 nId ); + SvxSizeItem( const sal_uInt16 nId, const Size& rSize); + + // "pure virtual Methods" from SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + virtual SvxSizeItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual void ScaleMetrics( tools::Long nMult, tools::Long nDiv ) override; + virtual bool HasMetrics() const override; + + const Size& GetSize() const { return m_aSize; } + void SetSize(const Size& rSize) { m_aSize = rSize; } + + tools::Long GetWidth() const { return m_aSize.getWidth(); } + tools::Long GetHeight() const { return m_aSize.getHeight(); } + void SetWidth(tools::Long n) { m_aSize.setWidth(n); } + void SetHeight(tools::Long n) { m_aSize.setHeight(n); } +}; + +#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 000000000..553e3263f --- /dev/null +++ b/include/editeng/spltitem.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 INCLUDED_EDITENG_SPLTITEM_HXX +#define INCLUDED_EDITENG_SPLTITEM_HXX + +#include <svl/eitem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxFormatSplitItem ------------------------------------------------- + +/* [Description] + + This item describes a logical variable "split paragraph yes or no". +*/ + +class EDITENG_DLLPUBLIC SvxFormatSplitItem final : public SfxBoolItem +{ +public: + static SfxPoolItem* CreateDefault(); + virtual ~SvxFormatSplitItem() override; + + inline SvxFormatSplitItem( const bool bSplit /*= true*/, + const sal_uInt16 nWh ); + + SvxFormatSplitItem(SvxFormatSplitItem const &) = default; + SvxFormatSplitItem(SvxFormatSplitItem &&) = default; + SvxFormatSplitItem & operator =(SvxFormatSplitItem const &) = delete; // due to SfxBoolItem + SvxFormatSplitItem & operator =(SvxFormatSplitItem &&) = delete; // due to SfxBoolItem + + // "pure virtual Methods" from SfxPoolItem + virtual SvxFormatSplitItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; +}; + +inline SvxFormatSplitItem::SvxFormatSplitItem( const bool bSplit, const sal_uInt16 nWh ) : + SfxBoolItem( nWh, bSplit ) +{} + +#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 000000000..79d55d179 --- /dev/null +++ b/include/editeng/splwrap.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 INCLUDED_EDITENG_SPLWRAP_HXX +#define INCLUDED_EDITENG_SPLWRAP_HXX + +#include <editeng/editengdllapi.h> +#include <editeng/svxenum.hxx> +#include <i18nlangtag/lang.h> +#include <rtl/ustring.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <vcl/weld.hxx> + +// forward --------------------------------------------------------------- + +namespace com::sun::star::linguistic2 { + class XDictionary; + class XSpellChecker1; + class XHyphenator; +} + +// misc functions --------------------------------------------------------------- + +void EDITENG_DLLPUBLIC SvxPrepareAutoCorrect( OUString &rOldText, const OUString &rNewText ); + +/*-------------------------------------------------------------------- + Description: The SpellWrapper + --------------------------------------------------------------------*/ + +class EDITENG_DLLPUBLIC SvxSpellWrapper { +private: + friend class SvxSpellCheckDialog; + friend class SvxHyphenWordDialog; + friend struct SvxHyphenWordDialog_Impl; + + weld::Widget* pWin; + std::unique_ptr<weld::WaitObject> xWait; + css::uno::Reference< + css::uno::XInterface > xLast; // result of last spelling/hyphenation attempt + css::uno::Reference< + css::linguistic2::XHyphenator > xHyph; + bool bOtherCntnt : 1; // set => Check special sections initially + bool bReverse : 1; // Reverse spell check + bool bStartDone : 1; // Beginning already corrected + bool bEndDone : 1; // End part already corrected + bool bStartChk : 1; // Examine the beginning + bool bRevAllowed : 1; // Reverse spell check prohibited + bool bAllRight : 1; // Record wrong words in the dedicated + // dictionary and do not start the dialog. + + EDITENG_DLLPRIVATE bool SpellNext(); // select next area + bool FindSpellError(); // Check for errors (over areas) + + SvxSpellWrapper(SvxSpellWrapper const &) = delete; + void operator =(SvxSpellWrapper const &) = delete; + +public: + SvxSpellWrapper( weld::Widget* pWn, + const bool bStart, const bool bIsAllRight ); + SvxSpellWrapper( weld::Widget* pWn, + css::uno::Reference< css::linguistic2::XHyphenator > const &xHyphenator, + const bool bStart, const bool bOther ); + + virtual ~SvxSpellWrapper(); + + static sal_Int16 CheckSpellLang( + css::uno::Reference< css::linguistic2::XSpellChecker1 > const & xSpell, + LanguageType nLang ); + static sal_Int16 CheckHyphLang( + css::uno::Reference< css::linguistic2::XHyphenator >const & xHyph, + LanguageType nLang ); + + static void ShowLanguageErrors(); + + void SpellDocument(); // Perform Spell Checking + bool IsStartDone() const { return bStartDone; } + bool IsEndDone() const { return bEndDone; } + bool IsAllRight() const { return bAllRight; } + +protected: + const css::uno::Reference< css::uno::XInterface >& + GetLast() const { return xLast; } + void SetLast(const css::uno::Reference< css::uno::XInterface > &xNewLast) + { xLast = xNewLast; } + virtual bool SpellMore(); // examine further documents? + virtual void SpellStart( SvxSpellArea eSpell ); // Preparing the area + virtual void SpellContinue(); // Check Areas + // Result available through GetLast + virtual void ReplaceAll( const OUString &rNewText ); //Replace word from the replace list + static css::uno::Reference< css::linguistic2::XDictionary > + GetAllRightDic(); + virtual void SpellEnd(); // Finish area + virtual void InsertHyphen( const sal_Int32 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 000000000..7483e83c1 --- /dev/null +++ b/include/editeng/svxacorr.hxx @@ -0,0 +1,447 @@ +/* -*- 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_EDITENG_SVXACORR_HXX +#define INCLUDED_EDITENG_SVXACORR_HXX + +#include <o3tl/sorted_vector.hxx> +#include <o3tl/typed_flags_set.hxx> +#include <o3tl/string_view.hxx> +#include <i18nlangtag/languagetag.hxx> +#include <tools/time.hxx> +#include <tools/date.hxx> +#include <editeng/swafopt.hxx> +#include <editeng/editengdllapi.h> + +#include <optional> +#include <map> +#include <memory> +#include <string_view> +#include <utility> + +class CharClass; +class SfxPoolItem; +class SotStorage; +class SvxAutoCorrect; +class SfxObjectShell; +namespace vcl { class Window; } +namespace com::sun::star::embed { class XStorage; } +namespace tools { template <typename T> class SvRef; } + +struct CompareSvStringsISortDtor +{ + bool operator()( std::u16string_view lhs, std::u16string_view rhs ) const + { + return o3tl::compareToIgnoreAsciiCase( lhs, rhs ) < 0; + } +}; + +class SvStringsISortDtor + : public o3tl::sorted_vector<OUString, CompareSvStringsISortDtor> +{ +}; + +// Auto correct flags +enum class ACFlags : sal_uInt32 { + NONE = 0x00000000, + CapitalStartSentence = 0x00000001, // Capital letters at the beginning of a sentence + CapitalStartWord = 0x00000002, // not two Capital letters at the beginning of a word + AddNonBrkSpace = 0x00000004, // Add non breaking space before :,?!% + ChgOrdinalNumber = 0x00000008, // Ordinal-Number 1st, 2nd,.. + ChgToEnEmDash = 0x00000010, // - -> Endash/Emdash + ChgWeightUnderl = 0x00000020, // * -> Bold, _ -> Underscore + SetINetAttr = 0x00000040, // Set INetAttribut + Autocorrect = 0x00000080, // Call AutoCorrect + ChgQuotes = 0x00000100, // replace double quotes + SaveWordCplSttLst = 0x00000200, // Save Auto correction of Capital letter at beginning of sentence. + SaveWordWordStartLst = 0x00000400, // Save Auto correction of TWo INitial CApitals or sMALL iNITIAL. + IgnoreDoubleSpace = 0x00000800, // Ignore 2 Spaces + ChgSglQuotes = 0x00001000, // Replace simple quotes + CorrectCapsLock = 0x00002000, // Correct accidental use of cAPS LOCK key + TransliterateRTL = 0x00004000, // Transliterate RTL text + ChgAngleQuotes = 0x00008000, // >>, << -> angle quotes in some languages + + ChgWordLstLoad = 0x20000000, // Replacement list loaded + CplSttLstLoad = 0x40000000, // Exception list for Capital letters Start loaded + WordStartLstLoad = 0x80000000, // Exception list for Word Start loaded +}; +namespace o3tl { + template<> struct typed_flags<ACFlags> : is_typed_flags<ACFlags, 0xe000ffff> {}; +} + +enum class ACQuotes +{ + NONE, + NonBreakingSpace, + CapitalizeIAm, + DoubleAngleQuote, + UseApostrophe, +}; + +// TODO: handle code points > U+FFFF and check users of this class + +// only a mapping class +class EDITENG_DLLPUBLIC SvxAutoCorrDoc +{ +public: + virtual ~SvxAutoCorrDoc(); + + virtual bool Delete( sal_Int32 nStt, sal_Int32 nEnd ) = 0; + virtual bool Insert( sal_Int32 nPos, const OUString& rTxt ) = 0; + virtual bool Replace( sal_Int32 nPos, const OUString& rTxt ) = 0; + virtual bool ReplaceRange( sal_Int32 nPos, sal_Int32 nLen, const OUString& rTxt ) = 0; + + virtual void SetAttr( sal_Int32 nStt, sal_Int32 nEnd, sal_uInt16 nSlotId, + SfxPoolItem& ) = 0; + + virtual bool SetINetAttr( sal_Int32 nStt, sal_Int32 nEnd, const OUString& rURL ) = 0; + + // Return the text of a previous paragraph. + // If no paragraph exits or just an empty one, then return an empty string. + // 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 OUString const* GetPrevPara(bool bAtNormalPos) = 0; + + virtual bool ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos, + SvxAutoCorrect& rACorrect, + OUString* pPara ) = 0; + virtual bool TransliterateRTLWord( sal_Int32& rSttPos, sal_Int32 nEndPos, + bool bApply = false ) = 0; + + // Is called after the change of the signs by the functions + // - FnCapitalStartWord + // - FnCapitalStartSentence + // As an option, the words can then be inserted into the exception lists. + virtual void SaveCpltSttWord( ACFlags nFlag, sal_Int32 nPos, + const OUString& rExceptWord, + sal_Unicode cChar ); + + // which language at the position? + virtual LanguageType GetLanguage( sal_Int32 nPos ) const; +}; + + +class EDITENG_DLLPUBLIC SvxAutocorrWord +{ + OUString sShort, sLong; + bool bIsTxtOnly; // Is pure ASCII - Text +public: + SvxAutocorrWord( OUString aS, OUString aL, bool bFlag = true ) + : sShort(std::move( aS )), sLong(std::move( aL )), bIsTxtOnly( bFlag ) + {} + + const OUString& GetShort() const { return sShort; } + const OUString& GetLong() const { return sLong; } + bool IsTextOnly() const { return bIsTxtOnly; } +}; + +class EDITENG_DLLPUBLIC SvxAutocorrWordList +{ + struct Impl; + std::unique_ptr<Impl> mpImpl; + + SvxAutocorrWordList( const SvxAutocorrWordList& ) = delete; + const SvxAutocorrWordList& operator= ( const SvxAutocorrWordList& ) = delete; + + const SvxAutocorrWord* WordMatches(const SvxAutocorrWord *pFnd, + const OUString &rTxt, + sal_Int32 &rStt, + sal_Int32 nEndPos) const; +public: + SvxAutocorrWordList(); + // free any objects still in the set + ~SvxAutocorrWordList(); + void DeleteAndDestroyAll(); + const SvxAutocorrWord* Insert(SvxAutocorrWord aWord) const; + std::optional<SvxAutocorrWord> FindAndRemove(const SvxAutocorrWord *pWord); + void LoadEntry(const OUString& sWrong, const OUString& sRight, bool bOnlyTxt); + bool empty() const; + + struct CompareSvxAutocorrWordList; + typedef std::vector<SvxAutocorrWord> AutocorrWordSetType; + const AutocorrWordSetType & getSortedContent() const; + + const SvxAutocorrWord* SearchWordsInList(const OUString& rTxt, sal_Int32& rStt, sal_Int32 nEndPos) const; +}; + +class EDITENG_DLLPUBLIC SvxAutoCorrectLanguageLists +{ + OUString sShareAutoCorrFile, sUserAutoCorrFile; + // If the AutoCorr file is newer + Date aModifiedDate; + tools::Time aModifiedTime, aLastCheckTime; + + std::unique_ptr<SvStringsISortDtor> pCplStt_ExcptLst; + std::unique_ptr<SvStringsISortDtor> pWordStart_ExcptLst; + std::unique_ptr<SvxAutocorrWordList> pAutocorr_List; + SvxAutoCorrect& rAutoCorrect; + + ACFlags nFlags; + + bool IsFileChanged_Imp(); + void LoadXMLExceptList_Imp( std::unique_ptr<SvStringsISortDtor>& rpLst, + const OUString& sStrmName, + tools::SvRef<SotStorage>& rStg); + static void SaveExceptList_Imp( const SvStringsISortDtor& rLst, + const OUString& sStrmName, + tools::SvRef<SotStorage> const & rStg, + bool bConvert = false); + + bool MakeBlocklist_Imp( SotStorage& rStg ); + void RemoveStream_Imp( const OUString& rName ); + void MakeUserStorage_Impl(); + +public: + SvxAutoCorrectLanguageLists( SvxAutoCorrect& rParent, + OUString aShareAutoCorrectFile, + OUString aUserAutoCorrectFile); + ~SvxAutoCorrectLanguageLists(); + + // Load, Set, Get - the replacement list + SvxAutocorrWordList* LoadAutocorrWordList(); + const SvxAutocorrWordList* GetAutocorrWordList(); + + // Load, Set, Get - the exception list for Capital letter at the + // beginning of a sentence + SvStringsISortDtor* LoadCplSttExceptList(); + void SaveCplSttExceptList(); + SvStringsISortDtor* GetCplSttExceptList(); + bool AddToCplSttExceptList(const OUString& rNew); + + // Load, Set, Get the exception list for TWo INitial CApitals or sMALL iNITIAL + SvStringsISortDtor* LoadWordStartExceptList(); + void SaveWordStartExceptList(); + SvStringsISortDtor* GetWordStartExceptList(); + bool AddToWordStartExceptList(const OUString& rNew); + + // Save word substitutions: + // Store these directly in the storage. The word list is updated + // accordingly! + // - pure Text + bool PutText( const OUString& rShort, const OUString& rLong ); + // - Text with attribution (only the SWG - SWG format!) + void PutText( const OUString& rShort, SfxObjectShell& ); + // - Make combined changes in one pass + bool MakeCombinedChanges( std::vector<SvxAutocorrWord>& aNewEntries, std::vector<SvxAutocorrWord>& aDeleteEntries ); +}; + +class EDITENG_DLLPUBLIC SvxAutoCorrect +{ + friend class SvxAutoCorrectLanguageLists; + + OUString sShareAutoCorrFile, sUserAutoCorrFile; + + SvxSwAutoFormatFlags aSwFlags; // StarWriter AutoFormat Flags + + // all languages in a table + std::map<LanguageTag, std::unique_ptr<SvxAutoCorrectLanguageLists>> m_aLangTable; + std::map<LanguageTag, sal_Int64> aLastFileTable; + std::unique_ptr<CharClass> pCharClass; + + LanguageType eCharClassLang; + + ACFlags nFlags; + sal_Unicode cStartDQuote, cEndDQuote, cStartSQuote, cEndSQuote; + + + // 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 bool PutText( const css::uno::Reference < css::embed::XStorage >& rStg, + const OUString& rFileName, const OUString& rShort, SfxObjectShell&, OUString& ); + + // required language in the table add if possible only when the file exists + bool CreateLanguageFile(const LanguageTag& rLanguageTag, bool bNewFile = 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, bool bSttQuote, + LanguageType eLang ) const; + virtual bool GetLongText( const OUString& rShort, OUString& rLong ); + + virtual void refreshBlockList( const css::uno::Reference < css::embed::XStorage >& rStg); + + SvxAutoCorrect( OUString aShareAutocorrFile, + OUString aUserAutocorrFile ); + SvxAutoCorrect( const SvxAutoCorrect& ); + virtual ~SvxAutoCorrect(); + + /** Execute an AutoCorrect. + Returns what has been executed, according to the above auto correct flags. + @param io_bNbspRunNext + Remembers if a NO-BREAK SPACE was added (eg. in "fr" language) + (set to <TRUE/>) at the last character input that may have to + be removed again depending on what character is following. + */ + // FIXME: this has the horrible flaw that the rTxt must be a reference + // to the actual SwTxtNode/EditNode string because it inserts the character + // in rDoc and expects that to side-effect rTxt + void DoAutoCorrect( SvxAutoCorrDoc& rDoc, const OUString& rTxt, + sal_Int32 nPos, sal_Unicode cInsChar, bool bInsert, bool& io_bNbspRunNext, + vcl::Window const * pFrameWin = nullptr ); + + // Return for the autotext expansion the previous word, + // AutoCorrect - corresponding algorithm + OUString GetPrevAutoCorrWord(SvxAutoCorrDoc const& rDoc, const OUString& rTxt, sal_Int32 nPos); + + // Returns vector candidates for AutoText name match, starting with the longest string between + // 3 and 9 characters long, that is a chunk of text starting with a whitespace or with a word's + // first character, and ending at the current cursor position or empty string if no such string + // exists + static std::vector<OUString> GetChunkForAutoText(std::u16string_view rTxt, sal_Int32 nPos); + + // Search for 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 OUString& rTxt, + sal_Int32& rStt, sal_Int32 nEndPos, + SvxAutoCorrDoc& rDoc, + LanguageTag& 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; } + + OUString GetQuote( SvxAutoCorrDoc const & rDoc, sal_Int32 nInsPos, + sal_Unicode cInsChar, bool bSttQuote ); + void InsertQuote( SvxAutoCorrDoc& rDoc, sal_Int32 nInsPos, + sal_Unicode cInsChar, bool bSttQuote, bool bIns, + LanguageType eLang, ACQuotes eType ) const; + + // Query/Set the name of the AutoCorrect file + // the default is "autocorr.dat" + OUString GetAutoCorrFileName( const LanguageTag& rLanguageTag /* = LANGUAGE_SYSTEM */ , + bool bNewFile = false, + bool bTstUserExist = false, + bool bUnlocalized = false ) const; + + // Query/Set the current settings of AutoCorrect + ACFlags GetFlags() const { return nFlags; } + SvxSwAutoFormatFlags& GetSwFlags() { return aSwFlags;} + const SvxSwAutoFormatFlags& GetSwFlags() const { return aSwFlags; } + bool IsAutoCorrFlag( ACFlags nFlag ) const + { return bool(nFlags & nFlag); } + void SetAutoCorrFlag( ACFlags nFlag, bool bOn = true ); + + // Load, Set, Get - the replacement list + SvxAutocorrWordList* LoadAutocorrWordList( LanguageType eLang ) + { return GetLanguageList_( eLang ).LoadAutocorrWordList(); } + + // Save word substitutions: + // Save these directly in the storage. The word list is updated + // accordingly! + // - pure Text + bool PutText( const OUString& rShort, const OUString& rLong, LanguageType eLang ); + // - Text with attribution (only in the SWG - SWG format!) + void PutText( const OUString& rShort, SfxObjectShell& rShell, LanguageType eLang ) + { GetLanguageList_( eLang ).PutText(rShort, rShell ); } + + void MakeCombinedChanges( std::vector<SvxAutocorrWord>& aNewEntries, + std::vector<SvxAutocorrWord>& aDeleteEntries, + LanguageType eLang ); + + // Load, Set, Get - the exception list for capital letters at the + // beginning of a sentence + void SaveCplSttExceptList( LanguageType eLang ); + SvStringsISortDtor* LoadCplSttExceptList(LanguageType eLang) + { return GetLanguageList_( eLang ).LoadCplSttExceptList(); } + const SvStringsISortDtor* GetCplSttExceptList( LanguageType eLang ) + { return GetLanguageList_( eLang ).GetCplSttExceptList(); } + + // Adds a single word. The list will be immediately written to the file! + bool AddCplSttException( const OUString& rNew, LanguageType eLang ); + + // Load, Set, Get the exception list for TWo INitial CApitals or sMALL iNITIAL + void SaveWordStartExceptList( LanguageType eLang ); + SvStringsISortDtor* LoadWordStartExceptList( LanguageType eLang ) + { return GetLanguageList_( eLang ).LoadWordStartExceptList(); } + const SvStringsISortDtor* GetWordStartExceptList( LanguageType eLang ) + { return GetLanguageList_( eLang ).GetWordStartExceptList(); } + // Adds a single word. The list will be immediately written to the file! + bool AddWordStartException( const OUString& rNew, LanguageType eLang); + + // Search through the Languages for the entry + bool FindInWordStartExceptList( LanguageType eLang, const OUString& sWord ); + bool FindInCplSttExceptList( LanguageType eLang, const OUString& sWord, + bool bAbbreviation = false); + + // Methods for the auto-correction + void FnCapitalStartWord( SvxAutoCorrDoc&, const OUString&, + sal_Int32 nSttPos, sal_Int32 nEndPos, + LanguageType eLang ); + bool FnChgOrdinalNumber( SvxAutoCorrDoc&, const OUString&, + sal_Int32 nSttPos, sal_Int32 nEndPos, + LanguageType eLang ); + bool FnChgToEnEmDash( SvxAutoCorrDoc&, std::u16string_view, + sal_Int32 nSttPos, sal_Int32 nEndPos, + LanguageType eLang ); + bool FnAddNonBrkSpace( SvxAutoCorrDoc&, const OUString&, + sal_Int32 nEndPos, + LanguageType eLang, bool& io_bNbspRunNext ); + bool FnSetINetAttr( SvxAutoCorrDoc&, const OUString&, + sal_Int32 nSttPos, sal_Int32 nEndPos, + LanguageType eLang ); + bool FnChgWeightUnderl( SvxAutoCorrDoc&, const OUString&, + sal_Int32 nEndPos ); + void FnCapitalStartSentence( SvxAutoCorrDoc&, const OUString&, bool bNormalPos, + sal_Int32 nSttPos, sal_Int32 nEndPos, + LanguageType eLang); + bool FnCorrectCapsLock( SvxAutoCorrDoc&, const OUString&, + sal_Int32 nSttPos, sal_Int32 nEndPos, + LanguageType eLang ); + + static ACFlags 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 bool IsAutoCorrectChar( sal_Unicode cChar ); + + static 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 000000000..6c0216560 --- /dev/null +++ b/include/editeng/svxenum.hxx @@ -0,0 +1,218 @@ +/* -*- 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_EDITENG_SVXENUM_HXX +#define INCLUDED_EDITENG_SVXENUM_HXX + +#include <com/sun/star/style/NumberingType.hpp> + +enum class SvxCaseMap +{ + NotMapped, + Uppercase, + Lowercase, + Capitalize, + SmallCaps, + End +}; + +enum class SvxEscapement +{ + Off, + Superscript, + Subscript, + End +}; + +enum class SvxShadowLocation +{ + NONE, + TopLeft, + TopRight, + BottomLeft, + BottomRight, + End +}; + +enum class SvxTabAdjust +{ + Left, + Right, + Decimal, + Center, + Default, + End +}; + +enum class SvxLineSpaceRule +{ + Auto, + Fix, + Min +}; + +enum class SvxInterLineSpaceRule +{ + Off, + Prop, + Fix +}; + +enum class SvxAdjust +{ + Left, + Right, + Block, + Center, + BlockLine, + End, + LAST = End +}; + +enum class SvxBreak +{ + NONE, + ColumnBefore, + ColumnAfter, + ColumnBoth, + PageBefore, + PageAfter, + PageBoth, + End +}; + +enum class SvxCellHorJustify +{ + Standard, + Left, + Center, + Right, + Block, + Repeat +}; + +enum class SvxCellJustifyMethod +{ + Auto, + Distribute +}; + +enum class SvxCellVerJustify +{ + Standard, + Top, + Center, + Bottom, + Block +}; + +enum class SvxCellOrientation +{ + Standard, + TopBottom, + BottomUp, + Stacked +}; + +enum class SvxSpellArea +{ + Body = 0, + BodyEnd, + BodyStart, + Other +}; + +/** + * these must match the values in css::style::NumberingType + */ +enum SvxNumType : sal_Int16 +{ + SVX_NUM_CHARS_UPPER_LETTER = css::style::NumberingType::CHARS_UPPER_LETTER, // Counts from a-z, aa - az, ba - bz, ... + SVX_NUM_CHARS_LOWER_LETTER = css::style::NumberingType::CHARS_LOWER_LETTER, + SVX_NUM_ROMAN_UPPER = css::style::NumberingType::ROMAN_UPPER, + SVX_NUM_ROMAN_LOWER = css::style::NumberingType::ROMAN_LOWER, + SVX_NUM_ARABIC = css::style::NumberingType::ARABIC, + SVX_NUM_NUMBER_NONE = css::style::NumberingType::NUMBER_NONE, + SVX_NUM_CHAR_SPECIAL = css::style::NumberingType::CHAR_SPECIAL, // Bullet + SVX_NUM_PAGEDESC = css::style::NumberingType::PAGE_DESCRIPTOR, // Numbering from the page template + SVX_NUM_BITMAP = css::style::NumberingType::BITMAP, + SVX_NUM_CHARS_UPPER_LETTER_N = css::style::NumberingType::CHARS_UPPER_LETTER_N, // Counts from a-z, aa-zz, aaa-zzz + SVX_NUM_CHARS_LOWER_LETTER_N = css::style::NumberingType::CHARS_LOWER_LETTER_N, + SVX_NUM_TRANSLITERATION = css::style::NumberingType::TRANSLITERATION, + SVX_NUM_NATIVE_NUMBERING = css::style::NumberingType::NATIVE_NUMBERING, + SVX_NUM_FULL_WIDTH_ARABIC = css::style::NumberingType::FULLWIDTH_ARABIC, + SVX_NUM_CIRCLE_NUMBER = css::style::NumberingType::CIRCLE_NUMBER, + SVX_NUM_NUMBER_LOWER_ZH = css::style::NumberingType::NUMBER_LOWER_ZH, + SVX_NUM_NUMBER_UPPER_ZH = css::style::NumberingType::NUMBER_UPPER_ZH, + SVX_NUM_NUMBER_UPPER_ZH_TW = css::style::NumberingType::NUMBER_UPPER_ZH_TW, + SVX_NUM_TIAN_GAN_ZH = css::style::NumberingType::TIAN_GAN_ZH, + SVX_NUM_DI_ZI_ZH = css::style::NumberingType::DI_ZI_ZH, + SVX_NUM_NUMBER_TRADITIONAL_JA = css::style::NumberingType::NUMBER_TRADITIONAL_JA, + SVX_NUM_AIU_FULLWIDTH_JA = css::style::NumberingType::AIU_FULLWIDTH_JA, + SVX_NUM_AIU_HALFWIDTH_JA = css::style::NumberingType::AIU_HALFWIDTH_JA, + SVX_NUM_IROHA_FULLWIDTH_JA = css::style::NumberingType::IROHA_FULLWIDTH_JA, + SVX_NUM_IROHA_HALFWIDTH_JA = css::style::NumberingType::IROHA_HALFWIDTH_JA, + SVX_NUM_NUMBER_UPPER_KO = css::style::NumberingType::NUMBER_UPPER_KO, + SVX_NUM_NUMBER_HANGUL_KO = css::style::NumberingType::NUMBER_HANGUL_KO, + SVX_NUM_HANGUL_JAMO_KO = css::style::NumberingType::HANGUL_JAMO_KO, + SVX_NUM_HANGUL_SYLLABLE_KO = css::style::NumberingType::HANGUL_SYLLABLE_KO, + SVX_NUM_HANGUL_CIRCLED_JAMO_KO = css::style::NumberingType::HANGUL_CIRCLED_JAMO_KO, + SVX_NUM_HANGUL_CIRCLED_SYLLABLE_KO = css::style::NumberingType::HANGUL_CIRCLED_SYLLABLE_KO, + SVX_NUM_CHARS_ARABIC = css::style::NumberingType::CHARS_ARABIC, + SVX_NUM_CHARS_THAI = css::style::NumberingType::CHARS_THAI, + SVX_NUM_CHARS_HEBREW = css::style::NumberingType::CHARS_HEBREW, + SVX_NUM_CHARS_NEPALI = css::style::NumberingType::CHARS_NEPALI, + SVX_NUM_CHARS_KHMER = css::style::NumberingType::CHARS_KHMER, + SVX_NUM_CHARS_LAO = css::style::NumberingType::CHARS_LAO, + SVX_NUM_CHARS_TIBETAN = css::style::NumberingType::CHARS_TIBETAN, + SVX_NUM_CHARS_CYRILLIC_UPPER_LETTER_BG = css::style::NumberingType::CHARS_CYRILLIC_UPPER_LETTER_BG, + SVX_NUM_CHARS_CYRILLIC_LOWER_LETTER_BG = css::style::NumberingType::CHARS_CYRILLIC_LOWER_LETTER_BG, + SVX_NUM_CHARS_CYRILLIC_UPPER_LETTER_N_BG = css::style::NumberingType::CHARS_CYRILLIC_UPPER_LETTER_N_BG, + SVX_NUM_CHARS_CYRILLIC_LOWER_LETTER_N_BG = css::style::NumberingType::CHARS_CYRILLIC_LOWER_LETTER_N_BG, + SVX_NUM_CHARS_CYRILLIC_UPPER_LETTER_RU = css::style::NumberingType::CHARS_CYRILLIC_UPPER_LETTER_RU, + SVX_NUM_CHARS_CYRILLIC_LOWER_LETTER_RU = css::style::NumberingType::CHARS_CYRILLIC_LOWER_LETTER_RU, + SVX_NUM_CHARS_CYRILLIC_UPPER_LETTER_N_RU = css::style::NumberingType::CHARS_CYRILLIC_UPPER_LETTER_N_RU, + SVX_NUM_CHARS_CYRILLIC_LOWER_LETTER_N_RU = css::style::NumberingType::CHARS_CYRILLIC_LOWER_LETTER_N_RU, + SVX_NUM_CHARS_PERSIAN = css::style::NumberingType::CHARS_PERSIAN, + SVX_NUM_CHARS_MYANMAR = css::style::NumberingType::CHARS_MYANMAR, + SVX_NUM_CHARS_CYRILLIC_UPPER_LETTER_SR = css::style::NumberingType::CHARS_CYRILLIC_UPPER_LETTER_SR, + SVX_NUM_CHARS_CYRILLIC_LOWER_LETTER_SR = css::style::NumberingType::CHARS_CYRILLIC_LOWER_LETTER_SR, + SVX_NUM_CHARS_CYRILLIC_UPPER_LETTER_N_SR = css::style::NumberingType::CHARS_CYRILLIC_UPPER_LETTER_N_SR, + SVX_NUM_CHARS_CYRILLIC_LOWER_LETTER_N_SR = css::style::NumberingType::CHARS_CYRILLIC_LOWER_LETTER_N_SR, + SVX_NUM_CHARS_GREEK_UPPER_LETTER = css::style::NumberingType::CHARS_GREEK_UPPER_LETTER, + SVX_NUM_CHARS_GREEK_LOWER_LETTER = css::style::NumberingType::CHARS_GREEK_LOWER_LETTER, + SVX_NUM_CHARS_ARABIC_ABJAD = css::style::NumberingType::CHARS_ARABIC_ABJAD, + SVX_NUM_CHARS_PERSIAN_WORD = css::style::NumberingType::CHARS_PERSIAN_WORD, + SVX_NUM_NUMBER_HEBREW = css::style::NumberingType::NUMBER_HEBREW, + SVX_NUM_NUMBER_ARABIC_INDIC = css::style::NumberingType::NUMBER_ARABIC_INDIC, + SVX_NUM_NUMBER_EAST_ARABIC_INDIC = css::style::NumberingType::NUMBER_EAST_ARABIC_INDIC, + SVX_NUM_NUMBER_INDIC_DEVANAGARI = css::style::NumberingType::NUMBER_INDIC_DEVANAGARI, + SVX_NUM_TEXT_NUMBER = css::style::NumberingType::TEXT_NUMBER, + SVX_NUM_TEXT_CARDINAL = css::style::NumberingType::TEXT_CARDINAL, + SVX_NUM_TEXT_ORDINAL = css::style::NumberingType::TEXT_ORDINAL, + SVX_NUM_SYMBOL_CHICAGO = css::style::NumberingType::SYMBOL_CHICAGO, + SVX_NUM_ARABIC_ZERO = css::style::NumberingType::ARABIC_ZERO, + SVX_NUM_ARABIC_ZERO3 = css::style::NumberingType::ARABIC_ZERO3, + SVX_NUM_ARABIC_ZERO4 = css::style::NumberingType::ARABIC_ZERO4, + SVX_NUM_ARABIC_ZERO5 = css::style::NumberingType::ARABIC_ZERO5, + SVX_NUM_SZEKELY_ROVAS = css::style::NumberingType::SZEKELY_ROVAS +}; + +#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 000000000..e0f92c572 --- /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 INCLUDED_EDITENG_SVXFONT_HXX +#define INCLUDED_EDITENG_SVXFONT_HXX + +#include <editeng/svxenum.hxx> +#include <o3tl/span.hxx> +#include <tools/long.hxx> +#include <vcl/font.hxx> +#include <editeng/editengdllapi.h> +#include <tools/poly.hxx> + +// 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; +namespace tools { class Rectangle; } +class Size; +class EDITENG_DLLPUBLIC SvxFont : public vcl::Font +{ + 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 vcl::Font &rFont ); + SvxFont( const SvxFont &rFont ); + + // Methods for Superscript/Subscript + short GetEscapement() const { return nEsc; } + void SetEscapement( const short nNewEsc ) { nEsc = nNewEsc; } + // set specific values instead of automatic, and ensure valid value. Depends on nPropr being set already. + void SetNonAutoEscapement(short nNewEsc, const OutputDevice* pOutDev = nullptr); + + sal_uInt8 GetPropr() const { return nPropr; } + void SetPropr( const sal_uInt8 nNewPropr ) { nPropr = nNewPropr; } + void SetProprRel( const sal_uInt8 nNewPropr ) + { SetPropr( static_cast<sal_uInt8>( static_cast<tools::Long>(nNewPropr) * static_cast<tools::Long>(nPropr) / 100 ) ); } + + // Kerning + short GetFixKerning() const { return nKern; } + void SetFixKerning( const short nNewKern ) { nKern = nNewKern; } + + SvxCaseMap GetCaseMap() const { return eCaseMap; } + void SetCaseMap( const SvxCaseMap eNew ) { eCaseMap = eNew; } + + // Is-Methods: + bool IsCaseMap() const { return SvxCaseMap::NotMapped != eCaseMap; } + bool IsCapital() const { return SvxCaseMap::SmallCaps == eCaseMap; } + bool IsKern() const { return 0 != nKern; } + 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; + + void SetPhysFont(OutputDevice& rOut) const; + vcl::Font ChgPhysFont(OutputDevice& rOut) const; + + Size GetCapitalSize( const OutputDevice *pOut, const OUString &rTxt, + const sal_Int32 nIdx, const sal_Int32 nLen) const; + void DrawCapital( OutputDevice *pOut, const Point &rPos, const OUString &rTxt, + const sal_Int32 nIdx, const sal_Int32 nLen ) const; + + Size GetPhysTxtSize( const OutputDevice *pOut, const OUString &rTxt, + const sal_Int32 nIdx, const sal_Int32 nLen ) const; + + Size GetPhysTxtSize( const OutputDevice *pOut ); + + Size GetTextSize(const OutputDevice& rOut, const OUString &rTxt, + const sal_Int32 nIdx = 0, const sal_Int32 nLen = SAL_MAX_INT32) const; + + void QuickDrawText( OutputDevice *pOut, const Point &rPos, const OUString &rTxt, + const sal_Int32 nIdx = 0, const sal_Int32 nLen = SAL_MAX_INT32, + o3tl::span<const sal_Int32> pDXArray = {} ) const; + + Size QuickGetTextSize( const OutputDevice *pOut, const OUString &rTxt, + const sal_Int32 nIdx, const sal_Int32 nLen, + std::vector<sal_Int32>* pDXArray = nullptr ) const; + + void DrawPrev( OutputDevice* pOut, Printer* pPrinter, + const Point &rPos, const OUString &rTxt, + const sal_Int32 nIdx = 0, const sal_Int32 nLen = SAL_MAX_INT32 ) const; + + static tools::Polygon DrawArrow( OutputDevice &rOut, const tools::Rectangle& rRect, + const Size& rSize, const Color& rCol, bool bLeftOrTop, + bool bVertical ); + + SvxFont& operator=( const SvxFont& rFont ); + SvxFont& operator=( const Font& rFont ); +}; + +#endif // INCLUDED_EDITENG_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 000000000..e5ed1949b --- /dev/null +++ b/include/editeng/svxrtf.hxx @@ -0,0 +1,295 @@ +/* -*- 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_EDITENG_SVXRTF_HXX +#define INCLUDED_EDITENG_SVXRTF_HXX + +#include <svl/itemset.hxx> +#include <svtools/parrtf.hxx> +#include <rtl/ustring.hxx> +#include <tools/color.hxx> +#include <vcl/font.hxx> + +#include <editeng/editengdllapi.h> + +#include <optional> +#include <vector> +#include <map> +#include <memory> + +struct SvxRTFStyleType; +class SvxRTFItemStackType; +class SvxRTFItemStackList : public std::vector<std::unique_ptr<SvxRTFItemStackType>> {}; + +// 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 EditEngine; +class ContentNode; +class EditNodeIdx +{ +public: + EditNodeIdx(EditEngine* pEE, ContentNode* pNd); + sal_Int32 GetIdx() const; + ContentNode* GetNode() { return mpNode; } +private: + EditEngine* mpEditEngine; + ContentNode* mpNode; +}; + +class EditSelection; +class EditPosition +{ +private: + EditEngine* mpEditEngine; + EditSelection* mpCurSel; + +public: + EditPosition(EditEngine* pIEE, EditSelection* pSel); + + sal_Int32 GetNodeIdx() const; + sal_Int32 GetCntIdx() const; + + // clone NodeIndex + EditNodeIdx MakeNodeIdx() const; +}; + +typedef std::map<short, vcl::Font> SvxRTFFontTbl; + +// own helper classes for the RTF Parser +struct SvxRTFStyleType +{ + SfxItemSet aAttrSet; // the attributes of Style (+ derivated!) + OUString sName; + sal_uInt16 nBasedOn; + sal_uInt8 nOutlineNo; + + SvxRTFStyleType(SfxItemPool& rPool, const WhichRangesContainer& pWhichRange); +}; + +typedef std::map<sal_uInt16, SvxRTFStyleType> SvxRTFStyleTbl; + +class EDITENG_DLLPUBLIC SvxRTFParser : public SvRTFParser +{ + std::vector<Color> maColorTable; + SvxRTFFontTbl m_FontTable; + SvxRTFStyleTbl m_StyleTable; + std::deque< std::unique_ptr<SvxRTFItemStackType> > aAttrStack; + SvxRTFItemStackList m_AttrSetList; + + std::map<sal_uInt16, sal_uInt16> aPlainMap; + std::map<sal_uInt16, sal_uInt16> aPardMap; + WhichRangesContainer aWhichMap; + + std::optional<EditPosition> mxInsertPosition; + SfxItemPool* pAttrPool; + std::optional<Color> mxDefaultColor; + std::optional<vcl::Font> pDfltFont; + std::unique_ptr<SfxItemSet> pRTFDefaults; + + int nDfltFont; + + bool bNewDoc : 1; // sal_False - Reading in an existing + bool bNewGroup : 1; // sal_True - there was an opening parenthesis + bool bIsSetDfltTab : 1; // sal_True - DefTab was loaded + bool bChkStyleAttr : 1; // sal_True - StyleSheets are evaluated + bool bCalcValue : 1; // sal_True - Twip values adapt to App + bool bIsLeftToRightDef : 1; // sal_True - in LeftToRight char run def. + // sal_False - in RightToLeft char run def. + bool bIsInReadStyleTab : 1; // sal_True - in ReadStyleTable + + SvxRTFParser(SvxRTFParser const&) = delete; + void operator=(SvxRTFParser const&) = delete; + + void ClearColorTbl(); + void ClearAttrStack(); + + SvxRTFItemStackType* GetAttrSet_(); // Create new ItemStackType:s + void ClearStyleAttr_( SvxRTFItemStackType& rStkType ); + + // Sets all the attributes that are different from the current + void SetAttrSet( SvxRTFItemStackType &rSet ); + void SetDefault( int nToken, int nValue ); + + // Execute pard / plain + void RTFPardPlain( bool bPard, SfxItemSet** ppSet ); + + void BuildWhichTable(); + + 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 InsertPara() = 0; + + static void DelCharAtEnd( OUStringBuffer& rStr, const sal_Unicode cDel ); + + // is called for each token that is recognized in CallParser + virtual void NextToken( int nToken ) override; + + void ReadStyleTable(); + void ReadColorTable(); + void ReadFontTable(); + void ReadAttr( int nToken, SfxItemSet* pSet ); + void ReadTabAttr( int nToken, SfxItemSet& rSet ); + + inline SfxItemSet& GetAttrSet(); + // no text yet inserted? (SttPos from the top stack entry!) + bool 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( bool bForward = true ) = 0; + virtual void SetEndPrevPara( std::optional<EditNodeIdx>& rpNodePos, + sal_Int32& rCntPos )=0; + virtual void SetAttrInDoc( SvxRTFItemStackType &rSet ); + // for Tokens, which are not evaluated in ReadAttr + virtual void UnknownAttrToken( int nToken ); + + // if no-one would like to have any twips + virtual void CalcValue(); + + SvxRTFParser( SfxItemPool& rAttrPool, SvStream& rIn ); + virtual ~SvxRTFParser() override; + + void SetNewDoc( bool bFlag ) { bNewDoc = bFlag; } + bool IsChkStyleAttr() const { return bChkStyleAttr; } + void SetChkStyleAttr( bool bFlag ) { bChkStyleAttr = bFlag; } + bool IsCalcValue() const { return bCalcValue; } + void SetCalcValue( bool bFlag ) { bCalcValue = bFlag; } + + // Query/Set the current insert position + void SetInsPos( const EditPosition& rNew ); + SvxRTFStyleTbl& GetStyleTbl() { return m_StyleTable; } + +public: + + virtual SvParserState CallParser() override; + + inline const Color& GetColor( size_t nId ) const; + const vcl::Font& GetFont( sal_uInt16 nId ); // Changes the default Font + + virtual bool IsEndPara( EditNodeIdx* pNd, sal_Int32 nCnt ) const = 0; + + // to set 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. + void SetPardMap(sal_uInt16 wid, sal_uInt16 widTrue) { aPardMap[wid] = widTrue; } + // to be able to assign them from the outside as for example table cells + void ReadBorderAttr( int nToken, SfxItemSet& rSet, bool bTableDef=false ); + void ReadBackgroundAttr( int nToken, SfxItemSet& rSet, bool bTableDef=false ); + + // for asynchronous read from the SvStream + virtual void Continue( int nToken ) override; + + // get RTF default ItemSets. Must be used by pard/plain tokens or in + // reset of Style-Items + const SfxItemSet& GetRTFDefaults(); +}; + +// The stack for the attributes: +// this class may only be used by SvxRTFParser! +class SvxRTFItemStackType +{ + friend class SvxRTFParser; + + SfxItemSet aAttrSet; + std::optional<EditNodeIdx> mxStartNodeIdx; + std::optional<EditNodeIdx> mxEndNodeIdx; + sal_Int32 nSttCnt, nEndCnt; + SvxRTFItemStackList maChildList; + sal_uInt16 nStyleNo; + + SvxRTFItemStackType(SvxRTFItemStackType const&) = delete; + void operator=(SvxRTFItemStackType const&) = delete; + + SvxRTFItemStackType( SfxItemPool&, const WhichRangesContainer& pWhichRange, + const EditPosition& ); + + static std::unique_ptr<SvxRTFItemStackType> createSvxRTFItemStackType( + SfxItemPool&, const WhichRangesContainer& pWhichRange, const EditPosition&); + + void Add(std::unique_ptr<SvxRTFItemStackType>); + void Compress( const SvxRTFParser& ); + void DropChildList(); + +public: + SvxRTFItemStackType(const SvxRTFItemStackType&, const EditPosition&, + bool bCopyAttr); + ~SvxRTFItemStackType(); + //cmc, I'm very suspicious about SetStartPos, it doesn't change + //its children's starting position, and the implementation looks + //bad, consider this deprecated. + void SetStartPos( const EditPosition& rPos ); + + const EditNodeIdx& GetSttNode() const { return *mxStartNodeIdx; } + const EditNodeIdx& GetEndNode() const { return *mxEndNodeIdx; } + + sal_Int32 GetSttCnt() const { return nSttCnt; } + sal_Int32 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 +{ + if( nId < maColorTable.size() ) + return maColorTable[ nId ]; + return *mxDefaultColor; +} + +inline SfxItemSet& SvxRTFParser::GetAttrSet() +{ + SvxRTFItemStackType* pTmp; + if( bNewGroup || aAttrStack.empty() ) + pTmp = GetAttrSet_(); + else + { + pTmp = aAttrStack.back().get(); + if ( pTmp == nullptr ) + pTmp = GetAttrSet_(); + } + return pTmp->aAttrSet; +} + + +#endif // INCLUDED_EDITENG_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 000000000..180ba6d1b --- /dev/null +++ b/include/editeng/swafopt.hxx @@ -0,0 +1,140 @@ +/* -*- 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_EDITENG_SWAFOPT_HXX +#define INCLUDED_EDITENG_SWAFOPT_HXX + +#include <sal/config.h> + +#include <editeng/editengdllapi.h> +#include <o3tl/sorted_vector.hxx> +#include <rtl/ustring.hxx> +#include <utility> +#include <vcl/font.hxx> +#include <vcl/vclenum.hxx> + +class SmartTagMgr; + +namespace editeng { + +class EDITENG_DLLPUBLIC IAutoCompleteString +{ +private: + OUString m_String; +public: + explicit IAutoCompleteString(OUString aString) : m_String(std::move(aString)) {} + virtual ~IAutoCompleteString() {} + OUString const& GetAutoCompleteString() const { return m_String; } +}; + +struct CompareAutoCompleteString +{ + bool operator()(IAutoCompleteString *const& lhs, + IAutoCompleteString *const& rhs) const + { + return lhs->GetAutoCompleteString().compareToIgnoreAsciiCase( + rhs->GetAutoCompleteString()) < 0; + } +}; + +class SortedAutoCompleteStrings + : public o3tl::sorted_vector<IAutoCompleteString*, CompareAutoCompleteString> +{ + bool owning_; + + SortedAutoCompleteStrings& operator =(SortedAutoCompleteStrings const &) = delete; + + // For createNonOwningCopy only: + SortedAutoCompleteStrings(SortedAutoCompleteStrings const & other): + sorted_vector(other), owning_(false) {} + +public: + SortedAutoCompleteStrings(): owning_(true) {} + + ~SortedAutoCompleteStrings() { if (owning_) DeleteAndDestroyAll(); } + + SortedAutoCompleteStrings createNonOwningCopy() const { return *this; } +}; + +} // namespace editeng + +// Class of options for AutoFormat +struct EDITENG_DLLPUBLIC SvxSwAutoFormatFlags +{ + vcl::Font aBulletFont; + vcl::Font aByInputBulletFont; + /// only valid inside the Dialog!!! + const editeng::SortedAutoCompleteStrings * m_pAutoCompleteList; + SmartTagMgr* pSmartTagMgr; + + sal_UCS4 cBullet; + sal_UCS4 cByInputBullet; + + sal_uInt16 nAutoCmpltWordLen, nAutoCmpltListLen; + sal_uInt16 nAutoCmpltExpandKey; + + sal_uInt8 nRightMargin; + + bool bAutoCorrect : 1; + bool bCapitalStartSentence : 1; + bool bCapitalStartWord : 1; + + bool bChgUserColl : 1; + bool bChgEnumNum : 1; + + bool bAFormatByInput : 1; + bool bDelEmptyNode : 1; + bool bSetNumRule : 1; + + bool bChgOrdinalNumber : 1; + bool bChgToEnEmDash : 1; + bool bAddNonBrkSpace : 1; + bool bTransliterateRTL : 1; + bool bChgAngleQuotes : 1; + bool bChgWeightUnderl : 1; + bool bSetINetAttr : 1; + + bool bSetBorder : 1; + bool bCreateTable : 1; + bool bReplaceStyles : 1; + + bool bWithRedlining : 1; + + bool bRightMargin : 1; + + bool bAutoCompleteWords : 1; + bool bAutoCmpltCollectWords : 1; + bool bAutoCmpltEndless : 1; +// -- under NT here starts a new long + bool bAutoCmpltAppendBlank : 1; + bool bAutoCmpltShowAsTip : 1; + + bool bAFormatDelSpacesAtSttEnd : 1; + bool bAFormatDelSpacesBetweenLines : 1; + bool bAFormatByInpDelSpacesAtSttEnd : 1; + bool bAFormatByInpDelSpacesBetweenLines : 1; + + bool bAutoCmpltKeepList : 1; + + SvxSwAutoFormatFlags(); +}; + +#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 000000000..b5aab04bc --- /dev/null +++ b/include/editeng/tstpitem.hxx @@ -0,0 +1,149 @@ +/* -*- 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_EDITENG_TSTPITEM_HXX +#define INCLUDED_EDITENG_TSTPITEM_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 u'\0' // Get from IntlWrapper +#define cDfltFillChar u' ' + +class EDITENG_DLLPUBLIC SvxTabStop +{ +private: + sal_Int32 nTabPos; + SvxTabAdjust eAdjustment; + mutable sal_Unicode + m_cDecimal; + sal_Unicode cFill; + + void fillDecimal() const; + +public: + SvxTabStop(); + explicit SvxTabStop( const sal_Int32 nPos, + const SvxTabAdjust eAdjst = SvxTabAdjust::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; } + + bool operator==( const SvxTabStop& rTS ) const + { + return ( nTabPos == rTS.nTabPos && + eAdjustment == rTS.eAdjustment && + m_cDecimal == rTS.m_cDecimal && + cFill == rTS.cFill ); + } + bool operator!=( const SvxTabStop& rTS ) const + { + return !operator==(rTS); + } + // For the SortedArray: + bool operator <( const SvxTabStop& rTS ) const + { return nTabPos < rTS.nTabPos; } + + void dumpAsXml(xmlTextWriterPtr pWriter) const; +}; + +// class SvxTabStopItem -------------------------------------------------- + +typedef o3tl::sorted_vector<SvxTabStop> SvxTabStopArr; + +/* [Description] + + This item describes a list of TabStops. +*/ + +class EDITENG_DLLPUBLIC SvxTabStopItem final : public SfxPoolItem +{ + SvxTabStopArr maTabStops; + +public: + static SfxPoolItem* CreateDefault(); + + explicit SvxTabStopItem( sal_uInt16 nWhich ); + SvxTabStopItem( const sal_uInt16 nTabs, + const sal_uInt16 nDist, + const SvxTabAdjust eAdjst /*= SvxTabAdjust::Default*/, + sal_uInt16 nWhich ); + + // 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 ); + 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!) + + // 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]; } + + const SvxTabStop& At( const sal_uInt16 nPos ) const + { + return maTabStops[nPos]; + } + + // "pure virtual Methods" from SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + virtual SvxTabStopItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +#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 000000000..d39a3ac60 --- /dev/null +++ b/include/editeng/twolinesitem.hxx @@ -0,0 +1,63 @@ +/* -*- 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_EDITENG_TWOLINESITEM_HXX +#define INCLUDED_EDITENG_TWOLINESITEM_HXX + +#include <sal/types.h> +#include <svl/poolitem.hxx> +#include <editeng/editengdllapi.h> + +class EDITENG_DLLPUBLIC SvxTwoLinesItem final : public SfxPoolItem +{ + sal_Unicode cStartBracket, cEndBracket; + bool bOn; +public: + SvxTwoLinesItem( bool bOn /*= true*/, + sal_Unicode nStartBracket /*= 0*/, + sal_Unicode nEndBracket /*= 0*/, + sal_uInt16 nId ); + virtual ~SvxTwoLinesItem() override; + + SvxTwoLinesItem(SvxTwoLinesItem const &) = default; + SvxTwoLinesItem(SvxTwoLinesItem &&) = default; + SvxTwoLinesItem & operator =(SvxTwoLinesItem const &) = delete; // due to SfxPoolItem + SvxTwoLinesItem & operator =(SvxTwoLinesItem &&) = delete; // due to SfxPoolItem + + // "pure virtual Methods" from SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SvxTwoLinesItem* Clone( SfxItemPool* pPool = nullptr ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& rIntl ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + bool GetValue() const { return bOn; } + + sal_Unicode GetStartBracket() const { return cStartBracket; } + + sal_Unicode GetEndBracket() const { return cEndBracket; } +}; + +#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 000000000..c6661f687 --- /dev/null +++ b/include/editeng/txtrange.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 INCLUDED_EDITENG_TXTRANGE_HXX +#define INCLUDED_EDITENG_TXTRANGE_HXX + +#include <editeng/editengdllapi.h> +#include <tools/gen.hxx> +#include <tools/poly.hxx> +#include <deque> +#include <optional> + +namespace basegfx { + class B2DPolyPolygon; +} + +class EDITENG_DLLPUBLIC TextRanger +{ + //! The RangeCache class is used to cache the result of a single range calculation. + struct RangeCacheItem + { + Range range; //!< Range for which we calculated results. + std::deque<tools::Long> results; //!< Calculated results for the range. + RangeCacheItem(const Range& rng) : range(rng) {}; + }; + std::deque<RangeCacheItem> mRangeCache; //!< Cached range calculations. + tools::PolyPolygon maPolyPolygon; // Surface polygon + std::optional<tools::PolyPolygon> mpLinePolyPolygon; // Line polygon + mutable std::optional<tools::Rectangle> mxBound; // 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 + bool bSimple : 1; // Just outside edge + bool bInner : 1; // TRUE: Object inline (EditEngine); + // FALSE: Object flow (StarWriter); + bool bVertical :1;// for vertical writing mode + + TextRanger( const TextRanger& ) = delete; + const tools::Rectangle& GetBoundRect_() const; +public: + TextRanger( const basegfx::B2DPolyPolygon& rPolyPolygon, + const basegfx::B2DPolyPolygon* pLinePolyPolygon, + sal_uInt16 nCacheSize, sal_uInt16 nLeft, sal_uInt16 nRight, + bool bSimple, bool bInner, bool bVert = false ); + ~TextRanger(); + std::deque<tools::Long>* 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; } + bool IsSimple() const { return bSimple; } + bool IsInner() const { return bInner; } + bool IsVertical() const { return bVertical; } + const tools::Rectangle& GetBoundRect() const + { return mxBound ? const_cast< const tools::Rectangle& >(*mxBound) : GetBoundRect_(); } + void SetUpper( sal_uInt16 nNew ){ nUpper = nNew; } + void SetLower( sal_uInt16 nNew ){ nLower = nNew; } + void SetVertical( bool 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 000000000..e190348bb --- /dev/null +++ b/include/editeng/udlnitem.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 INCLUDED_EDITENG_UDLNITEM_HXX +#define INCLUDED_EDITENG_UDLNITEM_HXX + +#include <svl/eitem.hxx> +#include <tools/color.hxx> +#include <tools/fontenum.hxx> +#include <editeng/editengdllapi.h> + +// class SvxTextLineItem ------------------------------------------------ + +/* Value container for underline and overline font effects */ + +class EDITENG_DLLPUBLIC SvxTextLineItem : public SfxEnumItem<FontLineStyle> +{ + Color mColor; +public: + SvxTextLineItem( const FontLineStyle eSt, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + virtual SvxTextLineItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const; + virtual sal_uInt16 GetValueCount() const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + using SfxEnumItem::SetValue; + virtual bool HasBoolValue() const override; + virtual bool GetBoolValue() const override; + virtual void SetBoolValue( bool bVal ) override; + + virtual bool operator==( const SfxPoolItem& ) const override; + + // enum cast + FontLineStyle GetLineStyle() const + { return GetValue(); } + void SetLineStyle( FontLineStyle eNew ) + { SetValue(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 final : public SvxTextLineItem +{ +public: + static SfxPoolItem* CreateDefault(); + + SvxUnderlineItem( const FontLineStyle eSt, + const sal_uInt16 nId ); + + virtual SvxUnderlineItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const override; +}; + +// class SvxOverlineItem ------------------------------------------------ + +/* Value container for overline font effects */ + +class EDITENG_DLLPUBLIC SvxOverlineItem final : public SvxTextLineItem +{ +public: + static SfxPoolItem* CreateDefault(); + + SvxOverlineItem( const FontLineStyle eSt, + const sal_uInt16 nId ); + + virtual SvxOverlineItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const override; +}; + +#endif // INCLUDED_EDITENG_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 000000000..b0131ab99 --- /dev/null +++ b/include/editeng/ulspitem.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 INCLUDED_EDITENG_ULSPITEM_HXX +#define INCLUDED_EDITENG_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 final : public SfxPoolItem +{ + sal_uInt16 nUpper; // Upper space + sal_uInt16 nLower; // Lower space + bool bContext; // Contextual spacing? + sal_uInt16 nPropUpper, nPropLower; // relative or absolute (=100%) +public: + static SfxPoolItem* CreateDefault(); + + explicit SvxULSpaceItem( const sal_uInt16 nId ); + SvxULSpaceItem( const sal_uInt16 nUp, const sal_uInt16 nLow, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual bool operator==( const SfxPoolItem& ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + virtual SvxULSpaceItem* Clone( SfxItemPool *pPool = nullptr ) const override; + virtual void ScaleMetrics( tools::Long nMult, tools::Long nDiv ) override; + virtual bool HasMetrics() const override; + + 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 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; } + bool GetContext() const { return bContext; } + sal_uInt16 GetPropUpper() const { return nPropUpper; } + sal_uInt16 GetPropLower() const { return nPropLower; } + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; + virtual boost::property_tree::ptree dumpAsJSON() const override; +}; + +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 000000000..5b70de35c --- /dev/null +++ b/include/editeng/unoedhlp.hxx @@ -0,0 +1,156 @@ +/* -*- 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_EDITENG_UNOEDHLP_HXX +#define INCLUDED_EDITENG_UNOEDHLP_HXX + +#include <memory> +#include <vcl/textdata.hxx> +#include <svl/hint.hxx> +#include <tools/gen.hxx> +#include <editeng/editengdllapi.h> + +struct EENotify; +class EditEngine; + +/** Extends TextHint by two additional parameters which are necessary + for the SfxHintId::EditSourceParasMoved 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 SAL_DLLPUBLIC_RTTI SvxEditSourceHint : public TextHint +{ +private: + sal_Int32 mnStart; + sal_Int32 mnEnd; + +public: + SvxEditSourceHint( SfxHintId nId ); + SvxEditSourceHint( SfxHintId nId, sal_Int32 nValue, sal_Int32 nStart, sal_Int32 nEnd ); + + using TextHint::GetValue; + sal_Int32 GetStartValue() const { return mnStart;} + sal_Int32 GetEndValue() const { return mnEnd;} +}; +class SvxEditSourceHintEndPara final : public SvxEditSourceHint +{ +public: + SvxEditSourceHintEndPara() : SvxEditSourceHint(SfxHintId::EditSourceSelectionChanged) {} +}; +/** Helper class for common functionality in edit sources + */ +class EDITENG_DLLPUBLIC SvxEditSourceHelper +{ +public: + + /** Translates EditEngine notifications into broadcastable hints + + @param aNotify + Notification object sent by the EditEngine. + + @return the translated hint + */ + static ::std::unique_ptr<SfxHint> EENotification2Hint( EENotify const * aNotify ); + + /** 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 + */ + static void GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, const EditEngine& rEE, sal_Int32 nPara, sal_Int32 nIndex, bool bInCell = false); + + /** 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 tools::Rectangle EEToUserSpace( const tools::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 000000000..f1db61fe9 --- /dev/null +++ b/include/editeng/unoedprx.hxx @@ -0,0 +1,172 @@ +/* -*- 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_EDITENG_UNOEDPRX_HXX +#define INCLUDED_EDITENG_UNOEDPRX_HXX + +#include <config_options.h> +#include <memory> +#include <svl/SfxBroadcaster.hxx> +#include <editeng/unoedsrc.hxx> + +#include <editeng/editdata.hxx> +#include <editeng/editengdllapi.h> + +class SvxAccessibleTextAdapter final : public SvxTextForwarder +{ +public: + SvxAccessibleTextAdapter(); + virtual ~SvxAccessibleTextAdapter() override; + + virtual sal_Int32 GetParagraphCount() const override; + virtual sal_Int32 GetTextLen( sal_Int32 nParagraph ) const override; + virtual OUString GetText( const ESelection& rSel ) const override; + virtual SfxItemSet GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs::All ) const override; + virtual SfxItemSet GetParaAttribs( sal_Int32 nPara ) const override; + virtual void SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet ) override; + virtual void RemoveAttribs( const ESelection& rSelection ) override; + virtual void GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList ) const override; + + sal_Int32 CalcEditEngineIndex( sal_Int32 nPara, sal_Int32 nLogicalIndex ); + + virtual SfxItemState GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const override; + virtual SfxItemState GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const override; + + virtual void QuickInsertText( const OUString& rText, const ESelection& rSel ) override; + virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ) override; + virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ) override; + virtual void QuickInsertLineBreak( const ESelection& rSel ) override; + + virtual SfxItemPool* GetPool() const override; + + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor ) override; + virtual void FieldClicked( const SvxFieldItem& rField ) override; + + virtual bool IsValid() const override; + + virtual LanguageType GetLanguage( sal_Int32, sal_Int32 ) const override; + virtual sal_Int32 GetFieldCount( sal_Int32 nPara ) const override; + virtual EFieldInfo GetFieldInfo( sal_Int32 nPara, sal_uInt16 nField ) const override; + virtual EBulletInfo GetBulletInfo( sal_Int32 nPara ) const override; + virtual tools::Rectangle GetCharBounds( sal_Int32 nPara, sal_Int32 nIndex ) const override; + virtual tools::Rectangle GetParaBounds( sal_Int32 nPara ) const override; + virtual MapMode GetMapMode() const override; + virtual OutputDevice* GetRefDevice() const override; + virtual bool GetIndexAtPoint( const Point&, sal_Int32& nPara, sal_Int32& nIndex ) const override; + virtual bool GetWordIndices( sal_Int32 nPara, sal_Int32 nIndex, sal_Int32& nStart, sal_Int32& nEnd ) const override; + virtual bool GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, sal_Int32 nPara, sal_Int32 nIndex, bool bInCell = false ) const override; + virtual sal_Int32 GetLineCount( sal_Int32 nPara ) const override; + virtual sal_Int32 GetLineLen( sal_Int32 nPara, sal_Int32 nLine ) const override; + virtual void GetLineBoundaries( /*out*/sal_Int32 &rStart, /*out*/sal_Int32 &rEnd, sal_Int32 nParagraph, sal_Int32 nLine ) const override; + virtual sal_Int32 GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const override; + + virtual bool Delete( const ESelection& ) override; + virtual bool InsertText( const OUString&, const ESelection& ) override; + virtual bool QuickFormatDoc( bool bFull = false ) override; + virtual sal_Int16 GetDepth( sal_Int32 nPara ) const override; + virtual bool SetDepth( sal_Int32 nPara, sal_Int16 nNewDepth ) override; + + virtual const SfxItemSet* GetEmptyItemSetPtr() override; + + // implementation functions for XParagraphAppend and XTextPortionAppend + // (not needed for accessibility, only for new import API) + virtual void AppendParagraph() override; + virtual sal_Int32 AppendTextPortion( sal_Int32 nPara, const OUString &rText, const SfxItemSet &rSet ) override; + + //XTextCopy + virtual void CopyText(const SvxTextForwarder& rSource) override; + + void SetForwarder( SvxTextForwarder& ); + bool HaveImageBullet( sal_Int32 nPara ) const; + bool HaveTextBullet( sal_Int32 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. + */ + bool IsEditable( const ESelection& rSelection ) const; + +private: + SvxTextForwarder* mpTextForwarder; +}; + +class SvxAccessibleTextEditViewAdapter final : public SvxEditViewForwarder +{ +public: + + SvxAccessibleTextEditViewAdapter(); + virtual ~SvxAccessibleTextEditViewAdapter() override; + + // SvxViewForwarder interface + virtual bool IsValid() const override; + virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const override; + virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const override; + + // SvxEditViewForwarder interface + virtual bool GetSelection( ESelection& rSelection ) const override; + virtual bool SetSelection( const ESelection& rSelection ) override; + virtual bool Copy() override; + virtual bool Cut() override; + virtual bool Paste() override; + + void SetForwarder( SvxEditViewForwarder&, SvxAccessibleTextAdapter& ); + +private: + SvxEditViewForwarder* mpViewForwarder; + SvxAccessibleTextAdapter* mpTextForwarder; +}; + +class UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) SvxEditSourceAdapter final : public SvxEditSource +{ +public: + SvxEditSourceAdapter(); + virtual ~SvxEditSourceAdapter() override; + + virtual std::unique_ptr<SvxEditSource> Clone() const override; + virtual SvxTextForwarder* GetTextForwarder() override; + SvxAccessibleTextAdapter* GetTextForwarderAdapter(); // covariant return types don't work on MSVC + virtual SvxViewForwarder* GetViewForwarder() override; + virtual SvxEditViewForwarder* GetEditViewForwarder( bool bCreate = false ) override; + SvxAccessibleTextEditViewAdapter* GetEditViewForwarderAdapter( bool bCreate ); // covariant return types don't work on MSVC + virtual void UpdateData() override; + virtual SfxBroadcaster& GetBroadcaster() const override; + + void SetEditSource( ::std::unique_ptr< SvxEditSource > && pAdaptee ); + + bool IsValid() const { return mbEditSourceValid;} + +private: + SvxEditSourceAdapter( const SvxEditSourceAdapter& ) = delete; + SvxEditSourceAdapter& operator= ( const SvxEditSourceAdapter& ) = delete; + + ::std::unique_ptr< SvxEditSource > mpAdaptee; + + SvxAccessibleTextAdapter maTextAdapter; + SvxAccessibleTextEditViewAdapter maEditViewAdapter; + + mutable SfxBroadcaster maDummyBroadcaster; + + 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 000000000..44d8944bc --- /dev/null +++ b/include/editeng/unoedsrc.hxx @@ -0,0 +1,533 @@ +/* -*- 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_EDITENG_UNOEDSRC_HXX +#define INCLUDED_EDITENG_UNOEDSRC_HXX + +#include <i18nlangtag/lang.h> +#include <rtl/ustring.hxx> +#include <tools/gen.hxx> +#include <vcl/mapmod.hxx> +#include <svl/poolitem.hxx> +#include <editeng/editengdllapi.h> +#include <editeng/editeng.hxx> + +#include <vector> + +struct ESelection; +struct EFieldInfo; +struct EBulletInfo; +class Color; +class OutputDevice; +class SfxItemSet; +class SvxTextForwarder; +class SvxViewForwarder; +class SvxEditViewForwarder; +class SvxFieldItem; +class SfxBroadcaster; +class SvxUnoTextRangeBase; + +typedef std::vector< SvxUnoTextRangeBase* > SvxUnoTextRangeBaseVec; + +/** 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: + SvxEditSource() = default; + SvxEditSource(SvxEditSource const &) = default; + SvxEditSource(SvxEditSource &&) = default; + SvxEditSource & operator =(SvxEditSource const &) = default; + SvxEditSource & operator =(SvxEditSource &&) = default; + + virtual ~SvxEditSource(); + + /// Returns a new reference to the same object. This is a shallow copy + virtual std::unique_ptr<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( bool bCreate = 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 they are 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 SvxUnoTextRangeBaseVec& 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() COVERITY_NOEXCEPT_FALSE; + + virtual sal_Int32 GetParagraphCount() const = 0; + virtual sal_Int32 GetTextLen( sal_Int32 nParagraph ) const = 0; + virtual OUString GetText( const ESelection& rSel ) const = 0; + virtual SfxItemSet GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs::All ) const = 0; + virtual SfxItemSet GetParaAttribs( sal_Int32 nPara ) const = 0; + virtual void SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet ) = 0; + virtual void RemoveAttribs( const ESelection& rSelection ) = 0; + virtual void GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList ) const = 0; + + virtual SfxItemState GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const = 0; + virtual SfxItemState GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const = 0; + + virtual void QuickInsertText( const OUString& 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 OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor ) = 0; + virtual void FieldClicked( const SvxFieldItem& rField ) = 0; + + virtual SfxItemPool* GetPool() const = 0; + + virtual const SfxItemSet* GetEmptyItemSetPtr() = 0; + + // implementation functions for XParagraphAppend and XTextPortionAppend + virtual void AppendParagraph() = 0; + virtual sal_Int32 AppendTextPortion( sal_Int32 nPara, const OUString &rText, const SfxItemSet &rSet ) = 0; + + // XTextCopy + virtual void CopyText(const SvxTextForwarder& rSource) = 0; + + /** Query state of forwarder + + @return false, if no longer valid + */ + virtual 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_Int32 nPara, sal_Int32 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_Int32 GetFieldCount( sal_Int32 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_Int32 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_Int32 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 + roughly 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 tools::Rectangle GetCharBounds( sal_Int32 nPara, sal_Int32 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 tools::Rectangle GetParaBounds( sal_Int32 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, relative 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 true, if the point is over any text and both rPara and rIndex are valid + + */ + virtual bool GetIndexAtPoint( const Point& rPoint, sal_Int32& rPara, sal_Int32& 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 true, if the result is non-empty + */ + virtual bool GetWordIndices( sal_Int32 nPara, sal_Int32 nIndex, sal_Int32& rStart, sal_Int32& 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 true, if the range has been successfully determined + */ + virtual bool GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, sal_Int32 nPara, sal_Int32 nIndex, bool bInCell = false ) 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_Int32 GetLineCount( sal_Int32 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_Int32 GetLineLen( sal_Int32 nPara, sal_Int32 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_Int32 &rStart, /*out*/sal_Int32 &rEnd, sal_Int32 nParagraph, sal_Int32 nLine ) const = 0; + + /** Query the line number for an 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 the char in the paragraph text + + @returns [0 .. k-1] + The line number of the char in the paragraph + */ + virtual sal_Int32 GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const = 0; + + /** Delete given text range and reformat text + + @param rSelection + The text range to be deleted + + @return true if text has been successfully deleted + */ + virtual 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 true if text has been successfully inserted + */ + virtual bool InsertText( const OUString& rText, const ESelection& rSel ) = 0; + + /** Updates the formatting + + @see EditEngine::QuickFormatDoc() for details + + @return true if text have been successfully reformatted + */ + virtual bool QuickFormatDoc( bool bFull = 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_Int32 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 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 bool SetDepth( sal_Int32 nPara, sal_Int16 nNewDepth ) = 0; + + virtual sal_Int32 GetNumberingStartValue( sal_Int32 nPara ); + virtual void SetNumberingStartValue( sal_Int32 nPara, sal_Int32 nNumberingStartValue ); + + virtual bool IsParaIsNumberingRestart( sal_Int32 nPara ); + virtual void SetParaIsNumberingRestart( sal_Int32 nPara, 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 bool IsValid() 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 false, if there is no view or no selection (the empty selection _is_ a selection) + + */ + virtual bool GetSelection( ESelection& rSelection ) const = 0; + + /** Set selection in view. + + @param rSelection + The selection to set + + @return false, if there is no view or selection is invalid + */ + virtual bool SetSelection( const ESelection& rSelection ) = 0; + + /** Copy current selection to clipboard. + + @return false if no selection or no view (the empty selection _is_ a selection) + */ + virtual bool Copy() = 0; + + /** Cut current selection to clipboard. + + @return false if no selection or no view (the empty selection _is_ a selection) + */ + virtual bool Cut() = 0; + + /** Paste clipboard into current selection. + + @return false if no view or no selection (the empty selection _is_ a selection) + */ + virtual 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 000000000..fbc94b09c --- /dev/null +++ b/include/editeng/unofdesc.hxx @@ -0,0 +1,50 @@ +/* -*- 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_EDITENG_UNOFDESC_HXX +#define INCLUDED_EDITENG_UNOFDESC_HXX + +#include <svl/itemset.hxx> +#include <editeng/editengdllapi.h> + +namespace com::sun::star::awt +{ +struct FontDescriptor; +} +namespace vcl +{ +class Font; +} + +class EDITENG_DLLPUBLIC SvxUnoFontDescriptor +{ +public: + static void ConvertToFont(const css::awt::FontDescriptor& rDesc, vcl::Font& rFont); + static void ConvertFromFont(const vcl::Font& rFont, css::awt::FontDescriptor& rDesc); + + static void FillItemSet(const css::awt::FontDescriptor& rDesc, SfxItemSet& rSet); + static void FillFromItemSet(const SfxItemSet& rSet, css::awt::FontDescriptor& rDesc); + + static void setPropertyToDefault(SfxItemSet& rSet); + static css::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 000000000..740a25a5b --- /dev/null +++ b/include/editeng/unofield.hxx @@ -0,0 +1,111 @@ +/* -*- 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_EDITENG_UNOFIELD_HXX +#define INCLUDED_EDITENG_UNOFIELD_HXX + +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/text/XTextField.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/component.hxx> +#include <editeng/editengdllapi.h> + +#include <cppuhelper/basemutex.hxx> +#include <memory> +#include <string_view> + +namespace com::sun::star::beans { class XPropertySetInfo; } + +class SvxUnoFieldData_Impl; +class SfxItemPropertySet; +class SvxFieldData; + +/// @throws css::uno::Exception +/// @throws css::uno::RuntimeException +css::uno::Reference< css::uno::XInterface > EDITENG_DLLPUBLIC SvxUnoTextCreateTextField( + std::u16string_view ServiceSpecifier ); + +class EDITENG_DLLPUBLIC SvxUnoTextField final : public cppu::BaseMutex, + public ::cppu::OComponentHelper, + public css::text::XTextField, + public css::beans::XPropertySet, + public css::lang::XServiceInfo, + public css::lang::XUnoTunnel +{ + css::uno::Reference< css::text::XTextRange > mxAnchor; + const SfxItemPropertySet* mpPropSet; + sal_Int32 mnServiceId; + std::unique_ptr<SvxUnoFieldData_Impl> mpImpl; + css::uno::Sequence< css::uno::Type > maTypeSequence; + +public: + SvxUnoTextField( sal_Int32 nServiceId ) noexcept; + SvxUnoTextField( css::uno::Reference< css::text::XTextRange > xAnchor, const OUString& rPresentation, const SvxFieldData* pFieldData ) noexcept; + virtual ~SvxUnoTextField() noexcept override; + + // Internal + std::unique_ptr<SvxFieldData> CreateFieldData() const noexcept; + + static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() noexcept; + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + + // css::uno::XInterface + virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override; + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + + // css::lang::XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override; + + // XTextField + virtual OUString SAL_CALL getPresentation( sal_Bool bShowCommand ) override; + + // XTextContent + virtual void SAL_CALL attach( const css::uno::Reference< css::text::XTextRange >& xTextRange ) override; + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor( ) override; + + // css::lang::XComponent + virtual void SAL_CALL dispose() override; + virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override; + virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override; + + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + // OComponentHelper + virtual void SAL_CALL disposing() override; + + // XServiceInfo + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; +}; + +#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 000000000..989b5c365 --- /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 INCLUDED_EDITENG_UNOFORED_HXX +#define INCLUDED_EDITENG_UNOFORED_HXX + +#include <editeng/editeng.hxx> +#include <editeng/unoedsrc.hxx> +#include <editeng/editengdllapi.h> + +// SvxEditEngineForwarder - SvxTextForwarder for EditEngine + +class EDITENG_DLLPUBLIC SvxEditEngineForwarder final : public SvxTextForwarder +{ +private: + EditEngine& rEditEngine; + +public: + SvxEditEngineForwarder( EditEngine& rEngine ); + virtual ~SvxEditEngineForwarder() override; + + virtual sal_Int32 GetParagraphCount() const override; + virtual sal_Int32 GetTextLen( sal_Int32 nParagraph ) const override; + virtual OUString GetText( const ESelection& rSel ) const override; + virtual SfxItemSet GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs::All ) const override; + virtual SfxItemSet GetParaAttribs( sal_Int32 nPara ) const override; + virtual void SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet ) override; + virtual void RemoveAttribs( const ESelection& rSelection ) override; + virtual void GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList ) const override; + + virtual SfxItemState GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const override; + virtual SfxItemState GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const override; + + virtual void QuickInsertText( const OUString& rText, const ESelection& rSel ) override; + virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ) override; + virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ) override; + virtual void QuickInsertLineBreak( const ESelection& rSel ) override; + + virtual SfxItemPool* GetPool() const override; + + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor ) override; + virtual void FieldClicked( const SvxFieldItem& rField ) override; + virtual bool IsValid() const override; + + virtual LanguageType GetLanguage( sal_Int32, sal_Int32 ) const override; + virtual sal_Int32 GetFieldCount( sal_Int32 nPara ) const override; + virtual EFieldInfo GetFieldInfo( sal_Int32 nPara, sal_uInt16 nField ) const override; + virtual EBulletInfo GetBulletInfo( sal_Int32 nPara ) const override; + virtual tools::Rectangle GetCharBounds( sal_Int32 nPara, sal_Int32 nIndex ) const override; + virtual tools::Rectangle GetParaBounds( sal_Int32 nPara ) const override; + virtual MapMode GetMapMode() const override; + virtual OutputDevice* GetRefDevice() const override; + virtual bool GetIndexAtPoint( const Point&, sal_Int32& nPara, sal_Int32& nIndex ) const override; + virtual bool GetWordIndices( sal_Int32 nPara, sal_Int32 nIndex, sal_Int32& nStart, sal_Int32& nEnd ) const override; + virtual bool GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, sal_Int32 nPara, sal_Int32 nIndex, bool bInCell = false ) const override; + virtual sal_Int32 GetLineCount( sal_Int32 nPara ) const override; + virtual sal_Int32 GetLineLen( sal_Int32 nPara, sal_Int32 nLine ) const override; + virtual void GetLineBoundaries( /*out*/sal_Int32 &rStart, /*out*/sal_Int32 &rEnd, sal_Int32 nParagraph, sal_Int32 nLine ) const override; + virtual sal_Int32 GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const override; + virtual bool Delete( const ESelection& ) override; + virtual bool InsertText( const OUString&, const ESelection& ) override; + virtual bool QuickFormatDoc( bool bFull = false ) override; + virtual sal_Int16 GetDepth( sal_Int32 nPara ) const override; + virtual bool SetDepth( sal_Int32 nPara, sal_Int16 nNewDepth ) override; + + virtual const SfxItemSet* GetEmptyItemSetPtr() override; + + // implementation functions for XParagraphAppend and XTextPortionAppend + virtual void AppendParagraph() override; + virtual sal_Int32 AppendTextPortion( sal_Int32 nPara, const OUString &rText, const SfxItemSet &rSet ) override; + //XTextCopy + virtual void CopyText(const SvxTextForwarder& rSource) override; +}; + +#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 000000000..a4535d83b --- /dev/null +++ b/include/editeng/unoforou.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 INCLUDED_EDITENG_UNOFOROU_HXX +#define INCLUDED_EDITENG_UNOFOROU_HXX + +#include <editeng/unoedsrc.hxx> +#include <editeng/editengdllapi.h> +#include <editeng/editdata.hxx> +#include <svl/itemset.hxx> +#include <optional> + +class Outliner; + +// SvxOutlinerForwarder - SvxTextForwarder for Outliner + +class EDITENG_DLLPUBLIC SvxOutlinerForwarder final : public SvxTextForwarder +{ +private: + Outliner& rOutliner; + bool bOutlinerText; + + /** this pointer may be null or point to an item set for the attribs of + the selection maAttribsSelection */ + mutable std::optional<SfxItemSet> moAttribsCache; + + /** if we have a cached 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 std::optional<SfxItemSet> moParaAttribsCache; + + /** if we have a cached para attribute item set, this is the paragraph of it */ + mutable sal_Int32 mnParaAttribsCache; + +public: + SvxOutlinerForwarder( Outliner& rOutl, bool bOutlText ); + virtual ~SvxOutlinerForwarder() override; + + virtual sal_Int32 GetParagraphCount() const override; + virtual sal_Int32 GetTextLen( sal_Int32 nParagraph ) const override; + virtual OUString GetText( const ESelection& rSel ) const override; + virtual SfxItemSet GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs::All ) const override; + virtual SfxItemSet GetParaAttribs( sal_Int32 nPara ) const override; + virtual void SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet ) override; + virtual void RemoveAttribs( const ESelection& rSelection ) override; + virtual void GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList ) const override; + + virtual SfxItemState GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const override; + virtual SfxItemState GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const override; + + virtual void QuickInsertText( const OUString& rText, const ESelection& rSel ) override; + virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ) override; + virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ) override; + virtual void QuickInsertLineBreak( const ESelection& rSel ) override; + + virtual SfxItemPool* GetPool() const override; + + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor ) override; + virtual void FieldClicked( const SvxFieldItem& rField ) override; + + virtual bool IsValid() const override; + + virtual LanguageType GetLanguage( sal_Int32, sal_Int32 ) const override; + virtual sal_Int32 GetFieldCount( sal_Int32 nPara ) const override; + virtual EFieldInfo GetFieldInfo( sal_Int32 nPara, sal_uInt16 nField ) const override; + virtual EBulletInfo GetBulletInfo( sal_Int32 nPara ) const override; + virtual tools::Rectangle GetCharBounds( sal_Int32 nPara, sal_Int32 nIndex ) const override; + virtual tools::Rectangle GetParaBounds( sal_Int32 nPara ) const override; + virtual MapMode GetMapMode() const override; + virtual OutputDevice* GetRefDevice() const override; + virtual bool GetIndexAtPoint( const Point&, sal_Int32& nPara, sal_Int32& nIndex ) const override; + virtual bool GetWordIndices( sal_Int32 nPara, sal_Int32 nIndex, sal_Int32& nStart, sal_Int32& nEnd ) const override; + virtual bool GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, sal_Int32 nPara, sal_Int32 nIndex, bool bInCell = false ) const override; + virtual sal_Int32 GetLineCount( sal_Int32 nPara ) const override; + virtual sal_Int32 GetLineLen( sal_Int32 nPara, sal_Int32 nLine ) const override; + virtual void GetLineBoundaries( /*out*/sal_Int32& rStart, /*out*/sal_Int32& rEnd, sal_Int32 nPara, sal_Int32 nLine ) const override; + virtual sal_Int32 GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const override; + virtual bool Delete( const ESelection& ) override; + virtual bool InsertText( const OUString&, const ESelection& ) override; + virtual bool QuickFormatDoc( bool bFull = false ) override; + virtual sal_Int16 GetDepth( sal_Int32 nPara ) const override; + virtual bool SetDepth( sal_Int32 nPara, sal_Int16 nNewDepth ) override; + virtual sal_Int32 GetNumberingStartValue( sal_Int32 nPara ) override; + virtual void SetNumberingStartValue( sal_Int32 nPara, sal_Int32 nNumberingStartValue ) override; + + virtual bool IsParaIsNumberingRestart( sal_Int32 nPara ) override; + virtual void SetParaIsNumberingRestart( sal_Int32 nPara, bool bParaIsNumberingRestart ) override; + + /* this method flushes internal caches for this forwarder */ + void flushCache(); + + virtual const SfxItemSet* GetEmptyItemSetPtr() override; + + // implementation functions for XParagraphAppend and XTextPortionAppend + virtual void AppendParagraph() override; + virtual sal_Int32 AppendTextPortion( sal_Int32 nPara, const OUString &rText, const SfxItemSet &rSet ) override; + //XTextCopy + virtual void CopyText(const SvxTextForwarder& rSource) override; +}; + +#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 000000000..5a0ac105c --- /dev/null +++ b/include/editeng/unoipset.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 INCLUDED_EDITENG_UNOIPSET_HXX +#define INCLUDED_EDITENG_UNOIPSET_HXX + +#include <editeng/editengdllapi.h> +#include <svl/itemprop.hxx> +#include <vector> + +namespace com::sun::star::beans { class XPropertySetInfo; } + +class SfxItemSet; +class SvxItemPropertySetUsrAnys; + +class EDITENG_DLLPUBLIC SvxItemPropertySet +{ + SfxItemPropertyMap m_aPropertyMap; + mutable css::uno::Reference<css::beans::XPropertySetInfo> m_xInfo; + SfxItemPool& mrItemPool; + +public: + SvxItemPropertySet( const SfxItemPropertyMapEntry *pMap, SfxItemPool& rPool ); + ~SvxItemPropertySet(); + + SvxItemPropertySet& operator=( SvxItemPropertySet const & ) = delete; // MSVC2015 workaround + SvxItemPropertySet( SvxItemPropertySet const & ) = delete; // MSVC2015 workaround + + // Methods, which work directly with the ItemSet + static css::uno::Any getPropertyValue( const SfxItemPropertyMapEntry* pMap, const SfxItemSet& rSet, bool bSearchInParent, bool bDontConvertNegativeValues ); + static void setPropertyValue( const SfxItemPropertyMapEntry* pMap, const css::uno::Any& rVal, SfxItemSet& rSet, bool bDontConvertNegativeValues ); + + // Methods that use Any instead + css::uno::Any getPropertyValue( const SfxItemPropertyMapEntry* pMap, SvxItemPropertySetUsrAnys& rAnys ) const; + static void setPropertyValue( const SfxItemPropertyMapEntry* pMap, const css::uno::Any& rVal, SvxItemPropertySetUsrAnys& rAnys ); + + css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const; + const SfxItemPropertyMap& getPropertyMap() const { return m_aPropertyMap;} + const SfxItemPropertyMapEntry* getPropertyMapEntry(std::u16string_view rName) const; +}; + +struct SvxIDPropertyCombine +{ + sal_uInt16 nWID; + sal_uInt8 memberId; + css::uno::Any aAny; +}; + + +class EDITENG_DLLPUBLIC SvxItemPropertySetUsrAnys +{ + ::std::vector< SvxIDPropertyCombine > aCombineList; + +public: + SvxItemPropertySetUsrAnys(); + ~SvxItemPropertySetUsrAnys(); + bool AreThereOwnUsrAnys() const { return ! aCombineList.empty(); } + css::uno::Any* GetUsrAnyForID(SfxItemPropertyMapEntry const & entry) const; + void AddUsrAnyForID(const css::uno::Any& rAny, SfxItemPropertyMapEntry const & entry); + void ClearAllUsrAny(); +}; + +/** converts the given any with a metric to 100th/mm if needed */ +EDITENG_DLLPUBLIC void SvxUnoConvertToMM( const MapUnit eSourceMapUnit, css::uno::Any & rMetric ) noexcept; + +/** converts the given any with a metric from 100th/mm to the given metric if needed */ +EDITENG_DLLPUBLIC void SvxUnoConvertFromMM( const MapUnit eDestinationMapUnit, css::uno::Any & rMetric ) noexcept; + +#endif // INCLUDED_EDITENG_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 000000000..2aec6db1a --- /dev/null +++ b/include/editeng/unolingu.hxx @@ -0,0 +1,133 @@ +/* -*- 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_EDITENG_UNOLINGU_HXX +#define INCLUDED_EDITENG_UNOLINGU_HXX + +#include <rtl/ustring.hxx> +#include <rtl/ref.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <editeng/editengdllapi.h> + +namespace com::sun::star::linguistic2 { class XDictionary; } +namespace com::sun::star::linguistic2 { class XHyphenator; } +namespace com::sun::star::linguistic2 { class XLinguProperties; } +namespace com::sun::star::linguistic2 { class XLinguServiceManager2; } +namespace com::sun::star::linguistic2 { class XSearchableDictionaryList; } +namespace com::sun::star::linguistic2 { class XSpellChecker1; } +namespace com::sun::star::linguistic2 { class XThesaurus; } + +class LinguMgrExitLstnr; + +namespace weld { class Window; } +namespace linguistic { enum class DictionaryError; } + + +class EDITENG_DLLPUBLIC LinguMgr +{ + friend class LinguMgrExitLstnr; + + static css::uno::Reference< css::linguistic2::XLinguServiceManager2 > xLngSvcMgr; + static css::uno::Reference< css::linguistic2::XSpellChecker1 > xSpell; + static css::uno::Reference< css::linguistic2::XHyphenator > xHyph; + static css::uno::Reference< css::linguistic2::XThesaurus > xThes; + static css::uno::Reference< css::linguistic2::XSearchableDictionaryList > xDicList; + static css::uno::Reference< css::linguistic2::XLinguProperties > xProp; + + static css::uno::Reference< css::linguistic2::XDictionary > xIgnoreAll; + static css::uno::Reference< css::linguistic2::XDictionary > xChangeAll; + + static rtl::Reference<LinguMgrExitLstnr> pExitLstnr; + static bool bExiting; + + static css::uno::Reference< css::linguistic2::XSpellChecker1 > GetSpell(); + static css::uno::Reference< css::linguistic2::XHyphenator > GetHyph(); + static css::uno::Reference< css::linguistic2::XThesaurus > GetThes(); + static css::uno::Reference< css::linguistic2::XSearchableDictionaryList > GetDicList(); + static css::uno::Reference< css::linguistic2::XLinguProperties > GetProp(); + static css::uno::Reference< css::linguistic2::XDictionary > GetStandard(); + static css::uno::Reference< css::linguistic2::XDictionary > GetIgnoreAll(); + static css::uno::Reference< css::linguistic2::XDictionary > GetChangeAll(); + + LinguMgr(const LinguMgr &) = delete; + LinguMgr & operator = (const LinguMgr &) = delete; + +public: + + static css::uno::Reference< css::linguistic2::XSpellChecker1 > GetSpellChecker(); + static css::uno::Reference< css::linguistic2::XHyphenator > GetHyphenator(); + static css::uno::Reference< css::linguistic2::XThesaurus > GetThesaurus(); + static css::uno::Reference< css::linguistic2::XSearchableDictionaryList > GetDictionaryList(); + static css::uno::Reference< css::linguistic2::XLinguProperties > GetLinguPropertySet(); + + static css::uno::Reference< css::linguistic2::XLinguServiceManager2 > GetLngSvcMgr(); + + static css::uno::Reference< css::linguistic2::XDictionary > GetStandardDic(); + static css::uno::Reference< css::linguistic2::XDictionary > GetIgnoreAllList(); + static css::uno::Reference< css::linguistic2::XDictionary > GetChangeAllList(); +}; + + +namespace com::sun::star::linguistic2 { + class XHyphenatedWord; +} + + +struct SvxAlternativeSpelling +{ + OUString aReplacement; + sal_Int16 nChangedPos, + nChangedLength; + bool bIsAltSpelling; + + inline SvxAlternativeSpelling(); +}; + +inline SvxAlternativeSpelling::SvxAlternativeSpelling() : + nChangedPos(-1), nChangedLength(-1), bIsAltSpelling(false) +{ +} + + +EDITENG_DLLPUBLIC SvxAlternativeSpelling SvxGetAltSpelling( + const css::uno::Reference< css::linguistic2::XHyphenatedWord > & rHyphWord ); + + +class EDITENG_DLLPUBLIC SvxDicListChgClamp +{ +private: + css::uno::Reference< + css::linguistic2::XSearchableDictionaryList > xDicList; + + SvxDicListChgClamp(const SvxDicListChgClamp &) = delete; + SvxDicListChgClamp & operator = (const SvxDicListChgClamp &) = delete; + +public: + SvxDicListChgClamp( css::uno::Reference< + css::linguistic2::XSearchableDictionaryList > xDicList ); + ~SvxDicListChgClamp(); +}; + +EDITENG_DLLPUBLIC short SvxDicError(weld::Window *pParent, linguistic::DictionaryError 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 000000000..2e5b44e1a --- /dev/null +++ b/include/editeng/unonames.hxx @@ -0,0 +1,52 @@ +/* -*- 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 INCLUDED_EDITENG_UNONAMES_HXX +#define INCLUDED_EDITENG_UNONAMES_HXX + +#include <rtl/ustring.hxx> + +// Common across fields +inline constexpr OUStringLiteral UNO_TC_PROP_ANCHOR = u"Anchor"; +inline constexpr OUStringLiteral UNO_TC_PROP_TEXTFIELD_TYPE = u"TextFieldType"; +inline constexpr OUStringLiteral UNO_TC_PROP_IS_FIXED = u"IsFixed"; +inline constexpr OUStringLiteral UNO_TC_PROP_CURRENT_PRESENTATION = u"CurrentPresentation"; +inline constexpr OUStringLiteral UNO_TC_PROP_NAME = u"Name"; +inline constexpr OUStringLiteral UNO_TC_PROP_IS_FIXED_LANGUAGE = u"IsFixedLanguage"; +inline constexpr OUStringLiteral UNO_TC_PROP_NUMFORMAT = u"NumberFormat"; + +// Date & Time +inline constexpr OUStringLiteral UNO_TC_PROP_IS_DATE = u"IsDate"; +inline constexpr OUStringLiteral UNO_TC_PROP_DATE_TIME = u"DateTime"; + +// URL +inline constexpr OUStringLiteral UNO_TC_PROP_URL_FORMAT = u"Format"; +inline constexpr OUStringLiteral UNO_TC_PROP_URL_REPRESENTATION = u"Representation"; +inline constexpr OUStringLiteral UNO_TC_PROP_URL_TARGET = u"TargetFrame"; +inline constexpr OUStringLiteral UNO_TC_PROP_URL = u"URL"; + +// Table +inline constexpr OUStringLiteral UNO_TC_PROP_TABLE_POSITION = u"TablePosition"; + +// File +inline constexpr OUStringLiteral UNO_TC_PROP_FILE_FORMAT = u"FileFormat"; + +// Author +inline constexpr OUStringLiteral UNO_TC_PROP_AUTHOR_CONTENT = u"Content"; +inline constexpr OUStringLiteral UNO_TC_PROP_AUTHOR_FORMAT = u"AuthorFormat"; +inline constexpr OUStringLiteral UNO_TC_PROP_AUTHOR_FULLNAME = u"FullName"; + +// Measure +inline constexpr OUStringLiteral UNO_TC_PROP_MEASURE_KIND = u"Kind"; + +inline constexpr OUStringLiteral UNO_TR_PROP_SELECTION = u"Selection"; + +#endif // INCLUDED_EDITENG_UNONAMES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/unonrule.hxx b/include/editeng/unonrule.hxx new file mode 100644 index 000000000..d0e89ffdc --- /dev/null +++ b/include/editeng/unonrule.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 INCLUDED_EDITENG_UNONRULE_HXX +#define INCLUDED_EDITENG_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> + +namespace com::sun::star::beans { struct PropertyValue; } + +EDITENG_DLLPUBLIC css::uno::Reference< css::container::XIndexReplace > SvxCreateNumRule(const SvxNumRule& rRule); +css::uno::Reference< css::container::XIndexReplace > SvxCreateNumRule(); +/// @throws css::lang::IllegalArgumentException +const SvxNumRule& SvxGetNumRule( css::uno::Reference< css::container::XIndexReplace > const & xRule ); +EDITENG_DLLPUBLIC css::uno::Reference< css::ucb::XAnyCompare > SvxCreateNumRuleCompare() noexcept; + +class SvxUnoNumberingRules final : public ::cppu::WeakAggImplHelper5< css::container::XIndexReplace, css::ucb::XAnyCompare, + css::lang::XUnoTunnel, css::util::XCloneable, css::lang::XServiceInfo > +{ +private: + SvxNumRule maRule; +public: + SvxUnoNumberingRules(SvxNumRule aRule); + virtual ~SvxUnoNumberingRules() noexcept override; + + UNO3_GETIMPLEMENTATION_DECL( SvxUnoNumberingRules ) + + //XIndexReplace + virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const css::uno::Any& Element ) override; + + //XIndexAccess + virtual sal_Int32 SAL_CALL getCount() override ; + virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override; + + //XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + + // XAnyCompare + virtual sal_Int16 SAL_CALL compare( const css::uno::Any& Any1, const css::uno::Any& Any2 ) override; + + // XCloneable + virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + // internal + /// @throws css::uno::RuntimeException + css::uno::Sequence<css::beans::PropertyValue> getNumberingRuleByIndex( sal_Int32 nIndex) const; + /// @throws css::uno::RuntimeException + /// @throws css::lang::IllegalArgumentException + void setNumberingRuleByIndex(const css::uno::Sequence<css::beans::PropertyValue>& rProperties, sal_Int32 nIndex); + + static sal_Int16 Compare( const css::uno::Any& rAny1, const css::uno::Any& rAny2 ); + + const SvxNumRule& getNumRule() const { return maRule; } +}; + + +#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 000000000..8569a3370 --- /dev/null +++ b/include/editeng/unoprnms.hxx @@ -0,0 +1,361 @@ +/* -*- 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 . + */ +#pragma once + +#include <rtl/ustring.hxx> + +inline constexpr OUStringLiteral UNO_NAME_CHAR_COLOR = u"CharColor"; +inline constexpr OUStringLiteral UNO_NAME_CHAR_COLOR_THEME = u"CharColorTheme"; +inline constexpr OUStringLiteral UNO_NAME_CHAR_COLOR_TINT_OR_SHADE = u"CharColorTintOrShade"; +inline constexpr OUStringLiteral UNO_NAME_CHAR_HEIGHT = u"CharHeight"; +inline constexpr OUStringLiteral UNO_NAME_CHAR_POSTURE = u"CharPosture"; +inline constexpr OUStringLiteral UNO_NAME_CHAR_SHADOWED = u"CharShadowed"; +inline constexpr OUStringLiteral UNO_NAME_CHAR_UNDERLINE = u"CharUnderline"; +inline constexpr OUStringLiteral UNO_NAME_CHAR_WEIGHT = u"CharWeight"; + +inline constexpr OUStringLiteral UNO_NAME_FILLSTYLE = u"FillStyle"; +inline constexpr OUStringLiteral UNO_NAME_FILLCOLOR = u"FillColor"; +inline constexpr OUStringLiteral UNO_NAME_FILLCOLOR_THEME = u"FillColorTheme"; +inline constexpr OUStringLiteral UNO_NAME_FILLCOLOR_LUM_MOD = u"FillColorLumMod"; +inline constexpr OUStringLiteral UNO_NAME_FILLCOLOR_LUM_OFF = u"FillColorLumOff"; +inline constexpr OUStringLiteral UNO_NAME_FILLGRADIENT = u"FillGradient"; +inline constexpr OUStringLiteral UNO_NAME_FILLGRADIENTNAME = u"FillGradientName"; +inline constexpr OUStringLiteral UNO_NAME_FILLHATCH = u"FillHatch"; +inline constexpr OUStringLiteral UNO_NAME_FILLHATCHNAME = u"FillHatchName"; +inline constexpr OUStringLiteral UNO_NAME_FILLBITMAP = u"FillBitmap"; +inline constexpr OUStringLiteral UNO_NAME_FILLBITMAPURL = u"FillBitmapURL"; +inline constexpr OUStringLiteral UNO_NAME_FILLBITMAPNAME = u"FillBitmapName"; +inline constexpr OUStringLiteral UNO_NAME_FILLGRADIENTSTEPCOUNT = u"FillGradientStepCount"; +inline constexpr OUStringLiteral UNO_NAME_FILLBACKGROUND = u"FillBackground"; +inline constexpr OUStringLiteral UNO_NAME_FILLUSESLIDEBACKGROUND = u"FillUseSlideBackground"; +inline constexpr OUStringLiteral UNO_NAME_FILLCOLOR_2 = u"FillColor2"; + +inline constexpr OUStringLiteral UNO_NAME_EDGEKIND = u"EdgeKind"; +inline constexpr OUStringLiteral UNO_NAME_EDGELINE1DELTA = u"EdgeLine1Delta"; +inline constexpr OUStringLiteral UNO_NAME_EDGELINE2DELTA = u"EdgeLine2Delta"; +inline constexpr OUStringLiteral UNO_NAME_EDGELINE3DELTA = u"EdgeLine3Delta"; +inline constexpr OUStringLiteral UNO_NAME_EDGENODE1HORZDIST = u"EdgeNode1HorzDist"; +inline constexpr OUStringLiteral UNO_NAME_EDGENODE1VERTDIST = u"EdgeNode1VertDist"; +inline constexpr OUStringLiteral UNO_NAME_EDGENODE2HORZDIST = u"EdgeNode2HorzDist"; +inline constexpr OUStringLiteral UNO_NAME_EDGENODE2VERTDIST = u"EdgeNode2VertDist"; + +inline constexpr OUStringLiteral UNO_NAME_FILLBMP_OFFSET_X = u"FillBitmapOffsetX"; +inline constexpr OUStringLiteral UNO_NAME_FILLBMP_OFFSET_Y = u"FillBitmapOffsetY"; +inline constexpr OUStringLiteral UNO_NAME_FILLBMP_POSITION_OFFSET_X = u"FillBitmapPositionOffsetX"; +inline constexpr OUStringLiteral UNO_NAME_FILLBMP_POSITION_OFFSET_Y = u"FillBitmapPositionOffsetY"; +inline constexpr OUStringLiteral UNO_NAME_FILLBMP_RECTANGLE_POINT = u"FillBitmapRectanglePoint"; +inline constexpr OUStringLiteral UNO_NAME_FILLBMP_TILE = u"FillBitmapTile"; +inline constexpr OUStringLiteral UNO_NAME_FILLBMP_STRETCH = u"FillBitmapStretch"; +inline constexpr OUStringLiteral UNO_NAME_FILLBMP_LOGICAL_SIZE = u"FillBitmapLogicalSize"; +inline constexpr OUStringLiteral UNO_NAME_FILLBMP_SIZE_X = u"FillBitmapSizeX"; +inline constexpr OUStringLiteral UNO_NAME_FILLBMP_SIZE_Y = u"FillBitmapSizeY"; +inline constexpr OUStringLiteral UNO_NAME_FILL_TRANSPARENCE = u"FillTransparence"; +inline constexpr OUStringLiteral UNO_NAME_FILLTRANSPARENCEGRADIENT = u"FillTransparenceGradient"; +inline constexpr OUStringLiteral UNO_NAME_FILLTRANSPARENCEGRADIENTNAME = u"FillTransparenceGradientName"; +inline constexpr OUStringLiteral UNO_NAME_FILLBMP_MODE = u"FillBitmapMode"; + + +inline constexpr OUStringLiteral UNO_NAME_LINESTYLE = u"LineStyle"; +inline constexpr OUStringLiteral UNO_NAME_LINEDASH = u"LineDash"; +inline constexpr OUStringLiteral UNO_NAME_LINEWIDTH = u"LineWidth"; +inline constexpr OUStringLiteral UNO_NAME_LINECOLOR = u"LineColor"; +inline constexpr OUStringLiteral UNO_NAME_LINEJOINT = u"LineJoint"; +inline constexpr OUStringLiteral UNO_NAME_LINESTART = u"LineStart"; +inline constexpr OUStringLiteral UNO_NAME_LINEEND = u"LineEnd"; +inline constexpr OUStringLiteral UNO_NAME_LINESTARTWIDTH = u"LineStartWidth"; +inline constexpr OUStringLiteral UNO_NAME_LINEENDWIDTH = u"LineEndWidth"; +inline constexpr OUStringLiteral UNO_NAME_LINESTARTCENTER = u"LineStartCenter"; +inline constexpr OUStringLiteral UNO_NAME_LINEENDCENTER = u"LineEndCenter"; +inline constexpr OUStringLiteral UNO_NAME_LINETRANSPARENCE = u"LineTransparence"; +inline constexpr OUStringLiteral UNO_NAME_LINECAP = u"LineCap"; + +inline constexpr OUStringLiteral UNO_NAME_SHADOW = u"Shadow"; +inline constexpr OUStringLiteral UNO_NAME_SHADOWCOLOR = u"ShadowColor"; +inline constexpr OUStringLiteral UNO_NAME_SHADOWXDIST = u"ShadowXDistance"; +inline constexpr OUStringLiteral UNO_NAME_SHADOWYDIST = u"ShadowYDistance"; +inline constexpr OUStringLiteral UNO_NAME_SHADOWSIZEX = u"ShadowSizeX"; +inline constexpr OUStringLiteral UNO_NAME_SHADOWSIZEY = u"ShadowSizeY"; +inline constexpr OUStringLiteral UNO_NAME_SHADOWTRANSPARENCE = u"ShadowTransparence"; +inline constexpr OUStringLiteral UNO_NAME_SHADOWBLUR = u"ShadowBlur"; + +inline constexpr OUStringLiteral UNO_NAME_EDGERADIUS = u"CornerRadius"; + +inline constexpr OUStringLiteral UNO_NAME_TEXT_MINFRAMEHEIGHT = u"TextMinimumFrameHeight"; +inline constexpr OUStringLiteral UNO_NAME_TEXT_AUTOGROWHEIGHT = u"TextAutoGrowHeight"; +inline constexpr OUStringLiteral UNO_NAME_TEXT_FITTOSIZE = u"TextFitToSize"; +inline constexpr OUStringLiteral UNO_NAME_TEXT_LEFTDIST = u"TextLeftDistance"; +inline constexpr OUStringLiteral UNO_NAME_TEXT_RIGHTDIST = u"TextRightDistance"; +inline constexpr OUStringLiteral UNO_NAME_TEXT_UPPERDIST = u"TextUpperDistance"; +inline constexpr OUStringLiteral UNO_NAME_TEXT_LOWERDIST = u"TextLowerDistance"; +inline constexpr OUStringLiteral UNO_NAME_TEXT_VERTADJUST = u"TextVerticalAdjust"; +inline constexpr OUStringLiteral UNO_NAME_TEXT_MAXFRAMEHEIGHT = u"TextMaximumFrameHeight"; +inline constexpr OUStringLiteral UNO_NAME_TEXT_MINFRAMEWIDTH = u"TextMinimumFrameWidth"; +inline constexpr OUStringLiteral UNO_NAME_TEXT_MAXFRAMEWIDTH = u"TextMaximumFrameWidth"; +inline constexpr OUStringLiteral UNO_NAME_TEXT_AUTOGROWWIDTH = u"TextAutoGrowWidth"; +inline constexpr OUStringLiteral UNO_NAME_TEXT_HORZADJUST = u"TextHorizontalAdjust"; +inline constexpr OUStringLiteral UNO_NAME_TEXT_ANIKIND = u"TextAnimationKind"; +inline constexpr OUStringLiteral UNO_NAME_TEXT_ANIDIRECTION = u"TextAnimationDirection"; +inline constexpr OUStringLiteral UNO_NAME_TEXT_ANISTARTINSIDE = u"TextAnimationStartInside"; +inline constexpr OUStringLiteral UNO_NAME_TEXT_ANISTOPINSIDE = u"TextAnimationStopInside"; +inline constexpr OUStringLiteral UNO_NAME_TEXT_ANICOUNT = u"TextAnimationCount"; +inline constexpr OUStringLiteral UNO_NAME_TEXT_ANIDELAY = u"TextAnimationDelay"; +inline constexpr OUStringLiteral UNO_NAME_TEXT_ANIAMOUNT = u"TextAnimationAmount"; +inline constexpr OUStringLiteral UNO_NAME_TEXT_CONTOURFRAME = u"TextContourFrame"; +inline constexpr OUStringLiteral UNO_NAME_TEXT_WRITINGMODE = u"TextWritingMode"; +inline constexpr OUStringLiteral UNO_NAME_TEXT_FONTINDEPENDENTLINESPACING = u"FontIndependentLineSpacing"; +inline constexpr OUStringLiteral UNO_NAME_TEXT_WORDWRAP = u"TextWordWrap"; +inline constexpr OUStringLiteral UNO_NAME_TEXT_CHAINNEXTNAME = u"TextChainNextName"; + +inline constexpr OUStringLiteral UNO_NAME_MEASUREKIND = u"MeasureKind"; +inline constexpr OUStringLiteral UNO_NAME_MEASURETEXTHPOS = u"MeasureTextHorizontalPosition"; +inline constexpr OUStringLiteral UNO_NAME_MEASURETEXTVPOS = u"MeasureTextVerticalPosition"; +inline constexpr OUStringLiteral UNO_NAME_MEASURELINEDIST = u"MeasureLineDistance"; +inline constexpr OUStringLiteral UNO_NAME_MEASUREHELPLINEOVERHANG = u"MeasureHelpLineOverhang"; +inline constexpr OUStringLiteral UNO_NAME_MEASUREHELPLINEDIST = u"MeasureHelpLineDistance"; +inline constexpr OUStringLiteral UNO_NAME_MEASUREHELPLINE1LEN = u"MeasureHelpLine1Length"; +inline constexpr OUStringLiteral UNO_NAME_MEASUREHELPLINE2LEN = u"MeasureHelpLine2Length"; +inline constexpr OUStringLiteral UNO_NAME_MEASUREBELOWREFEDGE = u"MeasureBelowReferenceEdge"; +inline constexpr OUStringLiteral UNO_NAME_MEASURETEXTROTA90 = u"MeasureTextRotate90"; +inline constexpr OUStringLiteral UNO_NAME_MEASURETEXTUPSIDEDOWN = u"MeasureTextUpsideDown"; +inline constexpr OUStringLiteral UNO_NAME_MEASUREOVERHANG = u"MeasureOverhang"; +inline constexpr OUStringLiteral UNO_NAME_MEASUREUNIT = u"MeasureUnit"; +inline constexpr OUStringLiteral UNO_NAME_MEASURESHOWUNIT = u"MeasureShowUnit"; +inline constexpr OUStringLiteral UNO_NAME_MEASUREFORMATSTRING = u"MeasureFormatString"; +inline constexpr OUStringLiteral UNO_NAME_MEASURETEXTAUTOANGLE = u"MeasureTextAutoAngle"; +inline constexpr OUStringLiteral UNO_NAME_MEASURETEXTAUTOANGLEVIEW = u"MeasureTextAutoAngleView"; +inline constexpr OUStringLiteral UNO_NAME_MEASURETEXTISFIXEDANGLE = u"MeasureTextIsFixedAngle"; +inline constexpr OUStringLiteral UNO_NAME_MEASURETEXTFIXEDANGLE = u"MeasureTextFixedAngle"; + +inline constexpr OUStringLiteral UNO_NAME_CIRCKIND = u"CircleKind"; +inline constexpr OUStringLiteral UNO_NAME_CIRCSTARTANGLE = u"CircleStartAngle"; +inline constexpr OUStringLiteral UNO_NAME_CIRCENDANGLE = u"CircleEndAngle"; + +inline constexpr OUStringLiteral UNO_NAME_POLYGONKIND = u"PolygonKind"; +inline constexpr OUStringLiteral UNO_NAME_POLYPOLYGON = u"PolyPolygon"; +inline constexpr OUStringLiteral UNO_NAME_POLYPOLYGONBEZIER = u"PolyPolygonBezier"; +inline constexpr OUStringLiteral UNO_NAME_POLYGON = u"Polygon"; + +inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_INTEROPGRABBAG = u"InteropGrabBag"; +inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_ZORDER = u"ZOrder"; +inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_MOVEPROTECT = u"MoveProtect"; +inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_SIZEPROTECT = u"SizeProtect"; +inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_PRINTABLE = u"Printable"; +inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_LAYERID = u"LayerID"; +inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_LAYERNAME = u"LayerName"; +inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_NAME = u"Name"; +inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_ROTATEANGLE = u"RotateAngle"; +inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_SHEARANGLE = u"ShearAngle"; +inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_FRAMERECT = u"FrameRect"; +inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_BOUNDRECT = u"BoundRect"; + +// #i68101# +inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_TITLE = u"Title"; +inline constexpr OUStringLiteral UNO_NAME_MISC_OBJ_DESCRIPTION = u"Description"; + +inline constexpr OUStringLiteral UNO_NAME_HYPERLINK = u"Hyperlink"; + +inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_FILLBITMAP = u"GraphicObjectFillBitmap"; +inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_REPLACEMENT_GRAPHIC = u"ReplacementGraphic"; +inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_GRAFSTREAMURL = u"GraphicStreamURL"; +#define UNO_NAME_GRAPHOBJ_URLPKGPREFIX "vnd.sun.star.Package:" +inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_GRAPHIC = u"Graphic"; +inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_GRAPHIC_URL = u"GraphicURL"; +inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_IS_SIGNATURELINE = u"IsSignatureLine"; +inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_SIGNATURELINE_ID = u"SignatureLineId"; +inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_SIGNATURELINE_SUGGESTED_SIGNER_NAME = u"SignatureLineSuggestedSignerName"; +inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_SIGNATURELINE_SUGGESTED_SIGNER_TITLE = u"SignatureLineSuggestedSignerTitle"; +inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_SIGNATURELINE_SUGGESTED_SIGNER_EMAIL = u"SignatureLineSuggestedSignerEmail"; +inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_SIGNATURELINE_SIGNING_INSTRUCTIONS = u"SignatureLineSigningInstructions"; +inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_SIGNATURELINE_SHOW_SIGN_DATE = u"SignatureLineShowSignDate"; +inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_SIGNATURELINE_CAN_ADD_COMMENT = u"SignatureLineCanAddComment"; +inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_SIGNATURELINE_UNSIGNED_IMAGE = u"SignatureLineUnsignedImage"; +inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_SIGNATURELINE_IS_SIGNED = u"SignatureLineIsSigned"; +inline constexpr OUStringLiteral UNO_NAME_GRAPHOBJ_QRCODE = u"BarCodeProperties"; + +inline constexpr OUStringLiteral UNO_NAME_OLE2_METAFILE = u"MetaFile"; +inline constexpr OUStringLiteral UNO_NAME_OLE2_PERSISTNAME = u"PersistName"; + +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_PERSPECTIVE = u"D3DScenePerspective"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_DISTANCE = u"D3DSceneDistance"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_FOCAL_LENGTH = u"D3DSceneFocalLength"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_TWO_SIDED_LIGHTING = u"D3DSceneTwoSidedLighting"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTCOLOR_1 = u"D3DSceneLightColor1"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTCOLOR_2 = u"D3DSceneLightColor2"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTCOLOR_3 = u"D3DSceneLightColor3"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTCOLOR_4 = u"D3DSceneLightColor4"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTCOLOR_5 = u"D3DSceneLightColor5"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTCOLOR_6 = u"D3DSceneLightColor6"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTCOLOR_7 = u"D3DSceneLightColor7"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTCOLOR_8 = u"D3DSceneLightColor8"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTON_1 = u"D3DSceneLightOn1"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTON_2 = u"D3DSceneLightOn2"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTON_3 = u"D3DSceneLightOn3"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTON_4 = u"D3DSceneLightOn4"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTON_5 = u"D3DSceneLightOn5"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTON_6 = u"D3DSceneLightOn6"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTON_7 = u"D3DSceneLightOn7"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTON_8 = u"D3DSceneLightOn8"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTDIRECTION_1 = u"D3DSceneLightDirection1"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTDIRECTION_2 = u"D3DSceneLightDirection2"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTDIRECTION_3 = u"D3DSceneLightDirection3"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTDIRECTION_4 = u"D3DSceneLightDirection4"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTDIRECTION_5 = u"D3DSceneLightDirection5"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTDIRECTION_6 = u"D3DSceneLightDirection6"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTDIRECTION_7 = u"D3DSceneLightDirection7"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_LIGHTDIRECTION_8 = u"D3DSceneLightDirection8"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_AMBIENTCOLOR = u"D3DSceneAmbientColor"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_SHADOW_SLANT = u"D3DSceneShadowSlant"; +inline constexpr OUStringLiteral UNO_NAME_3D_SCENE_SHADE_MODE = u"D3DSceneShadeMode"; + +inline constexpr OUStringLiteral UNO_NAME_3D_DOUBLE_SIDED = u"D3DDoubleSided"; +inline constexpr OUStringLiteral UNO_NAME_3D_NORMALS_KIND = u"D3DNormalsKind"; +inline constexpr OUStringLiteral UNO_NAME_3D_NORMALS_INVERT = u"D3DNormalsInvert"; +inline constexpr OUStringLiteral UNO_NAME_3D_TEXTURE_PROJ_X = u"D3DTextureProjectionX"; +inline constexpr OUStringLiteral UNO_NAME_3D_TEXTURE_PROJ_Y = u"D3DTextureProjectionY"; +inline constexpr OUStringLiteral UNO_NAME_3D_SHADOW_3D = u"D3DShadow3D"; +inline constexpr OUStringLiteral UNO_NAME_3D_MAT_COLOR = u"D3DMaterialColor"; +inline constexpr OUStringLiteral UNO_NAME_3D_MAT_EMISSION = u"D3DMaterialEmission"; +inline constexpr OUStringLiteral UNO_NAME_3D_MAT_SPECULAR = u"D3DMaterialSpecular"; +inline constexpr OUStringLiteral UNO_NAME_3D_MAT_SPECULAR_INTENSITY = u"D3DMaterialSpecularIntensity"; +inline constexpr OUStringLiteral UNO_NAME_3D_TEXTURE_KIND = u"D3DTextureKind"; +inline constexpr OUStringLiteral UNO_NAME_3D_TEXTURE_MODE = u"D3DTextureMode"; +inline constexpr OUStringLiteral UNO_NAME_3D_TEXTURE_FILTER = u"D3DTextureFilter"; + +// #i28528# +// Added extra Item (Bool) for chart2 to be able to show reduced line geometry +inline constexpr OUStringLiteral UNO_NAME_3D_REDUCED_LINE_GEOMETRY = u"D3DReducedLineGeometry"; + +inline constexpr OUStringLiteral UNO_NAME_3D_HORZ_SEGS = u"D3DHorizontalSegments"; +inline constexpr OUStringLiteral UNO_NAME_3D_VERT_SEGS = u"D3DVerticalSegments"; + +inline constexpr OUStringLiteral UNO_NAME_3D_PERCENT_DIAGONAL = u"D3DPercentDiagonal"; +inline constexpr OUStringLiteral UNO_NAME_3D_BACKSCALE = u"D3DBackscale"; +inline constexpr OUStringLiteral UNO_NAME_3D_LATHE_END_ANGLE = u"D3DEndAngle"; + +inline constexpr OUStringLiteral UNO_NAME_3D_EXTRUDE_DEPTH = u"D3DDepth"; + +inline constexpr OUStringLiteral UNO_NAME_3D_TRANSFORM_MATRIX = u"D3DTransformMatrix"; +inline constexpr OUStringLiteral UNO_NAME_3D_CAMERA_GEOMETRY = u"D3DCameraGeometry"; +inline constexpr OUStringLiteral UNO_NAME_3D_POS = u"D3DPosition"; +inline constexpr OUStringLiteral UNO_NAME_3D_SIZE = u"D3DSize"; +inline constexpr OUStringLiteral UNO_NAME_3D_POS_IS_CENTER = u"D3DPositionIsCenter"; +inline constexpr OUStringLiteral UNO_NAME_3D_POLYPOLYGON3D = u"D3DPolyPolygon3D"; +inline constexpr OUStringLiteral UNO_NAME_3D_NORMALSPOLYGON3D = u"D3DNormalsPolygon3D"; +inline constexpr OUStringLiteral UNO_NAME_3D_TEXTUREPOLYGON3D = u"D3DTexturePolygon3D"; +inline constexpr OUStringLiteral UNO_NAME_3D_LINEONLY = u"D3DLineOnly"; + +// New 3D properties which are possible for lathe and extrude 3d objects +inline constexpr OUStringLiteral UNO_NAME_3D_SMOOTH_NORMALS = u"D3DSmoothNormals"; +inline constexpr OUStringLiteral UNO_NAME_3D_SMOOTH_LIDS = u"D3DSmoothLids"; +inline constexpr OUStringLiteral UNO_NAME_3D_CHARACTER_MODE = u"D3DCharacterMode"; +inline constexpr OUStringLiteral UNO_NAME_3D_CLOSE_FRONT = u"D3DCloseFront"; +inline constexpr OUStringLiteral UNO_NAME_3D_CLOSE_BACK = u"D3DCloseBack"; + +inline constexpr OUStringLiteral UNO_NAME_NUMBERING = u"NumberingIsNumber"; +inline constexpr OUStringLiteral UNO_NAME_NUMBERING_RULES = u"NumberingRules"; +inline constexpr OUStringLiteral UNO_NAME_NUMBERING_LEVEL = u"NumberingLevel"; + +inline constexpr OUStringLiteral UNO_NAME_NRULE_NUMBERINGTYPE = u"NumberingType"; +inline constexpr OUStringLiteral UNO_NAME_NRULE_PREFIX = u"Prefix"; +inline constexpr OUStringLiteral UNO_NAME_NRULE_SUFFIX = u"Suffix"; +#define UNO_NAME_NRULE_BULLETID "BulletId" +inline constexpr OUStringLiteral UNO_NAME_NRULE_BULLET_COLOR = u"BulletColor"; +inline constexpr OUStringLiteral UNO_NAME_NRULE_BULLET_RELSIZE = u"BulletRelSize"; +inline constexpr OUStringLiteral UNO_NAME_NRULE_BULLET_FONT = u"BulletFont"; +inline constexpr OUStringLiteral UNO_NAME_NRULE_START_WITH = u"StartWith"; +inline constexpr OUStringLiteral UNO_NAME_NRULE_LEFT_MARGIN = u"LeftMargin"; +inline constexpr OUStringLiteral UNO_NAME_NRULE_FIRST_LINE_OFFSET = u"FirstLineOffset"; +inline constexpr OUStringLiteral UNO_NAME_NRULE_ADJUST = u"Adjust"; + +inline constexpr OUStringLiteral UNO_NAME_EDIT_FONT_DESCRIPTOR = u"FontDescriptor"; + +inline constexpr OUStringLiteral UNO_NAME_EDIT_PARA_ADJUST = u"ParaAdjust"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_PARA_BMARGIN = u"ParaBottomMargin"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_PARA_LASTLINEADJ = u"ParaLastLineAdjust"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_PARA_LMARGIN = u"ParaLeftMargin"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_PARA_LINESPACING = u"ParaLineSpacing"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_PARA_RMARGIN = u"ParaRightMargin"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_PARA_TAPSTOPS = u"ParaTabStops"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_PARA_TMARGIN = u"ParaTopMargin"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_PARA_IS_HYPHEN = u"ParaIsHyphenation"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_PARA_IS_HANGING_PUNCTUATION = u"ParaIsHangingPunctuation"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_PARA_IS_CHARACTER_DISTANCE = u"ParaIsCharacterDistance"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_PARA_IS_FORBIDDEN_RULES = u"ParaIsForbiddenRules"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_PARA_FIRST_LINE_INDENT = u"ParaFirstLineIndent"; + +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_HEIGHT = u"CharHeight"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTNAME = u"CharFontName"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTSTYLENAME = u"CharFontStyleName"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTFAMILY = u"CharFontFamily"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTCHARSET = u"CharFontCharSet"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTPITCH = u"CharFontPitch"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_POSTURE = u"CharPosture"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_WEIGHT = u"CharWeight"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_LOCALE = u"CharLocale"; + +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_HEIGHT_ASIAN = u"CharHeightAsian"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTNAME_ASIAN = u"CharFontNameAsian"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTSTYLENAME_ASIAN = u"CharFontStyleNameAsian"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTFAMILY_ASIAN = u"CharFontFamilyAsian"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTCHARSET_ASIAN = u"CharFontCharSetAsian"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTPITCH_ASIAN = u"CharFontPitchAsian"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_POSTURE_ASIAN = u"CharPostureAsian"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_WEIGHT_ASIAN = u"CharWeightAsian"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_LOCALE_ASIAN = u"CharLocaleAsian"; + +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_HEIGHT_COMPLEX = u"CharHeightComplex"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTNAME_COMPLEX = u"CharFontNameComplex"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTSTYLENAME_COMPLEX = u"CharFontStyleNameComplex"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTFAMILY_COMPLEX = u"CharFontFamilyComplex"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTCHARSET_COMPLEX = u"CharFontCharSetComplex"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_FONTPITCH_COMPLEX = u"CharFontPitchComplex"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_POSTURE_COMPLEX = u"CharPostureComplex"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_WEIGHT_COMPLEX = u"CharWeightComplex"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_LOCALE_COMPLEX = u"CharLocaleComplex"; + +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_COLOR = u"CharColor"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_COLOR_THEME = u"CharColorTheme"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_COLOR_TINT_OR_SHADE = u"CharColorTintOrShade"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_COLOR_LUM_MOD = u"CharColorLumMod"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_COLOR_LUM_OFF = u"CharColorLumOff"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_TRANSPARENCE = u"CharTransparence"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_CROSSEDOUT = u"CharCrossedOut"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_STRIKEOUT = u"CharStrikeout"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_CASEMAP = u"CharCaseMap"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_ESCAPEMENT = u"CharEscapement"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_SHADOWED = u"CharShadowed"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_UNDERLINE = u"CharUnderline"; +inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_OVERLINE = u"CharOverline"; + +inline constexpr OUStringLiteral UNO_NAME_BITMAP = u"Bitmap"; + +inline constexpr OUStringLiteral UNO_NAME_LINKDISPLAYNAME = u"LinkDisplayName"; +inline constexpr OUStringLiteral UNO_NAME_LINKDISPLAYBITMAP = u"LinkDisplayBitmap"; + +inline constexpr OUStringLiteral UNO_NAME_GRAPHIC_LUMINANCE = u"AdjustLuminance"; +inline constexpr OUStringLiteral UNO_NAME_GRAPHIC_CONTRAST = u"AdjustContrast"; +inline constexpr OUStringLiteral UNO_NAME_GRAPHIC_RED = u"AdjustRed"; +inline constexpr OUStringLiteral UNO_NAME_GRAPHIC_GREEN = u"AdjustGreen"; +inline constexpr OUStringLiteral UNO_NAME_GRAPHIC_BLUE = u"AdjustBlue"; +inline constexpr OUStringLiteral UNO_NAME_GRAPHIC_GAMMA = u"Gamma"; +inline constexpr OUStringLiteral UNO_NAME_GRAPHIC_TRANSPARENCY = u"Transparency"; +inline constexpr OUStringLiteral UNO_NAME_GRAPHIC_COLOR_MODE = u"GraphicColorMode"; +inline constexpr OUStringLiteral UNO_NAME_GRAPHIC_GRAPHICCROP = u"GraphicCrop"; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx new file mode 100644 index 000000000..3c8f95368 --- /dev/null +++ b/include/editeng/unotext.hxx @@ -0,0 +1,677 @@ +/* -*- 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_EDITENG_UNOTEXT_HXX +#define INCLUDED_EDITENG_UNOTEXT_HXX + +#include <memory> +#include <com/sun/star/text/XTextRange.hpp> +#include <com/sun/star/text/XTextContent.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/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/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 <comphelper/interfacecontainer4.hxx> +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/weakagg.hxx> +#include <osl/diagnose.hxx> +#include <mutex> +#include <comphelper/servicehelper.hxx> +#include <svl/itemset.hxx> +#include <svl/solar.hrc> +#include <editeng/editdata.hxx> +#include <editeng/unoedsrc.hxx> +#include <editeng/eeitem.hxx> +#include <editeng/editengdllapi.h> +#include <editeng/memberids.h> + +class SvxItemPropertySet; +struct SfxItemPropertyMapEntry; + +#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_PROPERTY \ + { UNO_NAME_NUMBERING_RULES, EE_PARA_NUMBULLET, cppu::UnoType<css::container::XIndexReplace>::get(), 0, 0 }, \ + { UNO_NAME_NUMBERING, EE_PARA_BULLETSTATE,cppu::UnoType<bool>::get(), 0, 0 } + +#define SVX_UNOEDIT_OUTLINER_PROPERTIES \ + SVX_UNOEDIT_NUMBERING_PROPERTY, \ + { UNO_NAME_NUMBERING_LEVEL, WID_NUMLEVEL, ::cppu::UnoType<sal_Int16>::get(), 0, 0 }, \ + {u"NumberingStartValue", WID_NUMBERINGSTARTVALUE, ::cppu::UnoType<sal_Int16>::get(), 0, 0 }, \ + {u"ParaIsNumberingRestart", WID_PARAISNUMBERINGRESTART, cppu::UnoType<bool>::get(), 0, 0 } + +#define SVX_UNOEDIT_CHAR_PROPERTIES \ + { UNO_NAME_EDIT_CHAR_HEIGHT, EE_CHAR_FONTHEIGHT, cppu::UnoType<float>::get(), 0, MID_FONTHEIGHT|CONVERT_TWIPS }, \ + { u"CharScaleWidth", EE_CHAR_FONTWIDTH, ::cppu::UnoType<sal_Int16>::get(), 0, 0 }, \ + { UNO_NAME_EDIT_CHAR_FONTNAME, EE_CHAR_FONTINFO, ::cppu::UnoType<OUString>::get(), 0, MID_FONT_FAMILY_NAME },\ + { UNO_NAME_EDIT_CHAR_FONTSTYLENAME,EE_CHAR_FONTINFO, ::cppu::UnoType<OUString>::get(), 0, MID_FONT_STYLE_NAME }, \ + { UNO_NAME_EDIT_CHAR_FONTFAMILY, EE_CHAR_FONTINFO, ::cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_FAMILY }, \ + { UNO_NAME_EDIT_CHAR_FONTCHARSET, EE_CHAR_FONTINFO, ::cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_CHAR_SET }, \ + { UNO_NAME_EDIT_CHAR_FONTPITCH, EE_CHAR_FONTINFO, ::cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_PITCH }, \ + { UNO_NAME_EDIT_CHAR_POSTURE, EE_CHAR_ITALIC, ::cppu::UnoType<css::awt::FontSlant>::get(),0, MID_POSTURE }, \ + { UNO_NAME_EDIT_CHAR_WEIGHT, EE_CHAR_WEIGHT, cppu::UnoType<float>::get(), 0, MID_WEIGHT }, \ + { UNO_NAME_EDIT_CHAR_LOCALE, EE_CHAR_LANGUAGE, ::cppu::UnoType<css::lang::Locale>::get(),0, MID_LANG_LOCALE }, \ + { UNO_NAME_EDIT_CHAR_COLOR, EE_CHAR_COLOR, ::cppu::UnoType<sal_Int32>::get(), 0, MID_COLOR_RGB }, \ + { UNO_NAME_EDIT_CHAR_TRANSPARENCE,EE_CHAR_COLOR, ::cppu::UnoType<sal_Int16>::get(), 0, MID_COLOR_ALPHA }, \ + { UNO_NAME_EDIT_CHAR_COLOR_THEME, EE_CHAR_COLOR, ::cppu::UnoType<sal_Int16>::get(), 0, MID_COLOR_THEME_INDEX }, \ + { UNO_NAME_EDIT_CHAR_COLOR_TINT_OR_SHADE, EE_CHAR_COLOR, ::cppu::UnoType<sal_Int16>::get(), 0, MID_COLOR_TINT_OR_SHADE }, \ + { UNO_NAME_EDIT_CHAR_COLOR_LUM_MOD, EE_CHAR_COLOR, ::cppu::UnoType<sal_Int16>::get(), 0, MID_COLOR_LUM_MOD }, \ + { UNO_NAME_EDIT_CHAR_COLOR_LUM_OFF, EE_CHAR_COLOR, ::cppu::UnoType<sal_Int16>::get(), 0, MID_COLOR_LUM_OFF }, \ + { u"CharBackColor", EE_CHAR_BKGCOLOR, ::cppu::UnoType<sal_Int32>::get(), 0, 0 }, \ + { u"CharBackTransparent", EE_CHAR_BKGCOLOR, ::cppu::UnoType<bool>::get(), 0, MID_GRAPHIC_TRANSPARENT }, \ + { UNO_NAME_EDIT_CHAR_ESCAPEMENT, EE_CHAR_ESCAPEMENT, ::cppu::UnoType<sal_Int16>::get(), 0, MID_ESC }, \ + { UNO_NAME_EDIT_CHAR_UNDERLINE, EE_CHAR_UNDERLINE, ::cppu::UnoType<sal_Int16>::get(), 0, MID_TL_STYLE }, \ + { u"CharUnderlineColor", EE_CHAR_UNDERLINE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_TL_COLOR }, \ + { u"CharUnderlineHasColor", EE_CHAR_UNDERLINE, cppu::UnoType<bool>::get(), 0, MID_TL_HASCOLOR } , \ + { UNO_NAME_EDIT_CHAR_OVERLINE, EE_CHAR_OVERLINE, ::cppu::UnoType<sal_Int16>::get(), 0, MID_TL_STYLE }, \ + { u"CharOverlineColor", EE_CHAR_OVERLINE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_TL_COLOR }, \ + { u"CharOverlineHasColor", EE_CHAR_OVERLINE, cppu::UnoType<bool>::get(), 0, MID_TL_HASCOLOR } , \ + { UNO_NAME_EDIT_CHAR_CROSSEDOUT, EE_CHAR_STRIKEOUT, cppu::UnoType<bool>::get(), 0, MID_CROSSED_OUT }, \ + { UNO_NAME_EDIT_CHAR_STRIKEOUT, EE_CHAR_STRIKEOUT, ::cppu::UnoType<sal_Int16>::get(), 0, MID_CROSS_OUT}, \ + { UNO_NAME_EDIT_CHAR_CASEMAP, EE_CHAR_CASEMAP, ::cppu::UnoType<sal_Int16>::get(), 0, 0 }, \ + { UNO_NAME_EDIT_CHAR_SHADOWED, EE_CHAR_SHADOW, cppu::UnoType<bool>::get(), 0, 0 }, \ + { u"CharContoured", EE_CHAR_OUTLINE, cppu::UnoType<bool>::get(), 0, 0 }, \ + { u"CharEscapementHeight", EE_CHAR_ESCAPEMENT, cppu::UnoType<sal_Int8>::get(), 0, MID_ESC_HEIGHT },\ + { u"CharAutoKerning", EE_CHAR_PAIRKERNING,cppu::UnoType<bool>::get(), 0, 0 } , \ + { u"CharKerning", EE_CHAR_KERNING, ::cppu::UnoType<sal_Int16>::get() , 0, 0 }, \ + { u"CharWordMode", EE_CHAR_WLM, cppu::UnoType<bool>::get(), 0, 0 }, \ + { u"CharEmphasis", EE_CHAR_EMPHASISMARK, ::cppu::UnoType<sal_Int16>::get(), 0, MID_EMPHASIS},\ + { UNO_NAME_EDIT_CHAR_HEIGHT_ASIAN, EE_CHAR_FONTHEIGHT_CJK, cppu::UnoType<float>::get(), 0, MID_FONTHEIGHT|CONVERT_TWIPS }, \ + { UNO_NAME_EDIT_CHAR_FONTNAME_ASIAN, EE_CHAR_FONTINFO_CJK, ::cppu::UnoType<OUString>::get(), 0, MID_FONT_FAMILY_NAME },\ + { UNO_NAME_EDIT_CHAR_FONTSTYLENAME_ASIAN, EE_CHAR_FONTINFO_CJK, ::cppu::UnoType<OUString>::get(), 0, MID_FONT_STYLE_NAME }, \ + { UNO_NAME_EDIT_CHAR_FONTFAMILY_ASIAN, EE_CHAR_FONTINFO_CJK, ::cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_FAMILY }, \ + { UNO_NAME_EDIT_CHAR_FONTCHARSET_ASIAN, EE_CHAR_FONTINFO_CJK, ::cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_CHAR_SET }, \ + { UNO_NAME_EDIT_CHAR_FONTPITCH_ASIAN, EE_CHAR_FONTINFO_CJK, ::cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_PITCH }, \ + { UNO_NAME_EDIT_CHAR_POSTURE_ASIAN, EE_CHAR_ITALIC_CJK, ::cppu::UnoType<css::awt::FontSlant>::get(),0, MID_POSTURE }, \ + { UNO_NAME_EDIT_CHAR_WEIGHT_ASIAN, EE_CHAR_WEIGHT_CJK, cppu::UnoType<float>::get(), 0, MID_WEIGHT }, \ + { UNO_NAME_EDIT_CHAR_LOCALE_ASIAN, EE_CHAR_LANGUAGE_CJK, ::cppu::UnoType<css::lang::Locale>::get(),0, MID_LANG_LOCALE }, \ + { UNO_NAME_EDIT_CHAR_HEIGHT_COMPLEX, EE_CHAR_FONTHEIGHT_CTL, cppu::UnoType<float>::get(), 0, MID_FONTHEIGHT|CONVERT_TWIPS }, \ + { UNO_NAME_EDIT_CHAR_FONTNAME_COMPLEX, EE_CHAR_FONTINFO_CTL, ::cppu::UnoType<OUString>::get(), 0, MID_FONT_FAMILY_NAME },\ + { UNO_NAME_EDIT_CHAR_FONTSTYLENAME_COMPLEX,EE_CHAR_FONTINFO_CTL, ::cppu::UnoType<OUString>::get(), 0, MID_FONT_STYLE_NAME }, \ + { UNO_NAME_EDIT_CHAR_FONTFAMILY_COMPLEX, EE_CHAR_FONTINFO_CTL, ::cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_FAMILY }, \ + { UNO_NAME_EDIT_CHAR_FONTCHARSET_COMPLEX, EE_CHAR_FONTINFO_CTL, ::cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_CHAR_SET }, \ + { UNO_NAME_EDIT_CHAR_FONTPITCH_COMPLEX, EE_CHAR_FONTINFO_CTL, ::cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_PITCH }, \ + { UNO_NAME_EDIT_CHAR_POSTURE_COMPLEX, EE_CHAR_ITALIC_CTL, ::cppu::UnoType<css::awt::FontSlant>::get(),0, MID_POSTURE }, \ + { UNO_NAME_EDIT_CHAR_WEIGHT_COMPLEX, EE_CHAR_WEIGHT_CTL, cppu::UnoType<float>::get(), 0, MID_WEIGHT }, \ + { UNO_NAME_EDIT_CHAR_LOCALE_COMPLEX, EE_CHAR_LANGUAGE_CTL, ::cppu::UnoType<css::lang::Locale>::get(),0, MID_LANG_LOCALE }, \ + { u"CharRelief", EE_CHAR_RELIEF, ::cppu::UnoType<sal_Int16>::get(), 0, MID_RELIEF }, \ + { u"CharInteropGrabBag", EE_CHAR_GRABBAG, cppu::UnoType<css::uno::Sequence<css::beans::PropertyValue >>::get(), 0, 0} + + +#define SVX_UNOEDIT_FONT_PROPERTIES \ + { UNO_NAME_EDIT_FONT_DESCRIPTOR, WID_FONTDESC, cppu::UnoType<css::awt::FontDescriptor>::get(), 0, MID_FONT_FAMILY_NAME } + +#define SVX_UNOEDIT_PARA_PROPERTIES \ + { UNO_NAME_EDIT_PARA_ADJUST, EE_PARA_JUST, ::cppu::UnoType<sal_Int16>::get(), 0, MID_PARA_ADJUST }, \ + { UNO_NAME_EDIT_PARA_BMARGIN, EE_PARA_ULSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_LO_MARGIN, PropertyMoreFlags::METRIC_ITEM }, \ + { UNO_NAME_EDIT_PARA_IS_HYPHEN, EE_PARA_HYPHENATE, ::cppu::UnoType<bool>::get(), 0, 0 }, \ + {u"ParaHyphenationNoCaps", EE_PARA_HYPHENATE_NO_CAPS, ::cppu::UnoType<bool>::get(), 0, 0 }, \ + {u"ParaHyphenationNoLastWord", EE_PARA_HYPHENATE_NO_LAST_WORD, ::cppu::UnoType<bool>::get(), 0, 0 }, \ + { UNO_NAME_EDIT_PARA_LASTLINEADJ, EE_PARA_JUST, ::cppu::UnoType<sal_Int16>::get(), 0, MID_LAST_LINE_ADJUST }, \ + { UNO_NAME_EDIT_PARA_LMARGIN, EE_PARA_LRSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_TXT_LMARGIN, PropertyMoreFlags::METRIC_ITEM }, \ + { UNO_NAME_EDIT_PARA_LINESPACING, EE_PARA_SBL, cppu::UnoType<css::style::LineSpacing>::get(), 0, CONVERT_TWIPS}, \ + { UNO_NAME_EDIT_PARA_RMARGIN, EE_PARA_LRSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_R_MARGIN, PropertyMoreFlags::METRIC_ITEM }, \ + { UNO_NAME_EDIT_PARA_TAPSTOPS, EE_PARA_TABS, cppu::UnoType<css::uno::Sequence< css::style::TabStop >>::get(), 0, 0 }, \ + { UNO_NAME_EDIT_PARA_TMARGIN, EE_PARA_ULSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_UP_MARGIN, PropertyMoreFlags::METRIC_ITEM },\ + { UNO_NAME_EDIT_PARA_FIRST_LINE_INDENT, EE_PARA_LRSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_FIRST_LINE_INDENT, PropertyMoreFlags::METRIC_ITEM}, \ + { UNO_NAME_EDIT_PARA_IS_HANGING_PUNCTUATION,EE_PARA_HANGINGPUNCTUATION, cppu::UnoType<bool>::get(), 0 ,0 }, \ + { UNO_NAME_EDIT_PARA_IS_CHARACTER_DISTANCE, EE_PARA_ASIANCJKSPACING, cppu::UnoType<bool>::get(), 0 ,0 }, \ + { UNO_NAME_EDIT_PARA_IS_FORBIDDEN_RULES, EE_PARA_FORBIDDENRULES, cppu::UnoType<bool>::get(), 0 ,0 },\ + {u"WritingMode", EE_PARA_WRITINGDIR, ::cppu::UnoType<sal_Int16>::get(), 0, 0 } + +class SvxFieldItem; +class SvxFieldData; + +EDITENG_DLLPUBLIC void GetSelection( struct ESelection& rSel, SvxTextForwarder const * pForwarder ) noexcept; +EDITENG_DLLPUBLIC void CheckSelection( struct ESelection& rSel, SvxTextForwarder const * pForwarder ) noexcept; + + +// This class implements a SvxEditSource and SvxTextForwarder and does +// nothing otherwise + + +class SvxDummyTextSource final : public SvxEditSource, public SvxTextForwarder +{ +public: + + // SvxEditSource + virtual ~SvxDummyTextSource() override; + virtual std::unique_ptr<SvxEditSource> Clone() const override; + virtual SvxTextForwarder* GetTextForwarder() override; + virtual void UpdateData() override; + + // SvxTextForwarder + virtual sal_Int32 GetParagraphCount() const override; + virtual sal_Int32 GetTextLen( sal_Int32 nParagraph ) const override; + virtual OUString GetText( const ESelection& rSel ) const override; + virtual SfxItemSet GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs::All ) const override; + virtual SfxItemSet GetParaAttribs( sal_Int32 nPara ) const override; + virtual void SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet ) override; + virtual void RemoveAttribs( const ESelection& rSelection ) override; + virtual void GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList ) const override; + + SfxItemState GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const override; + SfxItemState GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const override; + + virtual SfxItemPool* GetPool() const override; + + virtual void QuickInsertText( const OUString& rText, const ESelection& rSel ) override; + virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ) override; + virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ) override; + virtual void QuickInsertLineBreak( const ESelection& rSel ) override; + + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor ) override; + virtual void FieldClicked( const SvxFieldItem& rField ) override; + + virtual bool IsValid() const override; + + virtual LanguageType GetLanguage( sal_Int32, sal_Int32 ) const override; + virtual sal_Int32 GetFieldCount( sal_Int32 nPara ) const override; + virtual EFieldInfo GetFieldInfo( sal_Int32 nPara, sal_uInt16 nField ) const override; + virtual EBulletInfo GetBulletInfo( sal_Int32 nPara ) const override; + virtual tools::Rectangle GetCharBounds( sal_Int32 nPara, sal_Int32 nIndex ) const override; + virtual tools::Rectangle GetParaBounds( sal_Int32 nPara ) const override; + virtual MapMode GetMapMode() const override; + virtual OutputDevice* GetRefDevice() const override; + virtual bool GetIndexAtPoint( const Point&, sal_Int32& nPara, sal_Int32& nIndex ) const override; + virtual bool GetWordIndices( sal_Int32 nPara, sal_Int32 nIndex, sal_Int32& nStart, sal_Int32& nEnd ) const override; + virtual bool GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, sal_Int32 nPara, sal_Int32 nIndex, bool bInCell = false ) const override; + virtual sal_Int32 GetLineCount( sal_Int32 nPara ) const override; + virtual sal_Int32 GetLineLen( sal_Int32 nPara, sal_Int32 nLine ) const override; + virtual void GetLineBoundaries( /*out*/sal_Int32 &rStart, /*out*/sal_Int32 &rEnd, sal_Int32 nParagraph, sal_Int32 nLine ) const override; + virtual sal_Int32 GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const override; + virtual bool Delete( const ESelection& ) override; + virtual bool InsertText( const OUString&, const ESelection& ) override; + virtual bool QuickFormatDoc( bool bFull = false ) override; + virtual sal_Int16 GetDepth( sal_Int32 nPara ) const override; + virtual bool SetDepth( sal_Int32 nPara, sal_Int16 nNewDepth ) override; + + virtual const SfxItemSet* GetEmptyItemSetPtr() override; + + // implementation functions for XParagraphAppend and XTextPortionAppend + virtual void AppendParagraph() override; + virtual sal_Int32 AppendTextPortion( sal_Int32 nPara, const OUString &rText, const SfxItemSet &rSet ) override; + //XTextCopy + virtual void CopyText(const SvxTextForwarder& rSource) override; +}; + +namespace accessibility +{ + class AccessibleEditableTextPara; +} + + +class EDITENG_DLLPUBLIC SvxUnoTextRangeBase : public css::text::XTextRange, + public css::beans::XPropertySet, + public css::beans::XMultiPropertySet, + public css::beans::XMultiPropertyStates, + public css::beans::XPropertyState, + public css::lang::XServiceInfo, + public css::text::XTextRangeCompare, + public css::lang::XUnoTunnel, + private osl::DebugBase<SvxUnoTextRangeBase> + +{ + friend class SvxUnoTextRangeEnumeration; + friend class ::accessibility::AccessibleEditableTextPara; + const SvxItemPropertySet* mpPropSet; + +protected: + std::unique_ptr<SvxEditSource> mpEditSource; + ESelection maSelection; + + /// @throws css::beans::UnknownPropertyException + /// @throws css::beans::PropertyVetoException + /// @throws css::lang::IllegalArgumentException + /// @throws css::lang::WrappedTargetException + /// @throws css::uno::RuntimeException + void _setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue, sal_Int32 nPara = -1 ); + /// @throws css::beans::UnknownPropertyException + /// @throws css::lang::WrappedTargetException + /// @throws css::uno::RuntimeException + css::uno::Any _getPropertyValue( const OUString& PropertyName, sal_Int32 nPara = -1 ); + + /// @throws css::beans::PropertyVetoException + /// @throws css::lang::IllegalArgumentException + /// @throws css::lang::WrappedTargetException + /// @throws css::uno::RuntimeException + void _setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues, sal_Int32 nPara = -1 ); + /// @throws css::uno::RuntimeException + css::uno::Sequence< css::uno::Any > _getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, sal_Int32 nPara = -1 ); + + /// @throws css::beans::UnknownPropertyException + /// @throws css::uno::RuntimeException + css::beans::PropertyState _getPropertyState( const SfxItemPropertyMapEntry* pMap, sal_Int32 nPara = -1 ); + /// @throws css::beans::UnknownPropertyException + /// @throws css::uno::RuntimeException + css::beans::PropertyState _getPropertyState( std::u16string_view PropertyName, sal_Int32 nPara = -1 ); + /// @throws css::beans::UnknownPropertyException + /// @throws css::uno::RuntimeException + css::uno::Sequence< css::beans::PropertyState > _getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName, sal_Int32 nPara = -1 ); + // returns true if property found or false if unknown property + static bool _getOnePropertyStates(const SfxItemSet* pSet, const SfxItemPropertyMapEntry* pMap, css::beans::PropertyState& rState); + + /// @throws css::beans::UnknownPropertyException + /// @throws css::uno::RuntimeException + void _setPropertyToDefault( const OUString& PropertyName, sal_Int32 nPara = -1 ); + /// @throws css::beans::UnknownPropertyException + /// @throws css::uno::RuntimeException + void _setPropertyToDefault( SvxTextForwarder* pForwarder, const SfxItemPropertyMapEntry* pMap, sal_Int32 nPara ); + void SetEditSource( SvxEditSource* _pEditSource ) noexcept; + + /// @throws css::beans::UnknownPropertyException + /// @throws css::uno::RuntimeException + void getPropertyValue( const SfxItemPropertyMapEntry* pMap, css::uno::Any& rAny, const SfxItemSet& rSet ); + /// @throws css::beans::UnknownPropertyException + /// @throws css::lang::IllegalArgumentException + void setPropertyValue( const SfxItemPropertyMapEntry* pMap, const css::uno::Any& rValue, const ESelection& rSelection, const SfxItemSet& rOldSet, SfxItemSet& rNewSet ); + + SvxUnoTextRangeBase(const SvxItemPropertySet* _pSet); + SvxUnoTextRangeBase(const SvxEditSource* pSource, const SvxItemPropertySet* _pSet); + SvxUnoTextRangeBase(const SvxUnoTextRangeBase& rRange); + virtual ~SvxUnoTextRangeBase() noexcept; + +public: + // Internal + const ESelection& GetSelection() const noexcept + { + const SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr; + CheckSelection(const_cast<SvxUnoTextRangeBase*>(this)->maSelection, pForwarder); + return maSelection; + } + void SetSelection( const ESelection& rSelection ) noexcept; + + void CollapseToStart() noexcept; + void CollapseToEnd() noexcept; + bool IsCollapsed() noexcept; + bool GoLeft(sal_Int32 nCount, bool Expand) noexcept; + bool GoRight(sal_Int32 nCount, bool Expand) noexcept; + void GotoStart(bool Expand) noexcept; + void GotoEnd(bool Expand) noexcept; + + //const SfxItemPropertyMapEntry* getPropertyMapEntries() const throw() { return maPropSet.getPropertyMapEntries(); } + const SvxItemPropertySet* getPropertySet() const noexcept { return mpPropSet; } + SvxEditSource* GetEditSource() const noexcept { return mpEditSource.get(); } + + static bool SetPropertyValueHelper( const SfxItemPropertyMapEntry* pMap, const css::uno::Any& aValue, SfxItemSet& rNewSet, const ESelection* pSelection = nullptr, SvxEditSource* pEditSource = nullptr ); + /// @throws css::uno::RuntimeException + static bool GetPropertyValueHelper( SfxItemSet const & rSet, const SfxItemPropertyMapEntry* pMap, css::uno::Any& aAny, const ESelection* pSelection = nullptr, SvxEditSource* pEditSource = nullptr ); + + void attachField( std::unique_ptr<SvxFieldData> pData ) noexcept; + + UNO3_GETIMPLEMENTATION_DECL( SvxUnoTextRangeBase ) + + // css::text::XTextRange + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override; + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override; + virtual OUString SAL_CALL getString() override; + virtual void SAL_CALL setString( const OUString& aString ) override; + + // css::beans::XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + // XMultiPropertySet + virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues ) override; + virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override; + virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override; + virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override; + + // css::beans::XPropertyState + virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override; + virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override; + virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override; + virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override; + + // css::beans::XMultiPropertyStates + //virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) throw (css::beans::UnknownPropertyException, css::uno::RuntimeException); + virtual void SAL_CALL setAllPropertiesToDefault() override; + virtual void SAL_CALL setPropertiesToDefault( const css::uno::Sequence< OUString >& aPropertyNames ) override; + virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyDefaults( const css::uno::Sequence< OUString >& aPropertyNames ) override; + + // XTextRangeCompare + virtual ::sal_Int16 SAL_CALL compareRegionStarts( const css::uno::Reference< css::text::XTextRange >& xR1, const css::uno::Reference< css::text::XTextRange >& xR2 ) override; + virtual ::sal_Int16 SAL_CALL compareRegionEnds( const css::uno::Reference< css::text::XTextRange >& xR1, const css::uno::Reference< css::text::XTextRange >& xR2 ) override; + + // css::lang::XServiceInfo + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + static css::uno::Sequence< OUString > getSupportedServiceNames_Static( ); +}; + + +class SvxUnoTextBase; +class EDITENG_DLLPUBLIC SvxUnoTextRange final : public SvxUnoTextRangeBase, + public css::lang::XTypeProvider, + public ::cppu::OWeakAggObject +{ + friend class SvxUnoTextRangeEnumeration; +private: + css::uno::Reference< css::text::XText > xParentText; + bool mbPortion; + +public: + SvxUnoTextRange(const SvxUnoTextBase& rParent, bool bPortion = false); + virtual ~SvxUnoTextRange() noexcept override; + + // css::uno::XInterface + virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override; + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + + // css::text::XTextRange + virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override; + + // css::lang::XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + + // css::lang::XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override; +}; + +class EDITENG_DLLPUBLIC SvxUnoTextBase : public SvxUnoTextRangeBase, + public css::text::XTextAppend, + public css::text::XTextCopy, + public css::container::XEnumerationAccess, + public css::text::XTextRangeMover, + public css::lang::XTypeProvider +{ + css::uno::Reference< css::text::XText > xParentText; + +protected: + SvxUnoTextBase(const SvxItemPropertySet* _pSet); + SvxUnoTextBase(const SvxEditSource* pSource, const SvxItemPropertySet* _pSet, css::uno::Reference < css::text::XText > const & xParent); + SvxUnoTextBase(const SvxUnoTextBase& rText); + virtual ~SvxUnoTextBase() noexcept override; + +public: + UNO3_GETIMPLEMENTATION_DECL( SvxUnoTextBase ) + + css::uno::Reference< css::text::XTextCursor > createTextCursorBySelection( const ESelection& rSel ); + + // css::uno::XInterface + /// @throws css::uno::RuntimeException + virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ); + + // css::text::XSimpleText + virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursor( ) override; + virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursorByRange( const css::uno::Reference< css::text::XTextRange >& aTextPosition ) override; + virtual void SAL_CALL insertString( const css::uno::Reference< css::text::XTextRange >& xRange, const OUString& aString, sal_Bool bAbsorb ) override; + virtual void SAL_CALL insertControlCharacter( const css::uno::Reference< css::text::XTextRange >& xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb ) override; + + // css::text::XText + virtual void SAL_CALL insertTextContent( const css::uno::Reference< css::text::XTextRange >& xRange, const css::uno::Reference< css::text::XTextContent >& xContent, sal_Bool bAbsorb ) override; + virtual void SAL_CALL removeTextContent( const css::uno::Reference< css::text::XTextContent >& xContent ) override; + virtual OUString SAL_CALL getString() override; + virtual void SAL_CALL setString( const OUString& aString ) override; + + // css::text::XTextRange + virtual css::uno::Reference< css::text::XText > SAL_CALL getText( ) override; + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override; + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override; + + // css::container::XEnumerationAccess + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration( ) override; + + // css::container::XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + // css::text::XTextRangeMover + virtual void SAL_CALL moveTextRange( const css::uno::Reference< css::text::XTextRange >& xRange, sal_Int16 nParagraphs ) override; + + // css::text::XParagraphAppend (new import API) + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL finishParagraph( const css::uno::Sequence< css::beans::PropertyValue >& CharacterAndParagraphProperties ) override; + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL finishParagraphInsert( const css::uno::Sequence< css::beans::PropertyValue >& CharacterAndParagraphProperties, const css::uno::Reference< css::text::XTextRange >& xInsertPosition ) override; + + // css::text::XTextPortionAppend (new import API) + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL appendTextPortion( const OUString& Text, const css::uno::Sequence< css::beans::PropertyValue >& CharacterAndParagraphProperties ) override; + + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL insertTextPortion( const OUString& Text, const css::uno::Sequence< css::beans::PropertyValue >& CharacterAndParagraphProperties, const css::uno::Reference< css::text::XTextRange>& rTextRange ) override; + + // css::text::XTextCopy + virtual void SAL_CALL copyText( const css::uno::Reference< css::text::XTextCopy >& xSource ) override; + + // css::lang::XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + static css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames_Static( ); + + // css::lang::XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override; +}; + + +class EDITENG_DLLPUBLIC SvxUnoText : public SvxUnoTextBase, + public ::cppu::OWeakAggObject +{ +public: + SvxUnoText( const SvxItemPropertySet* _pSet ) noexcept; + SvxUnoText( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet, css::uno::Reference < css::text::XText > const & xParent ) noexcept; + SvxUnoText( const SvxUnoText& rText ) noexcept; + virtual ~SvxUnoText() noexcept override; + + // Internal + static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() noexcept; + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + + // css::uno::XInterface + virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override; + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + + // css::lang::XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override; +}; + + +class SvxUnoTextContent final : public SvxUnoTextRangeBase, + public css::text::XTextContent, + public css::container::XEnumerationAccess, + public css::lang::XTypeProvider, + public ::cppu::OWeakAggObject +{ + friend class SvxUnoTextContentEnumeration; +private: + css::uno::Reference< css::text::XText > mxParentText; + sal_Int32 mnParagraph; + const SvxUnoTextBase& mrParentText; + + // for xComponent + std::mutex maDisposeContainerMutex; + ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> maDisposeListeners; + bool mbDisposing; + +protected: + using SvxUnoTextRangeBase::setPropertyValue; + using SvxUnoTextRangeBase::getPropertyValue; + +public: + SvxUnoTextContent( const SvxUnoTextBase& rText, sal_Int32 nPara ) noexcept; + SvxUnoTextContent( const SvxUnoTextContent& rContent ) noexcept; + virtual ~SvxUnoTextContent() noexcept override; + + // css::uno::XInterface + virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override; + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + + // css::text::XTextRange + virtual css::uno::Reference< css::text::XText > SAL_CALL getText( ) override; + + // css::text::XTextContent -> css::lang::XComponent + virtual void SAL_CALL attach( const css::uno::Reference< css::text::XTextRange >& xTextRange ) override; + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor( ) override; + + // css::lang::XComponent + virtual void SAL_CALL dispose() override; + virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override; + virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override; + + // css::container::XEnumerationAccess + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration( ) override; + + // css::container::XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + + // css::beans::XPropertySet + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + + // XMultiPropertySet + virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues ) override; + virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override; + + // css::beans::XPropertyState + virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override; + virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override; + virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override; + + // css::lang::XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + // css::lang::XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override; +}; + + +class SvxUnoTextContentEnumeration final : public ::cppu::WeakAggImplHelper1< css::container::XEnumeration > +{ +private: + css::uno::Reference< css::text::XText > mxParentText; + std::unique_ptr<SvxEditSource> mpEditSource; + sal_Int32 mnNextParagraph; + std::vector< rtl::Reference<SvxUnoTextContent> > maContents; + +public: + SvxUnoTextContentEnumeration( const SvxUnoTextBase& _rText, const ESelection& rSel ) noexcept; + virtual ~SvxUnoTextContentEnumeration() noexcept override; + + // css::container::XEnumeration + virtual sal_Bool SAL_CALL hasMoreElements( ) override; + virtual css::uno::Any SAL_CALL nextElement( ) override; +}; + + +class SvxUnoTextRangeEnumeration final : public ::cppu::WeakAggImplHelper1< css::container::XEnumeration > +{ +private: + std::unique_ptr<SvxEditSource> mpEditSource; + css::uno::Reference< css::text::XText > mxParentText; + std::vector< rtl::Reference<SvxUnoTextRange> > maPortions; + sal_uInt16 mnNextPortion; + +public: + SvxUnoTextRangeEnumeration(const SvxUnoTextBase& rText, sal_Int32 nPara, const ESelection& rSel); + virtual ~SvxUnoTextRangeEnumeration() noexcept override; + + // css::container::XEnumeration + virtual sal_Bool SAL_CALL hasMoreElements( ) override; + virtual css::uno::Any SAL_CALL nextElement( ) override; +}; + + +class EDITENG_DLLPUBLIC SvxUnoTextCursor : public SvxUnoTextRangeBase, + public css::text::XTextCursor, + public css::lang::XTypeProvider, + public ::cppu::OWeakAggObject +{ +private: + css::uno::Reference< css::text::XText > mxParentText; + +public: + SvxUnoTextCursor( const SvxUnoTextBase& rText ) noexcept; + SvxUnoTextCursor( const SvxUnoTextCursor& rCursor ) noexcept; + virtual ~SvxUnoTextCursor() noexcept override; + + // css::uno::XInterface + virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override; + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + + // css::text::XTextRange + virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override; + virtual OUString SAL_CALL getString() override; + virtual void SAL_CALL setString( const OUString& aString ) override; + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override; + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override; + + // css::text::XTextCursor -> css::text::XTextRange + virtual void SAL_CALL collapseToStart( ) override; + virtual void SAL_CALL collapseToEnd( ) override; + virtual sal_Bool SAL_CALL isCollapsed( ) override; + virtual sal_Bool SAL_CALL goLeft( sal_Int16 nCount, sal_Bool bExpand ) override; + virtual sal_Bool SAL_CALL goRight( sal_Int16 nCount, sal_Bool bExpand ) override; + virtual void SAL_CALL gotoStart( sal_Bool bExpand ) override; + virtual void SAL_CALL gotoEnd( sal_Bool bExpand ) override; + virtual void SAL_CALL gotoRange( const css::uno::Reference< css::text::XTextRange >& xRange, sal_Bool bExpand ) override; + + // css::lang::XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // css::lang::XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override; + +}; + +EDITENG_DLLPUBLIC const SvxItemPropertySet* ImplGetSvxUnoOutlinerTextCursorSvxPropertySet(); +const SfxItemPropertyMapEntry* ImplGetSvxUnoOutlinerTextCursorPropertyMap(); +const SvxItemPropertySet* ImplGetSvxTextPortionSvxPropertySet(); +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 000000000..674bec8cf --- /dev/null +++ b/include/editeng/unoviwou.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 INCLUDED_EDITENG_UNOVIWOU_HXX +#define INCLUDED_EDITENG_UNOVIWOU_HXX + +#include <editeng/unoedsrc.hxx> +#include <editeng/editengdllapi.h> + +class OutlinerView; + +/// Specialization for Draw/Impress +class EDITENG_DLLPUBLIC SvxDrawOutlinerViewForwarder final : 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() override; + + virtual bool IsValid() const override; + + virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const override; + virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const override; + + virtual bool GetSelection( ESelection& rSelection ) const override; + virtual bool SetSelection( const ESelection& rSelection ) override; + virtual bool Copy() override; + virtual bool Cut() override; + virtual bool Paste() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/urlfieldhelper.hxx b/include/editeng/urlfieldhelper.hxx new file mode 100644 index 000000000..9a1d53d15 --- /dev/null +++ b/include/editeng/urlfieldhelper.hxx @@ -0,0 +1,28 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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/. + */ + +#pragma once + +#include <sal/config.h> +#include <editeng/editengdllapi.h> +#include <editeng/outliner.hxx> +#include <editeng/editview.hxx> + +class EDITENG_DLLPUBLIC URLFieldHelper +{ +public: + static void RemoveURLField(EditView& pEditView); + static bool IsCursorAtURLField(const EditView& pEditView); + static bool IsCursorAtURLField(const OutlinerView* pOLV) + { + return pOLV && IsCursorAtURLField(pOLV->GetEditView()); + } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/include/editeng/wghtitem.hxx b/include/editeng/wghtitem.hxx new file mode 100644 index 000000000..6f5f4b31c --- /dev/null +++ b/include/editeng/wghtitem.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 INCLUDED_EDITENG_WGHTITEM_HXX +#define INCLUDED_EDITENG_WGHTITEM_HXX + +#include <tools/fontenum.hxx> +#include <svl/eitem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxWeightItem --------------------------------------------------- + +/* [Description] + + This item describes the font weight. +*/ + +class EDITENG_DLLPUBLIC SvxWeightItem final : public SfxEnumItem<FontWeight> +{ +public: + static SfxPoolItem* CreateDefault(); + + SvxWeightItem( const FontWeight eWght /*= WEIGHT_NORMAL*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + SfxEnumItem + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; + + virtual SvxWeightItem* Clone( SfxItemPool *pPool = nullptr ) const override; + static OUString GetValueTextByPos( sal_uInt16 nPos ); + virtual sal_uInt16 GetValueCount() const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + virtual bool HasBoolValue() const override; + virtual bool GetBoolValue() const override; + virtual void SetBoolValue( bool bVal ) override; + + // enum cast + FontWeight GetWeight() const { return GetValue(); } + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; + + virtual bool IsSortable() const override { return true; } + + virtual bool operator<(const SfxPoolItem& rCmp) const override + { + auto const & other = static_cast<const SvxWeightItem&>(rCmp); + return GetValue() < other.GetValue(); + } +}; + +#endif // INCLUDED_EDITENG_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 000000000..5d64962d3 --- /dev/null +++ b/include/editeng/widwitem.hxx @@ -0,0 +1,50 @@ +/* -*- 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_EDITENG_WIDWITEM_HXX +#define INCLUDED_EDITENG_WIDWITEM_HXX + +#include <svl/intitem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxWidowsItem --------------------------------------------------- + +/* [Description] + + This item describes the number of lines for the widows control. +*/ + +class EDITENG_DLLPUBLIC SvxWidowsItem final : public SfxByteItem +{ +public: + static SfxPoolItem* CreateDefault(); + + SvxWidowsItem( const sal_uInt8 nL /*= 0*/, const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual SvxWidowsItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; +}; + +#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 000000000..f9e116d76 --- /dev/null +++ b/include/editeng/writingmodeitem.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 INCLUDED_EDITENG_WRITINGMODEITEM_HXX +#define INCLUDED_EDITENG_WRITINGMODEITEM_HXX + +#include <com/sun/star/text/WritingMode.hpp> +#include <svl/intitem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxWritingModeItem ---------------------------------------------- + +class EDITENG_DLLPUBLIC SvxWritingModeItem final : public SfxUInt16Item +{ +public: + SvxWritingModeItem( css::text::WritingMode eValue /*= css::text::WritingMode_LR_TB*/, + sal_uInt16 nWhich /*= SDRATTR_TEXTDIRECTION*/ ); + virtual ~SvxWritingModeItem() override; + + SvxWritingModeItem(SvxWritingModeItem const &) = default; + SvxWritingModeItem(SvxWritingModeItem &&) = default; + SvxWritingModeItem & operator =(SvxWritingModeItem const &) = delete; // due to SfxUInt16Item + SvxWritingModeItem & operator =(SvxWritingModeItem &&) = delete; // due to SfxUInt16Item + + virtual SvxWritingModeItem* Clone( SfxItemPool *pPool = nullptr ) const override; + css::text::WritingMode GetValue() const { return static_cast<css::text::WritingMode>(SfxUInt16Item::GetValue()); } + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& ) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; +}; + +#endif // INCLUDED_EDITENG_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 000000000..6226d3262 --- /dev/null +++ b/include/editeng/wrlmitem.hxx @@ -0,0 +1,52 @@ +/* -*- 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_EDITENG_WRLMITEM_HXX +#define INCLUDED_EDITENG_WRLMITEM_HXX + +#include <svl/eitem.hxx> +#include <editeng/editengdllapi.h> + +// class SvxWordLineModeItem --------------------------------------------- + +/* [Description] + + This item describes, whether underlined and strikethrough is limited + to word boundaries. +*/ + +class EDITENG_DLLPUBLIC SvxWordLineModeItem final : public SfxBoolItem +{ +public: + static SfxPoolItem* CreateDefault(); + + SvxWordLineModeItem( const bool bWordLineMode /*= false*/, + const sal_uInt16 nId ); + + // "pure virtual Methods" from SfxPoolItem + virtual SvxWordLineModeItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper& ) const override; +}; + +#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 000000000..a0ee0a63f --- /dev/null +++ b/include/editeng/xmlcnitm.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 INCLUDED_EDITENG_XMLCNITM_HXX +#define INCLUDED_EDITENG_XMLCNITM_HXX + +#include <svl/poolitem.hxx> +#include <editeng/editengdllapi.h> +#include <xmloff/xmlcnimp.hxx> + + +class EDITENG_DLLPUBLIC SvXMLAttrContainerItem final : public SfxPoolItem +{ + SvXMLAttrContainerData maContainerData; + +public: + + SvXMLAttrContainerItem( sal_uInt16 nWhich = 0 ); + SvXMLAttrContainerItem( const SvXMLAttrContainerItem& ); + virtual ~SvXMLAttrContainerItem() override; + + virtual bool operator==( const SfxPoolItem& ) const override; + + virtual bool GetPresentation(SfxItemPresentation ePresentation, + MapUnit eCoreMetric, + MapUnit ePresentationMetric, + OUString &rText, + const IntlWrapper& rIntlWrapper) const override; + + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + + virtual SvXMLAttrContainerItem* Clone( SfxItemPool * = nullptr) const override + { return new SvXMLAttrContainerItem( *this ); } + + bool AddAttr( const OUString& rLName, + const OUString& rValue ); + 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 // INCLUDED_EDITENG_XMLCNITM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |