From 940b4d1848e8c70ab7642901a68594e8016caffc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 18:51:28 +0200 Subject: Adding upstream version 1:7.0.4. Signed-off-by: Daniel Baumann --- include/editeng/AccessibleComponentBase.hxx | 115 +++ include/editeng/AccessibleContextBase.hxx | 341 +++++++++ include/editeng/AccessibleEditableTextPara.hxx | 387 ++++++++++ include/editeng/AccessibleParaManager.hxx | 271 +++++++ include/editeng/AccessibleSelectionBase.hxx | 67 ++ include/editeng/AccessibleStaticTextBase.hxx | 233 ++++++ include/editeng/CustomPropertyField.hxx | 61 ++ include/editeng/SpellPortions.hxx | 90 +++ include/editeng/Trie.hxx | 41 ++ include/editeng/UnoForbiddenCharsTable.hxx | 58 ++ include/editeng/acorrcfg.hxx | 123 ++++ include/editeng/adjustitem.hxx | 143 ++++ include/editeng/autokernitem.hxx | 51 ++ include/editeng/blinkitem.hxx | 50 ++ include/editeng/borderline.hxx | 245 +++++++ include/editeng/boxitem.hxx | 266 +++++++ include/editeng/brushitem.hxx | 120 +++ include/editeng/bulletitem.hxx | 94 +++ include/editeng/charhiddenitem.hxx | 46 ++ include/editeng/charreliefitem.hxx | 59 ++ include/editeng/charrotateitem.hxx | 104 +++ include/editeng/charscaleitem.hxx | 57 ++ include/editeng/cmapitem.hxx | 59 ++ include/editeng/colritem.hxx | 79 ++ include/editeng/contouritem.hxx | 50 ++ include/editeng/crossedoutitem.hxx | 67 ++ include/editeng/editdata.hxx | 341 +++++++++ include/editeng/editeng.hxx | 636 ++++++++++++++++ include/editeng/editengdllapi.h | 34 + include/editeng/editerr.hxx | 29 + include/editeng/editids.hrc | 149 ++++ include/editeng/editobj.hxx | 152 ++++ include/editeng/editrids.hrc | 314 ++++++++ include/editeng/editstat.hxx | 143 ++++ include/editeng/editund2.hxx | 73 ++ include/editeng/editview.hxx | 334 +++++++++ include/editeng/edtdlg.hxx | 109 +++ include/editeng/eedata.hxx | 48 ++ include/editeng/eeitem.hxx | 147 ++++ include/editeng/eerdll.hxx | 51 ++ include/editeng/emphasismarkitem.hxx | 60 ++ include/editeng/escapementitem.hxx | 97 +++ include/editeng/fhgtitem.hxx | 93 +++ include/editeng/fieldupdater.hxx | 47 ++ include/editeng/flditem.hxx | 439 +++++++++++ include/editeng/flstitem.hxx | 65 ++ include/editeng/fontitem.hxx | 112 +++ include/editeng/forbiddencharacterstable.hxx | 57 ++ include/editeng/forbiddenruleitem.hxx | 49 ++ include/editeng/formatbreakitem.hxx | 71 ++ include/editeng/frmdir.hxx | 62 ++ include/editeng/frmdiritem.hxx | 64 ++ include/editeng/hangulhanja.hxx | 287 ++++++++ include/editeng/hngpnctitem.hxx | 48 ++ include/editeng/hyphenzoneitem.hxx | 81 ++ include/editeng/itemtype.hxx | 50 ++ include/editeng/justifyitem.hxx | 104 +++ include/editeng/keepitem.hxx | 57 ++ include/editeng/kernitem.hxx | 58 ++ include/editeng/langitem.hxx | 68 ++ include/editeng/legacyitem.hxx | 193 +++++ include/editeng/lineitem.hxx | 71 ++ include/editeng/lrspitem.hxx | 160 ++++ include/editeng/lspcitem.hxx | 101 +++ include/editeng/macros.hxx | 17 + include/editeng/measfld.hxx | 48 ++ include/editeng/memberids.h | 185 +++++ include/editeng/misspellrange.hxx | 39 + include/editeng/mutxhelp.hxx | 37 + include/editeng/nhypitem.hxx | 42 ++ include/editeng/numdef.hxx | 28 + include/editeng/numitem.hxx | 352 +++++++++ include/editeng/opaqitem.hxx | 53 ++ include/editeng/optitems.hxx | 54 ++ include/editeng/orphitem.hxx | 50 ++ include/editeng/outliner.hxx | 974 +++++++++++++++++++++++++ include/editeng/outlobj.hxx | 120 +++ include/editeng/overflowingtxt.hxx | 136 ++++ include/editeng/paperinf.hxx | 66 ++ include/editeng/paragraphdata.hxx | 48 ++ include/editeng/paravertalignitem.hxx | 60 ++ include/editeng/pbinitem.hxx | 58 ++ include/editeng/pgrditem.hxx | 51 ++ include/editeng/pmdlitem.hxx | 70 ++ include/editeng/postitem.hxx | 67 ++ include/editeng/prntitem.hxx | 55 ++ include/editeng/protitem.hxx | 76 ++ include/editeng/rsiditem.hxx | 37 + include/editeng/scriptspaceitem.hxx | 50 ++ include/editeng/scripttypeitem.hxx | 52 ++ include/editeng/section.hxx | 36 + include/editeng/shaditem.hxx | 84 +++ include/editeng/shdditem.hxx | 53 ++ include/editeng/sizeitem.hxx | 69 ++ include/editeng/spltitem.hxx | 61 ++ include/editeng/splwrap.hxx | 113 +++ include/editeng/svxacorr.hxx | 444 +++++++++++ include/editeng/svxenum.hxx | 217 ++++++ include/editeng/svxfont.hxx | 113 +++ include/editeng/svxrtf.hxx | 365 +++++++++ include/editeng/swafopt.hxx | 138 ++++ include/editeng/tstpitem.hxx | 149 ++++ include/editeng/twolinesitem.hxx | 63 ++ include/editeng/txtrange.hxx | 84 +++ include/editeng/udlnitem.hxx | 102 +++ include/editeng/ulspitem.hxx | 93 +++ include/editeng/unoedhlp.hxx | 157 ++++ include/editeng/unoedprx.hxx | 172 +++++ include/editeng/unoedsrc.hxx | 533 ++++++++++++++ include/editeng/unofdesc.hxx | 46 ++ include/editeng/unofield.hxx | 110 +++ include/editeng/unofored.hxx | 93 +++ include/editeng/unoforou.hxx | 120 +++ include/editeng/unoipset.hxx | 73 ++ include/editeng/unolingu.hxx | 132 ++++ include/editeng/unonames.hxx | 52 ++ include/editeng/unonrule.hxx | 90 +++ include/editeng/unoprnms.hxx | 352 +++++++++ include/editeng/unotext.hxx | 673 +++++++++++++++++ include/editeng/unoviwou.hxx | 56 ++ include/editeng/urlfieldhelper.hxx | 28 + include/editeng/wghtitem.hxx | 74 ++ include/editeng/widwitem.hxx | 50 ++ include/editeng/writingmodeitem.hxx | 55 ++ include/editeng/wrlmitem.hxx | 52 ++ include/editeng/xmlcnitm.hxx | 75 ++ 126 files changed, 16333 insertions(+) create mode 100644 include/editeng/AccessibleComponentBase.hxx create mode 100644 include/editeng/AccessibleContextBase.hxx create mode 100644 include/editeng/AccessibleEditableTextPara.hxx create mode 100644 include/editeng/AccessibleParaManager.hxx create mode 100644 include/editeng/AccessibleSelectionBase.hxx create mode 100644 include/editeng/AccessibleStaticTextBase.hxx create mode 100644 include/editeng/CustomPropertyField.hxx create mode 100644 include/editeng/SpellPortions.hxx create mode 100644 include/editeng/Trie.hxx create mode 100644 include/editeng/UnoForbiddenCharsTable.hxx create mode 100644 include/editeng/acorrcfg.hxx create mode 100644 include/editeng/adjustitem.hxx create mode 100644 include/editeng/autokernitem.hxx create mode 100644 include/editeng/blinkitem.hxx create mode 100644 include/editeng/borderline.hxx create mode 100644 include/editeng/boxitem.hxx create mode 100644 include/editeng/brushitem.hxx create mode 100644 include/editeng/bulletitem.hxx create mode 100644 include/editeng/charhiddenitem.hxx create mode 100644 include/editeng/charreliefitem.hxx create mode 100644 include/editeng/charrotateitem.hxx create mode 100644 include/editeng/charscaleitem.hxx create mode 100644 include/editeng/cmapitem.hxx create mode 100644 include/editeng/colritem.hxx create mode 100644 include/editeng/contouritem.hxx create mode 100644 include/editeng/crossedoutitem.hxx create mode 100644 include/editeng/editdata.hxx create mode 100644 include/editeng/editeng.hxx create mode 100644 include/editeng/editengdllapi.h create mode 100644 include/editeng/editerr.hxx create mode 100644 include/editeng/editids.hrc create mode 100644 include/editeng/editobj.hxx create mode 100644 include/editeng/editrids.hrc create mode 100644 include/editeng/editstat.hxx create mode 100644 include/editeng/editund2.hxx create mode 100644 include/editeng/editview.hxx create mode 100644 include/editeng/edtdlg.hxx create mode 100644 include/editeng/eedata.hxx create mode 100644 include/editeng/eeitem.hxx create mode 100644 include/editeng/eerdll.hxx create mode 100644 include/editeng/emphasismarkitem.hxx create mode 100644 include/editeng/escapementitem.hxx create mode 100644 include/editeng/fhgtitem.hxx create mode 100644 include/editeng/fieldupdater.hxx create mode 100644 include/editeng/flditem.hxx create mode 100644 include/editeng/flstitem.hxx create mode 100644 include/editeng/fontitem.hxx create mode 100644 include/editeng/forbiddencharacterstable.hxx create mode 100644 include/editeng/forbiddenruleitem.hxx create mode 100644 include/editeng/formatbreakitem.hxx create mode 100644 include/editeng/frmdir.hxx create mode 100644 include/editeng/frmdiritem.hxx create mode 100644 include/editeng/hangulhanja.hxx create mode 100644 include/editeng/hngpnctitem.hxx create mode 100644 include/editeng/hyphenzoneitem.hxx create mode 100644 include/editeng/itemtype.hxx create mode 100644 include/editeng/justifyitem.hxx create mode 100644 include/editeng/keepitem.hxx create mode 100644 include/editeng/kernitem.hxx create mode 100644 include/editeng/langitem.hxx create mode 100644 include/editeng/legacyitem.hxx create mode 100644 include/editeng/lineitem.hxx create mode 100644 include/editeng/lrspitem.hxx create mode 100644 include/editeng/lspcitem.hxx create mode 100644 include/editeng/macros.hxx create mode 100644 include/editeng/measfld.hxx create mode 100644 include/editeng/memberids.h create mode 100644 include/editeng/misspellrange.hxx create mode 100644 include/editeng/mutxhelp.hxx create mode 100644 include/editeng/nhypitem.hxx create mode 100644 include/editeng/numdef.hxx create mode 100644 include/editeng/numitem.hxx create mode 100644 include/editeng/opaqitem.hxx create mode 100644 include/editeng/optitems.hxx create mode 100644 include/editeng/orphitem.hxx create mode 100644 include/editeng/outliner.hxx create mode 100644 include/editeng/outlobj.hxx create mode 100644 include/editeng/overflowingtxt.hxx create mode 100644 include/editeng/paperinf.hxx create mode 100644 include/editeng/paragraphdata.hxx create mode 100644 include/editeng/paravertalignitem.hxx create mode 100644 include/editeng/pbinitem.hxx create mode 100644 include/editeng/pgrditem.hxx create mode 100644 include/editeng/pmdlitem.hxx create mode 100644 include/editeng/postitem.hxx create mode 100644 include/editeng/prntitem.hxx create mode 100644 include/editeng/protitem.hxx create mode 100644 include/editeng/rsiditem.hxx create mode 100644 include/editeng/scriptspaceitem.hxx create mode 100644 include/editeng/scripttypeitem.hxx create mode 100644 include/editeng/section.hxx create mode 100644 include/editeng/shaditem.hxx create mode 100644 include/editeng/shdditem.hxx create mode 100644 include/editeng/sizeitem.hxx create mode 100644 include/editeng/spltitem.hxx create mode 100644 include/editeng/splwrap.hxx create mode 100644 include/editeng/svxacorr.hxx create mode 100644 include/editeng/svxenum.hxx create mode 100644 include/editeng/svxfont.hxx create mode 100644 include/editeng/svxrtf.hxx create mode 100644 include/editeng/swafopt.hxx create mode 100644 include/editeng/tstpitem.hxx create mode 100644 include/editeng/twolinesitem.hxx create mode 100644 include/editeng/txtrange.hxx create mode 100644 include/editeng/udlnitem.hxx create mode 100644 include/editeng/ulspitem.hxx create mode 100644 include/editeng/unoedhlp.hxx create mode 100644 include/editeng/unoedprx.hxx create mode 100644 include/editeng/unoedsrc.hxx create mode 100644 include/editeng/unofdesc.hxx create mode 100644 include/editeng/unofield.hxx create mode 100644 include/editeng/unofored.hxx create mode 100644 include/editeng/unoforou.hxx create mode 100644 include/editeng/unoipset.hxx create mode 100644 include/editeng/unolingu.hxx create mode 100644 include/editeng/unonames.hxx create mode 100644 include/editeng/unonrule.hxx create mode 100644 include/editeng/unoprnms.hxx create mode 100644 include/editeng/unotext.hxx create mode 100644 include/editeng/unoviwou.hxx create mode 100644 include/editeng/urlfieldhelper.hxx create mode 100644 include/editeng/wghtitem.hxx create mode 100644 include/editeng/widwitem.hxx create mode 100644 include/editeng/writingmodeitem.hxx create mode 100644 include/editeng/wrlmitem.hxx create mode 100644 include/editeng/xmlcnitm.hxx (limited to 'include/editeng') diff --git a/include/editeng/AccessibleComponentBase.hxx b/include/editeng/AccessibleComponentBase.hxx new file mode 100644 index 000000000..d3c5805ef --- /dev/null +++ b/include/editeng/AccessibleComponentBase.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_ACCESSIBLECOMPONENTBASE_HXX +#define INCLUDED_EDITENG_ACCESSIBLECOMPONENTBASE_HXX + + +#include +#include + +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, XInterface, + XServiceInfo, and XTypeProvider. +*/ +class EDITENG_DLLPUBLIC AccessibleComponentBase + : public css::accessibility::XAccessibleExtendedComponent +{ +public: + //===== internal ======================================================== + AccessibleComponentBase(); + virtual ~AccessibleComponentBase(); + + + //===== XAccessibleComponent ================================================ + + /** The default implementation uses the result of + getBounds 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 + getBounds 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 + getBounds 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..183c097fe --- /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 +#include +#include +#include +#include +#include +#include +#include + +namespace com::sun::star::accessibility { class XAccessibleStateSet; } +namespace com::sun::star::accessibility { class XAccessibleRelationSet; } +namespace com::sun::star::accessibility { struct AccessibleEventObject; } + +namespace accessibility { + +struct MutexOwner {mutable ::osl::Mutex maMutex;}; + +/** @descr + This base class provides an implementation of the + AccessibleContext service. Apart from the + XXAccessible and XAccessibleContextContext + interfaces it supports the XServiceInfo interface. +*/ +class EDITENG_DLLPUBLIC AccessibleContextBase + : public MutexOwner, + 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 ( + const css::uno::Reference< css::accessibility::XAccessible>& rxParent, + 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 + is returned, otherwise . + */ + 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 + is returned, otherwise . + */ + 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 indicates that the state is set. A + 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_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. + */ + css::uno::Reference< css::accessibility::XAccessibleStateSet> mxStateSet; + + /** The relation set. Relations can be set or removed by calling the + AddRelation and RemoveRelation 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 + +

Caution: This is only to be used in the construction phase (means within + the ctor or late ctor), never when the object is still alive and part + of an Accessibility hierarchy.

+ */ + 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..34fab512f --- /dev/null +++ b/include/editeng/AccessibleEditableTextPara.hxx @@ -0,0 +1,387 @@ +/* -*- 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 +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +class SvxViewForwarder; +class MapMode; +class SvxAccessibleTextAdapter; +class SvxAccessibleTextEditViewAdapter; +namespace accessibility { class AccessibleImageBullet; } + +namespace accessibility +{ + typedef ::cppu::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 ::cppu::BaseMutex, 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 , which + // created and manages this accessible paragraph. + AccessibleEditableTextPara ( const css::uno::Reference< css::accessibility::XAccessible >& rParent, + 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) + css::uno::Reference< css::accessibility::XAccessibleStateSet > 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 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..d496be8af --- /dev/null +++ b/include/editeng/AccessibleParaManager.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_ACCESSIBLEPARAMANAGER_HXX +#define INCLUDED_EDITENG_ACCESSIBLEPARAMANAGER_HXX + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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 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 get() const { + css::uno::Reference ref(maWeakRef); + return ref.is() ? maUnsafeRef : rtl::Reference(); + } + + // 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( const VectorOfStates& rChildStates ); + + /** Set the number of paragraphs + + @param nNumPara + The total number of paragraphs the EditEngine currently + has (_not_ the number of currently visible children) + */ + void SetNum( sal_Int32 nNumParas ); + + /** Get the number of paragraphs currently possible */ + sal_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 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; + + // 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 +#include + +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: + + implGetMutex, + implGetAccessibleContext, + implIsSelected, + implSelect, +*/ + 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 +#include +#include +#include +#include +#include +#include +#include +#include + +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()) 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..b44af7330 --- /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 + +#include + +#include + +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 const & rName, OUString const & rCurrentPresentation); + + virtual ~CustomPropertyField() override; + + virtual sal_Int32 GetClassId() const override { return css::text::textfield::Type::DOCINFO_CUSTOM; } + + virtual std::unique_ptr Clone() const override; + virtual bool operator==(const SvxFieldData&) const override; + + virtual MetaAction* createBeginComment() const override; + + OUString GetFormatted(css::uno::Reference 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..0681b5dbb --- /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 +#include +#include +#include +#include + +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; + /** Marks the portion as field, footnote symbol or any other special content that + should be protected against unintentional deletion. + */ + bool bIsField; + /** Marks the portion hidden content that should not be touched by spell checking + and not be removed like redlines. The creator of the portions has to take care + for them. + */ + bool bIsHidden; + /** contains the language applied to the text. It has to match the script type. + */ + LanguageType eLanguage; + /** for wrong words this reference is filled with the error information otherwise + it's an empty reference + */ + css::uno::Reference< css::linguistic2::XSpellAlternatives> xAlternatives; + /** determines whether the error type is a grammar error + */ + bool bIsGrammarError; + /** contains the grammar error information + */ + css::linguistic2::SingleProofreadingError aGrammarError; + /** provides access to the grammar checker interface + */ + css::uno::Reference< css::linguistic2::XProofreader > xGrammarChecker; + /** marks portion as to-be-ignored. This is a return parameter. + */ + /** contains the proposed dialog title if the proof reading component provides one. + */ + OUString sDialogTitle; + + bool bIgnoreThisError; + SpellPortion() : + bIsField(false), + bIsHidden(false), + eLanguage(LANGUAGE_DONTKNOW), + bIsGrammarError(false), + bIgnoreThisError(false) + { + aGrammarError.nErrorStart = aGrammarError.nErrorLength = aGrammarError.nErrorType = 0; + } +}; +typedef std::vector 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..87d4a54ec --- /dev/null +++ b/include/editeng/Trie.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/. + */ + +#ifndef INCLUDED_EDITENG_TRIE_HXX +#define INCLUDED_EDITENG_TRIE_HXX + +#include +#include +#include +#include + +namespace editeng +{ + +struct TrieNode; + +class EDITENG_DLLPUBLIC Trie final +{ +private: + std::unique_ptr mRoot; + +public: + Trie(); + ~Trie(); + + void insert(const OUString& sInputString) const; + void findSuggestions(const OUString& sWordPart, std::vector& 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..2697e5dc5 --- /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 +#include +#include +#include +#include + +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 mxForbiddenChars; + +public: + SvxUnoForbiddenCharsTable(std::shared_ptr const & 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 +#include +#include + +class SvxAutoCorrect; +class SvxAutoCorrCfg; + +class SvxBaseAutoCorrCfg final : public utl::ConfigItem +{ +private: + SvxAutoCorrCfg& rParent; + static css::uno::Sequence GetPropertyNames(); + + virtual void ImplCommit() override; + +public: + SvxBaseAutoCorrCfg(SvxAutoCorrCfg& rParent); + virtual ~SvxBaseAutoCorrCfg() override; + + void Load(bool bInit); + virtual void Notify( const css::uno::Sequence& aPropertyNames) override; + using ConfigItem::SetModified; +}; + +class SvxSwAutoCorrCfg final : public utl::ConfigItem +{ +private: + SvxAutoCorrCfg& rParent; + static css::uno::Sequence GetPropertyNames(); + + virtual void ImplCommit() override; + +public: + SvxSwAutoCorrCfg(SvxAutoCorrCfg& rParent); + virtual ~SvxSwAutoCorrCfg() override; + + void Load(bool bInit); + virtual void Notify( const css::uno::Sequence& aPropertyNames) override; + using ConfigItem::SetModified; +}; +/*-------------------------------------------------------------------- + Description: Configuration for Auto Correction + --------------------------------------------------------------------*/ +class EDITENG_DLLPUBLIC SvxAutoCorrCfg final +{ + friend class SvxBaseAutoCorrCfg; + friend class SvxSwAutoCorrCfg; + + std::unique_ptr 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 +#include +#include +#include + +// 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 +#include + +// 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..54f6da995 --- /dev/null +++ b/include/editeng/blinkitem.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_BLINKITEM_HXX +#define INCLUDED_EDITENG_BLINKITEM_HXX + +#include +#include +#include + +// class SvxBlinkItem ------------------------------------------------- + +/* + [Description] + This item describes, whether to flash. +*/ + +class EDITENG_DLLPUBLIC SvxBlinkItem final : public SfxBoolItem +{ +public: + static SfxPoolItem* CreateDefault(); + + 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..64d7f2c5c --- /dev/null +++ b/include/editeng/borderline.hxx @@ -0,0 +1,245 @@ +/* -*- 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 + +#include +#include +#include +#include + +class IntlWrapper; + +// Line defaults in twips (former Writer defaults): + +#define DEF_LINE_WIDTH_0 1 +#define DEF_LINE_WIDTH_1 20 +#define DEF_LINE_WIDTH_2 50 +#define DEF_LINE_WIDTH_3 80 +#define DEF_LINE_WIDTH_4 100 +#define DEF_LINE_WIDTH_5 10 +#define DEF_LINE_WIDTH_6 5 // 0.25pt + + +// 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 +{ + Color aColor; + + long m_nWidth; + bool m_bMirrorWidths; + BorderWidthImpl m_aWidthImpl; + long m_nMult; + long m_nDiv; + + SvxBorderLineStyle m_nStyle; + + bool m_bUseLeftTop; + Color (*m_pColorOutFn)( Color ); + Color (*m_pColorInFn)( Color ); + Color (*m_pColorGapFn)( Color ); + +public: + SvxBorderLine( const Color *pCol = nullptr, + 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( 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; } + 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( long nMult, 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..7ebb52b12 --- /dev/null +++ b/include/editeng/boxitem.hxx @@ -0,0 +1,266 @@ +/* -*- 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 +#include +#include +#include +#include + + +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 + pTop, + pBottom, + pLeft, + pRight; + sal_uInt16 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( long nMult, 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_uInt16 GetDistance( SvxBoxItemLine nLine ) const; + sal_uInt16 GetSmallestDistance() const; + + bool IsRemoveAdjacentCellBorder() const { return bRemoveAdjCellBorder; } + + void SetDistance( sal_uInt16 nNew, SvxBoxItemLine nLine ); + inline void SetAllDistances( sal_uInt16 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_uInt16 CalcLineSpace( SvxBoxItemLine nLine, bool bEvenIfNoLine = 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); +}; + +inline void SvxBoxItem::SetAllDistances(sal_uInt16 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 : is_typed_flags {}; +} + +class EDITENG_DLLPUBLIC SvxBoxInfoItem final : public SfxPoolItem +{ + std::unique_ptr pHori; //inner horizontal Line + std::unique_ptr 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( long nMult, 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(); +}; + +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..ab9387374 --- /dev/null +++ b/include/editeng/brushitem.hxx @@ -0,0 +1,120 @@ +/* -*- 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 +#include +#include +#include +#include + +// 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; + sal_Int32 nShadingValue; + mutable std::unique_ptr xGraphicObject; + sal_Int8 nGraphicTransparency; //contains a percentage value which is + //copied to the GraphicObject when necessary + SvtSecurityOptions maSecOptions; + 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( const OUString& rLink, const OUString& rFilter, + 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; } + + 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..35266d8a4 --- /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 +#include +#include +#include +#include + + +/** + * 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 + pGraphicObject; + OUString aPrevText; + OUString aFollowText; + sal_uInt16 nStart; + SvxBulletStyle nStyle; + 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; + + 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( 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 +#include +#include + +// 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 +#include +#include + +// class SvxCharRotateItem ---------------------------------------------- + +/* [Description] + + This item defines a character relief and has currently the values + emboss, relief. +*/ + +class EDITENG_DLLPUBLIC SvxCharReliefItem final : public SfxEnumItem +{ +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..25af24742 --- /dev/null +++ b/include/editeng/charrotateitem.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_CHARROTATEITEM_HXX +#define INCLUDED_EDITENG_CHARROTATEITEM_HXX + +#include +#include +#include + + // 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(sal_uInt16 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; + + // our currently only degree values + void SetTopToBottom() { SetValue(2700); } + void SetBottomToTop() { SetValue(900); } + bool IsTopToBottom() const { return 2700 == GetValue(); } + bool IsBottomToTop() const { return 900 == 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( sal_uInt16 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 +#include + +// 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 +#include +#include + +// class SvxCaseMapItem -------------------------------------------------- + +/* [Description] + + This item describe the font type (uppercase, small caps ,...). +*/ + +class EDITENG_DLLPUBLIC SvxCaseMapItem final : public SfxEnumItem +{ +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..1eab79723 --- /dev/null +++ b/include/editeng/colritem.hxx @@ -0,0 +1,79 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_EDITENG_COLRITEM_HXX +#define INCLUDED_EDITENG_COLRITEM_HXX + +#include +#include +#include + +#define VERSION_USEAUTOCOLOR 1 + +/** SvxColorItem item describes a color. +*/ +class EDITENG_DLLPUBLIC SvxColorItem : public SfxPoolItem +{ +private: + Color mColor; + +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); + + void dumpAsXml(xmlTextWriterPtr pWriter) const override; +}; + +// XXX: to be moved in a separate header. +class EDITENG_DLLPUBLIC SvxBackgroundColorItem final : public SvxColorItem +{ +public: + static SfxPoolItem* CreateDefault(); + + SvxBackgroundColorItem(const sal_uInt16 nId); + SvxBackgroundColorItem(const Color& rCol, const sal_uInt16 nId); + + virtual SvxBackgroundColorItem* 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; +}; + +#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 +#include + +// 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 +#include +#include + +// class SvxCrossedOutItem ----------------------------------------------- + +/* [Description] + This item describes, whether and how it is striked out. +*/ + +class EDITENG_DLLPUBLIC SvxCrossedOutItem final : public SfxEnumItem +{ +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..40c74cb2b --- /dev/null +++ b/include/editeng/editdata.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 . + */ + +// MyEDITDATA, wegen exportiertem EditData +#ifndef INCLUDED_EDITENG_EDITDATA_HXX +#define INCLUDED_EDITENG_EDITDATA_HXX + +#include +#include +#include +#include + +class SfxPoolItem; +template 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 +inline std::basic_ostream & operator <<( + std::basic_ostream & 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 +inline std::basic_ostream & operator <<( + std::basic_ostream & 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 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* pParser; + ESelection aSelection; + HtmlImportState eState; + + HtmlTokenId nToken; + + OUString aText; + + HtmlImportInfo( HtmlImportState eState, SvParser* pPrsrs, const ESelection& rSel ); + ~HtmlImportInfo(); +}; + +struct RtfImportInfo +{ + SvParser* pParser; + ESelection aSelection; + RtfImportState eState; + + int nToken; + short nTokenValue; + + RtfImportInfo( RtfImportState eState, SvParser* pPrsrs, const ESelection& rSel ); + ~RtfImportInfo(); +}; + +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; +}; + +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; } +}; + +#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..46f5ccf52 --- /dev/null +++ b/include/editeng/editeng.hxx @@ -0,0 +1,636 @@ +/* -*- 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 +#include + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +template 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 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 : is_typed_flags {}; +} + +enum class SetAttribsMode { + NONE, WholeWord, Edge +}; + +class EDITENG_DLLPUBLIC EditEngine +{ + friend class EditView; + friend class ImpEditView; + friend class EditDbg; + friend class Outliner; + friend class TextChainingUtils; + + +public: + typedef std::vector ViewsType; + + EditSelection InsertText( + css::uno::Reference const & rxDataObj, + const OUString& rBaseURL, const EditPaM& rPaM, bool bUseSpecial); + +private: + std::unique_ptr 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 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(); + + 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). + void SetUpdateMode(bool bUpdate, bool bRestoring = false); + bool GetUpdateMode() 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 IsVertical() const; + bool IsTopToBottom() const; + bool GetDirectVertical() const; + void SetRotation(TextRotation nRotation); + TextRotation GetRotation() const; + + void SetFixedCellHeight( bool bUseFixedCellHeight ); + + void SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir ); + EEHorizontalTextDirection GetDefaultHorizontalTextDirection() const; + + SvtScriptType GetScriptType( const ESelection& rSelection ) const; + LanguageType GetLanguage(const EditPaM& rPaM) const; + LanguageType 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 ); + + OUString GetText( LineEnd eEnd = LINEEND_LF ) const; + OUString GetText( const ESelection& rSelection ) const; + sal_uInt32 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( 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 CreateTextObject(); + std::unique_ptr GetEmptyTextObject() const; + std::unique_ptr CreateTextObject( sal_Int32 nPara, sal_Int32 nParas = 1 ); + std::unique_ptr 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& 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 ); + template + const T& GetParaAttrib( sal_Int32 nPara, TypedWhichId nWhich ) + { + return static_cast(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& rLink ); + Link const & GetModifyHdl() const; + + bool IsInSelectionMode() const; + + void StripPortions(); + void GetPortions( sal_Int32 nPara, std::vector& rList ); + + 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* pOutDev, const tools::Rectangle& rOutRect ); + void Draw( OutputDevice* pOutDev, const tools::Rectangle& rOutRect, const Point& rStartDocPos ); + void Draw( OutputDevice* pOutDev, const tools::Rectangle& rOutRect, const Point& rStartDocPos, bool bClip ); + void Draw( OutputDevice* pOutDev, const Point& rStartPos, short nOrientation = 0 ); + + ErrCode Read( SvStream& rInput, const OUString& rBaseURL, EETextFormat, SvKeyValueIterator* pHTTPHeaderAttrs = nullptr ); + void Write( SvStream& rOutput, EETextFormat ); + + void SetStatusEventHdl( const Link& rLink ); + Link const & GetStatusEventHdl() const; + + void SetNotifyHdl( const Link& rLink ); + Link const & GetNotifyHdl() const; + + void SetRtfImportHdl( const Link& rLink ); + const Link& GetRtfImportHdl() const; + + void SetHtmlImportHdl( const Link& rLink ); + const Link& 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& rRanges ) const; + void SetAllMisspellRanges( const std::vector& rRanges ); + + static void SetForbiddenCharsTable(const std::shared_ptr& 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& 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& rLink ); + void SetEndMovingParagraphsHdl( const Link& rLink ); + void SetBeginPasteOrDropHdl( const Link& rLink ); + void SetEndPasteOrDropHdl( const Link& rLink ); + + virtual void PaintingFirstLine( sal_Int32 nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev ); + 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, + const long* 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, 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(); + virtual void FieldClicked( const SvxFieldItem& rField ); + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional& rTxtColor, std::optional& 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 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& rLink ); + Link const & GetBeginDropHdl() const; + + /** sets a link that is called at the end of a drag operation at an edit view */ + void SetEndDropHdl( const Link& rLink ); + Link 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); + 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 FormatAndUpdate(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(); +}; + +#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..896dea070 --- /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 + +#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..23cc549a9 --- /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 + +#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..129afc522 --- /dev/null +++ b/include/editeng/editids.hrc @@ -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_EDITIDS_HRC +#define INCLUDED_EDITENG_EDITIDS_HRC + +#include + +/* + 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 ( SID_SVX_START + 1 ) +#define SID_ATTR_TABSTOP ( SID_SVX_START + 2 ) +#define SID_ATTR_TABSTOP_DEFAULTS ( SID_SVX_START + 3 ) +#define SID_ATTR_TABSTOP_POS ( SID_SVX_START + 4 ) +#define SID_ATTR_TABSTOP_OFFSET ( SID_SVX_START + 5 ) +#define SID_ATTR_CHAR ( SID_SVX_START + 6 ) +#define SID_ATTR_CHAR_FONT ( SID_SVX_START + 7 ) +#define SID_ATTR_CHAR_POSTURE ( SID_SVX_START + 8 ) +#define SID_ATTR_CHAR_WEIGHT ( SID_SVX_START + 9 ) +#define SID_ATTR_CHAR_SHADOWED ( SID_SVX_START + 10 ) +#define SID_ATTR_CHAR_WORDLINEMODE ( SID_SVX_START + 11 ) +#define SID_ATTR_CHAR_CONTOUR ( SID_SVX_START + 12 ) +#define SID_ATTR_CHAR_STRIKEOUT ( SID_SVX_START + 13 ) +#define SID_ATTR_CHAR_UNDERLINE ( SID_SVX_START + 14 ) +#define SID_ATTR_CHAR_FONTHEIGHT ( SID_SVX_START + 15 ) + // free +#define SID_ATTR_CHAR_COLOR ( SID_SVX_START + 17 ) +#define SID_ATTR_CHAR_KERNING ( SID_SVX_START + 18 ) +#define SID_ATTR_CHAR_CASEMAP ( SID_SVX_START + 19 ) +#define SID_ATTR_CHAR_LANGUAGE ( SID_SVX_START + 20 ) +#define SID_ATTR_CHAR_ESCAPEMENT ( SID_SVX_START + 21 ) +#define SID_ATTR_CHAR_FONTLIST ( SID_SVX_START + 22 ) +#define SID_ATTR_BORDER_OUTER ( SID_SVX_START + 24 ) +#define SID_ATTR_BORDER_SHADOW ( SID_SVX_START + 25 ) + // free +#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 ( SID_SVX_START + 33 ) +#define SID_ATTR_PARA_LINESPACE_10 ( SID_SVX_START + 34 ) +#define SID_ATTR_PARA_LINESPACE_15 ( SID_SVX_START + 35 ) +#define SID_ATTR_PARA_LINESPACE_20 ( SID_SVX_START + 36 ) +#define SID_ATTR_PARA_PAGEBREAK ( SID_SVX_START + 37 ) +#define SID_ATTR_PARA_HYPHENZONE ( SID_SVX_START + 38 ) +#define SID_ATTR_PARA_SPLIT ( SID_SVX_START + 39 ) +#define SID_ATTR_PARA_ORPHANS ( SID_SVX_START + 40 ) +#define SID_ATTR_PARA_WIDOWS ( SID_SVX_START + 41 ) +#define SID_ATTR_PARA_ULSPACE ( SID_SVX_START + 42 ) +#define SID_ATTR_PARA_LRSPACE ( SID_SVX_START + 43 ) +#define SID_ATTR_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 ( 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 ( SID_SVX_START + 855 ) +#define SID_ATTR_CHAR_CHARSETCOLOR ( SID_SVX_START + 877 ) +#define SID_ATTR_CHAR_CJK_FONT ( SID_SVX_START + 887 ) +#define SID_ATTR_CHAR_CJK_FONTHEIGHT ( SID_SVX_START + 888 ) +#define SID_ATTR_CHAR_CJK_LANGUAGE ( SID_SVX_START + 889 ) +#define SID_ATTR_CHAR_CJK_POSTURE ( SID_SVX_START + 890 ) +#define SID_ATTR_CHAR_CJK_WEIGHT ( SID_SVX_START + 891 ) +#define SID_ATTR_CHAR_CTL_FONT ( SID_SVX_START + 892 ) +#define SID_ATTR_CHAR_CTL_FONTHEIGHT ( SID_SVX_START + 893 ) +#define SID_ATTR_CHAR_CTL_LANGUAGE ( SID_SVX_START + 894 ) +#define SID_ATTR_CHAR_CTL_POSTURE ( SID_SVX_START + 895 ) +#define SID_ATTR_CHAR_CTL_WEIGHT ( SID_SVX_START + 896 ) +#define SID_ATTR_CHAR_TWO_LINES ( SID_SVX_START + 897 ) +#define SID_ATTR_CHAR_CJK_RUBY ( SID_SVX_START + 898 ) +#define SID_ATTR_CHAR_EMPHASISMARK ( SID_SVX_START + 899 ) +#define SID_ATTR_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 ( 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 ( SID_EDIT_START + 72 ) +#define SID_ATTR_PARA_OUTLINE_LEVEL ( SID_EDIT_START + 73 ) +#define SID_ATTR_CHAR_PREVIEW_FONT ( SID_EDIT_START + 74 ) +#define SID_ATTR_CHAR_ENDPREVIEW_FONT ( 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 ( 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..f635a93e9 --- /dev/null +++ b/include/editeng/editobj.hxx @@ -0,0 +1,152 @@ +/* -*- 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 +#include +#include +#include +#include + +#include + +#include +#include + +class SfxItemSet; +class SvxFieldItem; +class SvxFieldData; +enum class OutlinerMode; +struct EECharAttrib; + +namespace editeng { + +class FieldUpdater; +class FieldUpdaterImpl; +struct Section; + +} + +namespace svl { + +class SharedString; +class SharedStringPool; + +} + +enum class TextRotation { NONE, TOPTOBOTTOM, BOTTOMTOTOP }; + +class EditTextObjectImpl; + +class EDITENG_DLLPUBLIC EditTextObject final : public SfxItemPoolUser +{ + friend class EditTextObjectImpl; + friend class editeng::FieldUpdaterImpl; + friend class ImpEditEngine; + + std::unique_ptr mpImpl; + + EditTextObject( SfxItemPool* pPool ); + +public: + EditTextObject( const EditTextObject& r ); + virtual ~EditTextObject(); + EditTextObject& operator=( const EditTextObject& ) = delete; + + /** + * Set paragraph strings to the shared string pool. + * + * @param rPool shared string pool. + */ + void NormalizeString( svl::SharedStringPool& rPool ); + + std::vector GetSharedStrings() const; + + const SfxItemPool* GetPool() const; + OutlinerMode GetUserType() const; // For OutlinerMode, it can however not save in compatible format + void SetUserType( OutlinerMode n ); + + bool IsVertical() const; + bool GetDirectVertical() const; + bool IsTopToBottom() const; + void SetVertical( bool bVertical ); + void SetRotation( TextRotation nRotation ); + TextRotation GetRotation() const; + + SvtScriptType GetScriptType() const; + + std::unique_ptr Clone() const; + + sal_Int32 GetParagraphCount() const; + + OUString GetText(sal_Int32 nPara) const; + + void ClearPortionInfo(); + + bool HasOnlineSpellErrors() const; + + void GetCharAttribs( sal_Int32 nPara, std::vector& rLst ) const; + + bool RemoveCharAttribs( sal_uInt16 nWhich ); + + /** + * 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. + */ + void GetAllSections( std::vector& rAttrs ) const; + + bool IsFieldObject() const; + const SvxFieldItem* GetField() const; + const SvxFieldData* GetFieldData(sal_Int32 nPara, size_t nPos, sal_Int32 nType) const; + bool HasField( sal_Int32 nType = css::text::textfield::Type::UNSPECIFIED ) const; + + const SfxItemSet& GetParaAttribs(sal_Int32 nPara) const; + + void GetStyleSheet(sal_Int32 nPara, OUString& rName, SfxStyleFamily& eFamily) const; + void SetStyleSheet(sal_Int32 nPara, const OUString& rName, const SfxStyleFamily& eFamily); + bool ChangeStyleSheets( + const OUString& rOldName, SfxStyleFamily eOldFamily, const OUString& rNewName, SfxStyleFamily eNewFamily); + void ChangeStyleSheetName(SfxStyleFamily eFamily, const OUString& rOldName, const OUString& rNewName); + + editeng::FieldUpdater GetFieldUpdater() const; + + bool operator==( const EditTextObject& rCompare ) const; + + /** Compare, ignoring SfxItemPool pointer. + */ + bool Equals( const EditTextObject& rCompare ) const; + + // #i102062# + bool isWrongListEqual(const EditTextObject& rCompare) const; + + virtual void ObjectInDestruction(const SfxItemPool& rSfxItemPool) override; + +#if DEBUG_EDIT_ENGINE + void Dump() const; +#endif + void dumpAsXml(xmlTextWriterPtr pWriter) const; +}; + +#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..1abb47697 --- /dev/null +++ b/include/editeng/editrids.hrc @@ -0,0 +1,314 @@ +/* -*- 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) reinterpret_cast(Context "\004" 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_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..e23007899 --- /dev/null +++ b/include/editeng/editstat.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_EDITSTAT_HXX +#define INCLUDED_EDITENG_EDITSTAT_HXX + +#include +#include + +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 : is_typed_flags {}; +} + +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 : is_typed_flags {}; +} + +enum class EditStatusFlags +{ + NONE = 0x0000, + HSCROLL = 0x0001, + VSCROLL = 0x0002, + CURSOROUT = 0x0004, + TEXTWIDTHCHANGED = 0x0010, + TextHeightChanged = 0x0020, + WRONGWORDCHANGED = 0x0040 +}; +namespace o3tl +{ + template<> struct typed_flags : is_typed_flags {}; +} + +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, const OUString& rWord ) + : aWord( rWord ) + { + 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..bac117864 --- /dev/null +++ b/include/editeng/editund2.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_EDITUND2_HXX +#define INCLUDED_EDITENG_EDITUND2_HXX + +#include +#include +#include + +class EditEngine; + +class UNLESS_MERGELIBS(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..bf6374ca3 --- /dev/null +++ b/include/editeng/editview.hxx @@ -0,0 +1,334 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +// MyEDITVIEW, due to exported EditView +#ifndef INCLUDED_EDITENG_EDITVIEW_HXX +#define INCLUDED_EDITENG_EDITVIEW_HXX + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +class EditTextObject; +class EditEngine; +class ImpEditEngine; +class ImpEditView; +class OutlinerViewShell; +class SvxSearchItem; +class SvxFieldItem; +namespace vcl { class Window; } +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 dnd { + class XDropTarget; + } +} +namespace linguistic2 { + class XSpellChecker1; + class XLanguageGuessing; +} +}}} + +template 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 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) EditViewCallbacks +{ +public: + EditViewCallbacks() {} + 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; + + // 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; + + // implemented if drag and drop support is wanted + virtual css::uno::Reference GetDropTarget() + { + return nullptr; + } +}; + +class EDITENG_DLLPUBLIC EditView final +{ + friend class EditEngine; + friend class ImpEditEngine; + friend class EditSelFunctionSet; + +public: + typedef std::vector> OutWindowSet; + +public: // Needed for Undo + ImpEditView* GetImpEditView() const { return pImpEditView.get(); } + ImpEditEngine* GetImpEditEngine() const; + +private: + std::unique_ptr + 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; + + 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( long nHorzScroll, 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 ); + void SelectCurrentWord( sal_Int16 nWordType = css::i18n::WordType::ANYWORD_IGNOREWHITESPACES ); + /// Returns the rectangles of the current selection in TWIPs. + void GetSelectionRectangles(std::vector& 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 ); + const tools::Rectangle& GetVisArea() const; + + PointerStyle GetPointer() const; + + vcl::Cursor* GetCursor() const; + + void InsertText( const OUString& rNew, bool bSelect = false ); + 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 ); + void 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( long nDiff ); + + const SfxItemSet& GetEmptyItemSet(); + 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 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::XTransferable > GetTransferable() const; + + // An EditView, so that when TRUE the update will be free from flickering: + void SetEditEngineUpdateMode( bool bUpdate ); + void ForceUpdate(); + + const SfxStyleSheet* GetStyleSheet() const; + SfxStyleSheet* GetStyleSheet(); + + void SetAnchorMode( EEAnchorMode eMode ); + EEAnchorMode GetAnchorMode() const; + + void CompleteAutoCorrect( vcl::Window const * pFrameWin = nullptr ); + + EESpellState StartSpeller( bool bMultipleDoc = false ); + EESpellState StartThesaurus(); + sal_Int32 StartSearchAndReplace( const SvxSearchItem& rSearchItem ); + + // for text conversion + void StartTextConversion( 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 ); + void ExecuteSpellPopup( const Point& rPosPixel, Link const * pCallBack ); + 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; + + /** 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); +}; + +#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..1cadb9978 --- /dev/null +++ b/include/editeng/edtdlg.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_EDTDLG_HXX +#define INCLUDED_EDITENG_EDTDLG_HXX + +#include +#include +#include +#include +#include + +namespace com::sun::star::linguistic2 +{ + class XThesaurus; + class XHyphenator; +} + +template class Link; + +namespace vcl { class Window; } +class SvxSpellWrapper; +class LinkParamNone; + +namespace weld { class Button; } +namespace weld { class ToggleButton; } +namespace weld { class Window; } + + + +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& _rHdl ) = 0; + virtual void SetIgnoreHdl( const Link& _rHdl ) = 0; + virtual void SetIgnoreAllHdl( const Link& _rHdl ) = 0; + virtual void SetChangeHdl( const Link& _rHdl ) = 0; + virtual void SetChangeAllHdl( const Link& _rHdl ) = 0; + virtual void SetClickByCharacterHdl( const Link& _rHdl ) = 0; + virtual void SetConversionFormatChangedHdl( const Link& _rHdl ) = 0; + virtual void SetFindHdl( const Link& _rHdl ) = 0; + virtual bool GetUseBothDirections() const= 0; + virtual editeng::HangulHanjaConversion::ConversionDirection + GetDirection( editeng::HangulHanjaConversion::ConversionDirection _eDefaultDirection ) const = 0; + virtual void SetCurrentString( + const 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 CreateThesaurusDialog(weld::Window*, + css::uno::Reference xThesaurus, + const OUString &rWord, LanguageType nLanguage) = 0; + + virtual VclPtr CreateHyphenWordDialog(weld::Window*, + const OUString &rWord, LanguageType nLang, + css::uno::Reference< css::linguistic2::XHyphenator > &xHyphen, + SvxSpellWrapper* pWrapper) = 0; + virtual VclPtr CreateHangulHanjaConversionDialog(weld::Window* 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 + +#include + +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..667890bf5 --- /dev/null +++ b/include/editeng/eeitem.hxx @@ -0,0 +1,147 @@ +/* -*- 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 +#include + +class SfxBoolItem; +class SfxGrabBagItem; +class SfxInt16Item; +class SvxAdjustItem; +class SvxAutoKernItem; +class SvxBackgroundColorItem; +class SvxCaseMapItem; +class SvxCharReliefItem; +class SvxCharScaleWidthItem; +class SvxColorItem; +class SvxContourItem; +class SvxCrossedOutItem; +class SvxEmphasisMarkItem; +class SvxEscapementItem; +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 EE_PARA_WRITINGDIR (EE_PARA_START+0); +constexpr TypedWhichId EE_PARA_XMLATTRIBS (EE_PARA_START+1); +constexpr TypedWhichId EE_PARA_HANGINGPUNCTUATION (EE_PARA_START+2); +constexpr TypedWhichId EE_PARA_FORBIDDENRULES (EE_PARA_START+3); +constexpr TypedWhichId EE_PARA_ASIANCJKSPACING (EE_PARA_START+4); +constexpr TypedWhichId EE_PARA_NUMBULLET (EE_PARA_START+5); +constexpr TypedWhichId EE_PARA_HYPHENATE (EE_PARA_START+6); +constexpr TypedWhichId EE_PARA_HYPHENATE_NO_CAPS (EE_PARA_START+7); +constexpr TypedWhichId EE_PARA_BULLETSTATE (EE_PARA_START+8); +constexpr TypedWhichId EE_PARA_OUTLLRSPACE (EE_PARA_START+9); +constexpr TypedWhichId EE_PARA_OUTLLEVEL (EE_PARA_START+10); +constexpr TypedWhichId EE_PARA_BULLET (EE_PARA_START+11); +constexpr TypedWhichId EE_PARA_LRSPACE (EE_PARA_START+12); +constexpr TypedWhichId EE_PARA_ULSPACE (EE_PARA_START+13); +constexpr TypedWhichId EE_PARA_SBL (EE_PARA_START+14); +constexpr TypedWhichId EE_PARA_JUST (EE_PARA_START+15); +constexpr TypedWhichId EE_PARA_TABS (EE_PARA_START+16); +constexpr TypedWhichId EE_PARA_JUST_METHOD (EE_PARA_START+17); +constexpr TypedWhichId EE_PARA_VER_JUST (EE_PARA_START+18); +constexpr sal_uInt16 EE_PARA_END (EE_PARA_START + 18); + +// Character attributes: +constexpr sal_uInt16 EE_CHAR_START (EE_PARA_END + 1); +constexpr TypedWhichId EE_CHAR_COLOR (EE_CHAR_START+0); +constexpr TypedWhichId EE_CHAR_FONTINFO (EE_CHAR_START+1); +constexpr TypedWhichId EE_CHAR_FONTHEIGHT (EE_CHAR_START+2); +constexpr TypedWhichId EE_CHAR_FONTWIDTH (EE_CHAR_START+3); +constexpr TypedWhichId EE_CHAR_WEIGHT (EE_CHAR_START+4); +constexpr TypedWhichId EE_CHAR_UNDERLINE (EE_CHAR_START+5); +constexpr TypedWhichId EE_CHAR_STRIKEOUT (EE_CHAR_START+6); +constexpr TypedWhichId EE_CHAR_ITALIC (EE_CHAR_START+7); +constexpr TypedWhichId EE_CHAR_OUTLINE (EE_CHAR_START+8); +constexpr TypedWhichId EE_CHAR_SHADOW (EE_CHAR_START+9); +constexpr TypedWhichId EE_CHAR_ESCAPEMENT (EE_CHAR_START+10); +constexpr TypedWhichId EE_CHAR_PAIRKERNING (EE_CHAR_START+11); +constexpr TypedWhichId EE_CHAR_KERNING (EE_CHAR_START+12); +constexpr TypedWhichId EE_CHAR_WLM (EE_CHAR_START+13); +constexpr TypedWhichId EE_CHAR_LANGUAGE (EE_CHAR_START+14); +constexpr TypedWhichId EE_CHAR_LANGUAGE_CJK (EE_CHAR_START+15); +constexpr TypedWhichId EE_CHAR_LANGUAGE_CTL (EE_CHAR_START+16); +constexpr TypedWhichId EE_CHAR_FONTINFO_CJK (EE_CHAR_START+17); +constexpr TypedWhichId EE_CHAR_FONTINFO_CTL (EE_CHAR_START+18); +constexpr TypedWhichId EE_CHAR_FONTHEIGHT_CJK (EE_CHAR_START+19); +constexpr TypedWhichId EE_CHAR_FONTHEIGHT_CTL (EE_CHAR_START+20); +constexpr TypedWhichId EE_CHAR_WEIGHT_CJK (EE_CHAR_START+21); +constexpr TypedWhichId EE_CHAR_WEIGHT_CTL (EE_CHAR_START+22); +constexpr TypedWhichId EE_CHAR_ITALIC_CJK (EE_CHAR_START+23); +constexpr TypedWhichId EE_CHAR_ITALIC_CTL (EE_CHAR_START+24); +constexpr TypedWhichId EE_CHAR_EMPHASISMARK (EE_CHAR_START+25); +constexpr TypedWhichId EE_CHAR_RELIEF (EE_CHAR_START+26); +constexpr TypedWhichId EE_CHAR_RUBI_DUMMY (EE_CHAR_START+27); +constexpr TypedWhichId EE_CHAR_XMLATTRIBS (EE_CHAR_START+28); +constexpr TypedWhichId EE_CHAR_OVERLINE (EE_CHAR_START+29); +constexpr TypedWhichId EE_CHAR_CASEMAP (EE_CHAR_START+30); +constexpr TypedWhichId EE_CHAR_GRABBAG (EE_CHAR_START+31); +constexpr TypedWhichId 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 sal_uInt16 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..ba31c7238 --- /dev/null +++ b/include/editeng/eerdll.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_EERDLL_HXX +#define INCLUDED_EDITENG_EERDLL_HXX + +#include +#include +#include + +class GlobalEditData; +namespace editeng +{ + class SharedVclResources; +} + +OUString EDITENG_DLLPUBLIC EditResId(const char *pId); + +class EditDLL +{ + std::unique_ptr pGlobalData; + std::weak_ptr pSharedVcl; + +public: + EditDLL(); + ~EditDLL(); + + GlobalEditData* GetGlobalData() const { return pGlobalData.get(); } + std::shared_ptr 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 +#include +#include + +// 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(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 +#include +#include + +// 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..2bd3f583d --- /dev/null +++ b/include/editeng/fhgtitem.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_FHGTITEM_HXX +#define INCLUDED_EDITENG_FHGTITEM_HXX + +#include +#include +#include +#include + +// 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_uLong 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( long nMult, 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..b6057015f --- /dev/null +++ b/include/editeng/fieldupdater.hxx @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_EDITENG_FIELDUPDATER_HXX +#define INCLUDED_EDITENG_FIELDUPDATER_HXX + +#include +#include + +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 mpImpl; + +public: + FieldUpdater(EditTextObject const & 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..2f44c8e25 --- /dev/null +++ b/include/editeng/flditem.hxx @@ -0,0 +1,439 @@ +/* -*- 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 +#include +#include +#include +#include + +#include + +namespace com::sun::star::text { + class XTextContent; +} + +class SvNumberFormatter; +class MetaAction; + +// class SvxFieldItem --------------------------------------------------- + + +class EDITENG_DLLPUBLIC SvxFieldData +{ +public: + static const sal_Int32 UNKNOWN_FIELD; + + static SvxFieldData* Create(const css::uno::Reference& 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 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 mpField; +public: + SvxFieldItem( std::unique_ptr 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 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( const OUString& rURL, const OUString& rRepres, SvxURLFormat eFmt = SvxURLFormat::Url ); + + const OUString& GetURL() const { return aURL; } + void SetURL( const OUString& rURL ) { aURL = rURL; } + + const OUString& GetRepresentation() const { return aRepresentation; } + void SetRepresentation( const OUString& rRep ) { aRepresentation= rRep; } + + const OUString& GetTargetFrame() const { return aTargetFrame; } + void SetTargetFrame( const OUString& rFrm ) { aTargetFrame = rFrm; } + + SvxURLFormat GetFormat() const { return eFormat; } + void SetFormat( SvxURLFormat eFmt ) { eFormat = eFmt; } + + virtual std::unique_ptr 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 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 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 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 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 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 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 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 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 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 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 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 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 +#include +#include +#include + +// 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..9a73a051f --- /dev/null +++ b/include/editeng/fontitem.hxx @@ -0,0 +1,112 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_EDITENG_FONTITEM_HXX +#define INCLUDED_EDITENG_FONTITEM_HXX + +#include +#include +#include +#include + +/** 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, const OUString& rFamilyName, + const OUString& rStyleName, + 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; + 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..dff330959 --- /dev/null +++ b/include/editeng/forbiddencharacterstable.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_FORBIDDENCHARACTERSTABLE_HXX +#define INCLUDED_EDITENG_FORBIDDENCHARACTERSTABLE_HXX + +#include +#include +#include +#include +#include +#include + +namespace com { +namespace sun { +namespace star { +namespace uno { + class XComponentContext; +}}}} + +class EDITENG_DLLPUBLIC SvxForbiddenCharactersTable +{ +public: + typedef std::map Map; +private: + Map maMap; + css::uno::Reference< css::uno::XComponentContext > m_xContext; + SvxForbiddenCharactersTable(const css::uno::Reference< css::uno::XComponentContext >& rxContext); + +public: + static std::shared_ptr makeForbiddenCharactersTable(const css::uno::Reference& 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 +#include + +// 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 +#include +#include + + +// 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 +{ +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..f8801cc77 --- /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 + +/** + * 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, +}; + +const char* 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 +#include +#include + +/* 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 +{ +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..202f44a1b --- /dev/null +++ b/include/editeng/hangulhanja.hxx @@ -0,0 +1,287 @@ +/* -*- 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 +#include +#include + +namespace com::sun::star::lang { struct Locale; } +namespace com::sun::star::uno { class XComponentContext; } +namespace com::sun::star::uno { template class Sequence; } +namespace vcl { class Font; } +namespace weld { class Window; } + + +namespace editeng +{ + + + class HangulHanjaConversion_Impl; + + + //= HangulHanjaConversion + + /** encapsulates Hangul-Hanja conversion functionality + +

terminology: +

  • A text portion is some (potentially large) piece of text + which is to be analyzed for convertible sub-strings.
  • +
  • A text unit is a sub string in a text portion, which is + to be converted as a whole.
  • +
+ 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. +

+ */ + 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::Window* 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( ); + + // converts the whole document + void ConvertDocument(); + + 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 + +

pseudo-abstract, needs to be overridden

+ + @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" + +

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 GetNextPortion) + 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.

+ +

Note that the indexes are relative to the most recent replace action. See + ReplaceUnit for details.

+ + @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 + +

pseudo-abstract, needs to be overridden

+ +

Note an important thing about the indices: They are always relative to the previous + call 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 behind + the changed text. In a next call to ReplaceUnit, an index of 0 will denote exactly + this position behind the previous replacement
+ 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.
+ In the very first call to ReplaceUnit, an index of 0 denotes the very first position of + the current portion.

+ +

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.

+ + @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 + 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 +#include + +// 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..9b3abd338 --- /dev/null +++ b/include/editeng/hyphenzoneitem.hxx @@ -0,0 +1,81 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_EDITENG_HYPHENZONEITEM_HXX +#define INCLUDED_EDITENG_HYPHENZONEITEM_HXX + +#include +#include + +// 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; + sal_uInt8 nMinLead; + sal_uInt8 nMinTrail; + sal_uInt8 nMaxHyphens; + +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; } + + 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; } +}; + +#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..89666949d --- /dev/null +++ b/include/editeng/itemtype.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_ITEMTYPE_HXX +#define INCLUDED_EDITENG_ITEMTYPE_HXX + +// forward --------------------------------------------------------------- +#include +#include +#include +#include + +class Color; +class IntlWrapper; +// static and prototypes ------------------------------------------------- + +static const sal_Unicode cpDelim[] = { ',' , ' ', '\0' }; + +EDITENG_DLLPUBLIC OUString GetMetricText( long nVal, MapUnit eSrcUnit, MapUnit eDestUnit, const IntlWrapper * pIntl ); +OUString GetColorString( const Color& rCol ); +EDITENG_DLLPUBLIC const char* GetMetricId(MapUnit eUnit); + + +inline long Scale( long nVal, long nMult, long nDiv ) +{ + BigInt aVal( nVal ); + aVal *= nMult; + aVal += nDiv/2; + aVal /= nDiv; + return aVal; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/justifyitem.hxx b/include/editeng/justifyitem.hxx new file mode 100644 index 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 +#include +#include +#include + +class EDITENG_DLLPUBLIC SvxHorJustifyItem final : public SfxEnumItem +{ +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 +{ +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 +{ +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..6d511d04b --- /dev/null +++ b/include/editeng/keepitem.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_KEEPITEM_HXX +#define INCLUDED_EDITENG_KEEPITEM_HXX + +#include +#include + + +// 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; +}; + +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..a95eae9ef --- /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 +#include + +// 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( long nMult, 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 +#include +#include + +// class SvxLanguageItem ------------------------------------------------- + +/* [Description] + + This item describes a Language. +*/ + +// MSVC hack: +class SAL_DLLPUBLIC_RTTI SvxLanguageItem_Base: public SfxEnumItem { +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 +#include + +////////////////////////////////////////////////////////////////////////////// +// // 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..88a0bf768 --- /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 +#include +#include + + +// 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( long nMult, 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 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..4fd809ae6 --- /dev/null +++ b/include/editeng/lrspitem.hxx @@ -0,0 +1,160 @@ +/* -*- 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 +#include + + +// 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 +{ + long nTxtLeft; // We spend a sal_uInt16 + long nLeftMargin; // nLeft or the negative first-line indent + long nRightMargin; // The unproblematic right edge + + 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 long nLeft, const long nRight, + const 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( long nMult, long nDiv ) override; + virtual bool HasMetrics() const override; + + // The "layout interface": + inline void SetLeft ( const long nL, const sal_uInt16 nProp = 100 ); + inline void SetRight( const long nR, const sal_uInt16 nProp = 100 ); + + // Query/direct setting of the absolute values + long GetLeft() const { return nLeftMargin; } + long GetRight() const { return nRightMargin;} + void SetLeftValue( const long nL ) { nTxtLeft = nLeftMargin = nL; } + void SetRightValue( const 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 long nL, const sal_uInt16 nProp = 100 ); + 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 dumpAsXml(xmlTextWriterPtr pWriter) const override; + virtual boost::property_tree::ptree dumpAsJSON() const override; +}; + +inline void SvxLRSpaceItem::SetLeft( const long nL, const sal_uInt16 nProp ) +{ + nLeftMargin = (nL * nProp) / 100; + nTxtLeft = nLeftMargin; + nPropLeftMargin = nProp; +} +inline void SvxLRSpaceItem::SetRight( const long nR, const sal_uInt16 nProp ) +{ + if (0 == nR) + { + SetExplicitZeroMarginValRight(true); + } + nRightMargin = (nR * nProp) / 100; + nPropRightMargin = nProp; +} +inline void SvxLRSpaceItem::SetTextFirstLineOffset( const short nF, + const sal_uInt16 nProp ) +{ + nFirstLineOffset = short((long(nF) * nProp ) / 100); + nPropFirstLineOffset = nProp; + AdjustLeft(); +} + +inline void SvxLRSpaceItem::SetTextLeft( const 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 +#include +#include +#include + +// 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 +#include +#include + +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 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..bec53ca51 --- /dev/null +++ b/include/editeng/memberids.h @@ -0,0 +1,185 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef 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 + +// SvxBoxInfoItem +#define MID_HORIZONTAL 1 +#define MID_VERTICAL 2 +#define MID_VALIDFLAGS 4 + +//AdjustItem +#define MID_PARA_ADJUST 0 +#define MID_LAST_LINE_ADJUST 1 +#define MID_EXPAND_SINGLE 2 + +//SvxFontItem +// Don't use 0 as it used for the whole struct +#define MID_FONT_FAMILY_NAME 1 +#define MID_FONT_STYLE_NAME 2 +#define MID_FONT_FAMILY 3 +#define MID_FONT_CHAR_SET 4 +#define MID_FONT_PITCH 5 + +// SvxCharReliefItem +#define MID_RELIEF 0 + +//SvxCharRotateItem +#define MID_ROTATE 0 +#define MID_FITTOLINE 1 + +//SvxExcapementItem +#define MID_ESC 0 +#define MID_ESC_HEIGHT 1 +#define MID_AUTO_ESC 2 + +//SvxFontHeightItem +#define MID_FONTHEIGHT 1 +#define MID_FONTHEIGHT_PROP 2 +#define MID_FONTHEIGHT_DIFF 3 + +//SvxTextLineItem +#define MID_TEXTLINED 0 +#define MID_TL_STYLE 1 +#define MID_TL_COLOR 2 +#define MID_TL_HASCOLOR 3 + +//SvxCrossedOutItem +#define MID_CROSSED_OUT 0 +#define MID_CROSS_OUT 1 + +//SvxPostureItem +#define MID_ITALIC 0 +#define MID_POSTURE 1 + +//SvxBoolItem +#define MID_BOLD 0 +#define MID_WEIGHT 1 + +//SvxLanguageItem +#define MID_LANG_INT 0 +#define MID_LANG_LOCALE 1 + +//SvxEmphasisMarkItem +#define MID_EMPHASIS 0 + +//SvxTwoLinesItem +#define MID_TWOLINES 0 +#define MID_START_BRACKET 1 +#define MID_END_BRACKET 2 + +//ULSpaceItem +#define MID_UP_MARGIN 3 +#define MID_LO_MARGIN 4 +#define MID_UP_REL_MARGIN 5 +#define MID_LO_REL_MARGIN 6 +#define MID_CTX_MARGIN 7 + +//LRSpaceItem +#define MID_L_MARGIN 4 +#define MID_R_MARGIN 5 +#define MID_L_REL_MARGIN 6 +#define MID_R_REL_MARGIN 7 +#define MID_FIRST_LINE_INDENT 8 +#define MID_FIRST_LINE_REL_INDENT 9 +#define MID_FIRST_AUTO 10 +#define MID_TXT_LMARGIN 11 + +//ProtectItem +#define MID_PROTECT_CONTENT 0 +#define MID_PROTECT_SIZE 1 +#define MID_PROTECT_POSITION 2 + +//SvxBoxItem +#define LEFT_BORDER 1 +#define RIGHT_BORDER 2 +#define TOP_BORDER 3 +#define BOTTOM_BORDER 4 +#define BORDER_DISTANCE 5 +#define LEFT_BORDER_DISTANCE 6 +#define RIGHT_BORDER_DISTANCE 7 +#define TOP_BORDER_DISTANCE 8 +#define BOTTOM_BORDER_DISTANCE 9 +#define MID_LEFT_BORDER 10 +#define MID_RIGHT_BORDER 11 +#define MID_TOP_BORDER 12 +#define MID_BOTTOM_BORDER 13 +#define LINE_STYLE 14 +#define LINE_WIDTH 15 + +//BrushItem +#define MID_BACK_COLOR 0 +#define MID_GRAPHIC_POSITION 1 +#define MID_GRAPHIC 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 + +#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..5b8b4d03f --- /dev/null +++ b/include/editeng/misspellrange.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_MISSPELLRANGE_HXX +#define INCLUDED_EDITENG_MISSPELLRANGE_HXX + +#include + +#include + +namespace editeng { + +struct MisspellRange +{ + size_t mnStart; + size_t mnEnd; + + MisspellRange(size_t nStart, size_t nEnd); +}; + +struct MisspellRanges +{ + sal_Int32 mnParagraph; + std::vector maRanges; + + MisspellRanges(sal_Int32 nParagraph, const std::vector& rRanges); +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/mutxhelp.hxx b/include/editeng/mutxhelp.hxx new file mode 100644 index 000000000..2b8aacb51 --- /dev/null +++ b/include/editeng/mutxhelp.hxx @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_EDITENG_MUTXHELP_HXX +#define INCLUDED_EDITENG_MUTXHELP_HXX + +#include + +class SvxMutexHelper +{ +private: + ::osl::Mutex maMutex; + +public: + ::osl::Mutex& getMutex() { return maMutex; } +}; + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/nhypitem.hxx b/include/editeng/nhypitem.hxx new file mode 100644 index 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 +#include + +// 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..152e7566e --- /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..38dbfe903 --- /dev/null +++ b/include/editeng/numitem.hxx @@ -0,0 +1,352 @@ +/* -*- 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class SvxBrushItem; +namespace vcl { class Font; } +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 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 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_Unicode cBullet; // Symbol + sal_uInt16 nBulletRelSize; // percentage size of bullets + Color nBulletColor; // Bullet color + + // mode indicating, if the position and spacing of the list label is + // determined by the former attributes (nFirstLineOffset, nAbsLSpace + // 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 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 + long mnListtabPos; + // specifies the first line indent + long mnFirstLineIndent; + // specifies the indent before the text, e.g. in L2R-layout the left margin + long mnIndentAt; + + std::unique_ptr + pGraphicBrush; + sal_Int16 eVertOrient; // vertical alignment of a bitmap + + Size aGraphicSize; // Always! in 1/100 mm + std::unique_ptr + 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;} + void SetListFormat(const OUString& rSet) { sListFormat = rSet; } + bool HasListFormat() const { return sListFormat.has_value(); } + const OUString& GetListFormat() const { return *sListFormat; } + + void SetCharFormatName(const OUString& rSet){ sCharStyleName = rSet; } + virtual OUString GetCharFormatName()const; + + void SetBulletFont(const vcl::Font* pFont); + const vcl::Font* GetBulletFont() const {return pBulletFont.get();} + void SetBulletChar(sal_Unicode cSet){cBullet = cSet;} + sal_Unicode 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;} + void SetListtabPos( const long nListtabPos ); + long GetListtabPos() const { return mnListtabPos;} + void SetFirstLineIndent( const long nFirstLineIndent ); + long GetFirstLineIndent() const { return mnFirstLineIndent;} + void SetIndentAt( const long nIndentAt ); + long GetIndentAt() const { return mnIndentAt;} + + static Size GetGraphicSizeMM100(const Graphic* pGraphic); + static OUString CreateRomanString( sal_uLong nNo, bool bUpper ); +}; + +//Feature-Flags (only sal_uInt16!) +enum class SvxNumRuleFlags +{ + 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 : is_typed_flags {}; +} + +enum class SvxNumRuleType +{ + NUMBERING, + OUTLINE_NUMBERING, + PRESENTATION_NUMBERING +}; + +class EDITENG_DLLPUBLIC SvxNumRule final +{ + sal_uInt16 nLevelCount; // Number of supported levels + SvxNumRuleFlags nFeatureFlags; // What is supported? + SvxNumRuleType eNumberingType; // Type of numbering + bool bContinuousNumbering; // sequential numbering + + std::unique_ptr aFmts[SVX_MAX_NUM]; + 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(SvStream &rStream); + ~SvxNumRule(); + + bool operator==( const SvxNumRule& ) const; + bool operator!=( const SvxNumRule& rRule ) const {return !(*this == rRule);} + + SvxNumRule& operator=( const SvxNumRule& ); + + 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 +{ + std::unique_ptr pNumRule; +public: + explicit SvxNumBulletItem(SvxNumRule const & rRule); + SvxNumBulletItem(SvxNumRule const & 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; + + SvxNumRule* GetNumRule() const {return pNumRule.get();} + + 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; +} + +std::unique_ptr SvxConvertNumRule( const SvxNumRule* pRule, sal_uInt16 nLevel, SvxNumRuleType eType ); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/opaqitem.hxx b/include/editeng/opaqitem.hxx new file mode 100644 index 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 +#include + +// 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 +#include + + +// 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 +#include + +// 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..a048c4e06 --- /dev/null +++ b/include/editeng/outliner.hxx @@ -0,0 +1,974 @@ +/* -*- 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +class OutlinerEditEng; +class Outliner; +class EditView; +class EditUndo; +class ParagraphList; +class OutlinerParaObject; +class SvStream; +class SvxSearchItem; +class SvxFieldItem; +namespace vcl { class Window; } +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 OverflowingText; +class NonOverflowingText; +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 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 : is_typed_flags {}; +} + +// 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; + + ParaFlag nFlags; + OUString aBulText; + Size aBulSize; + 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 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 aEndCutPasteLink; + +public: + OutlinerView( Outliner* pOut, vcl::Window* pWindow ); + ~OutlinerView(); + + EditView& GetEditView() const { return *pEditView; } + + void Scroll( long nHorzScroll, 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 const & GetVisArea() const; + + void CreateSelectionList (std::vector &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( 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 ); + void Command( const CommandEvent& rCEvt ); + + void StartSpeller(); + EESpellState StartThesaurus(); + sal_Int32 StartSearchAndReplace( const SvxSearchItem& rSearchItem ); + + // for text conversion + void StartTextConversion( 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& 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 ); + + bool IsCursorAtWrongSpelledWord(); + bool IsWrongSpelledWordAtPos( const Point& rPosPixel, bool bMarkIfWrong = false ); + void ExecuteSpellPopup( const Point& rPosPixel, Link const * pCallBack ); + + void SetInvalidateMore( sal_uInt16 nPixel ); + sal_uInt16 GetInvalidateMore() const; + + OUString GetSurroundingText() const; + Selection GetSurroundingTextSelection() const; + + void SetEndCutPasteLinkHdl(const Link &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 ViewShellId GetViewShellId() 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() throw () {} +}; + +// 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; + const long* mpDXArray; + + const EEngineData::WrongSpellVector* mpWrongSpellVector; + const SvxFieldData* mpFieldData; + const css::lang::Locale* mpLocale; + const Color maOverlineColor; + const Color maTextLineColor; + + sal_uInt8 mnBiDiLevel; + + bool mbFilled; + long mnWidthToFill; + + bool mbEndOfLine : 1; + bool mbEndOfParagraph : 1; + bool mbEndOfBullet : 1; + + bool IsRTL() const { return mnBiDiLevel % 2 == 1; } + + DrawPortionInfo( + const Point& rPos, + const OUString& rTxt, + sal_Int32 nTxtStart, + sal_Int32 nTxtLen, + const SvxFont& rFnt, + sal_Int32 nPar, + const long* pDXArr, + const EEngineData::WrongSpellVector* pWrongSpellVector, + const SvxFieldData* pFieldData, + const css::lang::Locale* pLocale, + const Color& rOverlineColor, + const Color& rTextLineColor, + sal_uInt8 nBiDiLevel, + bool bFilled, + long nWidthToFill, + bool bEndOfLine, + bool bEndOfParagraph, + bool bEndOfBullet) + : mrStartPos(rPos), + maText(rTxt), + 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 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 mxTxtColor; + std::optional 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 const & GetTextColor() const { return mxTxtColor; } + void SetTextColor( std::optional xCol ) { mxTxtColor = xCol; } + + std::optional const & GetFieldColor() const { return mxFldColor; } + void SetFieldColor( std::optional 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 +{ + bool bVisible; + sal_uInt16 nType; // see SvxNumberType + OUString aText; + SvxFont aFont; + sal_Int32 nParagraph; + tools::Rectangle aBounds; + + EBulletInfo() : bVisible( false ), nType( 0 ), nParagraph( EE_PARA_NOT_FOUND ) {} +}; + +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 pEditEngine; + + std::unique_ptr pParaList; + ViewList aViewList; + + sal_Int32 mnFirstSelPage; + Link aDrawPortionHdl; + Link aDrawBulletHdl; + Link aParaInsertedHdl; + Link aParaRemovingHdl; + Link aDepthChangedHdl; + Link aBeginMovingHdl; + Link aEndMovingHdl; + Link aIndentingPagesHdl; + Link aRemovingPagesHdl; + Link aCalcFieldValueHdl; + Link maPaintFirstLineHdl; + Link maBeginPasteOrDropHdl; + Link 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_LINK( ParaVisibleStateChangedHdl, Paragraph&, void ); + DECL_LINK( BeginMovingParagraphsHdl, MoveParagraphsInfo&, void ); + DECL_LINK( EndMovingParagraphsHdl, MoveParagraphsInfo&, void ); + DECL_LINK( BeginPasteOrDropHdl, PasteOrDropInfos&, void ); + DECL_LINK( EndPasteOrDropHdl, PasteOrDropInfos&, void ); + DECL_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 ); + + OutlinerMode ImplGetOutlinerMode() const { return nOutlinerMode; } + 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, short nOrientation, + OutputDevice* pOutDev ); + + // 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 nOutlinerMode ); + virtual ~Outliner() override; + + void dumpAsXml(xmlTextWriterPtr pWriter) const; + + void Init( OutlinerMode nOutlinerMode ); + OutlinerMode GetMode() const { return nOutlinerMode; } + + void SetVertical( bool bVertical); + void SetRotation(TextRotation nRotation); + bool IsVertical() const; + bool IsTopToBottom() const; + + 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::unique_ptr 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; } + + void SetUpdateMode( bool bUpdate ); + bool GetUpdateMode() 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 ); + + 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 pUndo ); + bool IsInUndo() const; + + void ClearModifyFlag(); + bool IsModified() const; + + void ParagraphInsertedHdl(Paragraph*); + void SetParaInsertedHdl(const Link& rLink){aParaInsertedHdl=rLink;} + const Link& GetParaInsertedHdl() const { return aParaInsertedHdl; } + + void SetParaRemovingHdl(const Link& rLink){aParaRemovingHdl=rLink;} + const Link& GetParaRemovingHdl() const { return aParaRemovingHdl; } + + std::unique_ptr GetNonOverflowingText() const; + std::unique_ptr GetOverflowingText() const; + void ClearOverflowingParaNum(); + bool IsPageOverflow(); + + std::unique_ptr GetEmptyParaObject() const; + + + void DepthChangedHdl(Paragraph*, ParaFlag nPrevFlags); + void SetDepthChangedHdl(const Link& rLink){aDepthChangedHdl=rLink;} + const Link& GetDepthChangedHdl() const { return aDepthChangedHdl; } + sal_Int16 GetPrevDepth() const { return static_cast(nDepthChangedHdlPrevDepth); } + + bool RemovingPagesHdl( OutlinerView* ); + void SetRemovingPagesHdl(const Link& rLink){aRemovingPagesHdl=rLink;} + bool IndentingPagesHdl( OutlinerView* ); + void SetIndentingPagesHdl(const Link& rLink){aIndentingPagesHdl=rLink;} + // valid only in the two upper handlers + sal_Int32 GetSelPageCount() const { return nDepthChangedHdlPrevDepth; } + + void SetCalcFieldValueHdl(const Link& rLink ) { aCalcFieldValueHdl= rLink; } + const Link& GetCalcFieldValueHdl() const { return aCalcFieldValueHdl; } + + void SetDrawPortionHdl(const Link& rLink){aDrawPortionHdl=rLink;} + + void SetDrawBulletHdl(const Link& rLink){aDrawBulletHdl=rLink;} + + void SetPaintFirstLineHdl(const Link& rLink) { maPaintFirstLineHdl = rLink; } + + void SetModifyHdl( const Link& rLink ); + Link const & GetModifyHdl() const; + + void SetNotifyHdl( const Link& rLink ); + + void SetStatusEventHdl( const Link& rLink ); + Link const & GetStatusEventHdl() const; + + void Draw( OutputDevice* pOutDev, const tools::Rectangle& rOutRect ); + void Draw( OutputDevice* pOutDev, 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 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, + const long* 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, 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 ); + + 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& GetBeginMovingHdl() const { return aBeginMovingHdl; } + void SetBeginMovingHdl(const Link& rLink) {aBeginMovingHdl=rLink;} + const Link& GetEndMovingHdl() const {return aEndMovingHdl;} + void SetEndMovingHdl( const Link& rLink){aEndMovingHdl=rLink;} + + sal_uLong GetLineCount( sal_Int32 nParagraph ) const; + sal_Int32 GetLineLen( sal_Int32 nParagraph, sal_Int32 nLine ) const; + sal_uLong 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& isFieldData = [] (const SvxFieldData* ){return true;} ); + + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional& rTxtColor, std::optional& 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& 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_uLong 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& rLink ); + + /** sets a link that is called at the end of a drag operation at an edit view */ + void SetEndDropHdl( const Link& rLink ); + + /** sets a link that is called before a drop or paste operation. */ + void SetBeginPasteOrDropHdl( const Link& rLink ); + + /** sets a link that is called after a drop or paste operation. */ + void SetEndPasteOrDropHdl( const Link& rLink ); + + sal_Int16 GetNumberingStartValue( sal_Int32 nPara ); + void SetNumberingStartValue( sal_Int32 nPara, sal_Int16 nNumberingStartValue ); + + bool IsParaIsNumberingRestart( sal_Int32 nPara ); + 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..98414deda --- /dev/null +++ b/include/editeng/outlobj.hxx @@ -0,0 +1,120 @@ +/* -*- 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_OUTLOBJ_HXX +#define INCLUDED_EDITENG_OUTLOBJ_HXX + +#include +#include +#include +#include +#include +#include +#include + +class EditTextObject; +enum class OutlinerMode; +enum class TextRotation; + +/** + * This is the guts of OutlinerParaObject, refcounted and shared among + * multiple instances of OutlinerParaObject. + */ +struct OutlinerParaObjData +{ + // data members + std::unique_ptr mpEditTextObject; + ParagraphDataVector maParagraphDataVector; + bool mbIsEditDoc; + + // constructor + OutlinerParaObjData( std::unique_ptr pEditTextObject, const 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 +{ + ::o3tl::cow_wrapper< OutlinerParaObjData > mpImpl; + +public: + // constructors/destructor + OutlinerParaObject( const EditTextObject&, const ParagraphDataVector&, bool bIsEditDoc); + OutlinerParaObject( const EditTextObject&); + OutlinerParaObject( std::unique_ptr ); + OutlinerParaObject( const OutlinerParaObject&); + ~OutlinerParaObject(); + + // assignment operator + OutlinerParaObject& operator=(const OutlinerParaObject& rCandidate); + + // compare operator + bool operator==(const OutlinerParaObject& rCandidate) const; + + // #i102062# + bool isWrongListEqual(const OutlinerParaObject& rCompare) const; + + // outliner mode access + OutlinerMode GetOutlinerMode() const; + void SetOutlinerMode(OutlinerMode nNew); + + // vertical access + bool IsVertical() const; + bool GetDirectVertical() 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(const OUString& rOldName, SfxStyleFamily eOldFamily, + const OUString& rNewName, SfxStyleFamily eNewFamily); + void ChangeStyleSheetName(SfxStyleFamily eFamily, const OUString& rOldName, + const OUString& rNewName); + void SetStyleSheets(sal_uInt16 nLevel, const OUString& rNewName, + const SfxStyleFamily& rNewFamily); + + void dumpAsXml(xmlTextWriterPtr pWriter) const; +}; + +#endif + +/* 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..ad0a662d1 --- /dev/null +++ b/include/editeng/overflowingtxt.hxx @@ -0,0 +1,136 @@ +/* -*- 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 +#include +#include + +#include +#include + +namespace com::sun::star { + namespace datatransfer { class XTransferable; } +} +namespace rtl { + class OUString; +}; +using ::rtl::OUString; + + +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::unique_ptr JuxtaposeParaObject( + css::uno::Reference< css::datatransfer::XTransferable > const & xOverflowingContent, + Outliner *, + OutlinerParaObject const *); + static std::unique_ptr 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 > const & xOverflowingContent); + + std::unique_ptr JuxtaposeParaObject(Outliner *, OutlinerParaObject const *); + std::unique_ptr DeeplyMergeParaObject(Outliner *, OutlinerParaObject const *); + +private: + css::uno::Reference< css::datatransfer::XTransferable > mxOverflowingContent; +}; + +class NonOverflowingText +{ +public: + NonOverflowingText(const ESelection &aSel, bool bLastParaInterrupted); + + std::unique_ptr RemoveOverflowingText(Outliner *) const; + ESelection GetOverflowPointSel() const; + bool IsLastParaInterrupted() const; + +private: + const ESelection maContentSel; + const 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 UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) OFlowChainedText +{ +public: + OFlowChainedText(Outliner const *, bool ); + ~OFlowChainedText(); + + std::unique_ptr InsertOverflowingText(Outliner *, OutlinerParaObject const *); + std::unique_ptr RemoveOverflowingText(Outliner *); + + ESelection GetOverflowPointSel() const; + + bool IsLastParaInterrupted() const; + +private: + std::unique_ptr mpNonOverflowingTxt; + std::unique_ptr mpOverflowingTxt; + + bool mbIsDeepMerge; +}; + +// UFlowChainedText is a simpler class than OFlowChainedText: it almost only joins para-objects +class UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) UFlowChainedText +{ +public: + UFlowChainedText(Outliner const *, bool); + std::unique_ptr 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..e4b080145 --- /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 +#include +#include +#include +#include + +// 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 long GetSloppyPaperDimension( long nSize ); + static OUString GetName( Paper ePaper ); +}; + +// INLINE ----------------------------------------------------------------- + +inline Size &Swap(Size &rSize) +{ + const 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 +#include + +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 +#include + +// 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(SfxUInt16Item::GetValue()); } + void SetValue(Align n) { SfxUInt16Item::SetValue(static_cast(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 +#include + +// 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 +#include + +// 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 +#include + +// 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 +#include +#include + +// class SvxPostureItem -------------------------------------------------- + +/* [Description] + + This item describes the font setting (Italic) +*/ + +class EDITENG_DLLPUBLIC SvxPostureItem final : public SfxEnumItem +{ +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 +#include + + +// 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 +#include + +// 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 +#include + + +// 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 +#include + +// 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..e69ea0bdc --- /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 +#include +#include + +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..819c210f1 --- /dev/null +++ b/include/editeng/section.hxx @@ -0,0 +1,36 @@ +/* -*- 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 + +#include + +class SfxPoolItem; + +namespace editeng { + +struct Section +{ + sal_Int32 mnParagraph; + sal_Int32 mnStart; + sal_Int32 mnEnd; + + std::vector 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..8a843c84b --- /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 +#include +#include + +#include +#include + + +// 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( long nMult, 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 +#include + +// 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..c1ff51f5a --- /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 +#include +#include + +// 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( long nMult, long nDiv ) override; + virtual bool HasMetrics() const override; + + const Size& GetSize() const { return m_aSize; } + void SetSize(const Size& rSize) { m_aSize = rSize; } + + long GetWidth() const { return m_aSize.getWidth(); } + long GetHeight() const { return m_aSize.getHeight(); } + void SetWidth(long n) { m_aSize.setWidth(n); } + void SetHeight(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 +#include + +// 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..e9c719d45 --- /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 +#include +#include +#include +#include +#include + +// 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::Window* pWin; + std::unique_ptr 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::Window* pWn, + const bool bStart, const bool bIsAllRight ); + SvxSpellWrapper( weld::Window* 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..52f7bfdd5 --- /dev/null +++ b/include/editeng/svxacorr.hxx @@ -0,0 +1,444 @@ +/* -*- 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 +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +class CharClass; +class SfxPoolItem; +class SotStorage; +class SvxAutoCorrect; +class SfxObjectShell; +namespace vcl { class Window; } +namespace com::sun::star::embed { class XStorage; } +namespace tools { template class SvRef; } + +struct CompareSvStringsISortDtor +{ + bool operator()( OUString const& lhs, OUString const& rhs ) const + { + return lhs.compareToIgnoreAsciiCase( rhs ) < 0; + } +}; + +class SvStringsISortDtor + : public o3tl::sorted_vector +{ +}; + +// 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. + SaveWordWrdSttLst = 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 + WrdSttLstLoad = 0x80000000, // Exception list for Word Start loaded +}; +namespace o3tl { + template<> struct typed_flags : is_typed_flags {}; +} + +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: + SvxAutoCorrDoc() {} + 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 ) = 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( const OUString& rS, const OUString& rL, bool bFlag = true ) + : sShort( rS ), sLong( rL ), 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 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 FindAndRemove(const SvxAutocorrWord *pWord); + void LoadEntry(const OUString& sWrong, const OUString& sRight, bool bOnlyTxt); + bool empty() const; + + struct CompareSvxAutocorrWordList; + typedef std::vector 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 pCplStt_ExcptLst; + std::unique_ptr pWrdStt_ExcptLst; + std::unique_ptr pAutocorr_List; + SvxAutoCorrect& rAutoCorrect; + + ACFlags nFlags; + + bool IsFileChanged_Imp(); + void LoadXMLExceptList_Imp( std::unique_ptr& rpLst, + const char* pStrmName, + tools::SvRef& rStg); + static void SaveExceptList_Imp( const SvStringsISortDtor& rLst, + const char* pStrmName, + tools::SvRef const & rStg, + bool bConvert = false); + + bool MakeBlocklist_Imp( SotStorage& rStg ); + void RemoveStream_Imp( const OUString& rName ); + void MakeUserStorage_Impl(); + +public: + SvxAutoCorrectLanguageLists( SvxAutoCorrect& rParent, + const OUString& rShareAutoCorrectFile, + const OUString& rUserAutoCorrectFile); + ~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* LoadWrdSttExceptList(); + void SaveWrdSttExceptList(); + SvStringsISortDtor* GetWrdSttExceptList(); + bool AddToWrdSttExceptList(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& aNewEntries, std::vector& aDeleteEntries ); +}; + +class EDITENG_DLLPUBLIC SvxAutoCorrect +{ + friend class SvxAutoCorrectLanguageLists; + + OUString sShareAutoCorrFile, sUserAutoCorrFile; + + SvxSwAutoFormatFlags aSwFlags; // StarWriter AutoFormat Flags + + // all languages in a table + std::map> m_aLangTable; + std::map aLastFileTable; + std::unique_ptr 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( const OUString& rShareAutocorrFile, + const OUString& rUserAutocorrFile ); + 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 ) 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 GetChunkForAutoText(const OUString& 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& aNewEntries, + std::vector& 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 SaveWrdSttExceptList( LanguageType eLang ); + SvStringsISortDtor* LoadWrdSttExceptList( LanguageType eLang ) + { return GetLanguageList_( eLang ).LoadWrdSttExceptList(); } + const SvStringsISortDtor* GetWrdSttExceptList( LanguageType eLang ) + { return GetLanguageList_( eLang ).GetWrdSttExceptList(); } + // Adds a single word. The list will be immediately written to the file! + bool AddWrtSttException( const OUString& rNew, LanguageType eLang); + + // Search through the Languages for the entry + bool FindInWrdSttExceptList( 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&, const OUString&, + 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..fb6147383 --- /dev/null +++ b/include/editeng/svxenum.hxx @@ -0,0 +1,217 @@ +/* -*- 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 + +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, +}; + +#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..1a33e7318 --- /dev/null +++ b/include/editeng/svxfont.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_SVXFONT_HXX +#define INCLUDED_EDITENG_SVXFONT_HXX + +#include +#include +#include + +// 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( static_cast(nNewPropr) * static_cast(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 *pOut ) const; + vcl::Font ChgPhysFont( OutputDevice *pOut ) 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 *pOut, 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, const long* pDXArray = nullptr ) const; + + Size QuickGetTextSize( const OutputDevice *pOut, const OUString &rTxt, + const sal_Int32 nIdx, const sal_Int32 nLen, long* 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 void DrawArrow( OutputDevice &rOut, const tools::Rectangle& rRect, + const Size& rSize, const Color& rCol, bool bLeft ); + 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..2069abb48 --- /dev/null +++ b/include/editeng/svxrtf.hxx @@ -0,0 +1,365 @@ +/* -*- 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 +#include +#include + +#include + +#include +#include +#include +#include + +namespace vcl { class Font; } +class Color; +struct SvxRTFStyleType; +class SvxRTFItemStackType; +class SvxRTFItemStackList : public std::vector> {}; + +// 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 + std::unique_ptr Clone() const; + + // clone NodeIndex + std::unique_ptr MakeNodeIdx() const; +}; + +typedef std::map> SvxRTFFontTbl; +typedef std::map> SvxRTFStyleTbl; + +// 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 sal_uInt16* pWhichRange ); +}; + + +// Here are the IDs for all character attributes, which can be detected by +// SvxParser and can be set in a SfxItemSet. The IDs are set correctly through +// the SlotIds from POOL. +struct RTFPlainAttrMapIds +{ + sal_uInt16 nCaseMap, + nBgColor, + nColor, + nContour, + nCrossedOut, + nEscapement, + nFont, + nFontHeight, + nKering, + nLanguage, + nPosture, + nShadowed, + nUnderline, + nOverline, + nWeight, + nWordlineMode, + nAutoKerning, + nCJKFont, + nCJKFontHeight, + nCJKLanguage, + nCJKPosture, + nCJKWeight, + nCTLFont, + nCTLFontHeight, + nCTLLanguage, + nCTLPosture, + nCTLWeight, + nEmphasis, + nTwoLines, + nCharScaleX, + nHorzVert, + nRelief, + nHidden + ; + RTFPlainAttrMapIds( const SfxItemPool& rPool ); +}; + +// Here are the IDs for all paragraph attributes, which can be detected by +// SvxParser and can be set in a SfxItemSet. The IDs are set correctly through +// the SlotIds from POOL. +struct RTFPardAttrMapIds +{ + sal_uInt16 nLinespacing, + nAdjust, + nTabStop, + nHyphenzone, + nLRSpace, + nULSpace, + nBrush, + nBox, + nShadow, + nOutlineLvl, + nSplit, + nKeep, + nFontAlign, + nScriptSpace, + nHangPunct, + nForbRule, + nDirection + ; + RTFPardAttrMapIds( const SfxItemPool& rPool ); +}; + + +class EDITENG_DLLPUBLIC SvxRTFParser : public SvRTFParser +{ + std::deque< Color* > aColorTbl; + SvxRTFFontTbl m_FontTable; + SvxRTFStyleTbl m_StyleTable; + std::deque< std::unique_ptr > aAttrStack; + SvxRTFItemStackList m_AttrSetList; + + RTFPlainAttrMapIds aPlainMap; + RTFPardAttrMapIds aPardMap; + std::vector aWhichMap; + + std::unique_ptr pInsPos; + SfxItemPool* pAttrPool; + std::unique_ptr pDfltColor; + std::unique_ptr pDfltFont; + std::unique_ptr 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 OUString& DelCharAtEnd( OUString& 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( 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. + RTFPardAttrMapIds& GetPardMap() { return aPardMap; } + // 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::unique_ptr pSttNd; + EditNodeIdx *pEndNd; + sal_Int32 nSttCnt, nEndCnt; + std::unique_ptr m_pChildList; + sal_uInt16 nStyleNo; + + SvxRTFItemStackType(SvxRTFItemStackType const&) = delete; + void operator=(SvxRTFItemStackType const&) = delete; + + SvxRTFItemStackType( SfxItemPool&, const sal_uInt16* pWhichRange, + const EditPosition& ); + + void Add(std::unique_ptr); + 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 *pSttNd; } + const EditNodeIdx& GetEndNode() const { return *pEndNd; } + + 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 +{ + Color* pColor = pDfltColor.get(); + if( nId < aColorTbl.size() ) + pColor = aColorTbl[ nId ]; + return *pColor; +} + +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..4fd1207ce --- /dev/null +++ b/include/editeng/swafopt.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_SWAFOPT_HXX +#define INCLUDED_EDITENG_SWAFOPT_HXX + +#include + +#include +#include +#include +#include + +class SmartTagMgr; + +namespace editeng { + +class EDITENG_DLLPUBLIC IAutoCompleteString +{ +private: + OUString m_String; +public: + explicit IAutoCompleteString(OUString const& rString) : m_String(rString) {} + 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 +{ + 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_Unicode cBullet; + sal_Unicode 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 bAutoCmpltAppendBlanc : 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 +#include +#include +#include + +// 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 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 +#include +#include + +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..1898a3649 --- /dev/null +++ b/include/editeng/txtrange.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_TXTRANGE_HXX +#define INCLUDED_EDITENG_TXTRANGE_HXX + +#include +#include +#include +#include +#include +#include + +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 results; //!< Calculated results for the range. + RangeCacheItem(const Range& rng) : range(rng) {}; + }; + std::deque mRangeCache; //!< Cached range calculations. + tools::PolyPolygon maPolyPolygon; // Surface polygon + std::unique_ptr mpLinePolyPolygon; // Line polygon + mutable std::optional 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* 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 +#include +#include +#include + +// class SvxTextLineItem ------------------------------------------------ + +/* Value container for underline and overline font effects */ + +class EDITENG_DLLPUBLIC SvxTextLineItem : public SfxEnumItem +{ + 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..e6686d658 --- /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 +#include + + +// 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( long nMult, 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..24a910545 --- /dev/null +++ b/include/editeng/unoedhlp.hxx @@ -0,0 +1,157 @@ +/* -*- 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 +#include +#include +#include +#include +#include + +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_uLong 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 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..9786b2399 --- /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 +#include +#include +#include + +#include +#include + +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& 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& rpTxtColor, std::optional& 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 ); + +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 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 +#include +#include +#include +#include +#include +#include + +#include + +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 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& 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& rpTxtColor, std::optional& 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.

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.
+ + @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..218ce288b --- /dev/null +++ b/include/editeng/unofdesc.hxx @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_EDITENG_UNOFDESC_HXX +#define INCLUDED_EDITENG_UNOFDESC_HXX + +#include +#include + +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..8eb521066 --- /dev/null +++ b/include/editeng/unofield.hxx @@ -0,0 +1,110 @@ +/* -*- 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 +#include +#include +#include +#include +#include + +#include +#include + +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( + const OUString& ServiceSpecifier ); + +class EDITENG_DLLPUBLIC SvxUnoTextField final : public SvxMutexHelper, + 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 mpImpl; + css::uno::Sequence< css::uno::Type > maTypeSequence; + +public: + SvxUnoTextField( sal_Int32 nServiceId ) throw(); + SvxUnoTextField( css::uno::Reference< css::text::XTextRange > const & xAnchor, const OUString& rPresentation, const SvxFieldData* pFieldData ) throw(); + virtual ~SvxUnoTextField() throw() override; + + // Internal + std::unique_ptr CreateFieldData() const throw(); + + static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); + 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() throw() override; + virtual void SAL_CALL release() throw() 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 +#include +#include + +// 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& 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& rpTxtColor, std::optional& 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..4695077fa --- /dev/null +++ b/include/editeng/unoforou.hxx @@ -0,0 +1,120 @@ +/* -*- 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 +#include +#include +#include + +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::unique_ptr mpAttribsCache; + + /** 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::unique_ptr mpParaAttribsCache; + + /** 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& 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& rpTxtColor, std::optional& 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..c05ff656e --- /dev/null +++ b/include/editeng/unoipset.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_UNOIPSET_HXX +#define INCLUDED_EDITENG_UNOIPSET_HXX + +#include +#include +#include +#include + +namespace com::sun::star::beans { class XPropertySetInfo; } + +class SfxItemSet; +struct SvxIDPropertyCombine; + +class EDITENG_DLLPUBLIC SvxItemPropertySet +{ + SfxItemPropertyMap m_aPropertyMap; + mutable css::uno::Reference m_xInfo; + ::std::vector< std::unique_ptr > aCombineList; + 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 SfxItemPropertySimpleEntry* pMap, const SfxItemSet& rSet, bool bSearchInParent, bool bDontConvertNegativeValues ); + static void setPropertyValue( const SfxItemPropertySimpleEntry* pMap, const css::uno::Any& rVal, SfxItemSet& rSet, bool bDontConvertNegativeValues ); + + // Methods that use Any instead + css::uno::Any getPropertyValue( const SfxItemPropertySimpleEntry* pMap ) const; + void setPropertyValue( const SfxItemPropertySimpleEntry* pMap, const css::uno::Any& rVal ) const; + + bool AreThereOwnUsrAnys() const { return ! aCombineList.empty(); } + css::uno::Any* GetUsrAnyForID(SfxItemPropertySimpleEntry const & entry) const; + void AddUsrAnyForID(const css::uno::Any& rAny, SfxItemPropertySimpleEntry const & entry); + void ClearAllUsrAny(); + + css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const; + const SfxItemPropertyMap& getPropertyMap() const { return m_aPropertyMap;} + const SfxItemPropertySimpleEntry* getPropertyMapEntry(const OUString &rName) const; +}; + +/** converts the given any with a metric to 100th/mm if needed */ +EDITENG_DLLPUBLIC void SvxUnoConvertToMM( const MapUnit eSourceMapUnit, css::uno::Any & rMetric ) throw(); + +/** converts the given any with a metric from 100th/mm to the given metric if needed */ +EDITENG_DLLPUBLIC void SvxUnoConvertFromMM( const MapUnit eDestinationMapUnit, css::uno::Any & rMetric ) throw(); + +#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..3032b7b7d --- /dev/null +++ b/include/editeng/unolingu.hxx @@ -0,0 +1,132 @@ +/* -*- 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 +#include +#include + +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 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 > const &rxDicList ); + ~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..de2e1fcf6 --- /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 + +// Common across fields +#define UNO_TC_PROP_ANCHOR "Anchor" +#define UNO_TC_PROP_TEXTFIELD_TYPE "TextFieldType" +#define UNO_TC_PROP_IS_FIXED "IsFixed" +#define UNO_TC_PROP_CURRENT_PRESENTATION "CurrentPresentation" +#define UNO_TC_PROP_NAME "Name" +#define UNO_TC_PROP_IS_FIXED_LANGUAGE "IsFixedLanguage" +#define UNO_TC_PROP_NUMFORMAT "NumberFormat" +#define UNO_TC_PROP_USED "IsFieldUsed" +#define UNO_TC_PROP_DISPLAYED "IsFieldDisplayed" + +// Date & Time +#define UNO_TC_PROP_IS_DATE "IsDate" +#define UNO_TC_PROP_DATE_TIME "DateTime" + +// URL +#define UNO_TC_PROP_URL_FORMAT "Format" +#define UNO_TC_PROP_URL_REPRESENTATION "Representation" +#define UNO_TC_PROP_URL_TARGET "TargetFrame" +#define UNO_TC_PROP_URL "URL" + +// Table +#define UNO_TC_PROP_TABLE_POSITION "TablePosition" + +// File +#define UNO_TC_PROP_FILE_FORMAT "FileFormat" + +// Author +#define UNO_TC_PROP_AUTHOR_CONTENT "Content" +#define UNO_TC_PROP_AUTHOR_FORMAT "AuthorFormat" +#define UNO_TC_PROP_AUTHOR_FULLNAME "FullName" + +// Measure +#define UNO_TC_PROP_MEASURE_KIND "Kind" + +#define UNO_TR_PROP_SELECTION "Selection" + +#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..87d1ed12a --- /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 +#include +#include +#include +#include +#include +#include +#include +#include + +namespace com::sun::star::beans { struct PropertyValue; } + +EDITENG_DLLPUBLIC css::uno::Reference< css::container::XIndexReplace > SvxCreateNumRule(const SvxNumRule* pRule); +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() throw(); + +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(const SvxNumRule& rRule); + virtual ~SvxUnoNumberingRules() throw() 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 getNumberingRuleByIndex( sal_Int32 nIndex) const; + /// @throws css::uno::RuntimeException + /// @throws css::lang::IllegalArgumentException + void setNumberingRuleByIndex(const css::uno::Sequence& 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..0fff03424 --- /dev/null +++ b/include/editeng/unoprnms.hxx @@ -0,0 +1,352 @@ +/* -*- 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_UNOPRNMS_HXX +#define INCLUDED_EDITENG_UNOPRNMS_HXX + + +#define UNO_NAME_CHAR_COLOR "CharColor" +#define UNO_NAME_CHAR_HEIGHT "CharHeight" +#define UNO_NAME_CHAR_POSTURE "CharPosture" +#define UNO_NAME_CHAR_SHADOWED "CharShadowed" +#define UNO_NAME_CHAR_UNDERLINE "CharUnderline" +#define UNO_NAME_CHAR_WEIGHT "CharWeight" + +#define UNO_NAME_FILLSTYLE "FillStyle" +#define UNO_NAME_FILLCOLOR "FillColor" +#define UNO_NAME_FILLGRADIENT "FillGradient" +#define UNO_NAME_FILLGRADIENTNAME "FillGradientName" +#define UNO_NAME_FILLHATCH "FillHatch" +#define UNO_NAME_FILLHATCHNAME "FillHatchName" +#define UNO_NAME_FILLBITMAP "FillBitmap" +#define UNO_NAME_FILLBITMAPURL "FillBitmapURL" +#define UNO_NAME_FILLBITMAPNAME "FillBitmapName" +#define UNO_NAME_FILLGRADIENTSTEPCOUNT "FillGradientStepCount" +#define UNO_NAME_FILLBACKGROUND "FillBackground" +#define UNO_NAME_FILLCOLOR_2 "FillColor2" + +#define UNO_NAME_EDGEKIND "EdgeKind" +#define UNO_NAME_EDGELINE1DELTA "EdgeLine1Delta" +#define UNO_NAME_EDGELINE2DELTA "EdgeLine2Delta" +#define UNO_NAME_EDGELINE3DELTA "EdgeLine3Delta" +#define UNO_NAME_EDGENODE1HORZDIST "EdgeNode1HorzDist" +#define UNO_NAME_EDGENODE1VERTDIST "EdgeNode1VertDist" +#define UNO_NAME_EDGENODE2HORZDIST "EdgeNode2HorzDist" +#define UNO_NAME_EDGENODE2VERTDIST "EdgeNode2VertDist" + +#define UNO_NAME_FILLBMP_OFFSET_X "FillBitmapOffsetX" +#define UNO_NAME_FILLBMP_OFFSET_Y "FillBitmapOffsetY" +#define UNO_NAME_FILLBMP_POSITION_OFFSET_X "FillBitmapPositionOffsetX" +#define UNO_NAME_FILLBMP_POSITION_OFFSET_Y "FillBitmapPositionOffsetY" +#define UNO_NAME_FILLBMP_RECTANGLE_POINT "FillBitmapRectanglePoint" +#define UNO_NAME_FILLBMP_TILE "FillBitmapTile" +#define UNO_NAME_FILLBMP_STRETCH "FillBitmapStretch" +#define UNO_NAME_FILLBMP_LOGICAL_SIZE "FillBitmapLogicalSize" +#define UNO_NAME_FILLBMP_SIZE_X "FillBitmapSizeX" +#define UNO_NAME_FILLBMP_SIZE_Y "FillBitmapSizeY" +#define UNO_NAME_FILL_TRANSPARENCE "FillTransparence" +#define UNO_NAME_FILLTRANSPARENCEGRADIENT "FillTransparenceGradient" +#define UNO_NAME_FILLTRANSPARENCEGRADIENTNAME "FillTransparenceGradientName" +#define UNO_NAME_FILLBMP_MODE "FillBitmapMode" + + +#define UNO_NAME_LINESTYLE "LineStyle" +#define UNO_NAME_LINEDASH "LineDash" +#define UNO_NAME_LINEWIDTH "LineWidth" +#define UNO_NAME_LINECOLOR "LineColor" +#define UNO_NAME_LINEJOINT "LineJoint" +#define UNO_NAME_LINESTART "LineStart" +#define UNO_NAME_LINEEND "LineEnd" +#define UNO_NAME_LINESTARTWIDTH "LineStartWidth" +#define UNO_NAME_LINEENDWIDTH "LineEndWidth" +#define UNO_NAME_LINESTARTCENTER "LineStartCenter" +#define UNO_NAME_LINEENDCENTER "LineEndCenter" +#define UNO_NAME_LINETRANSPARENCE "LineTransparence" +#define UNO_NAME_LINECAP "LineCap" + +#define UNO_NAME_SHADOW "Shadow" +#define UNO_NAME_SHADOWCOLOR "ShadowColor" +#define UNO_NAME_SHADOWXDIST "ShadowXDistance" +#define UNO_NAME_SHADOWYDIST "ShadowYDistance" +#define UNO_NAME_SHADOWSIZEX "ShadowSizeX" +#define UNO_NAME_SHADOWSIZEY "ShadowSizeY" +#define UNO_NAME_SHADOWTRANSPARENCE "ShadowTransparence" + +#define UNO_NAME_EDGERADIUS "CornerRadius" + +#define UNO_NAME_TEXT_MINFRAMEHEIGHT "TextMinimumFrameHeight" +#define UNO_NAME_TEXT_AUTOGROWHEIGHT "TextAutoGrowHeight" +#define UNO_NAME_TEXT_FITTOSIZE "TextFitToSize" +#define UNO_NAME_TEXT_LEFTDIST "TextLeftDistance" +#define UNO_NAME_TEXT_RIGHTDIST "TextRightDistance" +#define UNO_NAME_TEXT_UPPERDIST "TextUpperDistance" +#define UNO_NAME_TEXT_LOWERDIST "TextLowerDistance" +#define UNO_NAME_TEXT_VERTADJUST "TextVerticalAdjust" +#define UNO_NAME_TEXT_MAXFRAMEHEIGHT "TextMaximumFrameHeight" +#define UNO_NAME_TEXT_MINFRAMEWIDTH "TextMinimumFrameWidth" +#define UNO_NAME_TEXT_MAXFRAMEWIDTH "TextMaximumFrameWidth" +#define UNO_NAME_TEXT_AUTOGROWWIDTH "TextAutoGrowWidth" +#define UNO_NAME_TEXT_HORZADJUST "TextHorizontalAdjust" +#define UNO_NAME_TEXT_ANIKIND "TextAnimationKind" +#define UNO_NAME_TEXT_ANIDIRECTION "TextAnimationDirection" +#define UNO_NAME_TEXT_ANISTARTINSIDE "TextAnimationStartInside" +#define UNO_NAME_TEXT_ANISTOPINSIDE "TextAnimationStopInside" +#define UNO_NAME_TEXT_ANICOUNT "TextAnimationCount" +#define UNO_NAME_TEXT_ANIDELAY "TextAnimationDelay" +#define UNO_NAME_TEXT_ANIAMOUNT "TextAnimationAmount" +#define UNO_NAME_TEXT_CONTOURFRAME "TextContourFrame" +#define UNO_NAME_TEXT_WRITINGMODE "TextWritingMode" +#define UNO_NAME_TEXT_FONTINDEPENDENTLINESPACING "FontIndependentLineSpacing" +#define UNO_NAME_TEXT_WORDWRAP "TextWordWrap" +#define UNO_NAME_TEXT_CHAINNEXTNAME "TextChainNextName" + +#define UNO_NAME_MEASUREKIND "MeasureKind" +#define UNO_NAME_MEASURETEXTHPOS "MeasureTextHorizontalPosition" +#define UNO_NAME_MEASURETEXTVPOS "MeasureTextVerticalPosition" +#define UNO_NAME_MEASURELINEDIST "MeasureLineDistance" +#define UNO_NAME_MEASUREHELPLINEOVERHANG "MeasureHelpLineOverhang" +#define UNO_NAME_MEASUREHELPLINEDIST "MeasureHelpLineDistance" +#define UNO_NAME_MEASUREHELPLINE1LEN "MeasureHelpLine1Length" +#define UNO_NAME_MEASUREHELPLINE2LEN "MeasureHelpLine2Length" +#define UNO_NAME_MEASUREBELOWREFEDGE "MeasureBelowReferenceEdge" +#define UNO_NAME_MEASURETEXTROTA90 "MeasureTextRotate90" +#define UNO_NAME_MEASURETEXTUPSIDEDOWN "MeasureTextUpsideDown" +#define UNO_NAME_MEASUREOVERHANG "MeasureOverhang" +#define UNO_NAME_MEASUREUNIT "MeasureUnit" +#define UNO_NAME_MEASURESHOWUNIT "MeasureShowUnit" +#define UNO_NAME_MEASUREFORMATSTRING "MeasureFormatString" +#define UNO_NAME_MEASURETEXTAUTOANGLE "MeasureTextAutoAngle" +#define UNO_NAME_MEASURETEXTAUTOANGLEVIEW "MeasureTextAutoAngleView" +#define UNO_NAME_MEASURETEXTISFIXEDANGLE "MeasureTextIsFixedAngle" +#define UNO_NAME_MEASURETEXTFIXEDANGLE "MeasureTextFixedAngle" + +#define UNO_NAME_CIRCKIND "CircleKind" +#define UNO_NAME_CIRCSTARTANGLE "CircleStartAngle" +#define UNO_NAME_CIRCENDANGLE "CircleEndAngle" + +#define UNO_NAME_POLYGONKIND "PolygonKind" +#define UNO_NAME_POLYPOLYGON "PolyPolygon" +#define UNO_NAME_POLYPOLYGONBEZIER "PolyPolygonBezier" +#define UNO_NAME_POLYGON "Polygon" + +#define UNO_NAME_MISC_OBJ_INTEROPGRABBAG "InteropGrabBag" +#define UNO_NAME_MISC_OBJ_ZORDER "ZOrder" +#define UNO_NAME_MISC_OBJ_MOVEPROTECT "MoveProtect" +#define UNO_NAME_MISC_OBJ_SIZEPROTECT "SizeProtect" +#define UNO_NAME_MISC_OBJ_PRINTABLE "Printable" +#define UNO_NAME_MISC_OBJ_LAYERID "LayerID" +#define UNO_NAME_MISC_OBJ_LAYERNAME "LayerName" +#define UNO_NAME_MISC_OBJ_NAME "Name" +#define UNO_NAME_MISC_OBJ_ROTATEANGLE "RotateAngle" +#define UNO_NAME_MISC_OBJ_SHEARANGLE "ShearAngle" +#define UNO_NAME_MISC_OBJ_FRAMERECT "FrameRect" +#define UNO_NAME_MISC_OBJ_BOUNDRECT "BoundRect" + +// #i68101# +#define UNO_NAME_MISC_OBJ_TITLE "Title" +#define UNO_NAME_MISC_OBJ_DESCRIPTION "Description" + +#define UNO_NAME_GRAPHOBJ_FILLBITMAP "GraphicObjectFillBitmap" +#define UNO_NAME_GRAPHOBJ_REPLACEMENT_GRAPHIC "ReplacementGraphic" +#define UNO_NAME_GRAPHOBJ_GRAFSTREAMURL "GraphicStreamURL" +#define UNO_NAME_GRAPHOBJ_URLPKGPREFIX "vnd.sun.star.Package:" +#define UNO_NAME_GRAPHOBJ_GRAPHIC "Graphic" +#define UNO_NAME_GRAPHOBJ_GRAPHIC_URL "GraphicURL" +#define UNO_NAME_GRAPHOBJ_IS_SIGNATURELINE "IsSignatureLine" +#define UNO_NAME_GRAPHOBJ_SIGNATURELINE_ID "SignatureLineId" +#define UNO_NAME_GRAPHOBJ_SIGNATURELINE_SUGGESTED_SIGNER_NAME "SignatureLineSuggestedSignerName" +#define UNO_NAME_GRAPHOBJ_SIGNATURELINE_SUGGESTED_SIGNER_TITLE "SignatureLineSuggestedSignerTitle" +#define UNO_NAME_GRAPHOBJ_SIGNATURELINE_SUGGESTED_SIGNER_EMAIL "SignatureLineSuggestedSignerEmail" +#define UNO_NAME_GRAPHOBJ_SIGNATURELINE_SIGNING_INSTRUCTIONS "SignatureLineSigningInstructions" +#define UNO_NAME_GRAPHOBJ_SIGNATURELINE_SHOW_SIGN_DATE "SignatureLineShowSignDate" +#define UNO_NAME_GRAPHOBJ_SIGNATURELINE_CAN_ADD_COMMENT "SignatureLineCanAddComment" +#define UNO_NAME_GRAPHOBJ_SIGNATURELINE_UNSIGNED_IMAGE "SignatureLineUnsignedImage" +#define UNO_NAME_GRAPHOBJ_SIGNATURELINE_IS_SIGNED "SignatureLineIsSigned" +#define UNO_NAME_GRAPHOBJ_QRCODE "QRCodeProperties" + +#define UNO_NAME_OLE2_METAFILE "MetaFile" +#define UNO_NAME_OLE2_PERSISTNAME "PersistName" + +#define UNO_NAME_3D_SCENE_PERSPECTIVE "D3DScenePerspective" +#define UNO_NAME_3D_SCENE_DISTANCE "D3DSceneDistance" +#define UNO_NAME_3D_SCENE_FOCAL_LENGTH "D3DSceneFocalLength" +#define UNO_NAME_3D_SCENE_TWO_SIDED_LIGHTING "D3DSceneTwoSidedLighting" +#define UNO_NAME_3D_SCENE_LIGHTCOLOR_1 "D3DSceneLightColor1" +#define UNO_NAME_3D_SCENE_LIGHTCOLOR_2 "D3DSceneLightColor2" +#define UNO_NAME_3D_SCENE_LIGHTCOLOR_3 "D3DSceneLightColor3" +#define UNO_NAME_3D_SCENE_LIGHTCOLOR_4 "D3DSceneLightColor4" +#define UNO_NAME_3D_SCENE_LIGHTCOLOR_5 "D3DSceneLightColor5" +#define UNO_NAME_3D_SCENE_LIGHTCOLOR_6 "D3DSceneLightColor6" +#define UNO_NAME_3D_SCENE_LIGHTCOLOR_7 "D3DSceneLightColor7" +#define UNO_NAME_3D_SCENE_LIGHTCOLOR_8 "D3DSceneLightColor8" +#define UNO_NAME_3D_SCENE_LIGHTON_1 "D3DSceneLightOn1" +#define UNO_NAME_3D_SCENE_LIGHTON_2 "D3DSceneLightOn2" +#define UNO_NAME_3D_SCENE_LIGHTON_3 "D3DSceneLightOn3" +#define UNO_NAME_3D_SCENE_LIGHTON_4 "D3DSceneLightOn4" +#define UNO_NAME_3D_SCENE_LIGHTON_5 "D3DSceneLightOn5" +#define UNO_NAME_3D_SCENE_LIGHTON_6 "D3DSceneLightOn6" +#define UNO_NAME_3D_SCENE_LIGHTON_7 "D3DSceneLightOn7" +#define UNO_NAME_3D_SCENE_LIGHTON_8 "D3DSceneLightOn8" +#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_1 "D3DSceneLightDirection1" +#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_2 "D3DSceneLightDirection2" +#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_3 "D3DSceneLightDirection3" +#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_4 "D3DSceneLightDirection4" +#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_5 "D3DSceneLightDirection5" +#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_6 "D3DSceneLightDirection6" +#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_7 "D3DSceneLightDirection7" +#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_8 "D3DSceneLightDirection8" +#define UNO_NAME_3D_SCENE_AMBIENTCOLOR "D3DSceneAmbientColor" +#define UNO_NAME_3D_SCENE_SHADOW_SLANT "D3DSceneShadowSlant" +#define UNO_NAME_3D_SCENE_SHADE_MODE "D3DSceneShadeMode" + +#define UNO_NAME_3D_DOUBLE_SIDED "D3DDoubleSided" +#define UNO_NAME_3D_NORMALS_KIND "D3DNormalsKind" +#define UNO_NAME_3D_NORMALS_INVERT "D3DNormalsInvert" +#define UNO_NAME_3D_TEXTURE_PROJ_X "D3DTextureProjectionX" +#define UNO_NAME_3D_TEXTURE_PROJ_Y "D3DTextureProjectionY" +#define UNO_NAME_3D_SHADOW_3D "D3DShadow3D" +#define UNO_NAME_3D_MAT_COLOR "D3DMaterialColor" +#define UNO_NAME_3D_MAT_EMISSION "D3DMaterialEmission" +#define UNO_NAME_3D_MAT_SPECULAR "D3DMaterialSpecular" +#define UNO_NAME_3D_MAT_SPECULAR_INTENSITY "D3DMaterialSpecularIntensity" +#define UNO_NAME_3D_TEXTURE_KIND "D3DTextureKind" +#define UNO_NAME_3D_TEXTURE_MODE "D3DTextureMode" +#define UNO_NAME_3D_TEXTURE_FILTER "D3DTextureFilter" + +// #i28528# +// Added extra Item (Bool) for chart2 to be able to show reduced line geometry +#define UNO_NAME_3D_REDUCED_LINE_GEOMETRY "D3DReducedLineGeometry" + +#define UNO_NAME_3D_HORZ_SEGS "D3DHorizontalSegments" +#define UNO_NAME_3D_VERT_SEGS "D3DVerticalSegments" + +#define UNO_NAME_3D_PERCENT_DIAGONAL "D3DPercentDiagonal" +#define UNO_NAME_3D_BACKSCALE "D3DBackscale" +#define UNO_NAME_3D_LATHE_END_ANGLE "D3DEndAngle" + +#define UNO_NAME_3D_EXTRUDE_DEPTH "D3DDepth" + +#define UNO_NAME_3D_TRANSFORM_MATRIX "D3DTransformMatrix" +#define UNO_NAME_3D_CAMERA_GEOMETRY "D3DCameraGeometry" +#define UNO_NAME_3D_POS "D3DPosition" +#define UNO_NAME_3D_SIZE "D3DSize" +#define UNO_NAME_3D_POS_IS_CENTER "D3DPositionIsCenter" +#define UNO_NAME_3D_POLYPOLYGON3D "D3DPolyPolygon3D" +#define UNO_NAME_3D_NORMALSPOLYGON3D "D3DNormalsPolygon3D" +#define UNO_NAME_3D_TEXTUREPOLYGON3D "D3DTexturePolygon3D" +#define UNO_NAME_3D_LINEONLY "D3DLineOnly" + +// New 3D properties which are possible for lathe and extrude 3d objects +#define UNO_NAME_3D_SMOOTH_NORMALS "D3DSmoothNormals" +#define UNO_NAME_3D_SMOOTH_LIDS "D3DSmoothLids" +#define UNO_NAME_3D_CHARACTER_MODE "D3DCharacterMode" +#define UNO_NAME_3D_CLOSE_FRONT "D3DCloseFront" +#define UNO_NAME_3D_CLOSE_BACK "D3DCloseBack" + +#define UNO_NAME_NUMBERING "NumberingIsNumber" +#define UNO_NAME_NUMBERING_RULES "NumberingRules" +#define UNO_NAME_NUMBERING_LEVEL "NumberingLevel" + +#define UNO_NAME_NRULE_NUMBERINGTYPE "NumberingType" +#define UNO_NAME_NRULE_PREFIX "Prefix" +#define UNO_NAME_NRULE_SUFFIX "Suffix" +#define UNO_NAME_NRULE_BULLETID "BulletId" +#define UNO_NAME_NRULE_BULLET_COLOR "BulletColor" +#define UNO_NAME_NRULE_BULLET_RELSIZE "BulletRelSize" +#define UNO_NAME_NRULE_BULLET_FONT "BulletFont" +#define UNO_NAME_NRULE_START_WITH "StartWith" +#define UNO_NAME_NRULE_LEFT_MARGIN "LeftMargin" +#define UNO_NAME_NRULE_FIRST_LINE_OFFSET "FirstLineOffset" +#define UNO_NAME_NRULE_ADJUST "Adjust" + +#define UNO_NAME_EDIT_FONT_DESCRIPTOR "FontDescriptor" + +#define UNO_NAME_EDIT_PARA_ADJUST "ParaAdjust" +#define UNO_NAME_EDIT_PARA_BMARGIN "ParaBottomMargin" +#define UNO_NAME_EDIT_PARA_LASTLINEADJ "ParaLastLineAdjust" +#define UNO_NAME_EDIT_PARA_LMARGIN "ParaLeftMargin" +#define UNO_NAME_EDIT_PARA_LINESPACING "ParaLineSpacing" +#define UNO_NAME_EDIT_PARA_RMARGIN "ParaRightMargin" +#define UNO_NAME_EDIT_PARA_TAPSTOPS "ParaTabStops" +#define UNO_NAME_EDIT_PARA_TMARGIN "ParaTopMargin" +#define UNO_NAME_EDIT_PARA_IS_HYPHEN "ParaIsHyphenation" +#define UNO_NAME_EDIT_PARA_IS_HANGING_PUNCTUATION "ParaIsHangingPunctuation" +#define UNO_NAME_EDIT_PARA_IS_CHARACTER_DISTANCE "ParaIsCharacterDistance" +#define UNO_NAME_EDIT_PARA_IS_FORBIDDEN_RULES "ParaIsForbiddenRules" +#define UNO_NAME_EDIT_PARA_FIRST_LINE_INDENT "ParaFirstLineIndent" + +#define UNO_NAME_EDIT_CHAR_HEIGHT "CharHeight" +#define UNO_NAME_EDIT_CHAR_FONTNAME "CharFontName" +#define UNO_NAME_EDIT_CHAR_FONTSTYLENAME "CharFontStyleName" +#define UNO_NAME_EDIT_CHAR_FONTFAMILY "CharFontFamily" +#define UNO_NAME_EDIT_CHAR_FONTCHARSET "CharFontCharSet" +#define UNO_NAME_EDIT_CHAR_FONTPITCH "CharFontPitch" +#define UNO_NAME_EDIT_CHAR_POSTURE "CharPosture" +#define UNO_NAME_EDIT_CHAR_WEIGHT "CharWeight" +#define UNO_NAME_EDIT_CHAR_LOCALE "CharLocale" + +#define UNO_NAME_EDIT_CHAR_HEIGHT_ASIAN "CharHeightAsian" +#define UNO_NAME_EDIT_CHAR_FONTNAME_ASIAN "CharFontNameAsian" +#define UNO_NAME_EDIT_CHAR_FONTSTYLENAME_ASIAN "CharFontStyleNameAsian" +#define UNO_NAME_EDIT_CHAR_FONTFAMILY_ASIAN "CharFontFamilyAsian" +#define UNO_NAME_EDIT_CHAR_FONTCHARSET_ASIAN "CharFontCharSetAsian" +#define UNO_NAME_EDIT_CHAR_FONTPITCH_ASIAN "CharFontPitchAsian" +#define UNO_NAME_EDIT_CHAR_POSTURE_ASIAN "CharPostureAsian" +#define UNO_NAME_EDIT_CHAR_WEIGHT_ASIAN "CharWeightAsian" +#define UNO_NAME_EDIT_CHAR_LOCALE_ASIAN "CharLocaleAsian" + +#define UNO_NAME_EDIT_CHAR_HEIGHT_COMPLEX "CharHeightComplex" +#define UNO_NAME_EDIT_CHAR_FONTNAME_COMPLEX "CharFontNameComplex" +#define UNO_NAME_EDIT_CHAR_FONTSTYLENAME_COMPLEX "CharFontStyleNameComplex" +#define UNO_NAME_EDIT_CHAR_FONTFAMILY_COMPLEX "CharFontFamilyComplex" +#define UNO_NAME_EDIT_CHAR_FONTCHARSET_COMPLEX "CharFontCharSetComplex" +#define UNO_NAME_EDIT_CHAR_FONTPITCH_COMPLEX "CharFontPitchComplex" +#define UNO_NAME_EDIT_CHAR_POSTURE_COMPLEX "CharPostureComplex" +#define UNO_NAME_EDIT_CHAR_WEIGHT_COMPLEX "CharWeightComplex" +#define UNO_NAME_EDIT_CHAR_LOCALE_COMPLEX "CharLocaleComplex" + +#define UNO_NAME_EDIT_CHAR_COLOR "CharColor" +#define UNO_NAME_EDIT_CHAR_TRANSPARENCE "CharTransparence" +#define UNO_NAME_EDIT_CHAR_CROSSEDOUT "CharCrossedOut" +#define UNO_NAME_EDIT_CHAR_STRIKEOUT "CharStrikeout" +#define UNO_NAME_EDIT_CHAR_CASEMAP "CharCaseMap" +#define UNO_NAME_EDIT_CHAR_ESCAPEMENT "CharEscapement" +#define UNO_NAME_EDIT_CHAR_SHADOWED "CharShadowed" +#define UNO_NAME_EDIT_CHAR_UNDERLINE "CharUnderline" +#define UNO_NAME_EDIT_CHAR_OVERLINE "CharOverline" + +#define UNO_NAME_BITMAP "Bitmap" + +#define UNO_NAME_LINKDISPLAYNAME "LinkDisplayName" +#define UNO_NAME_LINKDISPLAYBITMAP "LinkDisplayBitmap" + +#define UNO_NAME_GRAPHIC_LUMINANCE "AdjustLuminance" +#define UNO_NAME_GRAPHIC_CONTRAST "AdjustContrast" +#define UNO_NAME_GRAPHIC_RED "AdjustRed" +#define UNO_NAME_GRAPHIC_GREEN "AdjustGreen" +#define UNO_NAME_GRAPHIC_BLUE "AdjustBlue" +#define UNO_NAME_GRAPHIC_GAMMA "Gamma" +#define UNO_NAME_GRAPHIC_TRANSPARENCY "Transparency" +#define UNO_NAME_GRAPHIC_COLOR_MODE "GraphicColorMode" +#define UNO_NAME_GRAPHIC_GRAPHICCROP "GraphicCrop" + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx new file mode 100644 index 000000000..243d6ab51 --- /dev/null +++ b/include/editeng/unotext.hxx @@ -0,0 +1,673 @@ +/* -*- 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class SvxItemPropertySet; +struct SfxItemPropertyMapEntry; +struct SfxItemPropertySimpleEntry; + +#define WID_FONTDESC OWN_ATTR_VALUE_START +#define WID_NUMLEVEL OWN_ATTR_VALUE_START+1 +#define WID_PORTIONTYPE OWN_ATTR_VALUE_START+2 +#define WID_NUMBERINGSTARTVALUE OWN_ATTR_VALUE_START+3 +#define WID_PARAISNUMBERINGRESTART OWN_ATTR_VALUE_START+4 + +#define SVX_UNOEDIT_NUMBERING_PROPERTIE \ + {OUString(UNO_NAME_NUMBERING_RULES), EE_PARA_NUMBULLET, cppu::UnoType::get(), 0, 0 }, \ + {OUString(UNO_NAME_NUMBERING), EE_PARA_BULLETSTATE,cppu::UnoType::get(), 0, 0 } + +#define SVX_UNOEDIT_OUTLINER_PROPERTIES \ + SVX_UNOEDIT_NUMBERING_PROPERTIE, \ + {OUString(UNO_NAME_NUMBERING_LEVEL), WID_NUMLEVEL, ::cppu::UnoType::get(), 0, 0 }, \ + {OUString("NumberingStartValue"), WID_NUMBERINGSTARTVALUE, ::cppu::UnoType::get(), 0, 0 }, \ + {OUString("ParaIsNumberingRestart"), WID_PARAISNUMBERINGRESTART, cppu::UnoType::get(), 0, 0 } + +#define SVX_UNOEDIT_CHAR_PROPERTIES \ + { OUString(UNO_NAME_EDIT_CHAR_HEIGHT), EE_CHAR_FONTHEIGHT, cppu::UnoType::get(), 0, MID_FONTHEIGHT|CONVERT_TWIPS }, \ + { OUString("CharScaleWidth"), EE_CHAR_FONTWIDTH, ::cppu::UnoType::get(), 0, 0 }, \ + { OUString(UNO_NAME_EDIT_CHAR_FONTNAME), EE_CHAR_FONTINFO, ::cppu::UnoType::get(), 0, MID_FONT_FAMILY_NAME },\ + { OUString(UNO_NAME_EDIT_CHAR_FONTSTYLENAME),EE_CHAR_FONTINFO, ::cppu::UnoType::get(), 0, MID_FONT_STYLE_NAME }, \ + { OUString(UNO_NAME_EDIT_CHAR_FONTFAMILY), EE_CHAR_FONTINFO, ::cppu::UnoType::get(), 0, MID_FONT_FAMILY }, \ + { OUString(UNO_NAME_EDIT_CHAR_FONTCHARSET), EE_CHAR_FONTINFO, ::cppu::UnoType::get(), 0, MID_FONT_CHAR_SET }, \ + { OUString(UNO_NAME_EDIT_CHAR_FONTPITCH), EE_CHAR_FONTINFO, ::cppu::UnoType::get(), 0, MID_FONT_PITCH }, \ + { OUString(UNO_NAME_EDIT_CHAR_POSTURE), EE_CHAR_ITALIC, ::cppu::UnoType::get(),0, MID_POSTURE }, \ + { OUString(UNO_NAME_EDIT_CHAR_WEIGHT), EE_CHAR_WEIGHT, cppu::UnoType::get(), 0, MID_WEIGHT }, \ + { OUString(UNO_NAME_EDIT_CHAR_LOCALE), EE_CHAR_LANGUAGE, ::cppu::UnoType::get(),0, MID_LANG_LOCALE }, \ + { OUString(UNO_NAME_EDIT_CHAR_COLOR), EE_CHAR_COLOR, ::cppu::UnoType::get(), 0, 0 }, \ + { OUString(UNO_NAME_EDIT_CHAR_TRANSPARENCE),EE_CHAR_COLOR, ::cppu::UnoType::get(), 0, MID_COLOR_ALPHA }, \ + { OUString("CharBackColor"), EE_CHAR_BKGCOLOR, ::cppu::UnoType::get(), 0, 0 }, \ + { OUString("CharBackTransparent"), EE_CHAR_BKGCOLOR, ::cppu::UnoType::get(), 0, MID_GRAPHIC_TRANSPARENT }, \ + { OUString(UNO_NAME_EDIT_CHAR_ESCAPEMENT), EE_CHAR_ESCAPEMENT, ::cppu::UnoType::get(), 0, MID_ESC }, \ + { OUString(UNO_NAME_EDIT_CHAR_UNDERLINE), EE_CHAR_UNDERLINE, ::cppu::UnoType::get(), 0, MID_TL_STYLE }, \ + { OUString("CharUnderlineColor"), EE_CHAR_UNDERLINE, ::cppu::UnoType::get(), 0, MID_TL_COLOR }, \ + { OUString("CharUnderlineHasColor"), EE_CHAR_UNDERLINE, cppu::UnoType::get(), 0, MID_TL_HASCOLOR } , \ + { OUString(UNO_NAME_EDIT_CHAR_OVERLINE), EE_CHAR_OVERLINE, ::cppu::UnoType::get(), 0, MID_TL_STYLE }, \ + { OUString("CharOverlineColor"), EE_CHAR_OVERLINE, ::cppu::UnoType::get(), 0, MID_TL_COLOR }, \ + { OUString("CharOverlineHasColor"), EE_CHAR_OVERLINE, cppu::UnoType::get(), 0, MID_TL_HASCOLOR } , \ + { OUString(UNO_NAME_EDIT_CHAR_CROSSEDOUT), EE_CHAR_STRIKEOUT, cppu::UnoType::get(), 0, MID_CROSSED_OUT }, \ + { OUString(UNO_NAME_EDIT_CHAR_STRIKEOUT), EE_CHAR_STRIKEOUT, ::cppu::UnoType::get(), 0, MID_CROSS_OUT}, \ + { OUString(UNO_NAME_EDIT_CHAR_CASEMAP), EE_CHAR_CASEMAP, ::cppu::UnoType::get(), 0, 0 }, \ + { OUString(UNO_NAME_EDIT_CHAR_SHADOWED), EE_CHAR_SHADOW, cppu::UnoType::get(), 0, 0 }, \ + { OUString("CharContoured"), EE_CHAR_OUTLINE, cppu::UnoType::get(), 0, 0 }, \ + { OUString("CharEscapementHeight"), EE_CHAR_ESCAPEMENT, cppu::UnoType::get(), 0, MID_ESC_HEIGHT },\ + { OUString("CharAutoKerning"), EE_CHAR_PAIRKERNING,cppu::UnoType::get(), 0, 0 } , \ + { OUString("CharKerning"), EE_CHAR_KERNING, ::cppu::UnoType::get() , 0, 0 }, \ + { OUString("CharWordMode"), EE_CHAR_WLM, cppu::UnoType::get(), 0, 0 }, \ + { OUString("CharEmphasis"), EE_CHAR_EMPHASISMARK, ::cppu::UnoType::get(), 0, MID_EMPHASIS},\ + { OUString(UNO_NAME_EDIT_CHAR_HEIGHT_ASIAN), EE_CHAR_FONTHEIGHT_CJK, cppu::UnoType::get(), 0, MID_FONTHEIGHT|CONVERT_TWIPS }, \ + { OUString(UNO_NAME_EDIT_CHAR_FONTNAME_ASIAN), EE_CHAR_FONTINFO_CJK, ::cppu::UnoType::get(), 0, MID_FONT_FAMILY_NAME },\ + { OUString(UNO_NAME_EDIT_CHAR_FONTSTYLENAME_ASIAN), EE_CHAR_FONTINFO_CJK, ::cppu::UnoType::get(), 0, MID_FONT_STYLE_NAME }, \ + { OUString(UNO_NAME_EDIT_CHAR_FONTFAMILY_ASIAN), EE_CHAR_FONTINFO_CJK, ::cppu::UnoType::get(), 0, MID_FONT_FAMILY }, \ + { OUString(UNO_NAME_EDIT_CHAR_FONTCHARSET_ASIAN), EE_CHAR_FONTINFO_CJK, ::cppu::UnoType::get(), 0, MID_FONT_CHAR_SET }, \ + { OUString(UNO_NAME_EDIT_CHAR_FONTPITCH_ASIAN), EE_CHAR_FONTINFO_CJK, ::cppu::UnoType::get(), 0, MID_FONT_PITCH }, \ + { OUString(UNO_NAME_EDIT_CHAR_POSTURE_ASIAN), EE_CHAR_ITALIC_CJK, ::cppu::UnoType::get(),0, MID_POSTURE }, \ + { OUString(UNO_NAME_EDIT_CHAR_WEIGHT_ASIAN), EE_CHAR_WEIGHT_CJK, cppu::UnoType::get(), 0, MID_WEIGHT }, \ + { OUString(UNO_NAME_EDIT_CHAR_LOCALE_ASIAN), EE_CHAR_LANGUAGE_CJK, ::cppu::UnoType::get(),0, MID_LANG_LOCALE }, \ + { OUString(UNO_NAME_EDIT_CHAR_HEIGHT_COMPLEX), EE_CHAR_FONTHEIGHT_CTL, cppu::UnoType::get(), 0, MID_FONTHEIGHT|CONVERT_TWIPS }, \ + { OUString(UNO_NAME_EDIT_CHAR_FONTNAME_COMPLEX), EE_CHAR_FONTINFO_CTL, ::cppu::UnoType::get(), 0, MID_FONT_FAMILY_NAME },\ + { OUString(UNO_NAME_EDIT_CHAR_FONTSTYLENAME_COMPLEX),EE_CHAR_FONTINFO_CTL, ::cppu::UnoType::get(), 0, MID_FONT_STYLE_NAME }, \ + { OUString(UNO_NAME_EDIT_CHAR_FONTFAMILY_COMPLEX), EE_CHAR_FONTINFO_CTL, ::cppu::UnoType::get(), 0, MID_FONT_FAMILY }, \ + { OUString(UNO_NAME_EDIT_CHAR_FONTCHARSET_COMPLEX), EE_CHAR_FONTINFO_CTL, ::cppu::UnoType::get(), 0, MID_FONT_CHAR_SET }, \ + { OUString(UNO_NAME_EDIT_CHAR_FONTPITCH_COMPLEX), EE_CHAR_FONTINFO_CTL, ::cppu::UnoType::get(), 0, MID_FONT_PITCH }, \ + { OUString(UNO_NAME_EDIT_CHAR_POSTURE_COMPLEX), EE_CHAR_ITALIC_CTL, ::cppu::UnoType::get(),0, MID_POSTURE }, \ + { OUString(UNO_NAME_EDIT_CHAR_WEIGHT_COMPLEX), EE_CHAR_WEIGHT_CTL, cppu::UnoType::get(), 0, MID_WEIGHT }, \ + { OUString(UNO_NAME_EDIT_CHAR_LOCALE_COMPLEX), EE_CHAR_LANGUAGE_CTL, ::cppu::UnoType::get(),0, MID_LANG_LOCALE }, \ + { OUString("CharRelief"), EE_CHAR_RELIEF, ::cppu::UnoType::get(), 0, MID_RELIEF }, \ + { OUString("CharInteropGrabBag"), EE_CHAR_GRABBAG, cppu::UnoType>::get(), 0, 0} + + +#define SVX_UNOEDIT_FONT_PROPERTIES \ + {OUString(UNO_NAME_EDIT_FONT_DESCRIPTOR), WID_FONTDESC, cppu::UnoType::get(), 0, MID_FONT_FAMILY_NAME } + +#define SVX_UNOEDIT_PARA_PROPERTIES \ + {OUString(UNO_NAME_EDIT_PARA_ADJUST), EE_PARA_JUST, ::cppu::UnoType::get(), 0, MID_PARA_ADJUST }, \ + {OUString(UNO_NAME_EDIT_PARA_BMARGIN), EE_PARA_ULSPACE, ::cppu::UnoType::get(), 0, MID_LO_MARGIN, PropertyMoreFlags::METRIC_ITEM }, \ + {OUString(UNO_NAME_EDIT_PARA_IS_HYPHEN), EE_PARA_HYPHENATE, ::cppu::UnoType::get(), 0, 0 }, \ + {OUString("ParaHyphenationNoCaps"), EE_PARA_HYPHENATE_NO_CAPS, ::cppu::UnoType::get(), 0, 0 }, \ + {OUString(UNO_NAME_EDIT_PARA_LASTLINEADJ), EE_PARA_JUST, ::cppu::UnoType::get(), 0, MID_LAST_LINE_ADJUST }, \ + {OUString(UNO_NAME_EDIT_PARA_LMARGIN), EE_PARA_LRSPACE, ::cppu::UnoType::get(), 0, MID_TXT_LMARGIN, PropertyMoreFlags::METRIC_ITEM }, \ + {OUString(UNO_NAME_EDIT_PARA_LINESPACING), EE_PARA_SBL, cppu::UnoType::get(), 0, CONVERT_TWIPS}, \ + {OUString(UNO_NAME_EDIT_PARA_RMARGIN), EE_PARA_LRSPACE, ::cppu::UnoType::get(), 0, MID_R_MARGIN, PropertyMoreFlags::METRIC_ITEM }, \ + {OUString(UNO_NAME_EDIT_PARA_TAPSTOPS), EE_PARA_TABS, cppu::UnoType>::get(), 0, 0 }, \ + {OUString(UNO_NAME_EDIT_PARA_TMARGIN), EE_PARA_ULSPACE, ::cppu::UnoType::get(), 0, MID_UP_MARGIN, PropertyMoreFlags::METRIC_ITEM },\ + {OUString(UNO_NAME_EDIT_PARA_FIRST_LINE_INDENT), EE_PARA_LRSPACE, ::cppu::UnoType::get(), 0, MID_FIRST_LINE_INDENT, PropertyMoreFlags::METRIC_ITEM}, \ + {OUString(UNO_NAME_EDIT_PARA_IS_HANGING_PUNCTUATION),EE_PARA_HANGINGPUNCTUATION, cppu::UnoType::get(), 0 ,0 }, \ + {OUString(UNO_NAME_EDIT_PARA_IS_CHARACTER_DISTANCE), EE_PARA_ASIANCJKSPACING, cppu::UnoType::get(), 0 ,0 }, \ + {OUString(UNO_NAME_EDIT_PARA_IS_FORBIDDEN_RULES), EE_PARA_FORBIDDENRULES, cppu::UnoType::get(), 0 ,0 },\ + {OUString("WritingMode"), EE_PARA_WRITINGDIR, ::cppu::UnoType::get(), 0, 0 } + +class SvxFieldItem; +class SvxFieldData; + +EDITENG_DLLPUBLIC void GetSelection( struct ESelection& rSel, SvxTextForwarder const * pForwarder ) throw(); +EDITENG_DLLPUBLIC void CheckSelection( struct ESelection& rSel, SvxTextForwarder const * pForwarder ) throw(); + + +// 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 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& 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& rpTxtColor, std::optional& 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 + +{ + friend class SvxUnoTextRangeEnumeration; + friend class ::accessibility::AccessibleEditableTextPara; + const SvxItemPropertySet* mpPropSet; + +protected: + std::unique_ptr 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 SfxItemPropertySimpleEntry* pMap, sal_Int32 nPara = -1 ); + /// @throws css::beans::UnknownPropertyException + /// @throws css::uno::RuntimeException + css::beans::PropertyState _getPropertyState( const OUString& 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 SfxItemPropertySimpleEntry* 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 SfxItemPropertySimpleEntry* pMap, sal_Int32 nPara ); + void SetEditSource( SvxEditSource* _pEditSource ) throw(); + + /// @throws css::beans::UnknownPropertyException + /// @throws css::uno::RuntimeException + void getPropertyValue( const SfxItemPropertySimpleEntry* pMap, css::uno::Any& rAny, const SfxItemSet& rSet ); + /// @throws css::beans::UnknownPropertyException + /// @throws css::lang::IllegalArgumentException + void setPropertyValue( const SfxItemPropertySimpleEntry* 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() throw(); + +public: + // Internal + const ESelection& GetSelection() const throw() + { + const SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr; + CheckSelection(const_cast(this)->maSelection, pForwarder); + return maSelection; + } + void SetSelection( const ESelection& rSelection ) throw(); + + void CollapseToStart() throw(); + void CollapseToEnd() throw(); + bool IsCollapsed() throw(); + bool GoLeft(sal_Int16 nCount, bool Expand) throw(); + bool GoRight(sal_Int16 nCount, bool Expand) throw(); + void GotoStart(bool Expand) throw(); + void GotoEnd(bool Expand) throw(); + + //const SfxItemPropertyMapEntry* getPropertyMapEntries() const throw() { return maPropSet.getPropertyMapEntries(); } + const SvxItemPropertySet* getPropertySet() const throw() { return mpPropSet; } + SvxEditSource* GetEditSource() const throw() { return mpEditSource.get(); } + + static bool SetPropertyValueHelper( const SfxItemPropertySimpleEntry* 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 SfxItemPropertySimpleEntry* pMap, css::uno::Any& aAny, const ESelection* pSelection = nullptr, SvxEditSource* pEditSource = nullptr ); + + void attachField( std::unique_ptr pData ) throw(); + + 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() throw() 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() throw() override; + virtual void SAL_CALL release() throw() 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() throw() 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 ) throw(); + SvxUnoText( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet, css::uno::Reference < css::text::XText > const & xParent ) throw(); + SvxUnoText( const SvxUnoText& rText ) throw(); + virtual ~SvxUnoText() throw() override; + + // Internal + static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); + 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() throw() override; + virtual void SAL_CALL release() throw() 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 + ::osl::Mutex maDisposeContainerMutex; + ::comphelper::OInterfaceContainerHelper2 maDisposeListeners; + bool mbDisposing; + +protected: + using SvxUnoTextRangeBase::setPropertyValue; + using SvxUnoTextRangeBase::getPropertyValue; + +public: + SvxUnoTextContent( const SvxUnoTextBase& rText, sal_Int32 nPara ) throw(); + SvxUnoTextContent( const SvxUnoTextContent& rContent ) throw(); + virtual ~SvxUnoTextContent() throw() 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() throw() override; + virtual void SAL_CALL release() throw() 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 : public ::cppu::WeakAggImplHelper1< css::container::XEnumeration > +{ +private: + css::uno::Reference< css::text::XText > mxParentText; + std::unique_ptr mpEditSource; + sal_Int32 mnNextParagraph; + std::vector< rtl::Reference > maContents; + +public: + SvxUnoTextContentEnumeration( const SvxUnoTextBase& _rText, const ESelection& rSel ) throw(); + virtual ~SvxUnoTextContentEnumeration() throw() override; + + // css::container::XEnumeration + virtual sal_Bool SAL_CALL hasMoreElements( ) override; + virtual css::uno::Any SAL_CALL nextElement( ) override; +}; + + +class SvxUnoTextRangeEnumeration : public ::cppu::WeakAggImplHelper1< css::container::XEnumeration > +{ +private: + std::unique_ptr mpEditSource; + css::uno::Reference< css::text::XText > mxParentText; + std::vector< rtl::Reference > maPortions; + sal_uInt16 mnNextPortion; + +public: + SvxUnoTextRangeEnumeration(const SvxUnoTextBase& rText, sal_Int32 nPara, const ESelection& rSel); + virtual ~SvxUnoTextRangeEnumeration() throw() 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 ) throw(); + SvxUnoTextCursor( const SvxUnoTextCursor& rCursor ) throw(); + virtual ~SvxUnoTextCursor() throw() 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() throw() override; + virtual void SAL_CALL release() throw() 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 +#include + +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 +#include +#include +#include + +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 +#include +#include + +// class SvxWeightItem --------------------------------------------------- + +/* [Description] + + This item describes the font weight. +*/ + +class EDITENG_DLLPUBLIC SvxWeightItem final : public SfxEnumItem +{ +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(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 +#include + +// 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 +#include +#include + +// 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(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 +#include + +// 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..b5eb190fb --- /dev/null +++ b/include/editeng/xmlcnitm.hxx @@ -0,0 +1,75 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_EDITENG_XMLCNITM_HXX +#define INCLUDED_EDITENG_XMLCNITM_HXX + +#include +#include +#include + + +class SvXMLAttrContainerData; + +class EDITENG_DLLPUBLIC SvXMLAttrContainerItem final : public SfxPoolItem +{ + std::unique_ptr pImpl; + +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: */ -- cgit v1.2.3