summaryrefslogtreecommitdiff
path: root/sw/inc
diff options
context:
space:
mode:
authorOliver-Rainer Wittmann <orw@apache.org>2013-11-18 11:29:24 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-11-19 15:51:27 +0000
commitc2b5521921b806ff7b04cdacebde3834d2aafd4b (patch)
treeb38392e0a7d40b58487ea4a72a5ddc748b8cb5b3 /sw/inc
parent06ed06d2808cad5eeea17ee94c0da0426bb6ea9f (diff)
Resolves: #i33737# enable in-place editing of Input Fields
(cherry picked from commit c2afeb1c3f11e8f420b59f3786eb8626c99ff595) Conflicts: sw/inc/IDocumentContentOperations.hxx sw/inc/crsrsh.hxx sw/inc/doc.hxx sw/inc/editsh.hxx sw/inc/expfld.hxx sw/inc/fldbas.hxx sw/inc/fmtfld.hxx sw/inc/hintids.hxx sw/inc/ndtxt.hxx sw/inc/txatbase.hxx sw/inc/txtfld.hxx sw/inc/txtrfmrk.hxx sw/inc/txttxmrk.hxx sw/inc/viscrs.hxx sw/source/core/bastyp/init.cxx sw/source/core/crsr/crsrsh.cxx sw/source/core/crsr/crstrvl.cxx sw/source/core/crsr/findattr.cxx sw/source/core/crsr/findtxt.cxx sw/source/core/crsr/swcrsr.cxx sw/source/core/crsr/viscrs.cxx sw/source/core/doc/dbgoutsw.cxx sw/source/core/doc/doc.cxx sw/source/core/doc/docfld.cxx sw/source/core/doc/docfmt.cxx sw/source/core/doc/docnum.cxx sw/source/core/doc/docredln.cxx sw/source/core/doc/docruby.cxx sw/source/core/doc/doctxm.cxx sw/source/core/doc/visiturl.cxx sw/source/core/docnode/nodes.cxx sw/source/core/edit/edatmisc.cxx sw/source/core/edit/edattr.cxx sw/source/core/edit/edfld.cxx sw/source/core/edit/edfldexp.cxx sw/source/core/edit/editsh.cxx sw/source/core/edit/edlingu.cxx sw/source/core/edit/ednumber.cxx sw/source/core/fields/expfld.cxx sw/source/core/fields/fldbas.cxx sw/source/core/fields/reffld.cxx sw/source/core/frmedt/fefly1.cxx sw/source/core/inc/docfld.hxx sw/source/core/inc/rolbck.hxx sw/source/core/inc/swfont.hxx sw/source/core/layout/flycnt.cxx sw/source/core/layout/laycache.cxx sw/source/core/layout/trvlfrm.cxx sw/source/core/text/atrhndl.hxx sw/source/core/text/atrstck.cxx sw/source/core/text/inftxt.cxx sw/source/core/text/porfld.cxx sw/source/core/text/porfld.hxx sw/source/core/text/txtfld.cxx sw/source/core/tox/tox.cxx sw/source/core/tox/txmsrt.cxx sw/source/core/txtnode/atrfld.cxx sw/source/core/txtnode/ndhints.cxx sw/source/core/txtnode/ndtxt.cxx sw/source/core/txtnode/thints.cxx sw/source/core/txtnode/txatbase.cxx sw/source/core/txtnode/txatritr.cxx sw/source/core/txtnode/txtedt.cxx sw/source/core/undo/SwUndoField.cxx sw/source/core/undo/rolbck.cxx sw/source/core/undo/unsect.cxx sw/source/core/undo/untbl.cxx sw/source/core/unocore/unocrsrhelper.cxx sw/source/core/unocore/unofield.cxx sw/source/core/unocore/unoframe.cxx sw/source/core/unocore/unorefmk.cxx sw/source/core/view/vprint.cxx sw/source/filter/ascii/ascatr.cxx sw/source/filter/html/htmlatr.cxx sw/source/filter/rtf/rtffly.cxx sw/source/filter/ww1/fltshell.cxx sw/source/filter/ww1/w1filter.cxx sw/source/filter/ww8/wrtw8esh.cxx sw/source/filter/ww8/wrtw8nds.cxx sw/source/filter/ww8/ww8atr.cxx sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par3.cxx sw/source/filter/ww8/ww8par5.cxx sw/source/ui/app/applab.cxx sw/source/ui/docvw/edtwin.cxx sw/source/ui/docvw/edtwin2.cxx sw/source/ui/envelp/envfmt.cxx sw/source/ui/fldui/fldedt.cxx sw/source/ui/fldui/fldmgr.cxx sw/source/ui/inc/wrtsh.hxx sw/source/ui/lingu/hhcwrp.cxx sw/source/ui/shells/basesh.cxx sw/source/ui/shells/drwtxtex.cxx sw/source/ui/shells/grfsh.cxx sw/source/ui/shells/tabsh.cxx sw/source/ui/shells/textfld.cxx sw/source/ui/shells/textidx.cxx sw/source/ui/shells/textsh.cxx sw/source/ui/shells/textsh1.cxx sw/source/ui/shells/txtattr.cxx sw/source/ui/uiview/formatclipboard.cxx sw/source/ui/uiview/view.cxx sw/source/ui/uiview/view2.cxx sw/source/ui/uiview/viewsrch.cxx sw/source/ui/uiview/viewstat.cxx sw/source/ui/uiview/viewtab.cxx sw/source/ui/wrtsh/wrtsh1.cxx sw/source/ui/wrtsh/wrtsh2.cxx Change-Id: I6758d6719e1fd523797cc6ee2648ffcb47d52595
Diffstat (limited to 'sw/inc')
-rw-r--r--sw/inc/IDocumentContentOperations.hxx67
-rw-r--r--sw/inc/crsrsh.hxx36
-rw-r--r--sw/inc/doc.hxx14
-rw-r--r--sw/inc/editsh.hxx5
-rw-r--r--sw/inc/expfld.hxx34
-rw-r--r--sw/inc/fldbas.hxx7
-rw-r--r--sw/inc/fmtfld.hxx33
-rw-r--r--sw/inc/hintids.hxx12
-rw-r--r--sw/inc/ndtxt.hxx53
-rw-r--r--sw/inc/txatbase.hxx16
-rw-r--r--sw/inc/txtfld.hxx76
-rw-r--r--sw/inc/txtrfmrk.hxx3
-rw-r--r--sw/inc/txttxmrk.hxx1
-rw-r--r--sw/inc/viscrs.hxx21
14 files changed, 238 insertions, 140 deletions
diff --git a/sw/inc/IDocumentContentOperations.hxx b/sw/inc/IDocumentContentOperations.hxx
index 7bb156bfbe67..7fd45f74febe 100644
--- a/sw/inc/IDocumentContentOperations.hxx
+++ b/sw/inc/IDocumentContentOperations.hxx
@@ -17,33 +17,34 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
- #ifndef INCLUDED_SW_INC_IDOCUMENTCONTENTOPERATIONS_HXX
- #define INCLUDED_SW_INC_IDOCUMENTCONTENTOPERATIONS_HXX
-
- #include <sal/types.h>
-
- class SwPaM;
- struct SwPosition;
- class SwNode;
- class SwNodeRange;
- class Graphic;
- class SfxItemSet;
- class SfxPoolItem;
- class GraphicObject;
- class SdrObject;
- class SwFrmFmt;
- class SwDrawFrmFmt;
- class SwFlyFrmFmt;
- class SwNodeIndex;
-
- namespace utl { class TransliterationWrapper; }
- namespace svt { class EmbeddedObjectRef; }
-
- /** Text operation/manipulation interface
- */
- class IDocumentContentOperations
- {
- public:
+#ifndef INCLUDED_SW_INC_IDOCUMENTCONTENTOPERATIONS_HXX
+#define INCLUDED_SW_INC_IDOCUMENTCONTENTOPERATIONS_HXX
+
+#include <sal/types.h>
+
+class SwPaM;
+struct SwPosition;
+class SwNode;
+class SwNodeRange;
+class Graphic;
+class SfxItemSet;
+class SfxPoolItem;
+class GraphicObject;
+class SdrObject;
+class SwFrmFmt;
+class SwDrawFrmFmt;
+class SwFlyFrmFmt;
+class SwNodeIndex;
+class SwFmtFld;
+
+namespace utl { class TransliterationWrapper; }
+namespace svt { class EmbeddedObjectRef; }
+
+/** Text operation/manipulation interface
+*/
+class IDocumentContentOperations
+{
+public:
enum SwMoveFlags
{
DOC_MOVEDEFAULT = 0x00,
@@ -61,7 +62,7 @@
, INS_FORCEHINTEXPAND = 0x04 // expand all hints at insert position
};
- public:
+public:
/** Copying of a range within or to another document.
The position can also be within the range!
*/
@@ -86,7 +87,7 @@
Needed for hiding of deletion redlines
*/
virtual bool DeleteAndJoin( SwPaM&,
- const bool bForceJoinNext = false ) = 0;
+ const bool bForceJoinNext = false ) = 0;
virtual bool MoveRange(SwPaM&, SwPosition&, SwMoveFlags) = 0;
@@ -115,7 +116,7 @@
const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
virtual SwFlyFrmFmt* Insert(const SwPaM& rRg, const GraphicObject& rGrfObj, const SfxItemSet* pFlyAttrSet,
- const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
+ const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
/** Transpose graphic (with undo)
*/
@@ -129,7 +130,7 @@
/** Insert OLE-objects.
*/
virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, const SfxItemSet* pFlyAttrSet,
- const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
+ const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
virtual SwFlyFrmFmt* InsertOLE(const SwPaM &rRg, const OUString& rObjName, sal_Int64 nAspect, const SfxItemSet* pFlyAttrSet,
const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
@@ -165,13 +166,13 @@
const sal_uInt16 nFlags,bool bExpandCharToPara=false) = 0;
virtual bool InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
- const sal_uInt16 nFlags) = 0;
+ const sal_uInt16 nFlags) = 0;
/** Removes any leading white space from the paragraph
*/
virtual void RemoveLeadingWhiteSpace(const SwPosition & rPos ) = 0;
- protected:
+protected:
virtual ~IDocumentContentOperations() {};
};
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 47f41c70d732..8548d91f7766 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -64,9 +64,8 @@ class SwTOXMark;
class SwRedline;
class IBlockCursor;
class SwCntntNode;
-
class SwPostItField;
-
+class SwTxtFld;
struct SwPosition;
namespace com { namespace sun { namespace star { namespace util {
@@ -232,9 +231,9 @@ private:
bool m_bMacroExecAllowed : 1;
- SW_DLLPRIVATE void UpdateCrsr( sal_uInt16 eFlags
- =SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE,
- sal_Bool bIdleEnd = sal_False );
+ SW_DLLPRIVATE void UpdateCrsr(
+ sal_uInt16 eFlags = SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE,
+ sal_Bool bIdleEnd = sal_False );
SW_DLLPRIVATE void _ParkPams( SwPaM* pDelRg, SwShellCrsr** ppDelRing );
@@ -699,11 +698,27 @@ public:
inline void UnSetVisCrsr();
// jump to the next or previous field of the corresponding type
- sal_Bool MoveFldType( const SwFieldType* pFldType, sal_Bool bNext,
- sal_uInt16 nSubType = USHRT_MAX,
- sal_uInt16 nResType = USHRT_MAX );
+ sal_Bool MoveFldType(
+ const SwFieldType* pFldType,
+ const bool bNext,
+ const sal_uInt16 nResType = USHRT_MAX,
+ const bool bAddSetExpressionFldsToInputFlds = true );
+
sal_Bool GotoFld( const SwFmtFld& rFld );
+ SwTxtFld* GetTxtFldAtPos(
+ const SwPosition* pPos,
+ const bool bIncludeInputFldAtStart ) const;
+ SwField* GetFieldAtCrsr(
+ const SwPaM* pCrsr,
+ const bool bIncludeInputFldAtStart ) const;
+ SwField* GetCurFld( const bool bIncludeInputFldAtStart = false ) const;
+ bool CrsrInsideInputFld() const;
+ bool PosInsideInputFld( const SwPosition& rPos ) const;
+ bool DocPtInsideInputFld( const Point& rDocPt ) const;
+ xub_StrLen StartOfInputFldAtPos( const SwPosition& rPos ) const;
+ xub_StrLen EndOfInputFldAtPos( const SwPosition& rPos ) const;
+
// Return number of cursors in ring (The flag indicates whether
// only cursors containing selections are requested).
sal_uInt16 GetCrsrCnt( sal_Bool bAll = sal_True ) const;
@@ -783,6 +798,9 @@ public:
bool GotoINetAttr( const SwTxtINetFmt& rAttr );
const SwFmtINetFmt* FindINetAttr( const OUString& rName ) const;
+ sal_Bool SelectTxt( const xub_StrLen nStart,
+ const xub_StrLen nEnd );
+
sal_Bool CheckTblBoxCntnt( const SwPosition* pPos = 0 );
void SaveTblBoxCntnt( const SwPosition* pPos = 0 );
void ClearTblBoxCntnt();
@@ -833,8 +851,6 @@ public:
@return the textual description of the current selection
*/
OUString GetCrsrDescr() const;
-
- SwRect GetRectOfCurrentChar();
};
// Cursor Inlines:
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 2de669d02a18..378c6b5ac7ef 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -836,13 +836,13 @@ public:
@param rPos position to search at
@return pointer to field at the given position or NULL in case no field is found
*/
- static SwField* GetField(const SwPosition& rPos);
+ static SwField* GetFieldAtPos(const SwPosition& rPos);
/** Returns the field at a certain position.
@param rPos position to search at
@return pointer to field at the given position or NULL in case no field is found
*/
- static SwTxtFld* GetTxtFld(const SwPosition& rPos);
+ static SwTxtFld* GetTxtFldAtPos(const SwPosition& rPos);
bool containsUpdatableFields();
/** IDocumentContentOperations
@@ -855,7 +855,6 @@ public:
// Needed for hiding of deletion redlines
virtual bool DeleteAndJoin( SwPaM&,
const bool bForceJoinNext = false );
-
virtual bool MoveRange(SwPaM&, SwPosition&, SwMoveFlags);
virtual bool MoveNodeRange(SwNodeRange&, SwNodeIndex&, SwMoveFlags);
virtual bool MoveAndJoin(SwPaM&, SwPosition&, SwMoveFlags);
@@ -871,9 +870,14 @@ public:
virtual SwDrawFrmFmt* Insert(const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet* pFlyAttrSet, SwFrmFmt*);
virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, const SfxItemSet* pFlyAttrSet,
const SfxItemSet* pGrfAttrSet, SwFrmFmt*);
+
/// Add a para for the char attribute exp...
- virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&,
- const SetAttrMode nFlags,bool bExpandCharToPara=false);
+ virtual bool InsertPoolItem(
+ const SwPaM &rRg,
+ const SfxPoolItem&,
+ const SetAttrMode nFlags,
+ const bool bExpandCharToPara=false);
+
virtual bool InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
const SetAttrMode nFlags);
virtual void ReRead(SwPaM&, const OUString& rGrfName, const OUString& rFltName, const Graphic* pGraphic, const GraphicObject* pGrfObj);
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index bbafef9e22a3..9991fd014987 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -236,8 +236,8 @@ public:
const bool bMergeIndentValuesOfNumRule = false ) const;
sal_Bool GetCurAttr( SfxItemSet& ,
const bool bMergeIndentValuesOfNumRule = false ) const;
- void SetAttr( const SfxPoolItem&, sal_uInt16 nFlags = 0 );
- void SetAttr( const SfxItemSet&, sal_uInt16 nFlags = 0, SwPaM* pCrsr = NULL );
+ void SetAttrItem( const SfxPoolItem&, sal_uInt16 nFlags = 0 );
+ void SetAttrSet( const SfxItemSet&, sal_uInt16 nFlags = 0, SwPaM* pCrsr = NULL );
/**
* Get the paragraph format attribute(s) of the current selection.
@@ -358,7 +358,6 @@ public:
{ return (SwCharFmt*)SwEditShell::GetFmtFromPool( nId ); }
void Insert2(SwField&, const bool bForceExpandHints = false);
- SwField* GetCurFld() const;
void UpdateFlds( SwField & ); ///< One single field.
diff --git a/sw/inc/expfld.hxx b/sw/inc/expfld.hxx
index 4599911f7006..2944589c42e4 100644
--- a/sw/inc/expfld.hxx
+++ b/sw/inc/expfld.hxx
@@ -293,20 +293,40 @@ public:
class SW_DLLPUBLIC SwInputField : public SwField
{
- OUString aContent;
+ mutable OUString aContent;
OUString aPText;
OUString aHelp;
OUString aToolTip;
- sal_uInt16 nSubType;
+ sal_uInt16 nSubType;
+ bool mbIsFormField;
+
+ SwFmtFld* mpFmtFld; // attribute to which the <SwInputField> belongs to
virtual OUString Expand() const;
virtual SwField* Copy() const;
+ // Accessing Input Field's content
+ const OUString& getContent() const;
+
public:
/// Direct input via dialog; delete old value.
- SwInputField(SwInputFieldType*, const OUString& rContent,
- const OUString& rPrompt, sal_uInt16 nSubType = 0,
- sal_uLong nFmt = 0);
+ SwInputField(
+ SwInputFieldType* pFieldType,
+ const OUString& rContent,
+ const OUString& rPrompt,
+ sal_uInt16 nSubType = 0,
+ sal_uLong nFmt = 0,
+ bool bIsFormField = true );
+ virtual ~SwInputField();
+
+ void SetFmtFld( SwFmtFld& rFmtFld );
+ SwFmtFld* GetFmtFld();
+
+ // Providing new Input Field's content:
+ // Fill Input Field's content depending on <nSupType>.
+ void applyFieldContent( const OUString& rNewFieldContent );
+
+ bool isFormField() const;
virtual OUString GetFieldName() const;
@@ -324,9 +344,7 @@ public:
virtual OUString GetToolTip() const;
virtual void SetToolTip(const OUString & rStr);
- virtual sal_Bool isFormField() const;
-
- virtual sal_uInt16 GetSubType() const;
+ virtual sal_uInt16 GetSubType() const;
virtual void SetSubType(sal_uInt16 nSub);
virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index 661dd78bc020..453d2468e866 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -276,6 +276,8 @@ class SW_DLLPUBLIC SwField
{
private:
mutable OUString m_Cache; ///< Cached expansion (for clipboard).
+ bool m_bUseFieldValueCache; /// control the usage of the cached field value
+
sal_uInt16 nLang; ///< Always change via SetLanguage!
sal_Bool bIsAutomaticLanguage;
sal_uInt32 nFormat;
@@ -288,7 +290,10 @@ private:
protected:
void SetFormat(sal_uInt32 nSet) {nFormat = nSet;}
- SwField(SwFieldType* pTyp, sal_uInt32 nFmt = 0, sal_uInt16 nLang = LANGUAGE_SYSTEM);
+ SwField( SwFieldType* pTyp,
+ sal_uInt32 nFmt = 0,
+ sal_uInt16 nLang = LANGUAGE_SYSTEM,
+ bool m_bUseFieldValueCache = true );
public:
virtual ~SwField();
diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx
index 56184d0ce8b7..47826637cb24 100644
--- a/sw/inc/fmtfld.hxx
+++ b/sw/inc/fmtfld.hxx
@@ -38,19 +38,16 @@ class SwFieldType;
// ATT_FLD
class SW_DLLPUBLIC SwFmtFld : public SfxPoolItem, public SwClient, public SfxBroadcaster
{
- friend class SwTxtFld;
friend void _InitCore();
+ SwFmtFld( sal_uInt16 nWhich ); // for default-Attibute
::com::sun::star::uno::WeakReference<
::com::sun::star::text::XTextField> m_wXTextField;
- SwField *pField;
- SwTxtFld* pTxtAttr;
+ SwField* mpField;
+ SwTxtFld* mpTxtFld; // the TextAttribute
- SwFmtFld(); ///< Default attibute.
-
- /* Protected CopyCtor.
- @@@ copy construction allowed, but copy assignment is not? @@@ */
+ // @@@ copy construction allowed, but copy assignment is not? @@@
SwFmtFld& operator=(const SwFmtFld& rFld);
protected:
@@ -76,11 +73,11 @@ public:
const SwField* GetField() const
{
- return pField;
+ return mpField;
}
SwField* GetField()
{
- return pField;
+ return mpField;
}
/**
@@ -90,13 +87,23 @@ public:
@attention The current field will be destroyed before setting the new field.
*/
- void SetFld(SwField * pField);
+ void SetField( SwField * pField );
+
+
+ const SwTxtFld* GetTxtFld() const
+ {
+ return mpTxtFld;
+ }
+ SwTxtFld* GetTxtFld()
+ {
+ return mpTxtFld;
+ }
+ void SetTxtFld( SwTxtFld& rTxtFld );
+ void ClearTxtFld();
- const SwTxtFld *GetTxtFld() const { return pTxtAttr; }
- SwTxtFld *GetTxtFld() { return pTxtAttr; }
void RegisterToFieldType( SwFieldType& );
- sal_Bool IsFldInDoc() const;
+ bool IsFldInDoc() const;
sal_Bool IsProtect() const;
SW_DLLPRIVATE ::com::sun::star::uno::WeakReference<
diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index 00d20c440ea9..5773c2f7ca72 100644
--- a/sw/inc/hintids.hxx
+++ b/sw/inc/hintids.hxx
@@ -29,11 +29,15 @@
#define CH_TXTATR_INWORD ((sal_Unicode)0xFFF9)
#define CH_TXTATR_TAB ((sal_Unicode)'\t')
#define CH_TXTATR_NEWLINE ((sal_Unicode)'\n')
-#define CH_TXT_ATR_FIELDSTART ((sal_Unicode)0x04)
-#define CH_TXT_ATR_FIELDEND ((sal_Unicode)0x05)
+#define CH_TXT_ATR_INPUTFIELDSTART ((sal_Unicode)0x04)
+#define CH_TXT_ATR_INPUTFIELDEND ((sal_Unicode)0x05)
+
+#define CH_TXT_ATR_FORMELEMENT ((sal_Unicode)0x06)
+
+#define CH_TXT_ATR_FIELDSTART ((sal_Unicode)0x07)
+#define CH_TXT_ATR_FIELDEND ((sal_Unicode)0x08)
#define CH_TXT_ATR_SUBST_FIELDSTART ("[")
#define CH_TXT_ATR_SUBST_FIELDEND ("]")
-#define CH_TXT_ATR_FORMELEMENT ((sal_Unicode)0x06)
/*
* Enums for the hints
@@ -127,7 +131,7 @@ RES_TXTATR_WITHEND_BEGIN = RES_TXTATR_BEGIN ,
RES_TXTATR_CHARFMT, // 51
RES_TXTATR_CJK_RUBY, // 52
RES_TXTATR_UNKNOWN_CONTAINER, // 53
- RES_TXTATR_DUMMY5, // 54
+ RES_TXTATR_INPUTFIELD, // 54
RES_TXTATR_WITHEND_END,
// all TextAttributes without an end
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 516f9c70aa73..d8b23ff60ecb 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -46,6 +46,8 @@ namespace utl {
class SwTxtFmtColl;
class SwCntntFrm;
+class SwTxtFld;
+class SwTxtInputFld;
class SfxItemSet;
class SwUndoTransliterate;
struct SwSpellArgs;
@@ -179,6 +181,8 @@ class SW_DLLPUBLIC SwTxtNode: public SwCntntNode, public ::sfx2::Metadatable
SW_DLLPRIVATE void impl_FmtToTxtAttr(const SfxItemSet& i_rAttrSet);
+ const SwTxtInputFld* GetOverlappingInputFld( const SwTxtAttr& rTxtAttr ) const;
+
public:
bool IsWordCountDirty() const;
bool IsWrongDirty() const;
@@ -262,7 +266,7 @@ public:
refmarks, toxmarks, and metas will be ignored unless this is true
ATTENTION: setting bInclRefToxMark is only allowed from UNDO!
*/
- void RstAttr(
+ void RstTxtAttr(
const SwIndex &rIdx,
const xub_StrLen nLen,
const sal_uInt16 nWhich = 0,
@@ -350,8 +354,8 @@ public:
bool bFmtToTxtAttributes = true );
enum GetTxtAttrMode {
- DEFAULT, /// DEFAULT: (Start < nIndex <= End)
- EXPAND, /// EXPAND : (Start <= nIndex < End)
+ DEFAULT, /// DEFAULT: (Start <= nIndex < End)
+ EXPAND, /// EXPAND : (Start < nIndex <= End)
PARENT, /// PARENT : (Start < nIndex < End)
};
@@ -363,16 +367,19 @@ public:
hints of which several may cover a single position, like
RES_TXTATR_CHARFMT, RES_TXTATR_REFMARK, RES_TXTATR_TOXMARK
*/
- SwTxtAttr *GetTxtAttrAt(xub_StrLen const nIndex, RES_TXTATR const nWhich,
- enum GetTxtAttrMode const eMode = DEFAULT) const;
+ SwTxtAttr *GetTxtAttrAt(
+ xub_StrLen const nIndex,
+ RES_TXTATR const nWhich,
+ enum GetTxtAttrMode const eMode = DEFAULT ) const;
/** get the innermost text attributes covering position nIndex.
@param nWhich only attributes with this id are returned.
@param eMode the predicate for matching (@see GetTxtAttrMode).
*/
- ::std::vector<SwTxtAttr *> GetTxtAttrsAt(xub_StrLen const nIndex,
- RES_TXTATR const nWhich,
- enum GetTxtAttrMode const eMode = DEFAULT) const;
+ ::std::vector<SwTxtAttr *> GetTxtAttrsAt(
+ xub_StrLen const nIndex,
+ RES_TXTATR const nWhich,
+ enum GetTxtAttrMode const eMode = DEFAULT ) const;
/** get the text attribute at position nIndex which owns
the dummy character CH_TXTATR_* at that position, if one exists.
@@ -381,8 +388,13 @@ public:
attribute with given which id
@return the text attribute at nIndex of type nWhich, if it exists
*/
- SwTxtAttr *GetTxtAttrForCharAt( const xub_StrLen nIndex,
- const RES_TXTATR nWhich = RES_TXTATR_END ) const;
+ SwTxtAttr *GetTxtAttrForCharAt(
+ const xub_StrLen nIndex,
+ const RES_TXTATR nWhich = RES_TXTATR_END ) const;
+
+ SwTxtFld* GetFldTxtAttrAt(
+ const xub_StrLen nIndex,
+ const bool bIncludeInputFldAtStart = false ) const;
OUString GetCurWord(xub_StrLen) const;
sal_uInt16 Spell(SwSpellArgs*);
@@ -398,8 +410,6 @@ public:
(Method in ndcopy.cxx!!). */
void CopyCollFmt( SwTxtNode& rDestNd );
- //const SwNodeNum* _GetNodeNum() const { return pNdNum; }
-
//
// BEGIN OF BULLET/NUMBERING/OUTLINE STUFF:
//
@@ -432,18 +442,6 @@ public:
void UpdateOutlineState();
- /** Returns if this text node may be numbered.
-
- A text node may be numbered if
- - it has no SwNodeNum
- - it has a SwNodeNum and it has a numbering rule and the according
- SwNumFmt defines a numbering type that is an enumeration.
-
- @retval sal_True this text node may be numbered
- @retval sal_False else
- */
- //sal_Bool MayBeNumbered() const;
-
/**
Notify this textnode that its numbering rule has changed.
*/
@@ -735,8 +733,11 @@ public:
TYPEINFO(); // fuer rtti
/// override SwIndexReg
- virtual void Update( SwIndex const & rPos, const sal_Int32 nChangeLen,
- const bool bNegative = false, const bool bDelete = false );
+ virtual void Update(
+ SwIndex const & rPos,
+ const sal_Int32 nChangeLen,
+ const bool bNegative = false,
+ const bool bDelete = false );
/// change text to Upper/Lower/Hiragana/Katagana/...
void TransliterateText( utl::TransliterationWrapper& rTrans,
diff --git a/sw/inc/txatbase.hxx b/sw/inc/txatbase.hxx
index 234110a3d615..266b205ed436 100644
--- a/sw/inc/txatbase.hxx
+++ b/sw/inc/txatbase.hxx
@@ -57,6 +57,7 @@ private:
bool m_bHasDummyChar : 1; // without end + meta
bool m_bFormatIgnoreStart : 1; ///< text formatting should ignore start
bool m_bFormatIgnoreEnd : 1; ///< text formatting should ignore end
+ bool m_bHasContent : 1; // text attribute with content
protected:
SwTxtAttr( SfxPoolItem& rAttr, sal_Int32 nStart );
@@ -69,6 +70,7 @@ protected:
void SetDontExpandStartAttr(bool bFlag) { m_bDontExpandStart = bFlag; }
void SetNesting(const bool bFlag) { m_bNesting = bFlag; }
void SetHasDummyChar(const bool bFlag) { m_bHasDummyChar = bFlag; }
+ void SetHasContent( const bool bFlag ) { m_bHasContent = bFlag; }
public:
@@ -80,8 +82,8 @@ public:
const sal_Int32* GetStart() const { return & m_nStart; }
/// end position
- virtual sal_Int32* GetEnd();
- inline const sal_Int32* GetEnd() const;
+ virtual sal_Int32* GetEnd(); // also used to change the end position
+ inline const sal_Int32* End() const;
/// end (if available), else start
inline const sal_Int32* GetAnyEnd() const;
@@ -100,6 +102,7 @@ public:
bool IsFormatIgnoreEnd () const { return m_bFormatIgnoreEnd ; }
void SetFormatIgnoreStart(bool bFlag) { m_bFormatIgnoreStart = bFlag; }
void SetFormatIgnoreEnd (bool bFlag) { m_bFormatIgnoreEnd = bFlag; }
+ bool HasContent() const { return m_bHasContent; }
inline const SfxPoolItem& GetAttr() const;
inline SfxPoolItem& GetAttr();
@@ -128,21 +131,20 @@ protected:
public:
SwTxtAttrEnd( SfxPoolItem& rAttr, sal_Int32 nStart, sal_Int32 nEnd );
- using SwTxtAttr::GetEnd;
virtual sal_Int32* GetEnd();
};
// --------------- Inline Implementations ------------------------
-inline const sal_Int32* SwTxtAttr::GetEnd() const
+inline const sal_Int32* SwTxtAttr::End() const
{
return const_cast<SwTxtAttr * >(this)->GetEnd();
}
inline const sal_Int32* SwTxtAttr::GetAnyEnd() const
{
- const sal_Int32* pEnd = GetEnd();
+ const sal_Int32* pEnd = End();
return pEnd ? pEnd : GetStart();
}
@@ -182,7 +184,9 @@ inline const SwFmtAutoFmt& SwTxtAttr::GetAutoFmt() const
inline const SwFmtFld& SwTxtAttr::GetFmtFld() const
{
- assert( m_pAttr && m_pAttr->Which() == RES_TXTATR_FIELD );
+ assert( m_pAttr
+ && ( m_pAttr->Which() == RES_TXTATR_FIELD
+ || m_pAttr->Which() == RES_TXTATR_INPUTFIELD ));
return (const SwFmtFld&)(*m_pAttr);
}
diff --git a/sw/inc/txtfld.hxx b/sw/inc/txtfld.hxx
index 3c98492733a0..cfab932a8660 100644
--- a/sw/inc/txtfld.hxx
+++ b/sw/inc/txtfld.hxx
@@ -28,43 +28,71 @@ class SwTxtNode;
class SwTxtFld : public SwTxtAttr
{
- mutable OUString m_aExpand;
+ mutable OUString m_aExpand; // only used to determine, if field content is changing in <ExpandTxtFld()>
SwTxtNode * m_pTxtNode;
public:
- SwTxtFld(SwFmtFld & rAttr, sal_Int32 const nStart,
- bool const bInClipboard);
+ SwTxtFld(
+ SwFmtFld & rAttr,
+ sal_Int32 const nStart,
+ bool const bInClipboard );
+
virtual ~SwTxtFld();
- void CopyFld( SwTxtFld *pDest ) const;
- void Expand() const;
- inline void ExpandAlways();
+ void CopyTxtFld( SwTxtFld *pDest ) const;
+
+ void ExpandTxtFld() const;
+ void ExpandAlways()
+ {
+ m_aExpand += " "; // changing current value to assure that <ExpandTxtFld()> changes the value.
+ ExpandTxtFld();
+ }
// get and set TxtNode pointer
- SwTxtNode* GetpTxtNode() const { return m_pTxtNode; }
- inline SwTxtNode& GetTxtNode() const;
- void ChgTxtNode( SwTxtNode* pNew ) { m_pTxtNode = pNew; }
- // enable notification that field content has changed and needs reformatting
- void NotifyContentChange(SwFmtFld& rFmtFld);
+ SwTxtNode* GetpTxtNode() const
+ {
+ return m_pTxtNode;
+ }
+ SwTxtNode& GetTxtNode() const
+ {
+ OSL_ENSURE( m_pTxtNode, "SwTxtFld:: where is my TxtNode?" );
+ return *m_pTxtNode;
+ }
+ void ChgTxtNode( SwTxtNode* pNew )
+ {
+ m_pTxtNode = pNew;
+ }
- /**
- Returns position of this field.
+ bool IsFldInDoc() const;
+
+ // enable notification that field content has changed and needs reformatting
+ virtual void NotifyContentChange( SwFmtFld& rFmtFld );
- @return position of this field. Has to be deleted explicitly.
- */
};
-inline SwTxtNode& SwTxtFld::GetTxtNode() const
+class SwTxtInputFld : public SwTxtFld
{
- assert( m_pTxtNode );
- return *m_pTxtNode;
-}
+public:
+ SwTxtInputFld(
+ SwFmtFld & rAttr,
+ sal_Int32 const nStart,
+ sal_Int32 const nEnd,
+ bool const bInClipboard );
-inline void SwTxtFld::ExpandAlways()
-{
- m_aExpand += " ";
- Expand();
-}
+ virtual ~SwTxtInputFld();
+
+ virtual sal_Int32* GetEnd();
+
+ virtual void NotifyContentChange( SwFmtFld& rFmtFld );
+
+ void UpdateTextNodeContent( const OUString& rNewContent );
+
+ const OUString GetFieldContent() const;
+ void UpdateFieldContent();
+
+private:
+ sal_Int32 m_nEnd;
+};
#endif
diff --git a/sw/inc/txtrfmrk.hxx b/sw/inc/txtrfmrk.hxx
index ae944f96f7ff..b4f560c8ba5b 100644
--- a/sw/inc/txtrfmrk.hxx
+++ b/sw/inc/txtrfmrk.hxx
@@ -35,8 +35,7 @@ public:
SwTxtRefMark( SwFmtRefMark& rAttr,
sal_Int32 const nStart, sal_Int32 const*const pEnd = 0);
- virtual sal_Int32 * GetEnd(); // SwTxtAttr
- inline const sal_Int32 * GetEnd() const { return m_pEnd; }
+ virtual sal_Int32* GetEnd(); // SwTxtAttr
// get and set TxtNode pointer
inline const SwTxtNode& GetTxtNode() const;
diff --git a/sw/inc/txttxmrk.hxx b/sw/inc/txttxmrk.hxx
index ccc870743d4c..755905391582 100644
--- a/sw/inc/txttxmrk.hxx
+++ b/sw/inc/txttxmrk.hxx
@@ -38,7 +38,6 @@ public:
virtual ~SwTxtTOXMark();
virtual sal_Int32 *GetEnd(); // SwTxtAttr
- inline const sal_Int32* GetEnd() const { return m_pEnd; }
void CopyTOXMark( SwDoc* pDestDoc );
diff --git a/sw/inc/viscrs.hxx b/sw/inc/viscrs.hxx
index 194efe4ee55a..b4010b991660 100644
--- a/sw/inc/viscrs.hxx
+++ b/sw/inc/viscrs.hxx
@@ -28,6 +28,7 @@
class SwCrsrShell;
class SwShellCrsr;
+class SwTxtInputFld;
// From here classes/methods for non-text cursor.
@@ -59,6 +60,7 @@ public:
// From here classes/methods for selections.
namespace sdr { namespace overlay { class OverlayObject; }}
+namespace sw { namespace overlay { class OverlayRangesOutline; }}
class SwSelPaintRects : public SwRects
{
@@ -71,7 +73,6 @@ class SwSelPaintRects : public SwRects
const SwCrsrShell* pCShell;
virtual void Paint( const Rectangle& rRect );
- virtual void FillRects() = 0;
#if HAVE_FEATURE_DESKTOP
sdr::overlay::OverlayObject* mpCursorOverlay;
@@ -81,11 +82,18 @@ class SwSelPaintRects : public SwRects
void setCursorOverlay(sdr::overlay::OverlayObject* pNew) { mpCursorOverlay = pNew; }
#endif
+ bool mbShowTxtInputFldOverlay;
+ sw::overlay::OverlayRangesOutline* mpTxtInputFldOverlay;
+
+ void HighlightInputFld();
+
public:
SwSelPaintRects( const SwCrsrShell& rCSh );
virtual ~SwSelPaintRects();
- // in SwCrsrShell::CreateCrsr() the content of SwSelPaintRects is exchanged. To
+ virtual void FillRects() = 0;
+
+ // #i75172# in SwCrsrShell::CreateCrsr() the content of SwSelPaintRects is exchanged. To
// make a complete swap access to mpCursorOverlay is needed there
void swapContent(SwSelPaintRects& rSwap);
@@ -93,6 +101,11 @@ public:
void Hide();
void Invalidate( const SwRect& rRect );
+ inline void SetShowTxtInputFldOverlay( const bool bShow )
+ {
+ mbShowTxtInputFldOverlay = bShow;
+ }
+
const SwCrsrShell* GetShell() const { return pCShell; }
// check current MapMode of the shell and set possibly the static members.
// Optional set the parameters pX, pY
@@ -107,8 +120,6 @@ class SwShellCrsr : public virtual SwCursor, public SwSelPaintRects
Point aMkPt, aPtPt;
const SwPosition* pPt; // For assignment of GetPoint() to aPtPt.
- virtual void FillRects(); // For Table- und normal cursors.
-
using SwCursor::UpDown;
public:
@@ -118,6 +129,8 @@ public:
SwShellCrsr( SwShellCrsr& );
virtual ~SwShellCrsr();
+ virtual void FillRects(); // For Table- und normal cursors.
+
void Show(); // Update and display all selections.
void Hide(); // Hide all selections.
void Invalidate( const SwRect& rRect );