summaryrefslogtreecommitdiff
path: root/sw
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
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')
-rw-r--r--sw/Library_sw.mk1
-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
-rw-r--r--sw/sdi/_textsh.sdi15
-rw-r--r--sw/sdi/_viewsh.sdi12
-rw-r--r--sw/source/core/access/accportions.cxx1
-rw-r--r--sw/source/core/bastyp/init.cxx6
-rw-r--r--sw/source/core/crsr/callnk.cxx2
-rw-r--r--sw/source/core/crsr/crsrsh.cxx27
-rw-r--r--sw/source/core/crsr/crstrvl.cxx407
-rw-r--r--sw/source/core/crsr/findattr.cxx4
-rw-r--r--sw/source/core/crsr/findtxt.cxx12
-rw-r--r--sw/source/core/crsr/overlayrangesoutline.cxx109
-rw-r--r--sw/source/core/crsr/overlayrangesoutline.hxx64
-rw-r--r--sw/source/core/crsr/swcrsr.cxx97
-rw-r--r--sw/source/core/crsr/viscrs.cxx127
-rw-r--r--sw/source/core/doc/dbgoutsw.cxx4
-rw-r--r--sw/source/core/doc/doc.cxx13
-rw-r--r--sw/source/core/doc/docedt.cxx4
-rw-r--r--sw/source/core/doc/docfld.cxx22
-rw-r--r--sw/source/core/doc/docfmt.cxx40
-rw-r--r--sw/source/core/doc/docnum.cxx10
-rw-r--r--sw/source/core/doc/docredln.cxx2
-rw-r--r--sw/source/core/doc/docruby.cxx4
-rw-r--r--sw/source/core/doc/doctxm.cxx4
-rw-r--r--sw/source/core/doc/visiturl.cxx2
-rw-r--r--sw/source/core/docnode/nodes.cxx4
-rw-r--r--sw/source/core/edit/acorrect.cxx2
-rw-r--r--sw/source/core/edit/edatmisc.cxx4
-rw-r--r--sw/source/core/edit/edattr.cxx5
-rw-r--r--sw/source/core/edit/edfld.cxx80
-rw-r--r--sw/source/core/edit/edfldexp.cxx1
-rw-r--r--sw/source/core/edit/editsh.cxx2
-rw-r--r--sw/source/core/edit/edlingu.cxx6
-rw-r--r--sw/source/core/edit/ednumber.cxx6
-rw-r--r--sw/source/core/edit/edtox.cxx4
-rw-r--r--sw/source/core/fields/expfld.cxx401
-rw-r--r--sw/source/core/fields/fldbas.cxx29
-rw-r--r--sw/source/core/fields/reffld.cxx1
-rw-r--r--sw/source/core/frmedt/fefly1.cxx76
-rw-r--r--sw/source/core/inc/docfld.hxx5
-rw-r--r--sw/source/core/inc/rolbck.hxx9
-rw-r--r--sw/source/core/inc/rootfrm.hxx5
-rw-r--r--sw/source/core/inc/swfont.hxx19
-rw-r--r--sw/source/core/inc/txttypes.hxx1
-rw-r--r--sw/source/core/layout/flycnt.cxx14
-rw-r--r--sw/source/core/layout/trvlfrm.cxx4
-rw-r--r--sw/source/core/text/atrhndl.hxx2
-rw-r--r--sw/source/core/text/atrstck.cxx21
-rw-r--r--sw/source/core/text/inftxt.cxx58
-rw-r--r--sw/source/core/text/itrform2.cxx26
-rw-r--r--sw/source/core/text/porfld.cxx6
-rw-r--r--sw/source/core/text/porlay.cxx4
-rw-r--r--sw/source/core/text/pormulti.cxx36
-rw-r--r--sw/source/core/text/portxt.cxx118
-rw-r--r--sw/source/core/text/portxt.hxx18
-rw-r--r--sw/source/core/text/txtfld.cxx14
-rw-r--r--sw/source/core/tox/tox.cxx2
-rw-r--r--sw/source/core/tox/txmsrt.cxx14
-rw-r--r--sw/source/core/txtnode/atrfld.cxx284
-rw-r--r--sw/source/core/txtnode/ndhints.cxx16
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx365
-rw-r--r--sw/source/core/txtnode/swfont.cxx3
-rw-r--r--sw/source/core/txtnode/thints.cxx230
-rw-r--r--sw/source/core/txtnode/txatbase.cxx1
-rw-r--r--sw/source/core/txtnode/txatritr.cxx10
-rw-r--r--sw/source/core/txtnode/txtedt.cxx39
-rw-r--r--sw/source/core/undo/SwUndoField.cxx8
-rw-r--r--sw/source/core/undo/rolbck.cxx19
-rw-r--r--sw/source/core/undo/unsect.cxx7
-rw-r--r--sw/source/core/undo/untbl.cxx3
-rw-r--r--sw/source/core/undo/untblk.cxx2
-rw-r--r--sw/source/core/unocore/unocrsrhelper.cxx8
-rw-r--r--sw/source/core/unocore/unodraw.cxx3
-rw-r--r--sw/source/core/unocore/unofield.cxx22
-rw-r--r--sw/source/core/unocore/unoframe.cxx25
-rw-r--r--sw/source/core/unocore/unoidx.cxx12
-rw-r--r--sw/source/core/unocore/unoportenum.cxx64
-rw-r--r--sw/source/core/unocore/unorefmk.cxx20
-rw-r--r--sw/source/core/view/vprint.cxx17
-rw-r--r--sw/source/filter/ascii/ascatr.cxx53
-rw-r--r--sw/source/filter/ascii/parasc.cxx4
-rw-r--r--sw/source/filter/html/css1atr.cxx2
-rw-r--r--sw/source/filter/html/htmlatr.cxx12
-rw-r--r--sw/source/filter/html/swhtml.cxx1
-rw-r--r--sw/source/filter/html/wrthtml.cxx2
-rw-r--r--sw/source/filter/ww1/fltshell.cxx4
-rw-r--r--sw/source/filter/ww1/w1filter.cxx4
-rw-r--r--sw/source/filter/ww8/attributeoutputbase.hxx2
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx3
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx25
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx7
-rw-r--r--sw/source/filter/ww8/ww8par.cxx9
-rw-r--r--sw/source/filter/ww8/ww8par3.cxx74
-rw-r--r--sw/source/filter/ww8/ww8par5.cxx6
-rw-r--r--sw/source/ui/app/docst.cxx4
-rw-r--r--sw/source/ui/docvw/edtdd.cxx4
-rw-r--r--sw/source/ui/docvw/edtwin.cxx72
-rw-r--r--sw/source/ui/fldui/fldedt.cxx16
-rw-r--r--sw/source/ui/fldui/fldmgr.cxx12
-rw-r--r--sw/source/ui/inc/wrtsh.hxx2
-rw-r--r--sw/source/ui/lingu/hhcwrp.cxx6
-rw-r--r--sw/source/ui/misc/insfnote.cxx2
-rw-r--r--sw/source/ui/misc/titlepage.cxx8
-rw-r--r--sw/source/ui/shells/annotsh.cxx36
-rw-r--r--sw/source/ui/shells/basesh.cxx70
-rw-r--r--sw/source/ui/shells/drwtxtex.cxx43
-rw-r--r--sw/source/ui/shells/frmsh.cxx10
-rw-r--r--sw/source/ui/shells/grfsh.cxx15
-rw-r--r--sw/source/ui/shells/langhelper.cxx6
-rw-r--r--sw/source/ui/shells/listsh.cxx7
-rw-r--r--sw/source/ui/shells/tabsh.cxx6
-rw-r--r--sw/source/ui/shells/textfld.cxx144
-rw-r--r--sw/source/ui/shells/textidx.cxx9
-rw-r--r--sw/source/ui/shells/textsh.cxx149
-rw-r--r--sw/source/ui/shells/textsh1.cxx121
-rw-r--r--sw/source/ui/shells/txtattr.cxx20
-rw-r--r--sw/source/ui/uiview/formatclipboard.cxx6
-rw-r--r--sw/source/ui/uiview/view2.cxx2
-rw-r--r--sw/source/ui/uiview/viewmdi.cxx28
-rw-r--r--sw/source/ui/uiview/viewsrch.cxx2
-rw-r--r--sw/source/ui/uiview/viewstat.cxx91
-rw-r--r--sw/source/ui/uiview/viewtab.cxx10
-rw-r--r--sw/source/ui/wrtsh/delete.cxx2
-rw-r--r--sw/source/ui/wrtsh/wrtsh1.cxx24
-rw-r--r--sw/source/ui/wrtsh/wrtsh2.cxx13
138 files changed, 3117 insertions, 1553 deletions
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index f1064ef75748..ead414835643 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -154,6 +154,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
sw/source/core/crsr/trvltbl \
sw/source/core/crsr/unocrsr \
sw/source/core/crsr/viscrs \
+ sw/source/core/crsr/overlayrangesoutline \
sw/source/core/doc/SwStyleNameMapper \
sw/source/core/doc/acmplwrd \
sw/source/core/doc/dbgoutsw \
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 );
diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi
index 44f2b15224a0..0fb5cdb057f4 100644
--- a/sw/sdi/_textsh.sdi
+++ b/sw/sdi/_textsh.sdi
@@ -31,6 +31,7 @@ interface BaseText
FN_INSERT_GLOSSARY // status(final|play|record)
[
ExecMethod = ExecGlossary ;
+ StateMethod = GetState ;
]
FN_TXTATR_INET // status()
@@ -133,7 +134,7 @@ interface BaseText
SID_INSERTDOC // status(final|play|rec)
[
ExecMethod = Execute ;
- StateMethod = NoState ;
+ StateMethod = GetState ;
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
FN_INSERT_BOOKMARK // status(final|play)
@@ -237,13 +238,13 @@ interface BaseText
FN_INSERT_BREAK // status(final|play)
[
ExecMethod = ExecInsert ;
- StateMethod = NoState ;
+ StateMethod = GetState ;
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
FN_INSERT_PAGEBREAK // status(final|play)
[
ExecMethod = ExecInsert ;
- StateMethod = NoState ;
+ StateMethod = GetState ;
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
FN_INSERT_LINEBREAK // status(final|play)
@@ -255,19 +256,19 @@ interface BaseText
FN_INSERT_COLUMN_BREAK // status(final|play)
[
ExecMethod = ExecInsert ;
- StateMethod = NoState ;
+ StateMethod = GetState ;
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
FN_INSERT_BREAK_DLG // status(final|play)
[
ExecMethod = Execute ;
- StateMethod = NoState ;
+ StateMethod = GetState ;
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
SID_INSERT_AVMEDIA // status(final|play)
[
ExecMethod = ExecInsert;
- StateMethod = NoState ;
+ StateMethod = StateInsert ;
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
SID_INSERT_DIAGRAM // status(final|play)
@@ -330,6 +331,7 @@ interface BaseText
FN_INSERT_HYPERLINK // status()
[
ExecMethod = Execute ;
+ StateMethod = GetState;
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
SID_HYPERLINK_DIALOG
@@ -916,6 +918,7 @@ interface BaseText
FN_EXPAND_GLOSSARY // status(final|play)
[
ExecMethod = ExecGlossary ;
+ StateMethod = GetState ;
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
FN_POSTIT // status(final|play)
diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi
index bd05db1accfd..54152af3a5be 100644
--- a/sw/sdi/_viewsh.sdi
+++ b/sw/sdi/_viewsh.sdi
@@ -653,12 +653,12 @@ interface BaseTextEditView
ExecMethod = Execute ;
StateMethod = GetState ;
]
- SID_INSERT_GRAPHIC // status(final|play)
- [
- ExecMethod = Execute ;
- StateMethod = NoState ;
- DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
- ]
+ SID_INSERT_GRAPHIC // status(final|play)
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
SID_AUTOSPELL_CHECK
[
ExecMethod = ExecViewOptions ;
diff --git a/sw/source/core/access/accportions.cxx b/sw/source/core/access/accportions.cxx
index 20c5d9a8b7c4..102fb4ddcf50 100644
--- a/sw/source/core/access/accportions.cxx
+++ b/sw/source/core/access/accportions.cxx
@@ -257,6 +257,7 @@ sal_Bool SwAccessiblePortionData::IsGrayPortionType( sal_uInt16 nType ) const
case POR_NUMBER:
case POR_FLD:
case POR_URL:
+ case POR_INPUTFLD:
case POR_ISOTOX:
case POR_TOX:
case POR_HIDDEN:
diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx
index f52012564369..d606aa615781 100644
--- a/sw/source/core/bastyp/init.cxx
+++ b/sw/source/core/bastyp/init.cxx
@@ -303,7 +303,7 @@ SfxItemInfo aSlotTab[] =
{ 0, 0 }, // RES_TXTATR_CHARFMT
{ SID_ATTR_CHAR_CJK_RUBY, 0 }, // RES_TXTATR_CJK_RUBY
{ 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_UNKNOWN_CONTAINER
- { 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_DUMMY5
+ { 0, 0 }, // RES_TXTATR_INPUTFIELD
{ 0, 0 }, // RES_TXTATR_FIELD
{ 0, 0 }, // RES_TXTATR_FLYCNT
@@ -511,8 +511,9 @@ void _InitCore()
aAttrTab[ RES_TXTATR_CHARFMT- POOLATTR_BEGIN ] = new SwFmtCharFmt( 0 );
aAttrTab[ RES_TXTATR_CJK_RUBY - POOLATTR_BEGIN ] = new SwFmtRuby( aEmptyOUStr );
aAttrTab[ RES_TXTATR_UNKNOWN_CONTAINER - POOLATTR_BEGIN ] = new SvXMLAttrContainerItem( RES_TXTATR_UNKNOWN_CONTAINER );
+ aAttrTab[ RES_TXTATR_INPUTFIELD - POOLATTR_BEGIN ] = new SwFmtFld( RES_TXTATR_INPUTFIELD );
- aAttrTab[ RES_TXTATR_FIELD- POOLATTR_BEGIN ] = new SwFmtFld;
+ aAttrTab[ RES_TXTATR_FIELD- POOLATTR_BEGIN ] = new SwFmtFld( RES_TXTATR_FIELD );
aAttrTab[ RES_TXTATR_FLYCNT - POOLATTR_BEGIN ] = new SwFmtFlyCnt( 0 );
aAttrTab[ RES_TXTATR_FTN - POOLATTR_BEGIN ] = new SwFmtFtn;
@@ -521,7 +522,6 @@ void _InitCore()
aAttrTab[ RES_TXTATR_DUMMY2 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY2 );
aAttrTab[ RES_TXTATR_DUMMY3 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY3 );
aAttrTab[ RES_TXTATR_DUMMY4 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY4 );
- aAttrTab[ RES_TXTATR_DUMMY5 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY5 );
aAttrTab[ RES_PARATR_LINESPACING- POOLATTR_BEGIN ] = new SvxLineSpacingItem( LINE_SPACE_DEFAULT_HEIGHT, RES_PARATR_LINESPACING );
aAttrTab[ RES_PARATR_ADJUST- POOLATTR_BEGIN ] = new SvxAdjustItem( SVX_ADJUST_LEFT, RES_PARATR_ADJUST );
diff --git a/sw/source/core/crsr/callnk.cxx b/sw/source/core/crsr/callnk.cxx
index 4b22683d2313..44c84b387cdf 100644
--- a/sw/source/core/crsr/callnk.cxx
+++ b/sw/source/core/crsr/callnk.cxx
@@ -171,7 +171,7 @@ SwCallLink::~SwCallLink()
for( n = 0; n < rHts.Count(); n++ )
{
const SwTxtAttr* pHt = rHts[ n ];
- pEnd = pHt->GetEnd();
+ pEnd = pHt->End();
nStart = *pHt->GetStart();
// If "only start" or "start and end equal" then call on
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 4e75c86e3be9..b51c3cc8a835 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -880,8 +880,10 @@ void SwCrsrShell::SwapPam()
@param bTstOnly Should I only do a test run? If true so do not move cursor.
@param bTstHit ???
*/
-sal_Bool SwCrsrShell::ChgCurrPam( const Point & rPt,
- sal_Bool bTstOnly, sal_Bool bTstHit )
+sal_Bool SwCrsrShell::ChgCurrPam(
+ const Point & rPt,
+ sal_Bool bTstOnly,
+ sal_Bool bTstHit )
{
SET_CURR_SHELL( this );
@@ -1317,7 +1319,6 @@ void SwCrsrShell::UpdateCrsr( sal_uInt16 eFlags, sal_Bool bIdleEnd )
return; // if not then no update
}
- // #i27301#
SwNotifyAccAboutInvalidTextSelections aInvalidateTextSelections( *this );
if ( m_bIgnoreReadonly )
@@ -2034,6 +2035,7 @@ void SwCrsrShell::ShowCrsr()
if( !m_bBasicHideCrsr )
{
m_bSVCrsrVis = sal_True;
+ m_pCurCrsr->SetShowTxtInputFldOverlay( true );
#if defined(ANDROID) || defined(IOS)
touch_ui_show_keyboard();
#endif
@@ -2048,6 +2050,7 @@ void SwCrsrShell::HideCrsr()
m_bSVCrsrVis = sal_False;
// possibly reverse selected areas!!
SET_CURR_SHELL( this );
+ m_pCurCrsr->SetShowTxtInputFldOverlay( false );
m_pVisCrsr->Hide();
#if defined(ANDROID) || defined(IOS)
touch_ui_hide_keyboard();
@@ -2852,24 +2855,28 @@ sal_Bool SwCrsrShell::FindValidCntntNode( sal_Bool bOnlyText )
sal_Bool SwCrsrShell::IsCrsrReadonly() const
{
if ( GetViewOptions()->IsReadonly() ||
- GetViewOptions()->IsFormView() /* Formular view */ )
+ GetViewOptions()->IsFormView() /* Formula view */ )
{
SwFrm *pFrm = GetCurrFrm( sal_False );
const SwFlyFrm* pFly;
const SwSection* pSection;
if( pFrm && pFrm->IsInFly() &&
- (pFly = pFrm->FindFlyFrm())->GetFmt()->GetEditInReadonly().GetValue() &&
- pFly->Lower() &&
- !pFly->Lower()->IsNoTxtFrm() &&
- !GetDrawView()->GetMarkedObjectList().GetMarkCount() )
+ (pFly = pFrm->FindFlyFrm())->GetFmt()->GetEditInReadonly().GetValue() &&
+ pFly->Lower() &&
+ !pFly->Lower()->IsNoTxtFrm() &&
+ !GetDrawView()->GetMarkedObjectList().GetMarkCount() )
{
return sal_False;
}
// edit in readonly sections
else if ( pFrm && pFrm->IsInSct() &&
- 0 != ( pSection = pFrm->FindSctFrm()->GetSection() ) &&
- pSection->IsEditInReadonlyFlag() )
+ 0 != ( pSection = pFrm->FindSctFrm()->GetSection() ) &&
+ pSection->IsEditInReadonlyFlag() )
+ {
+ return sal_False;
+ }
+ else if ( !IsMultiSelection() && CrsrInsideInputFld() )
{
return sal_False;
}
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 20006dc1d274..33d77d2174f7 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -603,72 +603,83 @@ const SwTOXMark& SwCrsrShell::GotoTOXMark( const SwTOXMark& rStart,
}
/// jump to next/previous field type
-static void lcl_MakeFldLst( _SetGetExpFlds& rLst, const SwFieldType& rFldType,
- sal_uInt16 nSubType, sal_Bool bInReadOnly,
- sal_Bool bChkInpFlag = sal_False )
+void lcl_MakeFldLst(
+ _SetGetExpFlds& rLst,
+ const SwFieldType& rFldType,
+ const bool bInReadOnly,
+ const bool bChkInpFlag = false )
{
// always search the 1. frame
Point aPt;
- SwTxtFld* pTxtFld;
+ SwTxtFld* pTxtFld = NULL;
SwIterator<SwFmtFld,SwFieldType> aIter(rFldType);
- bool bSubType = nSubType != USHRT_MAX;
for( SwFmtFld* pFmtFld = aIter.First(); pFmtFld; pFmtFld = aIter.Next() )
- if( 0 != ( pTxtFld = pFmtFld->GetTxtFld() ) &&
- ( !bChkInpFlag || ((SwSetExpField*)pTxtFld->GetFmtFld().GetField())
- ->GetInputFlag() ) &&
- (!bSubType || (pFmtFld->GetField()->GetSubType()
- & 0xff ) == nSubType ))
+ {
+ pTxtFld = pFmtFld->GetTxtFld();
+ if ( pTxtFld != NULL
+ && ( !bChkInpFlag
+ || ((SwSetExpField*)pTxtFld->GetFmtFld().GetField())->GetInputFlag() ) )
{
- SwCntntFrm* pCFrm;
const SwTxtNode& rTxtNode = pTxtFld->GetTxtNode();
- if( 0 != ( pCFrm = rTxtNode.getLayoutFrm( rTxtNode.GetDoc()->GetCurrentLayout(), &aPt, 0, sal_False )) &&
- ( bInReadOnly || !pCFrm->IsProtected() ))
+ const SwCntntFrm* pCFrm =
+ rTxtNode.getLayoutFrm( rTxtNode.GetDoc()->GetCurrentLayout(), &aPt, 0, sal_False );
+ if ( pCFrm != NULL
+ && ( bInReadOnly || !pCFrm->IsProtected() ) )
{
- _SetGetExpFld* pNew = new _SetGetExpFld(
- SwNodeIndex( rTxtNode ), pTxtFld );
+ _SetGetExpFld* pNew = new _SetGetExpFld( SwNodeIndex( rTxtNode ), pTxtFld );
pNew->SetBodyPos( *pCFrm );
rLst.insert( pNew );
}
}
+ }
}
-sal_Bool SwCrsrShell::MoveFldType( const SwFieldType* pFldType, sal_Bool bNext,
- sal_uInt16 nSubType, sal_uInt16 nResType )
+sal_Bool SwCrsrShell::MoveFldType(
+ const SwFieldType* pFldType,
+ const bool bNext,
+ const sal_uInt16 nResType,
+ const bool bAddSetExpressionFldsToInputFlds )
{
// sorted list of all fields
_SetGetExpFlds aSrtLst;
- if (pFldType)
+ if ( pFldType )
{
if( RES_INPUTFLD != pFldType->Which() && !pFldType->GetDepends() )
+ {
return sal_False;
+ }
// found Modify object, add all fields to array
- ::lcl_MakeFldLst( aSrtLst, *pFldType, nSubType, IsReadOnlyAvailable() );
+ ::lcl_MakeFldLst( aSrtLst, *pFldType, ( IsReadOnlyAvailable() ? true : false ) );
- if( RES_INPUTFLD == pFldType->Which() )
+ if( RES_INPUTFLD == pFldType->Which() && bAddSetExpressionFldsToInputFlds )
{
// there are hidden input fields in the set exp. fields
const SwFldTypes& rFldTypes = *mpDoc->GetFldTypes();
- const sal_uInt16 nSize = rFldTypes.size();
-
- // iterate over all types
- for( sal_uInt16 i=0; i < nSize; ++i )
- if( RES_SETEXPFLD == ( pFldType = rFldTypes[ i ] )->Which() )
- ::lcl_MakeFldLst( aSrtLst, *pFldType, nSubType,
- IsReadOnlyAvailable(), sal_True );
+ const size_t nSize = rFldTypes.size();
+ for( size_t i=0; i < nSize; ++i )
+ {
+ pFldType = rFldTypes[ i ];
+ if ( RES_SETEXPFLD == pFldType->Which() )
+ {
+ ::lcl_MakeFldLst( aSrtLst, *pFldType, ( IsReadOnlyAvailable() ? true : false ), true );
+ }
+ }
}
}
else
{
const SwFldTypes& rFldTypes = *mpDoc->GetFldTypes();
- const sal_uInt16 nSize = rFldTypes.size();
-
- // iterate over all types
- for( sal_uInt16 i=0; i < nSize; ++i )
- if( nResType == ( pFldType = rFldTypes[ i ] )->Which() )
- ::lcl_MakeFldLst( aSrtLst, *pFldType, nSubType,
- IsReadOnlyAvailable() );
+ const size_t nSize = rFldTypes.size();
+ for( size_t i=0; i < nSize; ++i )
+ {
+ pFldType = rFldTypes[ i ];
+ if( nResType == pFldType->Which() )
+ {
+ ::lcl_MakeFldLst( aSrtLst, *pFldType, ( IsReadOnlyAvailable() ? true : false ) );
+ }
+ }
}
// found no fields?
@@ -686,12 +697,11 @@ sal_Bool SwCrsrShell::MoveFldType( const SwFieldType* pFldType, sal_Bool bNext,
SwTxtNode* pTNd = rPos.nNode.GetNode().GetTxtNode();
OSL_ENSURE( pTNd, "No CntntNode" );
- SwTxtFld * pTxtFld = static_cast<SwTxtFld *>(
- pTNd->GetTxtAttrForCharAt(rPos.nContent.GetIndex(),
- RES_TXTATR_FIELD));
- bool bDelFld = 0 == pTxtFld;
+ SwTxtFld * pTxtFld = pTNd->GetFldTxtAttrAt( rPos.nContent.GetIndex(), true );
+ const bool bDelFld = ( pTxtFld == NULL );
if( bDelFld )
{
+ // create dummy for the search
SwFmtFld* pFmtFld = new SwFmtFld( SwDateTimeField(
(SwDateTimeFieldType*)mpDoc->GetSysFldType( RES_DATETIMEFLD ) ) );
@@ -781,6 +791,129 @@ sal_Bool SwCrsrShell::GotoFld( const SwFmtFld& rFld )
return bRet;
}
+
+SwTxtFld * SwCrsrShell::GetTxtFldAtPos(
+ const SwPosition* pPos,
+ const bool bIncludeInputFldAtStart ) const
+{
+ SwTxtFld* pTxtFld = NULL;
+
+ SwTxtNode * const pNode = pPos->nNode.GetNode().GetTxtNode();
+ if ( pNode != NULL )
+ {
+ pTxtFld = pNode->GetFldTxtAttrAt( pPos->nContent.GetIndex(), bIncludeInputFldAtStart );
+ }
+
+ return pTxtFld;
+}
+
+
+SwField* SwCrsrShell::GetFieldAtCrsr(
+ const SwPaM* pCrsr,
+ const bool bIncludeInputFldAtStart ) const
+{
+ SwField* pFieldAtCrsr = NULL;
+
+ SwTxtFld* pTxtFld = GetTxtFldAtPos( pCrsr->Start(), bIncludeInputFldAtStart );
+ if ( pTxtFld != NULL
+ && pCrsr->Start()->nNode == pCrsr->End()->nNode )
+ {
+ const xub_StrLen nTxtFldLength =
+ pTxtFld->End() != NULL
+ ? *(pTxtFld->End()) - *(pTxtFld->GetStart())
+ : 1;
+ if ( ( pCrsr->End()->nContent.GetIndex() - pCrsr->Start()->nContent.GetIndex() ) <= nTxtFldLength )
+ {
+ pFieldAtCrsr = (SwField*)pTxtFld->GetFmtFld().GetField();
+ }
+ }
+
+ return pFieldAtCrsr;
+}
+
+
+SwField* SwCrsrShell::GetCurFld( const bool bIncludeInputFldAtStart ) const
+{
+ SwPaM* pCrsr = GetCrsr();
+ if ( pCrsr->GetNext() != pCrsr )
+ {
+ // multi selection not handled.
+ return NULL;
+ }
+
+ SwField* pCurFld = GetFieldAtCrsr( pCrsr, bIncludeInputFldAtStart );;
+ if ( pCurFld != NULL
+ && RES_TABLEFLD == pCurFld->GetTyp()->Which() )
+ {
+ // TabellenFormel ? wandel internen in externen Namen um
+ const SwTableNode* pTblNd = IsCrsrInTbl();
+ ((SwTblField*)pCurFld)->PtrToBoxNm( pTblNd ? &pTblNd->GetTable() : 0 );
+ }
+
+ return pCurFld;
+}
+
+
+bool SwCrsrShell::CrsrInsideInputFld() const
+{
+ bool bCrsrInsideInputFld = false;
+
+ const SwPaM* pCrsr = GetCrsr();
+ const SwPaM* pFirst = pCrsr;
+ do
+ {
+ bCrsrInsideInputFld = dynamic_cast<const SwInputField*>(GetFieldAtCrsr( pCrsr, false )) != NULL;
+
+ pCrsr = static_cast<SwPaM*>(pCrsr->GetNext());
+ } while ( !bCrsrInsideInputFld
+ && pCrsr != pFirst );
+
+ return bCrsrInsideInputFld;
+}
+
+
+bool SwCrsrShell::PosInsideInputFld( const SwPosition& rPos ) const
+{
+ return dynamic_cast<const SwTxtInputFld*>(GetTxtFldAtPos( &rPos, false )) != NULL;
+}
+
+
+bool SwCrsrShell::DocPtInsideInputFld( const Point& rDocPt ) const
+{
+ SwPosition aPos( *(GetCrsr()->Start()) );
+ Point aDocPt( rDocPt );
+ if ( GetLayout()->GetCrsrOfst( &aPos, aDocPt ) )
+ {
+ return PosInsideInputFld( aPos );
+ }
+ return false;
+}
+
+
+xub_StrLen SwCrsrShell::StartOfInputFldAtPos( const SwPosition& rPos ) const
+{
+ const SwTxtInputFld* pTxtInputFld = dynamic_cast<const SwTxtInputFld*>(GetTxtFldAtPos( &rPos, true ));
+ if ( pTxtInputFld == NULL )
+ {
+ OSL_ENSURE( false, "<SwEditShell::StartOfInputFldAtPos(..)> - no Input Field at given position" );
+ return 0;
+ }
+ return *(pTxtInputFld->GetStart());
+}
+
+
+xub_StrLen SwCrsrShell::EndOfInputFldAtPos( const SwPosition& rPos ) const
+{
+ const SwTxtInputFld* pTxtInputFld = dynamic_cast<const SwTxtInputFld*>(GetTxtFldAtPos( &rPos, true ));
+ if ( pTxtInputFld == NULL )
+ {
+ OSL_ENSURE( false, "<SwEditShell::EndOfInputFldAtPos(..)> - no Input Field at given position" );
+ return 0;
+ }
+ return *(pTxtInputFld->End());
+}
+
+
void SwCrsrShell::GotoOutline( sal_uInt16 nIdx )
{
SwCursor* pCrsr = getShellCrsr( true );
@@ -1017,7 +1150,8 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt,
pTxtNd = aPos.nNode.GetNode().GetTxtNode();
const SwNodes& rNds = GetDoc()->GetNodes();
- if( pTxtNd && SwContentAtPos::SW_OUTLINE & rCntntAtPos.eCntntAtPos
+ if( pTxtNd
+ && SwContentAtPos::SW_OUTLINE & rCntntAtPos.eCntntAtPos
&& !rNds.GetOutLineNds().empty() )
{
const SwTxtNode* pONd = pTxtNd->FindOutlineNodeOfLevel( MAXLEVEL-1);
@@ -1028,15 +1162,13 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt,
bRet = sal_True;
}
}
- // #i43742# New function
- else if ( SwContentAtPos::SW_CONTENT_CHECK & rCntntAtPos.eCntntAtPos &&
- bCrsrFoundExact )
+ else if ( SwContentAtPos::SW_CONTENT_CHECK & rCntntAtPos.eCntntAtPos
+ && bCrsrFoundExact )
{
bRet = sal_True;
}
- // #i23726#
- else if( pTxtNd &&
- SwContentAtPos::SW_NUMLABEL & rCntntAtPos.eCntntAtPos)
+ else if( pTxtNd
+ && SwContentAtPos::SW_NUMLABEL & rCntntAtPos.eCntntAtPos)
{
bRet = aTmpState.bInNumPortion;
rCntntAtPos.aFnd.pNode = pTxtNd;
@@ -1049,8 +1181,9 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt,
{
if( !aTmpState.bPosCorr )
{
- if( !bRet && SwContentAtPos::SW_SMARTTAG & rCntntAtPos.eCntntAtPos
- && !aTmpState.bFtnNoInfo )
+ if ( !bRet
+ && SwContentAtPos::SW_SMARTTAG & rCntntAtPos.eCntntAtPos
+ && !aTmpState.bFtnNoInfo )
{
const SwWrongList* pSmartTagList = pTxtNd->GetSmartTags();
sal_Int32 nCurrent = aPos.nContent.GetIndex();
@@ -1077,8 +1210,7 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt,
SwCallLink aLk( *this ); // watch Crsr-Moves
m_pCurCrsr->DeleteMark();
*m_pCurCrsr->GetPoint() = aPos;
- if( m_pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
- nsSwCursorSelOverFlags::SELOVER_TOGGLE) )
+ if( m_pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | nsSwCursorSelOverFlags::SELOVER_TOGGLE) )
bRet = sal_False;
else
UpdateCrsr();
@@ -1093,19 +1225,21 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt,
}
}
- if( !bRet && ( SwContentAtPos::SW_FIELD | SwContentAtPos::SW_CLICKFIELD )
- & rCntntAtPos.eCntntAtPos && !aTmpState.bFtnNoInfo )
+ if ( !bRet
+ && ( SwContentAtPos::SW_FIELD | SwContentAtPos::SW_CLICKFIELD ) & rCntntAtPos.eCntntAtPos
+ && !aTmpState.bFtnNoInfo )
{
- pTxtAttr = pTxtNd->GetTxtAttrForCharAt(
- aPos.nContent.GetIndex(), RES_TXTATR_FIELD );
- const SwField* pFld = pTxtAttr
- ? pTxtAttr->GetFmtFld().GetField()
- : 0;
- if( SwContentAtPos::SW_CLICKFIELD & rCntntAtPos.eCntntAtPos &&
- pFld && !pFld->HasClickHdl() )
+ pTxtAttr = pTxtNd->GetFldTxtAttrAt( aPos.nContent.GetIndex() );
+ const SwField* pFld = pTxtAttr != NULL
+ ? pTxtAttr->GetFmtFld().GetField()
+ : 0;
+ if ( SwContentAtPos::SW_CLICKFIELD & rCntntAtPos.eCntntAtPos
+ && pFld && !pFld->HasClickHdl() )
+ {
pFld = 0;
+ }
- if( pFld )
+ if ( pFld )
{
if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
@@ -1121,14 +1255,14 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt,
// allow click fields in protected sections
// only placeholder is not possible
if( SwContentAtPos::SW_FIELD & rCntntAtPos.eCntntAtPos
- || RES_JUMPEDITFLD == pFld->Which() )
+ || RES_JUMPEDITFLD == pFld->Which() )
pFld = 0;
}
else
UpdateCrsr();
}
else if( RES_TABLEFLD == pFld->Which() &&
- ((SwTblField*)pFld)->IsIntrnlName() )
+ ((SwTblField*)pFld)->IsIntrnlName() )
{
// create from internal (for CORE) the external
// (for UI) formula
@@ -1147,16 +1281,16 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt,
}
}
- if( !bRet && SwContentAtPos::SW_FORMCTRL & rCntntAtPos.eCntntAtPos )
- {
- IDocumentMarkAccess* pMarksAccess = GetDoc()->getIDocumentMarkAccess( );
- sw::mark::IFieldmark* pFldBookmark = pMarksAccess->getFieldmarkFor( aPos );
- if( bCrsrFoundExact && pTxtNd && pFldBookmark) {
- rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FORMCTRL;
- rCntntAtPos.aFnd.pFldmark = pFldBookmark;
- bRet=sal_True;
- }
- }
+ if( !bRet && SwContentAtPos::SW_FORMCTRL & rCntntAtPos.eCntntAtPos )
+ {
+ IDocumentMarkAccess* pMarksAccess = GetDoc()->getIDocumentMarkAccess( );
+ sw::mark::IFieldmark* pFldBookmark = pMarksAccess->getFieldmarkFor( aPos );
+ if( bCrsrFoundExact && pTxtNd && pFldBookmark) {
+ rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FORMCTRL;
+ rCntntAtPos.aFnd.pFldmark = pFldBookmark;
+ bRet=sal_True;
+ }
+ }
if( !bRet && SwContentAtPos::SW_FTN & rCntntAtPos.eCntntAtPos )
{
@@ -1174,7 +1308,7 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt,
rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FTN;
}
else if ( 0 != ( pTxtAttr = pTxtNd->GetTxtAttrForCharAt(
- aPos.nContent.GetIndex(), RES_TXTATR_FTN )) )
+ aPos.nContent.GetIndex(), RES_TXTATR_FTN )) )
{
bRet = sal_True;
if( bSetCrsr )
@@ -1183,14 +1317,14 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt,
SwCrsrSaveState aSaveState( *m_pCurCrsr );
m_pCurCrsr->GetPoint()->nNode = *((SwTxtFtn*)pTxtAttr)->GetStartNode();
SwCntntNode* pCNd = GetDoc()->GetNodes().GoNextSection(
- &m_pCurCrsr->GetPoint()->nNode,
- sal_True, !IsReadOnlyAvailable() );
+ &m_pCurCrsr->GetPoint()->nNode,
+ sal_True, !IsReadOnlyAvailable() );
if( pCNd )
{
m_pCurCrsr->GetPoint()->nContent.Assign( pCNd, 0 );
if( m_pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
- nsSwCursorSelOverFlags::SELOVER_TOGGLE ))
+ nsSwCursorSelOverFlags::SELOVER_TOGGLE ))
bRet = sal_False;
else
UpdateCrsr();
@@ -1211,9 +1345,9 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt,
}
}
- if( !bRet && ( SwContentAtPos::SW_TOXMARK |
- SwContentAtPos::SW_REFMARK ) &
- rCntntAtPos.eCntntAtPos && !aTmpState.bFtnNoInfo )
+ if( !bRet
+ && ( SwContentAtPos::SW_TOXMARK | SwContentAtPos::SW_REFMARK ) & rCntntAtPos.eCntntAtPos
+ && !aTmpState.bFtnNoInfo )
{
pTxtAttr = 0;
if( SwContentAtPos::SW_TOXMARK & rCntntAtPos.eCntntAtPos )
@@ -1248,8 +1382,7 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt,
SwCrsrSaveState aSaveState( *m_pCurCrsr );
m_pCurCrsr->DeleteMark();
*m_pCurCrsr->GetPoint() = aPos;
- if( m_pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
- nsSwCursorSelOverFlags::SELOVER_TOGGLE ) )
+ if( m_pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | nsSwCursorSelOverFlags::SELOVER_TOGGLE ) )
bRet = sal_False;
else
UpdateCrsr();
@@ -1259,17 +1392,16 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt,
{
const sal_Int32* pEnd = pTxtAttr->GetEnd();
if( pEnd )
- rCntntAtPos.sStr = pTxtNd->GetExpandTxt(
- *pTxtAttr->GetStart(),
- *pEnd - *pTxtAttr->GetStart() );
+ rCntntAtPos.sStr =
+ pTxtNd->GetExpandTxt( *pTxtAttr->GetStart(), *pEnd - *pTxtAttr->GetStart() );
else if( RES_TXTATR_TOXMARK == pTxtAttr->Which())
- rCntntAtPos.sStr = pTxtAttr->GetTOXMark().
- GetAlternativeText();
+ rCntntAtPos.sStr =
+ pTxtAttr->GetTOXMark().GetAlternativeText();
rCntntAtPos.eCntntAtPos =
RES_TXTATR_TOXMARK == pTxtAttr->Which()
- ? SwContentAtPos::SW_TOXMARK
- : SwContentAtPos::SW_REFMARK;
+ ? SwContentAtPos::SW_TOXMARK
+ : SwContentAtPos::SW_REFMARK;
rCntntAtPos.pFndTxtAttr = pTxtAttr;
rCntntAtPos.aFnd.pAttr = &pTxtAttr->GetAttr();
@@ -1279,8 +1411,9 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt,
}
}
- if( !bRet && SwContentAtPos::SW_INETATTR & rCntntAtPos.eCntntAtPos
- && !aTmpState.bFtnNoInfo )
+ if ( !bRet
+ && SwContentAtPos::SW_INETATTR & rCntntAtPos.eCntntAtPos
+ && !aTmpState.bFtnNoInfo )
{
pTxtAttr = pTxtNd->GetTxtAttrAt(
aPos.nContent.GetIndex(), RES_TXTATR_INETFMT);
@@ -1295,7 +1428,7 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt,
m_pCurCrsr->DeleteMark();
*m_pCurCrsr->GetPoint() = aPos;
if( m_pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
- nsSwCursorSelOverFlags::SELOVER_TOGGLE) )
+ nsSwCursorSelOverFlags::SELOVER_TOGGLE) )
bRet = sal_False;
else
UpdateCrsr();
@@ -1303,8 +1436,8 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt,
if( bRet )
{
rCntntAtPos.sStr = pTxtNd->GetExpandTxt(
- *pTxtAttr->GetStart(),
- *pTxtAttr->GetEnd() - *pTxtAttr->GetStart() );
+ *pTxtAttr->GetStart(),
+ *pTxtAttr->GetEnd() - *pTxtAttr->GetStart() );
rCntntAtPos.aFnd.pAttr = &pTxtAttr->GetAttr();
rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_INETATTR;
@@ -1332,12 +1465,12 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt,
}
}
- if( !bRet && (
- SwContentAtPos::SW_TABLEBOXFML & rCntntAtPos.eCntntAtPos
+ if( !bRet
+ && ( SwContentAtPos::SW_TABLEBOXFML & rCntntAtPos.eCntntAtPos
#ifdef DBG_UTIL
- || SwContentAtPos::SW_TABLEBOXVALUE & rCntntAtPos.eCntntAtPos
+ || SwContentAtPos::SW_TABLEBOXVALUE & rCntntAtPos.eCntntAtPos
#endif
- ))
+ ) )
{
const SwTableNode* pTblNd;
const SwTableBox* pBox;
@@ -1345,15 +1478,15 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt,
const SfxPoolItem* pItem;
if( pSttNd && 0 != ( pTblNd = pTxtNd->FindTableNode()) &&
0 != ( pBox = pTblNd->GetTable().GetTblBox(
- pSttNd->GetIndex() )) &&
+ pSttNd->GetIndex() )) &&
#ifdef DBG_UTIL
( SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState(
- RES_BOXATR_FORMULA, sal_False, &pItem ) ||
- SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState(
- RES_BOXATR_VALUE, sal_False, &pItem ))
+ RES_BOXATR_FORMULA, sal_False, &pItem ) ||
+ SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState(
+ RES_BOXATR_VALUE, sal_False, &pItem ))
#else
SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState(
- RES_BOXATR_FORMULA, sal_False, &pItem )
+ RES_BOXATR_FORMULA, sal_False, &pItem )
#endif
)
{
@@ -1393,7 +1526,7 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt,
SwCrsrSaveState aSaveState( *m_pCurCrsr );
*m_pCurCrsr->GetPoint() = aPos;
if( m_pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
- nsSwCursorSelOverFlags::SELOVER_TOGGLE) )
+ nsSwCursorSelOverFlags::SELOVER_TOGGLE) )
bRet = sal_False;
else
UpdateCrsr();
@@ -1418,7 +1551,7 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt,
{
const sal_Int32 n = aPos.nContent.GetIndex();
SfxItemSet aSet( GetDoc()->GetAttrPool(), POOLATTR_BEGIN,
- POOLATTR_END - 1 );
+ POOLATTR_END - 1 );
if( pTxtNd->GetpSwpHints() )
{
for( sal_uInt16 i = 0; i < pTxtNd->GetSwpHints().Count(); ++i )
@@ -1428,12 +1561,12 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt,
if( nAttrStart > n ) // over the section
break;
- if( 0 != pHt->GetEnd() && (
+ if( 0 != pHt->End() && (
( nAttrStart < n &&
- ( pHt->DontExpand() ? n < *pHt->GetEnd()
- : n <= *pHt->GetEnd() )) ||
+ ( pHt->DontExpand() ? n < *pHt->End()
+ : n <= *pHt->End() )) ||
( n == nAttrStart &&
- ( nAttrStart == *pHt->GetEnd() || !n ))) )
+ ( nAttrStart == *pHt->End() || !n ))) )
{
aSet.Put( pHt->GetAttr() );
}
@@ -1475,8 +1608,8 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt,
{
OUString aStr;
GetDoc()->GetAttrPool().GetPresentation( *pItem,
- SFX_ITEM_PRESENTATION_COMPLETE,
- SFX_MAPUNIT_CM, aStr );
+ SFX_ITEM_PRESENTATION_COMPLETE,
+ SFX_MAPUNIT_CM, aStr );
if (!sAttrs.isEmpty())
sAttrs += ", ";
sAttrs += aStr;
@@ -1518,9 +1651,8 @@ const SwPostItField* SwCrsrShell::GetPostItFieldAtCursor() const
const SwTxtNode* pTxtNd = pCursorPos->nNode.GetNode().GetTxtNode();
if ( pTxtNd )
{
- SwTxtAttr* pTxtAttr = pTxtNd->GetTxtAttrForCharAt(
- pCursorPos->nContent.GetIndex(), RES_TXTATR_FIELD );
- const SwField* pFld = pTxtAttr ? pTxtAttr->GetFmtFld().GetField() : 0;
+ SwTxtAttr* pTxtAttr = pTxtNd->GetFldTxtAttrAt( pCursorPos->nContent.GetIndex() );
+ const SwField* pFld = pTxtAttr != NULL ? pTxtAttr->GetFmtFld().GetField() : 0;
if ( pFld && pFld->Which()== RES_POSTITFLD )
{
pPostItFld = static_cast<const SwPostItField*>(pFld);
@@ -1597,17 +1729,44 @@ bool SwContentAtPos::IsInRTLText()const
return bRet;
}
-sal_Bool SwCrsrShell::SelectTxtAttr( sal_uInt16 nWhich, sal_Bool bExpand,
- const SwTxtAttr* pTxtAttr )
+
+sal_Bool SwCrsrShell::SelectTxt( const xub_StrLen nStart,
+ const xub_StrLen nEnd )
+{
+ SET_CURR_SHELL( this );
+ sal_Bool bRet = sal_False;
+
+ SwCallLink aLk( *this );
+ SwCrsrSaveState aSaveState( *m_pCurCrsr );
+
+ SwPosition& rPos = *m_pCurCrsr->GetPoint();
+ m_pCurCrsr->DeleteMark();
+ rPos.nContent = nStart;
+ m_pCurCrsr->SetMark();
+ rPos.nContent = nEnd;
+
+ if( !m_pCurCrsr->IsSelOvr() )
+ {
+ UpdateCrsr();
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+
+sal_Bool SwCrsrShell::SelectTxtAttr( sal_uInt16 nWhich,
+ sal_Bool bExpand,
+ const SwTxtAttr* pTxtAttr )
{
SET_CURR_SHELL( this );
sal_Bool bRet = sal_False;
if( !IsTableMode() )
{
- SwPosition& rPos = *m_pCurCrsr->GetPoint();
if( !pTxtAttr )
{
+ SwPosition& rPos = *m_pCurCrsr->GetPoint();
SwTxtNode* pTxtNd = rPos.nNode.GetNode().GetTxtNode();
pTxtAttr = (pTxtNd)
? pTxtNd->GetTxtAttrAt(rPos.nContent.GetIndex(),
@@ -1618,20 +1777,8 @@ sal_Bool SwCrsrShell::SelectTxtAttr( sal_uInt16 nWhich, sal_Bool bExpand,
if( pTxtAttr )
{
- SwCallLink aLk( *this ); // watch Crsr-Moves
- SwCrsrSaveState aSaveState( *m_pCurCrsr );
-
- m_pCurCrsr->DeleteMark();
- rPos.nContent = *pTxtAttr->GetStart();
- m_pCurCrsr->SetMark();
- const sal_Int32* pEnd = pTxtAttr->GetEnd();
- rPos.nContent = pEnd ? *pEnd : *pTxtAttr->GetStart() + 1;
-
- if( !m_pCurCrsr->IsSelOvr() )
- {
- UpdateCrsr();
- bRet = sal_True;
- }
+ const sal_Int32* pEnd = pTxtAttr->End();
+ bRet = SelectTxt( *pTxtAttr->GetStart(), ( pEnd ? *pEnd : *pTxtAttr->GetStart() + 1 ) );
}
}
return bRet;
@@ -2137,7 +2284,7 @@ bool SwCrsrShell::SelectNxtPrvHyperlink( bool bNext )
aCmpPos.GetPosOfContent( *m_pCurCrsr->GetPoint() );
m_pCurCrsr->DeleteMark();
m_pCurCrsr->SetMark();
- m_pCurCrsr->GetPoint()->nContent = *pFndAttr->SwTxtAttr::GetEnd();
+ m_pCurCrsr->GetPoint()->nContent = *pFndAttr->End();
if( !m_pCurCrsr->IsInProtectTable() && !m_pCurCrsr->IsSelOvr() )
{
diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx
index a7ef07e42d19..d183a1af9483 100644
--- a/sw/source/core/crsr/findattr.cxx
+++ b/sw/source/core/crsr/findattr.cxx
@@ -165,7 +165,7 @@ static sal_Bool lcl_Search( const SwTxtNode& rTxtNd, SwPaM& rPam,
if( pTxtHt->Which() == rCmpItem.Which() &&
( !bValue || CmpAttr( pTxtHt->GetAttr(), rCmpItem )))
{
- lcl_SetAttrPam( rPam, *pTxtHt->GetStart(), pTxtHt->GetEnd(), bForward );
+ lcl_SetAttrPam( rPam, *pTxtHt->GetStart(), pTxtHt->End(), bForward );
return sal_True;
}
return sal_False;
@@ -876,7 +876,7 @@ bool SwPaM::Find( const SfxPoolItem& rAttr, bool bValue, SwMoveFn fnMove,
const SwPaM *pRegion, bool bInReadOnly )
{
// determine which attribute is searched:
- sal_uInt16 nWhich = rAttr.Which();
+ const sal_uInt16 nWhich = rAttr.Which();
int bCharAttr = isCHRATR(nWhich) || isTXTATR(nWhich);
SwPaM* pPam = MakeRegion( fnMove, pRegion );
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index bd76b300b71c..796da83246f8 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -187,8 +187,8 @@ xub_StrLen GetPostIt(xub_StrLen aCount,const SwpHints *pHts)
{
aIndex++;
const SwTxtAttr* pTxtAttr = (*pHts)[i];
- if ( (pTxtAttr->Which()==RES_TXTATR_FIELD) &&
- (pTxtAttr->GetFmtFld().GetField()->Which()==RES_POSTITFLD))
+ if ( (pTxtAttr->Which()==RES_TXTATR_FIELD)
+ && (pTxtAttr->GetFmtFld().GetField()->Which()==RES_POSTITFLD))
{
aCount--;
if (!aCount)
@@ -200,8 +200,8 @@ xub_StrLen GetPostIt(xub_StrLen aCount,const SwpHints *pHts)
for( sal_Int32 i = aIndex; i < pHts->Count(); i++ )
{
const SwTxtAttr* pTxtAttr = (*pHts)[i];
- if ( (pTxtAttr->Which()==RES_TXTATR_FIELD) &&
- (pTxtAttr->GetFmtFld().GetField()->Which()==RES_POSTITFLD))
+ if ( (pTxtAttr->Which()==RES_TXTATR_FIELD)
+ && (pTxtAttr->GetFmtFld().GetField()->Which()==RES_POSTITFLD))
break;
else
aIndex++;
@@ -265,8 +265,8 @@ bool SwPaM::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes , utl::Te
for( sal_Int32 i = 0; i < pHts->Count(); i++ )
{
const SwTxtAttr* pTxtAttr = (*pHts)[i];
- if ( (pTxtAttr->Which()==RES_TXTATR_FIELD) &&
- (pTxtAttr->GetFmtFld().GetField()->Which()==RES_POSTITFLD))
+ if ( (pTxtAttr->Which()==RES_TXTATR_FIELD)
+ && (pTxtAttr->GetFmtFld().GetField()->Which()==RES_POSTITFLD))
{
const sal_Int32 aPos = *pTxtAttr->GetStart();
if ( (aPos >= nStart) && (aPos <= nEnd) )
diff --git a/sw/source/core/crsr/overlayrangesoutline.cxx b/sw/source/core/crsr/overlayrangesoutline.cxx
new file mode 100644
index 000000000000..61e9273bf465
--- /dev/null
+++ b/sw/source/core/crsr/overlayrangesoutline.cxx
@@ -0,0 +1,109 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#include <overlayrangesoutline.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace
+{
+ // combine ranges geometrically to a single, ORed polygon
+ basegfx::B2DPolyPolygon impCombineRangesToPolyPolygon(const std::vector< basegfx::B2DRange >& rRanges)
+ {
+ const sal_uInt32 nCount(rRanges.size());
+ basegfx::B2DPolyPolygon aRetval;
+
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ const basegfx::B2DPolygon aDiscretePolygon(basegfx::tools::createPolygonFromRect(rRanges[a]));
+
+ if(0 == a)
+ {
+ aRetval.append(aDiscretePolygon);
+ }
+ else
+ {
+ aRetval = basegfx::tools::solvePolygonOperationOr(aRetval, basegfx::B2DPolyPolygon(aDiscretePolygon));
+ }
+ }
+
+ return aRetval;
+ }
+}
+
+namespace sw
+{
+ namespace overlay
+ {
+ drawinglayer::primitive2d::Primitive2DSequence OverlayRangesOutline::createOverlayObjectPrimitive2DSequence()
+ {
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
+ const sal_uInt32 nCount(getRanges().size());
+
+ if( nCount )
+ {
+ const basegfx::BColor aRGBColor(getBaseColor().getBColor());
+ const basegfx::B2DPolyPolygon aPolyPolygon(impCombineRangesToPolyPolygon(getRanges()));
+ const drawinglayer::primitive2d::Primitive2DReference aOutline(
+ new drawinglayer::primitive2d::PolyPolygonHairlinePrimitive2D(
+ aPolyPolygon,
+ aRGBColor));
+
+ aRetval.realloc(1);
+ aRetval[0] = aOutline;
+ }
+
+ return aRetval;
+ }
+
+ OverlayRangesOutline::OverlayRangesOutline(
+ const Color& rColor,
+ const std::vector< basegfx::B2DRange >& rRanges )
+ : sdr::overlay::OverlayObject(rColor)
+ , maRanges(rRanges)
+ {
+ // no AA for highlight overlays
+ allowAntiAliase(false);
+ }
+
+ OverlayRangesOutline::~OverlayRangesOutline()
+ {
+ if( getOverlayManager() )
+ {
+ getOverlayManager()->remove(*this);
+ }
+ }
+
+ void OverlayRangesOutline::setRanges(const std::vector< basegfx::B2DRange >& rNew)
+ {
+ if(rNew != maRanges)
+ {
+ maRanges = rNew;
+ objectChange();
+ }
+ }
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/sw/source/core/crsr/overlayrangesoutline.hxx b/sw/source/core/crsr/overlayrangesoutline.hxx
new file mode 100644
index 000000000000..1e2d168f7be4
--- /dev/null
+++ b/sw/source/core/crsr/overlayrangesoutline.hxx
@@ -0,0 +1,64 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SW_OVERLAY_OVERLAYRANGESOUTLINE_HXX
+#define _SW_OVERLAY_OVERLAYRANGESOUTLINE_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+#include <basegfx/range/b2drange.hxx>
+
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sw
+{
+ namespace overlay
+ {
+ class OverlayRangesOutline : public sdr::overlay::OverlayObject
+ {
+ protected:
+ // geometry of overlay
+ std::vector< basegfx::B2DRange > maRanges;
+
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
+
+ public:
+ OverlayRangesOutline(
+ const Color& rColor,
+ const std::vector< basegfx::B2DRange >& rRanges );
+
+ virtual ~OverlayRangesOutline();
+
+ // data read access
+ inline const std::vector< basegfx::B2DRange >& getRanges() const
+ {
+ return maRanges;
+ }
+
+ // data write access
+ void setRanges(const std::vector< basegfx::B2DRange >& rNew);
+ };
+ } // end of namespace overlay
+} // end of namespace sw
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SW_OVERLAY_OVERLAYRANGESOUTLINE_HXX
+
+// eof
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index 54987224d453..dcd81fb89527 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -49,6 +49,7 @@
#include <statstr.hrc>
#include <redline.hxx>
#include <xmloff/odffields.hxx>
+#include <txatbase.hxx>
using namespace ::com::sun::star::i18n;
@@ -231,7 +232,7 @@ sal_Bool SwCursor::IsSelOvr( int eFlags )
const SwSectionNode* pSectNd = rPtIdx.GetNode().FindSectionNode();
if( pSectNd &&
((bSkipOverHiddenSections && pSectNd->GetSection().IsHiddenFlag() ) ||
- (bSkipOverProtectSections && pSectNd->GetSection().IsProtectFlag() )))
+ (bSkipOverProtectSections && pSectNd->GetSection().IsProtectFlag() )))
{
if( 0 == ( nsSwCursorSelOverFlags::SELOVER_CHANGEPOS & eFlags ) )
{
@@ -245,18 +246,18 @@ sal_Bool SwCursor::IsSelOvr( int eFlags )
sal_Int32 nCntntPos = pSavePos->nCntnt;
int bGoNxt = pSavePos->nNode < rPtIdx.GetIndex();
SwCntntNode* pCNd = bGoNxt
- ? rNds.GoNextSection( &rPtIdx, bSkipOverHiddenSections, bSkipOverProtectSections)
- : rNds.GoPrevSection( &rPtIdx, bSkipOverHiddenSections, bSkipOverProtectSections);
+ ? rNds.GoNextSection( &rPtIdx, bSkipOverHiddenSections, bSkipOverProtectSections)
+ : rNds.GoPrevSection( &rPtIdx, bSkipOverHiddenSections, bSkipOverProtectSections);
if( !pCNd && ( nsSwCursorSelOverFlags::SELOVER_ENABLEREVDIREKTION & eFlags ))
{
bGoNxt = !bGoNxt;
pCNd = bGoNxt ? rNds.GoNextSection( &rPtIdx, bSkipOverHiddenSections, bSkipOverProtectSections)
- : rNds.GoPrevSection( &rPtIdx, bSkipOverHiddenSections, bSkipOverProtectSections);
+ : rNds.GoPrevSection( &rPtIdx, bSkipOverHiddenSections, bSkipOverProtectSections);
}
int bIsValidPos = 0 != pCNd;
const bool bValidNodesRange = bIsValidPos &&
- ::CheckNodesRange( rPtIdx, aIdx, true );
+ ::CheckNodesRange( rPtIdx, aIdx, true );
if( !bValidNodesRange )
{
rPtIdx = pSavePos->nNode;
@@ -286,7 +287,7 @@ sal_Bool SwCursor::IsSelOvr( int eFlags )
if( HasMark() && bSkipOverProtectSections)
{
sal_uLong nSttIdx = GetMark()->nNode.GetIndex(),
- nEndIdx = GetPoint()->nNode.GetIndex();
+ nEndIdx = GetPoint()->nNode.GetIndex();
if( nEndIdx <= nSttIdx )
{
sal_uLong nTmp = nSttIdx;
@@ -323,15 +324,15 @@ sal_Bool SwCursor::IsSelOvr( int eFlags )
if( pNd->IsCntntNode() && !dynamic_cast<SwUnoCrsr*>(this) )
{
const SwCntntFrm* pFrm = ((SwCntntNode*)pNd)->getLayoutFrm( pDoc->GetCurrentLayout() );
- if( pFrm && pFrm->IsValid() && 0 == pFrm->Frm().Height() &&
- 0 != ( nsSwCursorSelOverFlags::SELOVER_CHANGEPOS & eFlags ) )
+ if( pFrm && pFrm->IsValid()
+ && 0 == pFrm->Frm().Height()
+ && 0 != ( nsSwCursorSelOverFlags::SELOVER_CHANGEPOS & eFlags ) )
{
// skip to the next/prev valid paragraph with a layout
SwNodeIndex& rPtIdx = GetPoint()->nNode;
int bGoNxt = pSavePos->nNode < rPtIdx.GetIndex();
- while( 0 != ( pFrm = ( bGoNxt ? pFrm->GetNextCntntFrm()
- : pFrm->GetPrevCntntFrm() )) &&
- 0 == pFrm->Frm().Height() )
+ while( 0 != ( pFrm = ( bGoNxt ? pFrm->GetNextCntntFrm() : pFrm->GetPrevCntntFrm() ))
+ && 0 == pFrm->Frm().Height() )
;
// #i72394# skip to prev/next valid paragraph with a layout in case
@@ -389,19 +390,68 @@ sal_Bool SwCursor::IsSelOvr( int eFlags )
return sal_True; // we need a frame
}
- const SwTableNode* pPtNd = pNd->FindTableNode();
-
- if( (pNd = &GetMark()->nNode.GetNode())->IsCntntNode() &&
- !((SwCntntNode*)pNd)->getLayoutFrm( pDoc->GetCurrentLayout() ) && !dynamic_cast<SwUnoCrsr*>(this) )
+ if( (pNd = &GetMark()->nNode.GetNode())->IsCntntNode()
+ && !((SwCntntNode*)pNd)->getLayoutFrm( pDoc->GetCurrentLayout() )
+ && !dynamic_cast<SwUnoCrsr*>(this) )
{
DeleteMark();
RestoreSavePos();
return sal_True; // we need a frame
}
- const SwTableNode* pMrkNd = pNd->FindTableNode();
+ // assure that selection is only inside an InputField or contains the InputField completely
+ {
+ const SwTxtAttr* pInputFldTxtAttrAtPoint = NULL;
+ SwTxtNode* pTxtNdAtPoint = GetPoint()->nNode.GetNode().GetTxtNode();
+ if ( pTxtNdAtPoint != NULL )
+ {
+ pInputFldTxtAttrAtPoint =
+ pTxtNdAtPoint->GetTxtAttrAt( GetPoint()->nContent.GetIndex(), RES_TXTATR_INPUTFIELD, SwTxtNode::PARENT );
+ }
+
+ const SwTxtAttr* pInputFldTxtAttrAtMark = NULL;
+ SwTxtNode* pTxtNdAtMark = GetMark()->nNode.GetNode().GetTxtNode();
+ if ( pTxtNdAtMark != NULL )
+ {
+ pInputFldTxtAttrAtMark =
+ pTxtNdAtMark->GetTxtAttrAt( GetMark()->nContent.GetIndex(), RES_TXTATR_INPUTFIELD, SwTxtNode::PARENT );
+ }
+
+ if ( pInputFldTxtAttrAtPoint != pInputFldTxtAttrAtMark )
+ {
+ const sal_uLong nRefNodeIdx =
+ ( nsSwCursorSelOverFlags::SELOVER_TOGGLE & eFlags )
+ ? pSavePos->nNode
+ : GetMark()->nNode.GetIndex();
+ const xub_StrLen nRefContentIdx =
+ ( nsSwCursorSelOverFlags::SELOVER_TOGGLE & eFlags )
+ ? pSavePos->nCntnt
+ : GetMark()->nContent.GetIndex();
+ const bool bIsForwardSelection =
+ nRefNodeIdx < GetPoint()->nNode.GetIndex()
+ || ( nRefNodeIdx == GetPoint()->nNode.GetIndex()
+ && nRefContentIdx < GetPoint()->nContent.GetIndex() );
+
+ if ( pInputFldTxtAttrAtPoint != NULL )
+ {
+ const xub_StrLen nNewPointPos =
+ bIsForwardSelection ? *(pInputFldTxtAttrAtPoint->End()) : *(pInputFldTxtAttrAtPoint->GetStart());
+ GetPoint()->nContent.Assign( pTxtNdAtPoint, nNewPointPos );
+ }
+
+ if ( pInputFldTxtAttrAtMark != NULL )
+ {
+ const xub_StrLen nNewMarkPos =
+ bIsForwardSelection ? *(pInputFldTxtAttrAtMark->GetStart()) : *(pInputFldTxtAttrAtMark->End());
+ GetMark()->nContent.Assign( pTxtNdAtMark, nNewMarkPos );
+ }
+ }
+ }
// both in no or in same table node
+ const SwTableNode* pPtNd = pNd->FindTableNode();
+ const SwTableNode* pMrkNd = pNd->FindTableNode();
+ // beide in keinem oder beide im gleichen TableNode
if( ( !pMrkNd && !pPtNd ) || pPtNd == pMrkNd )
return sal_False;
@@ -420,8 +470,8 @@ sal_Bool SwCursor::IsSelOvr( int eFlags )
if( nsSwCursorSelOverFlags::SELOVER_CHANGEPOS & eFlags )
{
sal_Bool bSelTop = GetPoint()->nNode.GetIndex() <
- (( nsSwCursorSelOverFlags::SELOVER_TOGGLE & eFlags ) ? pSavePos->nNode
- : GetMark()->nNode.GetIndex());
+ (( nsSwCursorSelOverFlags::SELOVER_TOGGLE & eFlags ) ? pSavePos->nNode
+ : GetMark()->nNode.GetIndex());
do { // loop for table after table
sal_uLong nSEIdx = pPtNd->EndOfSectionIndex();
@@ -451,7 +501,7 @@ sal_Bool SwCursor::IsSelOvr( int eFlags )
// we permit these
if( pMyNd->IsCntntNode() &&
::CheckNodesRange( GetMark()->nNode,
- GetPoint()->nNode, true ))
+ GetPoint()->nNode, true ))
{
// table in table
const SwTableNode* pOuterTableNd = pMyNd->FindTableNode();
@@ -475,6 +525,7 @@ sal_Bool SwCursor::IsSelOvr( int eFlags )
RestoreSavePos();
return sal_True;
}
+
return sal_False;
}
@@ -1782,7 +1833,7 @@ sal_Bool SwCursor::UpDown( sal_Bool bUp, sal_uInt16 nCnt,
}
pFrm->GetCrsrOfst( GetPoint(), aPt, &eTmpState );
}
- bRet = sal_True;
+ bRet = !IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | nsSwCursorSelOverFlags::SELOVER_CHANGEPOS );
}
else
*GetPoint() = aOldPos;
@@ -1801,8 +1852,10 @@ sal_Bool SwCursor::LeftRightMargin( sal_Bool bLeft, sal_Bool bAPI )
if ( pFrm )
SetCrsrBidiLevel( pFrm->IsRightToLeft() ? 1 : 0 );
- return pFrm && (bLeft ? pFrm->LeftMargin( this ) :
- pFrm->RightMargin( this, bAPI ) );
+ SwCrsrSaveState aSave( *this );
+ return pFrm
+ && (bLeft ? pFrm->LeftMargin( this ) : pFrm->RightMargin( this, bAPI ) )
+ && !IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | nsSwCursorSelOverFlags::SELOVER_CHANGEPOS );
}
sal_Bool SwCursor::IsAtLeftRightMargin( sal_Bool bLeft, sal_Bool bAPI ) const
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index c925e4c9a5a2..96e106ecd231 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -35,6 +35,7 @@
#include <docary.hxx>
#include <extinput.hxx>
#include <ndtxt.hxx>
+#include <txtfld.hxx>
#include <scriptinfo.hxx>
#include <mdiexp.hxx>
#include <wrtsh.hxx>
@@ -44,6 +45,9 @@
#include <svx/sdrpaintwindow.hxx>
#include <vcl/svapp.hxx>
#include <svx/sdr/overlay/overlayselection.hxx>
+#include <overlayrangesoutline.hxx>
+
+#include <boost/scoped_ptr.hpp>
#include <touch/touch.h>
@@ -188,10 +192,12 @@ void SwVisCrsr::_SetPosAndShow()
}
SwSelPaintRects::SwSelPaintRects( const SwCrsrShell& rCSh )
-: SwRects(),
- pCShell( &rCSh )
+ : SwRects()
+ , pCShell( &rCSh )
#if HAVE_FEATURE_DESKTOP
- , mpCursorOverlay(0)
+ , mpCursorOverlay( 0 )
+ , mbShowTxtInputFldOverlay( true )
+ , mpTxtInputFldOverlay( NULL )
#endif
{
}
@@ -210,6 +216,14 @@ void SwSelPaintRects::swapContent(SwSelPaintRects& rSwap)
sdr::overlay::OverlayObject* pTempOverlay = getCursorOverlay();
setCursorOverlay(rSwap.getCursorOverlay());
rSwap.setCursorOverlay(pTempOverlay);
+
+ const bool bTempShowTxtInputFldOverlay = mbShowTxtInputFldOverlay;
+ mbShowTxtInputFldOverlay = rSwap.mbShowTxtInputFldOverlay;
+ rSwap.mbShowTxtInputFldOverlay = bTempShowTxtInputFldOverlay;
+
+ sw::overlay::OverlayRangesOutline* pTempTxtInputFldOverlay = mpTxtInputFldOverlay;
+ mpTxtInputFldOverlay = rSwap.mpTxtInputFldOverlay;
+ rSwap.mpTxtInputFldOverlay = pTempTxtInputFldOverlay;
#endif
}
@@ -221,6 +235,12 @@ void SwSelPaintRects::Hide()
delete mpCursorOverlay;
mpCursorOverlay = 0;
}
+
+ if ( mpTxtInputFldOverlay != NULL )
+ {
+ delete mpTxtInputFldOverlay;
+ mpTxtInputFldOverlay = NULL;
+ }
#endif
SwRects::clear();
@@ -283,6 +303,8 @@ void SwSelPaintRects::Show()
xTargetOverlay->add(*mpCursorOverlay);
}
}
+
+ HighlightInputFld();
#else
const OutputDevice* pOut = GetShell()->GetWin();
if ( ! pOut )
@@ -329,6 +351,71 @@ extern "C" void touch_lo_selection_attempt_resize(const void * /* documentHandle
#endif
+void SwSelPaintRects::HighlightInputFld()
+{
+ std::vector< basegfx::B2DRange > aInputFldRanges;
+
+ if ( mbShowTxtInputFldOverlay )
+ {
+ SwTxtInputFld* pCurTxtInputFldAtCrsr =
+ dynamic_cast<SwTxtInputFld*>(GetShell()->GetTxtFldAtPos( GetShell()->GetCrsr()->Start(), false ));
+ if ( pCurTxtInputFldAtCrsr != NULL )
+ {
+ SwTxtNode* pTxtNode = pCurTxtInputFldAtCrsr->GetpTxtNode();
+ ::boost::scoped_ptr<SwShellCrsr> pCrsrForInputTxtFld(
+ new SwShellCrsr( *GetShell(), SwPosition( *pTxtNode, *(pCurTxtInputFldAtCrsr->GetStart()) ) ) );
+ pCrsrForInputTxtFld->SetMark();
+ pCrsrForInputTxtFld->GetMark()->nNode = *pTxtNode;
+ pCrsrForInputTxtFld->GetMark()->nContent.Assign( pTxtNode, *(pCurTxtInputFldAtCrsr->End()) );
+
+ pCrsrForInputTxtFld->FillRects();
+
+ for (size_t a(0); a < pCrsrForInputTxtFld->size(); ++a)
+ {
+ const SwRect aNextRect((*pCrsrForInputTxtFld)[a]);
+ const Rectangle aPntRect(aNextRect.SVRect());
+
+ aInputFldRanges.push_back(basegfx::B2DRange(
+ aPntRect.Left(), aPntRect.Top(),
+ aPntRect.Right() + 1, aPntRect.Bottom() + 1));
+ }
+ }
+ }
+
+ if ( aInputFldRanges.size() > 0 )
+ {
+ if ( mpTxtInputFldOverlay != NULL )
+ {
+ mpTxtInputFldOverlay->setRanges( aInputFldRanges );
+ }
+ else
+ {
+ SdrView* pView = (SdrView*)GetShell()->GetDrawView();
+ SdrPaintWindow* pCandidate = pView->GetPaintWindow(0);
+ rtl::Reference<sdr::overlay::OverlayManager> xTargetOverlay = pCandidate->GetOverlayManager();
+
+ if (xTargetOverlay.is())
+ {
+ // use system's hilight color with decreased luminance as highlight color
+ const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
+ Color aHighlight(aSvtOptionsDrawinglayer.getHilightColor());
+ aHighlight.DecreaseLuminance( 128 );
+
+ mpTxtInputFldOverlay = new sw::overlay::OverlayRangesOutline( aHighlight, aInputFldRanges );
+ xTargetOverlay->add( *mpTxtInputFldOverlay );
+ }
+ }
+ }
+ else
+ {
+ if ( mpTxtInputFldOverlay != NULL )
+ {
+ delete mpTxtInputFldOverlay;
+ mpTxtInputFldOverlay = NULL;
+ }
+ }
+}
+
void SwSelPaintRects::Invalidate( const SwRect& rRect )
{
sal_uInt16 nSz = size();
@@ -391,21 +478,37 @@ void SwSelPaintRects::Get1PixelInLogic( const SwViewShell& rSh,
*pY = nPixPtY;
}
-SwShellCrsr::SwShellCrsr( const SwCrsrShell& rCShell, const SwPosition &rPos )
- : SwCursor(rPos,0,false), SwSelPaintRects(rCShell), pPt(SwPaM::GetPoint())
+SwShellCrsr::SwShellCrsr(
+ const SwCrsrShell& rCShell,
+ const SwPosition &rPos )
+ : SwCursor(rPos,0,false)
+ , SwSelPaintRects(rCShell)
+ , pPt(SwPaM::GetPoint())
{}
-SwShellCrsr::SwShellCrsr( const SwCrsrShell& rCShell, const SwPosition &rPos,
- const Point& rPtPos, SwPaM* pRing )
- : SwCursor(rPos, pRing, false), SwSelPaintRects(rCShell), aMkPt(rPtPos),
- aPtPt(rPtPos), pPt(SwPaM::GetPoint())
+
+SwShellCrsr::SwShellCrsr(
+ const SwCrsrShell& rCShell,
+ const SwPosition &rPos,
+ const Point& rPtPos,
+ SwPaM* pRing )
+ : SwCursor(rPos, pRing, false)
+ , SwSelPaintRects(rCShell)
+ , aMkPt(rPtPos)
+ , aPtPt(rPtPos)
+ , pPt(SwPaM::GetPoint())
{}
SwShellCrsr::SwShellCrsr( SwShellCrsr& rICrsr )
- : SwCursor(rICrsr), SwSelPaintRects(*rICrsr.GetShell()),
- aMkPt(rICrsr.GetMkPos()), aPtPt(rICrsr.GetPtPos()), pPt(SwPaM::GetPoint())
+ : SwCursor(rICrsr)
+ , SwSelPaintRects(*rICrsr.GetShell())
+ , aMkPt(rICrsr.GetMkPos())
+ , aPtPt(rICrsr.GetPtPos())
+ , pPt(SwPaM::GetPoint())
+{}
+
+SwShellCrsr::~SwShellCrsr()
{}
-SwShellCrsr::~SwShellCrsr() {}
bool SwShellCrsr::IsReadOnlyAvailable() const
{
diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx
index f852557d91e1..ba20925dac5e 100644
--- a/sw/source/core/doc/dbgoutsw.cxx
+++ b/sw/source/core/doc/dbgoutsw.cxx
@@ -161,7 +161,7 @@ map<sal_uInt16,OUString,CompareUShort> & GetItemWhichMap()
aItemWhichMap[RES_TXTATR_REFMARK] = "TXTATR_REFMARK";
aItemWhichMap[RES_TXTATR_TOXMARK] = "TXTATR_TOXMARK";
aItemWhichMap[RES_TXTATR_CHARFMT] = "TXTATR_CHARFMT";
- aItemWhichMap[RES_TXTATR_DUMMY5] = "TXTATR_DUMMY5";
+ aItemWhichMap[RES_TXTATR_INPUTFIELD] = "RES_TXTATR_INPUTFIELD";
aItemWhichMap[RES_TXTATR_CJK_RUBY] = "TXTATR_CJK_RUBY";
aItemWhichMap[RES_TXTATR_UNKNOWN_CONTAINER] = "TXTATR_UNKNOWN_CONTAINER";
aItemWhichMap[RES_TXTATR_META] = "TXTATR_META";
@@ -310,7 +310,7 @@ static const OUString lcl_dbg_out(const SwTxtAttr & rAttr)
aStr += OUString::number(*rAttr.GetStart());
aStr += "->";
- aStr += OUString::number(*rAttr.GetEnd());
+ aStr += OUString::number(*rAttr.End());
aStr += " ";
aStr += lcl_dbg_out(rAttr.GetAttr());
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 93c4941bbd1e..6382d74bdf38 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -352,7 +352,7 @@ void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value)
mbSurroundTextWrapSmall = value;
break;
- // COMPATIBILITY FLAGS END
+ // COMPATIBILITY FLAGS END
case BROWSE_MODE: //can be used temporary (load/save) when no SwViewShell is avaiable
mbLastBrowseMode = value;
@@ -2625,20 +2625,19 @@ OUString SwDoc::GetPaMDescr(const SwPaM & rPam) const
return aResult;
}
-SwField * SwDoc::GetField(const SwPosition & rPos)
+SwField * SwDoc::GetFieldAtPos(const SwPosition & rPos)
{
- SwTxtFld * const pAttr = GetTxtFld(rPos);
+ SwTxtFld * const pAttr = GetTxtFldAtPos(rPos);
return (pAttr) ? const_cast<SwField *>( pAttr->GetFmtFld().GetField() ) : 0;
}
-SwTxtFld * SwDoc::GetTxtFld(const SwPosition & rPos)
+SwTxtFld * SwDoc::GetTxtFldAtPos(const SwPosition & rPos)
{
SwTxtNode * const pNode = rPos.nNode.GetNode().GetTxtNode();
- return (pNode)
- ? static_cast<SwTxtFld*>( pNode->GetTxtAttrForCharAt(
- rPos.nContent.GetIndex(), RES_TXTATR_FIELD) )
+ return (pNode != NULL)
+ ? pNode->GetFldTxtAttrAt( rPos.nContent.GetIndex(), true )
: 0;
}
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index f4e32c723dfa..18f80baecaf6 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -1417,7 +1417,7 @@ lcl_CalcBreaks( ::std::vector<sal_Int32> & rBreaks, SwPaM const & rPam )
if ((CH_TXTATR_INWORD == c) || (CH_TXTATR_BREAKWORD == c))
{
SwTxtAttr const * const pAttr( pTxtNode->GetTxtAttrForCharAt(i) );
- if (pAttr && pAttr->GetEnd() && (*pAttr->GetEnd() > nEnd))
+ if (pAttr && pAttr->End() && (*pAttr->End() > nEnd))
{
OSL_ENSURE(pAttr->HasDummyChar(), "GetTxtAttrForCharAt broken?");
rBreaks.push_back(i);
@@ -1602,7 +1602,7 @@ bool SwDoc::DeleteRangeImplImpl(SwPaM & rPam)
break;
if( nMkCntPos == *pAttr->GetStart() &&
- 0 != (pEndIdx = pAttr->GetEnd()) &&
+ 0 != (pEndIdx = pAttr->End()) &&
*pEndIdx == *pAttr->GetStart() )
pTxtNd->DestroyAttr( pHts->Cut( n ) );
}
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index cd9d9f204968..372f3dfb3b27 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -711,8 +711,10 @@ void SwDoc::SetNewFldLst(bool bFlag)
// the StartIndex can be supplied optionally (e.g. if it was queried before - is a virtual
// method otherwise!)
-_SetGetExpFld::_SetGetExpFld( const SwNodeIndex& rNdIdx, const SwTxtFld* pFld,
- const SwIndex* pIdx )
+_SetGetExpFld::_SetGetExpFld(
+ const SwNodeIndex& rNdIdx,
+ const SwTxtFld* pFld,
+ const SwIndex* pIdx )
{
eSetGetExpFldType = TEXTFIELD;
CNTNT.pTxtFld = pFld;
@@ -860,6 +862,15 @@ void _SetGetExpFld::SetBodyPos( const SwCntntFrm& rFrm )
}
}
+bool _SetGetExpFld::operator==( const _SetGetExpFld& rFld ) const
+{
+ return nNode == rFld.nNode
+ && nCntnt == rFld.nCntnt
+ && ( !CNTNT.pTxtFld
+ || !rFld.CNTNT.pTxtFld
+ || CNTNT.pTxtFld == rFld.CNTNT.pTxtFld );
+}
+
bool _SetGetExpFld::operator<( const _SetGetExpFld& rFld ) const
{
if( nNode < rFld.nNode || ( nNode == rFld.nNode && nCntnt < rFld.nCntnt ))
@@ -2565,13 +2576,12 @@ bool SwDoc::UpdateFld(SwTxtFld * pDstTxtFld, SwField & rSrcFld,
SwPosition aPosition( pDstTxtFld->GetTxtNode() );
aPosition.nContent = *pDstTxtFld->GetStart();
- SwUndo *const pUndo( new SwUndoFieldFromDoc(
- aPosition, *pDstFld, rSrcFld, pMsgHnt, bUpdateFlds) );
+ SwUndo *const pUndo( new SwUndoFieldFromDoc( aPosition, *pDstFld, rSrcFld, pMsgHnt, bUpdateFlds) );
GetIDocumentUndoRedo().AppendUndo(pUndo);
}
SwField * pNewFld = rSrcFld.CopyField();
- pDstFmtFld->SetFld(pNewFld);
+ pDstFmtFld->SetField(pNewFld);
switch( nFldWhich )
{
@@ -2646,7 +2656,7 @@ bool SwDoc::PutValueToField(const SwPosition & rPos,
const Any& rVal, sal_uInt16 nWhich)
{
Any aOldVal;
- SwField * pField = GetField(rPos);
+ SwField * pField = GetFieldAtPos(rPos);
if (GetIDocumentUndoRedo().DoesUndo() &&
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index d3f08d127b46..e2e671f0d820 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -155,14 +155,14 @@ static bool lcl_RstTxtAttr( const SwNodePtr& rpNd, void* pArgs )
// Save all attributes for the Undo.
SwRegHistory aRHst( *pTxtNode, pPara->pHistory );
pTxtNode->GetpSwpHints()->Register( &aRHst );
- pTxtNode->RstAttr( aSt, nEnd - aSt.GetIndex(), pPara->nWhich,
- pPara->pDelSet, pPara->bInclRefToxMark );
+ pTxtNode->RstTxtAttr( aSt, nEnd - aSt.GetIndex(), pPara->nWhich,
+ pPara->pDelSet, pPara->bInclRefToxMark );
if( pTxtNode->GetpSwpHints() )
pTxtNode->GetpSwpHints()->DeRegister();
}
else
- pTxtNode->RstAttr( aSt, nEnd - aSt.GetIndex(), pPara->nWhich,
- pPara->pDelSet, pPara->bInclRefToxMark );
+ pTxtNode->RstTxtAttr( aSt, nEnd - aSt.GetIndex(), pPara->nWhich,
+ pPara->pDelSet, pPara->bInclRefToxMark );
}
return true;
}
@@ -345,7 +345,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
if (pURLAttr && !pURLAttr->GetINetFmt().GetValue().isEmpty())
{
nMkPos = *pURLAttr->GetStart();
- nPtPos = *pURLAttr->GetEnd();
+ nPtPos = *pURLAttr->End();
}
else
{
@@ -491,9 +491,14 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
/// Insert Hints according to content types;
// Is used in SwDoc::Insert(..., SwFmtHint &rHt)
-static bool
-lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
- const SetAttrMode nFlags, SwUndoAttr *const pUndo,bool bExpandCharToPara=false)
+
+static bool lcl_InsAttr(
+ SwDoc *const pDoc,
+ const SwPaM &rRg,
+ const SfxItemSet& rChgSet,
+ const SetAttrMode nFlags,
+ SwUndoAttr *const pUndo,
+ const bool bExpandCharToPara=false)
{
// Divide the Sets (for selections in Nodes)
const SfxItemSet* pCharSet = 0;
@@ -576,7 +581,6 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
SwTxtNode * pTxtNd = pNode->GetTxtNode();
SwNumRule * pNumRule = pTxtNd->GetNumRule();
- // make code robust:
if ( !pNumRule )
{
OSL_FAIL( "<InsAttr(..)> - PaM in front of label, but text node has no numbering rule set. This is a serious defect, please inform OD." );
@@ -649,6 +653,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
RES_TXTATR_REFMARK, RES_TXTATR_TOXMARK,
RES_TXTATR_META, RES_TXTATR_METAFIELD,
RES_TXTATR_CJK_RUBY, RES_TXTATR_CJK_RUBY,
+ RES_TXTATR_INPUTFIELD, RES_TXTATR_INPUTFIELD,
0 );
aTxtSet.Put( rChgSet );
@@ -796,7 +801,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
if (pURLAttr && !pURLAttr->GetINetFmt().GetValue().isEmpty())
{
nMkPos = *pURLAttr->GetStart();
- nPtPos = *pURLAttr->GetEnd();
+ nPtPos = *pURLAttr->End();
}
else
{
@@ -830,12 +835,12 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
// Save all attributes for the Undo.
SwRegHistory aRHst( *pTxtNd, pHistory );
pTxtNd->GetpSwpHints()->Register( &aRHst );
- pTxtNd->RstAttr( aSt, nPtPos, 0, pCharSet );
+ pTxtNd->RstTxtAttr( aSt, nPtPos, 0, pCharSet );
if( pTxtNd->GetpSwpHints() )
pTxtNd->GetpSwpHints()->DeRegister();
}
else
- pTxtNd->RstAttr( aSt, nPtPos, 0, pCharSet );
+ pTxtNd->RstTxtAttr( aSt, nPtPos, 0, pCharSet );
}
// the SwRegHistory inserts the attribute into the TxtNode!
@@ -1053,8 +1058,11 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
}
///Add a para for the char attribute exp...
-bool SwDoc::InsertPoolItem( const SwPaM &rRg, const SfxPoolItem &rHt,
- const SetAttrMode nFlags, bool bExpandCharToPara)
+bool SwDoc::InsertPoolItem(
+ const SwPaM &rRg,
+ const SfxPoolItem &rHt,
+ const SetAttrMode nFlags,
+ const bool bExpandCharToPara)
{
SwDataChanged aTmp( rRg );
SwUndoAttr* pUndoAttr = 0;
@@ -1066,7 +1074,7 @@ bool SwDoc::InsertPoolItem( const SwPaM &rRg, const SfxPoolItem &rHt,
SfxItemSet aSet( GetAttrPool(), rHt.Which(), rHt.Which() );
aSet.Put( rHt );
- bool bRet = lcl_InsAttr( this, rRg, aSet, nFlags, pUndoAttr,bExpandCharToPara );
+ const bool bRet = lcl_InsAttr( this, rRg, aSet, nFlags, pUndoAttr, bExpandCharToPara );
if (GetIDocumentUndoRedo().DoesUndo())
{
@@ -1074,7 +1082,9 @@ bool SwDoc::InsertPoolItem( const SwPaM &rRg, const SfxPoolItem &rHt,
}
if( bRet )
+ {
SetModified();
+ }
return bRet;
}
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 458f5505c39a..256e30882703 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -879,14 +879,12 @@ void SwDoc::SetNumRule( const SwPaM& rPam,
"<SwDoc::SetNumRule(..)> - could not create new list. Serious defect -> please inform OD." );
sListId = pNewList->GetListId();
}
- InsertPoolItem( rPam,
- SfxStringItem( RES_PARATR_LIST_ID, sListId ), 0 );
+ InsertPoolItem( rPam, SfxStringItem( RES_PARATR_LIST_ID, sListId ), 0 );
}
else if ( !sContinuedListId.isEmpty() )
{
// apply given list id
- InsertPoolItem( rPam,
- SfxStringItem( RES_PARATR_LIST_ID, sContinuedListId ), 0 );
+ InsertPoolItem( rPam, SfxStringItem( RES_PARATR_LIST_ID, sContinuedListId ), 0 );
}
}
@@ -901,7 +899,6 @@ void SwDoc::SetNumRule( const SwPaM& rPam,
if (pRule && pRule->GetName() == pNew->GetName())
{
bSetItem = false;
-
if ( !pTxtNd->IsInList() )
{
pTxtNd->AddToList();
@@ -952,8 +949,7 @@ void SwDoc::SetCounted(const SwPaM & rPam, bool bCounted)
}
else
{
- InsertPoolItem( rPam,
- SfxBoolItem( RES_PARATR_LIST_ISCOUNTED, sal_False ), 0 );
+ InsertPoolItem( rPam, SfxBoolItem( RES_PARATR_LIST_ISCOUNTED, sal_False ), 0 );
}
}
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 6dd4e5b00922..04bd74736b25 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -2957,7 +2957,7 @@ void SwRedlineExtraData_Format::Reject( SwPaM& rPam ) const
for( it = aWhichIds.begin(); it != aWhichIds.end(); ++it )
{
pDoc->InsertPoolItem( rPam, *GetDfltAttr( *it ),
- nsSetAttrMode::SETATTR_DONTEXPAND );
+ nsSetAttrMode::SETATTR_DONTEXPAND );
}
pDoc->SetRedlineMode_intern( eOld );
diff --git a/sw/source/core/doc/docruby.cxx b/sw/source/core/doc/docruby.cxx
index 52b990b9d786..acc91a04641c 100644
--- a/sw/source/core/doc/docruby.cxx
+++ b/sw/source/core/doc/docruby.cxx
@@ -161,8 +161,8 @@ sal_uInt16 SwDoc::SetRubyList( const SwPaM& rPam, const SwRubyList& rList,
InsertString( aPam, pEntry->GetText() );
aPam.SetMark();
aPam.GetMark()->nContent -= pEntry->GetText().getLength();
- InsertPoolItem( aPam, pEntry->GetRubyAttr(),
- nsSetAttrMode::SETATTR_DONTEXPAND );
+ InsertPoolItem(
+ aPam, pEntry->GetRubyAttr(), nsSetAttrMode::SETATTR_DONTEXPAND );
}
else
break;
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 0d77608fcdb8..e28617df0efe 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -138,7 +138,7 @@ sal_uInt16 SwDoc::GetCurTOXMark( const SwPosition& rPos,
if( ( nSttIdx = *pHt->GetStart() ) < nAktPos )
{
// also check the end
- if( 0 == ( pEndIdx = pHt->GetEnd() ) ||
+ if( 0 == ( pEndIdx = pHt->End() ) ||
*pEndIdx <= nAktPos )
continue; // keep searching
}
@@ -2020,7 +2020,7 @@ void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd,
for(sal_uInt16 nHintIdx = 0; nHintIdx < pHints->GetStartCount(); nHintIdx++)
{
SwTxtAttr* pAttr = pHints->GetStart(nHintIdx);
- xub_StrLen nTmpEnd = pAttr->GetEnd() ? *pAttr->GetEnd() : 0;
+ const xub_StrLen nTmpEnd = pAttr->End() ? *pAttr->End() : 0;
if( nStartPos >= *pAttr->GetStart() &&
(nStartPos + 2) <= nTmpEnd &&
pAttr->Which() == RES_TXTATR_CHARFMT)
diff --git a/sw/source/core/doc/visiturl.cxx b/sw/source/core/doc/visiturl.cxx
index 8c9ac67f09a3..4c26121b575d 100644
--- a/sw/source/core/doc/visiturl.cxx
+++ b/sw/source/core/doc/visiturl.cxx
@@ -78,7 +78,7 @@ void SwURLStateChanged::Notify( SfxBroadcaster& , const SfxHint& rHint )
const_cast<SwTxtINetFmt*>(pTxtAttr)->SetVisitedValid( false );
const SwTxtAttr* pAttr = pTxtAttr;
SwUpdateAttr aUpdateAttr( *pAttr->GetStart(),
- *pAttr->GetEnd(),
+ *pAttr->End(),
RES_FMT_CHG );
((SwTxtNode*)pTxtNd)->ModifyNotification( &aUpdateAttr, &aUpdateAttr );
}
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index bd59984216fd..e30bb8ee3b48 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -264,9 +264,9 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
switch ( pAttr->Which() )
{
case RES_TXTATR_FIELD:
+ case RES_TXTATR_INPUTFIELD:
{
- SwTxtFld* pTxtFld =
- static_cast<SwTxtFld*>(pAttr);
+ SwTxtFld* pTxtFld = static_cast<SwTxtFld*>(pAttr);
rNds.GetDoc()->InsDelFldInFldLst( !bToUndo, *pTxtFld );
const SwFieldType* pTyp = pTxtFld->GetFmtFld().GetField()->GetTyp();
diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx
index f4ff5e0be6c1..4bf22c5a8250 100644
--- a/sw/source/core/edit/acorrect.cxx
+++ b/sw/source/core/edit/acorrect.cxx
@@ -494,7 +494,7 @@ void SwDontExpandItem::RestoreDontExpandItems( const SwPosition& rPos )
if( nAttrStart > nStart ) // beyond the area
break;
- if( 0 != ( pAttrEnd = pHt->GetEnd() ) &&
+ if( 0 != ( pAttrEnd = pHt->End() ) &&
( ( nAttrStart < nStart &&
( pHt->DontExpand() ? nStart < *pAttrEnd
: nStart <= *pAttrEnd )) ||
diff --git a/sw/source/core/edit/edatmisc.cxx b/sw/source/core/edit/edatmisc.cxx
index e270f49e3d82..79f5377f9156 100644
--- a/sw/source/core/edit/edatmisc.cxx
+++ b/sw/source/core/edit/edatmisc.cxx
@@ -96,7 +96,7 @@ const SfxPoolItem& SwEditShell::GetDefault( sal_uInt16 nFmtHint ) const
return GetDoc()->GetDefault( nFmtHint );
}
-void SwEditShell::SetAttr( const SfxPoolItem& rHint, sal_uInt16 nFlags )
+void SwEditShell::SetAttrItem( const SfxPoolItem& rHint, sal_uInt16 nFlags )
{
SET_CURR_SHELL( this );
StartAllAction();
@@ -125,7 +125,7 @@ void SwEditShell::SetAttr( const SfxPoolItem& rHint, sal_uInt16 nFlags )
EndAllAction();
}
-void SwEditShell::SetAttr( const SfxItemSet& rSet, sal_uInt16 nFlags, SwPaM* pPaM )
+void SwEditShell::SetAttrSet( const SfxItemSet& rSet, sal_uInt16 nFlags, SwPaM* pPaM )
{
SET_CURR_SHELL( this );
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 33dc8d7f762a..b77657208e26 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -308,9 +308,8 @@ bool SwEditShell::SetCurFtn( const SwFmtFtn& rFillFtn )
SwPaM* pCrsr = GetCrsr(), *pFirst = pCrsr;
do {
- bChgd |= mpDoc->SetCurFtn( *pCrsr, rFillFtn.GetNumStr(),
- rFillFtn.GetNumber(),
- rFillFtn.IsEndNote() );
+ bChgd |=
+ mpDoc->SetCurFtn( *pCrsr, rFillFtn.GetNumStr(), rFillFtn.GetNumber(), rFillFtn.IsEndNote() );
} while( pFirst != ( pCrsr = (SwPaM*)pCrsr->GetNext() ));
diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx
index b20d04d2b927..1e394d75d420 100644
--- a/sw/source/core/edit/edfld.cxx
+++ b/sw/source/core/edit/edfld.cxx
@@ -20,7 +20,6 @@
#include <unotools/charclass.hxx>
#include <editsh.hxx>
#include <fldbas.hxx>
-#include <ndtxt.hxx>
#include <doc.hxx>
#include <docary.hxx>
#include <fmtfld.hxx>
@@ -200,7 +199,7 @@ void SwEditShell::Insert2(SwField& rFld, const bool bForceExpandHints)
: nsSetAttrMode::SETATTR_DEFAULT;
FOREACHPAM_START(GetCrsr()) // for each PaM
- bool bSuccess(GetDoc()->InsertPoolItem(*PCURCRSR, aFld, nInsertFlags));
+ const bool bSuccess(GetDoc()->InsertPoolItem(*PCURCRSR, aFld, nInsertFlags));
OSL_ENSURE( bSuccess, "Doc->Insert(Field) failed");
(void) bSuccess;
FOREACHPAM_END()
@@ -208,62 +207,33 @@ void SwEditShell::Insert2(SwField& rFld, const bool bForceExpandHints)
EndAllAction();
}
-/// Are the PaMs positioned on fields?
-inline SwTxtFld *GetDocTxtFld( const SwPosition* pPos )
-{
- SwTxtNode * const pNode = pPos->nNode.GetNode().GetTxtNode();
- return (pNode)
- ? static_cast<SwTxtFld*>( pNode->GetTxtAttrForCharAt(
- pPos->nContent.GetIndex(), RES_TXTATR_FIELD ))
- : 0;
-}
-
-SwField* SwEditShell::GetCurFld() const
-{
- // If there are no selections so take the value of the current cursor position.
-
- SwPaM* pCrsr = GetCrsr();
- SwTxtFld *pTxtFld = GetDocTxtFld( pCrsr->Start() );
- SwField *pCurFld = NULL;
-
- /* Field was only recognized if no selection was
- present. Now it is recognized if either the cursor is in the
- field or the selection spans exactly over the field. */
- if( pTxtFld &&
- pCrsr->GetNext() == pCrsr &&
- pCrsr->Start()->nNode == pCrsr->End()->nNode &&
- (pCrsr->End()->nContent.GetIndex() -
- pCrsr->Start()->nContent.GetIndex()) <= 1)
- {
- pCurFld = (SwField*)pTxtFld->GetFmtFld().GetField();
- // Table formula? Convert internal into external name:
- if( RES_TABLEFLD == pCurFld->GetTyp()->Which() )
- {
- const SwTableNode* pTblNd = IsCrsrInTbl();
- ((SwTblField*)pCurFld)->PtrToBoxNm( pTblNd ? &pTblNd->GetTable() : 0 );
- }
-
- }
-
- /* removed handling of multi-selections */
-
- return pCurFld;
-}
/// Are the PaMs positioned on fields?
static SwTxtFld* lcl_FindInputFld( SwDoc* pDoc, SwField& rFld )
{
// Search field via its address. For input fields this needs to be done in protected fields.
SwTxtFld* pTFld = 0;
- if( RES_INPUTFLD == rFld.Which() || ( RES_SETEXPFLD == rFld.Which() &&
- ((SwSetExpField&)rFld).GetInputFlag() ) )
+ if( RES_INPUTFLD == rFld.Which() )
+ {
+ const SfxPoolItem* pItem = NULL;
+ const sal_uInt32 nMaxItems =
+ pDoc->GetAttrPool().GetItemCount2( RES_TXTATR_INPUTFIELD );
+ for( sal_uInt32 n = 0; n < nMaxItems; ++n )
+ if( 0 != (pItem = pDoc->GetAttrPool().GetItem2( RES_TXTATR_INPUTFIELD, n ) )
+ && ((SwFmtFld*)pItem)->GetField() == &rFld )
+ {
+ pTFld = ((SwFmtFld*)pItem)->GetTxtFld();
+ break;
+ }
+ }
+ else if( RES_SETEXPFLD == rFld.Which()
+ && ((SwSetExpField&)rFld).GetInputFlag() )
{
- const SfxPoolItem* pItem;
- sal_uInt32 n, nMaxItems =
+ const SfxPoolItem* pItem = NULL;
+ const sal_uInt32 nMaxItems =
pDoc->GetAttrPool().GetItemCount2( RES_TXTATR_FIELD );
- for( n = 0; n < nMaxItems; ++n )
- if( 0 != (pItem =
- pDoc->GetAttrPool().GetItem2( RES_TXTATR_FIELD, n ) )
+ for( sal_uInt32 n = 0; n < nMaxItems; ++n )
+ if( 0 != (pItem = pDoc->GetAttrPool().GetItem2( RES_TXTATR_FIELD, n ) )
&& ((SwFmtFld*)pItem)->GetField() == &rFld )
{
pTFld = ((SwFmtFld*)pItem)->GetTxtFld();
@@ -291,7 +261,7 @@ void SwEditShell::UpdateFlds( SwField &rFld )
if ( pCrsr->GetNext() == pCrsr && !pCrsr->HasMark())
{
- pTxtFld = GetDocTxtFld(pCrsr->Start());
+ pTxtFld = GetTxtFldAtPos( pCrsr->Start(), true );
if (!pTxtFld) // #i30221#
pTxtFld = lcl_FindInputFld( GetDoc(), rFld);
@@ -306,7 +276,8 @@ void SwEditShell::UpdateFlds( SwField &rFld )
bool bOkay = true;
sal_Bool bTblSelBreak = sal_False;
- SwMsgPoolItem aHint( RES_TXTATR_FIELD ); // Search-Hint
+ SwMsgPoolItem aFldHint( RES_TXTATR_FIELD ); // Search-Hint
+ SwMsgPoolItem aInputFldHint( RES_TXTATR_INPUTFIELD );
FOREACHPAM_START(GetCrsr()) // for each PaM
if( PCURCRSR->HasMark() && bOkay ) // ... with selection
{
@@ -325,13 +296,14 @@ void SwEditShell::UpdateFlds( SwField &rFld )
// Search for SwTxtFld ...
while( bOkay
&& pCurStt->nContent != pCurEnd->nContent
- && aPam.Find( aHint, sal_False, fnMoveForward, &aCurPam ) )
+ && ( aPam.Find( aFldHint, sal_False, fnMoveForward, &aCurPam )
+ || aPam.Find( aInputFldHint, sal_False, fnMoveForward, &aCurPam ) ) )
{
// if only one PaM has more than one field ...
if( aPam.Start()->nContent != pCurStt->nContent )
bOkay = false;
- if( 0 != (pTxtFld = GetDocTxtFld( pCurStt )) )
+ if( 0 != (pTxtFld = GetTxtFldAtPos( pCurStt, true )) )
{
pFmtFld = (SwFmtFld*)&pTxtFld->GetFmtFld();
SwField *pCurFld = pFmtFld->GetField();
diff --git a/sw/source/core/edit/edfldexp.cxx b/sw/source/core/edit/edfldexp.cxx
index 64383014db38..7a7b207880c2 100644
--- a/sw/source/core/edit/edfldexp.cxx
+++ b/sw/source/core/edit/edfldexp.cxx
@@ -26,7 +26,6 @@
#include <com/sun/star/sdb/DatabaseContext.hpp>
#include <doc.hxx>
#include <docary.hxx>
-#include <ndtxt.hxx>
#include <txtfld.hxx>
#include <fmtfld.hxx>
#include <edimp.hxx>
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index 3d6f72ebd2af..d7d8e1ca68f7 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -673,7 +673,7 @@ sal_Bool SwEditShell::InsertURL( const SwFmtINetFmt& rFmt, const OUString& rStr,
else
bInsTxt = false;
- SetAttr( rFmt );
+ SetAttrItem( rFmt );
if (bInsTxt && !IsCrsrPtAtEnd())
SwapPam();
if(!bKeepSelection)
diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index ccdadbfdc721..c9f9b5643742 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -1172,13 +1172,13 @@ void SwEditShell::ApplyChangedSentence(const ::svx::SpellPortions& rNewPortions,
mpDoc->DeleteAndJoin(*pCrsr);
// ... and apply language if necessary
if(aCurrentNewPortion->eLanguage != aCurrentOldPortion->eLanguage)
- SetAttr( SvxLanguageItem(aCurrentNewPortion->eLanguage, nLangWhichId), nLangWhichId );
+ SetAttrItem( SvxLanguageItem(aCurrentNewPortion->eLanguage, nLangWhichId), nLangWhichId );
mpDoc->InsertString(*pCrsr, aCurrentNewPortion->sText);
}
else if(aCurrentNewPortion->eLanguage != aCurrentOldPortion->eLanguage)
{
// apply language
- SetAttr( SvxLanguageItem(aCurrentNewPortion->eLanguage, nLangWhichId), nLangWhichId );
+ SetAttrItem( SvxLanguageItem(aCurrentNewPortion->eLanguage, nLangWhichId), nLangWhichId );
}
else if( aCurrentNewPortion->bIgnoreThisError )
{
@@ -1219,7 +1219,7 @@ void SwEditShell::ApplyChangedSentence(const ::svx::SpellPortions& rNewPortions,
GetCurAttr( aSet );
const SvxLanguageItem& rLang = static_cast<const SvxLanguageItem& >(aSet.Get(nLangWhichId));
if(rLang.GetLanguage() != aCurrentNewPortion->eLanguage)
- SetAttr( SvxLanguageItem(aCurrentNewPortion->eLanguage, nLangWhichId) );
+ SetAttrItem( SvxLanguageItem(aCurrentNewPortion->eLanguage, nLangWhichId) );
// insert the new string
mpDoc->InsertString(*pCrsr, aCurrentNewPortion->sText);
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index b74bc0d231d2..431f30ff0212 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -723,13 +723,13 @@ void SwEditShell::SetCurNumRule( const SwNumRule& rRule,
SwPamRanges aRangeArr( *pCrsr );
SwPaM aPam( *pCrsr->GetPoint() );
for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
- {
+ {
aRangeArr.SetPam( n, aPam );
GetDoc()->SetNumRule( aPam, rRule,
bCreateNewList, sContinuedListId,
- true, bResetIndentAttrs );
+ true , bResetIndentAttrs );
GetDoc()->SetCounted( aPam, true );
- }
+ }
}
else
{
diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx
index 9059e17e6e24..9282c9495af6 100644
--- a/sw/source/core/edit/edtox.cxx
+++ b/sw/source/core/edit/edtox.cxx
@@ -70,8 +70,8 @@ void SwEditShell::Insert(const SwTOXMark& rMark)
}
else if( *pEnd != *pStt )
{
- GetDoc()->InsertPoolItem( *PCURCRSR, rMark,
- nsSetAttrMode::SETATTR_DONTEXPAND );
+ GetDoc()->InsertPoolItem(
+ *PCURCRSR, rMark, nsSetAttrMode::SETATTR_DONTEXPAND );
}
FOREACHPAM_END()
diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx
index 31f979771b32..e25dd31f13eb 100644
--- a/sw/source/core/fields/expfld.cxx
+++ b/sw/source/core/fields/expfld.cxx
@@ -948,8 +948,164 @@ void SwSetExpField::SetPar2(const OUString& rStr)
}
}
+
+bool SwSetExpField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
+{
+ sal_Int32 nTmp32 = 0;
+ sal_Int16 nTmp16 = 0;
+ switch( nWhichId )
+ {
+ case FIELD_PROP_BOOL2:
+ if(*(sal_Bool*)rAny.getValue())
+ nSubType &= ~nsSwExtendedSubType::SUB_INVISIBLE;
+ else
+ nSubType |= nsSwExtendedSubType::SUB_INVISIBLE;
+ break;
+ case FIELD_PROP_FORMAT:
+ rAny >>= nTmp32;
+ SetFormat(nTmp32);
+ break;
+ case FIELD_PROP_USHORT2:
+ {
+ rAny >>= nTmp16;
+ if(nTmp16 <= SVX_NUMBER_NONE )
+ SetFormat(nTmp16);
+ else {
+ //exception(wrong_value)
+ ;
+ }
+ }
+ break;
+ case FIELD_PROP_USHORT1:
+ rAny >>= nTmp16;
+ nSeqNo = nTmp16;
+ break;
+ case FIELD_PROP_PAR1:
+ {
+ OUString sTmp;
+ rAny >>= sTmp;
+ SetPar1( SwStyleNameMapper::GetUIName( sTmp, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL ) );
+ }
+ break;
+ case FIELD_PROP_PAR2:
+ {
+ OUString uTmp;
+ rAny >>= uTmp;
+ //I18N - if the formula contains only "TypeName+1"
+ //and it's one of the initially created sequence fields
+ //then the localized names has to be replaced by a programmatic name
+ OUString sMyFormula = SwXFieldMaster::LocalizeFormula(*this, uTmp, sal_False);
+ SetFormula( sMyFormula );
+ }
+ break;
+ case FIELD_PROP_DOUBLE:
+ {
+ double fVal = 0.0;
+ rAny >>= fVal;
+ SetValue(fVal);
+ }
+ break;
+ case FIELD_PROP_SUBTYPE:
+ nTmp32 = lcl_APIToSubType(rAny);
+ if(nTmp32 >= 0)
+ SetSubType(static_cast<sal_uInt16>((GetSubType() & 0xff00) | nTmp32));
+ break;
+ case FIELD_PROP_PAR3:
+ rAny >>= aPText;
+ break;
+ case FIELD_PROP_BOOL3:
+ if(*(sal_Bool*) rAny.getValue())
+ nSubType |= nsSwExtendedSubType::SUB_CMD;
+ else
+ nSubType &= (~nsSwExtendedSubType::SUB_CMD);
+ break;
+ case FIELD_PROP_BOOL1:
+ SetInputFlag(*(sal_Bool*) rAny.getValue());
+ break;
+ case FIELD_PROP_PAR4:
+ {
+ OUString sTmp;
+ rAny >>= sTmp;
+ ChgExpStr( sTmp );
+ }
+ break;
+ default:
+ return SwField::PutValue(rAny, nWhichId);
+ }
+ return true;
+}
+
+
+bool SwSetExpField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
+{
+ switch( nWhichId )
+ {
+ case FIELD_PROP_BOOL2:
+ {
+ sal_Bool bVal = 0 == (nSubType & nsSwExtendedSubType::SUB_INVISIBLE);
+ rAny.setValue(&bVal, ::getBooleanCppuType());
+ }
+ break;
+ case FIELD_PROP_FORMAT:
+ rAny <<= (sal_Int32)GetFormat();
+ break;
+ case FIELD_PROP_USHORT2:
+ rAny <<= (sal_Int16)GetFormat();
+ break;
+ case FIELD_PROP_USHORT1:
+ rAny <<= (sal_Int16)nSeqNo;
+ break;
+ case FIELD_PROP_PAR1:
+ rAny <<= OUString ( SwStyleNameMapper::GetProgName(GetPar1(), nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL ) );
+ break;
+ case FIELD_PROP_PAR2:
+ {
+ //I18N - if the formula contains only "TypeName+1"
+ //and it's one of the initially created sequence fields
+ //then the localized names has to be replaced by a programmatic name
+ OUString sMyFormula = SwXFieldMaster::LocalizeFormula(*this, GetFormula(), sal_True);
+ rAny <<= OUString( sMyFormula );
+ }
+ break;
+ case FIELD_PROP_DOUBLE:
+ rAny <<= (double)GetValue();
+ break;
+ case FIELD_PROP_SUBTYPE:
+ {
+ sal_Int16 nRet = 0;
+ nRet = lcl_SubTypeToAPI(GetSubType() & 0xff);
+ rAny <<= nRet;
+ }
+ break;
+ case FIELD_PROP_PAR3:
+ rAny <<= OUString( aPText );
+ break;
+ case FIELD_PROP_BOOL3:
+ {
+ sal_Bool bTmp = 0 != (nSubType & nsSwExtendedSubType::SUB_CMD);
+ rAny.setValue(&bTmp, ::getBooleanCppuType());
+ }
+ break;
+ case FIELD_PROP_BOOL1:
+ {
+ sal_Bool bTmp = GetInputFlag();
+ rAny.setValue(&bTmp, ::getBooleanCppuType());
+ }
+ break;
+ case FIELD_PROP_PAR4:
+ rAny <<= rtl::OUString(GetExpStr());
+ break;
+ default:
+ return SwField::QueryValue(rAny, nWhichId);
+ }
+ return true;
+}
+
+
+
SwInputFieldType::SwInputFieldType( SwDoc* pD )
- : SwFieldType( RES_INPUTFLD ), pDoc( pD )
+ : SwFieldType( RES_INPUTFLD )
+ , pDoc( pD )
{
}
@@ -959,10 +1115,57 @@ SwFieldType* SwInputFieldType::Copy() const
return pType;
}
-SwInputField::SwInputField(SwInputFieldType* pTyp, const OUString& rContent,
- const OUString& rPrompt, sal_uInt16 nSub, sal_uLong nFmt) :
- SwField(pTyp, nFmt), aContent(rContent), aPText(rPrompt), nSubType(nSub)
+SwInputField::SwInputField( SwInputFieldType* pFieldType,
+ const OUString& rContent,
+ const OUString& rPrompt,
+ sal_uInt16 nSub,
+ sal_uLong nFmt,
+ bool bIsFormField )
+ : SwField( pFieldType, nFmt, LANGUAGE_SYSTEM, false )
+ , aContent(rContent)
+ , aPText(rPrompt)
+ , nSubType(nSub)
+ , mbIsFormField( bIsFormField )
+ , mpFmtFld( NULL )
+{
+}
+
+SwInputField::~SwInputField()
+{
+}
+
+
+void SwInputField::SetFmtFld( SwFmtFld& rFmtFld )
+{
+ mpFmtFld = &rFmtFld;
+}
+
+SwFmtFld* SwInputField::GetFmtFld()
+{
+ return mpFmtFld;
+}
+
+
+const OUString& SwInputField::getContent() const
+{
+ return aContent;
+}
+
+void SwInputField::applyFieldContent( const OUString& rNewFieldContent )
{
+ if ( (nSubType & 0x00ff) == INP_TXT )
+ {
+ aContent = rNewFieldContent;
+ }
+ else if( (nSubType & 0x00ff) == INP_USR )
+ {
+ SwUserFieldType* pUserTyp = static_cast<SwUserFieldType*>(
+ static_cast<SwInputFieldType*>(GetTyp())->GetDoc()->GetFldType( RES_USERFLD, getContent(), false ) );
+ if( pUserTyp )
+ {
+ pUserTyp->SetContent( rNewFieldContent );
+ }
+ }
}
OUString SwInputField::GetFieldName() const
@@ -970,18 +1173,24 @@ OUString SwInputField::GetFieldName() const
OUString aStr(SwField::GetFieldName());
if ((nSubType & 0x00ff) == INP_USR)
{
- aStr += GetTyp()->GetName() + " " + aContent;
+ aStr += GetTyp()->GetName() + " " + getContent();
}
return aStr;
}
SwField* SwInputField::Copy() const
{
- SwInputField* pFld = new SwInputField((SwInputFieldType*)GetTyp(), aContent,
- aPText, GetSubType(), GetFormat());
+ SwInputField* pFld =
+ new SwInputField(
+ static_cast<SwInputFieldType*>(GetTyp()),
+ getContent(),
+ aPText,
+ GetSubType(),
+ GetFormat(),
+ mbIsFormField );
- pFld->SetHelp(aHelp);
- pFld->SetToolTip(aToolTip);
+ pFld->SetHelp( aHelp );
+ pFld->SetToolTip( aToolTip );
pFld->SetAutomaticLanguage(IsAutomaticLanguage());
return pFld;
@@ -990,13 +1199,14 @@ SwField* SwInputField::Copy() const
OUString SwInputField::Expand() const
{
if((nSubType & 0x00ff) == INP_TXT)
- return aContent;
+ {
+ return getContent();
+ }
if( (nSubType & 0x00ff) == INP_USR )
{
- SwUserFieldType* pUserTyp = (SwUserFieldType*)
- ((SwInputFieldType*)GetTyp())->GetDoc()->
- GetFldType( RES_USERFLD, aContent, false );
+ SwUserFieldType* pUserTyp = static_cast<SwUserFieldType*>(
+ static_cast<SwInputFieldType*>(GetTyp())->GetDoc()->GetFldType( RES_USERFLD, getContent(), false ) );
if( pUserTyp )
return pUserTyp->GetContent();
}
@@ -1004,12 +1214,21 @@ OUString SwInputField::Expand() const
return OUString();
}
+
+bool SwInputField::isFormField() const
+{
+ return mbIsFormField
+ || !aHelp.isEmpty()
+ || !aToolTip.isEmpty();
+}
+
+
bool SwInputField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
{
switch( nWhichId )
{
case FIELD_PROP_PAR1:
- rAny <<= aContent;
+ rAny <<= getContent();
break;
case FIELD_PROP_PAR2:
rAny <<= aPText;
@@ -1048,6 +1267,7 @@ bool SwInputField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
return true;
}
+
/// set condition
void SwInputField::SetPar1(const OUString& rStr)
{
@@ -1056,10 +1276,9 @@ void SwInputField::SetPar1(const OUString& rStr)
OUString SwInputField::GetPar1() const
{
- return aContent;
+ return getContent();
}
-/// True/False Text
void SwInputField::SetPar2(const OUString& rStr)
{
aPText = rStr;
@@ -1090,11 +1309,6 @@ OUString SwInputField::GetToolTip() const
return aToolTip;
}
-sal_Bool SwInputField::isFormField() const
-{
- return !aHelp.isEmpty() || !aToolTip.isEmpty();
-}
-
sal_uInt16 SwInputField::GetSubType() const
{
return nSubType;
@@ -1105,149 +1319,4 @@ void SwInputField::SetSubType(sal_uInt16 nSub)
nSubType = nSub;
}
-bool SwSetExpField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
-{
- switch( nWhichId )
- {
- case FIELD_PROP_BOOL2:
- {
- sal_Bool bVal = 0 == (nSubType & nsSwExtendedSubType::SUB_INVISIBLE);
- rAny.setValue(&bVal, ::getBooleanCppuType());
- }
- break;
- case FIELD_PROP_FORMAT:
- rAny <<= (sal_Int32)GetFormat();
- break;
- case FIELD_PROP_USHORT2:
- rAny <<= (sal_Int16)GetFormat();
- break;
- case FIELD_PROP_USHORT1:
- rAny <<= (sal_Int16)nSeqNo;
- break;
- case FIELD_PROP_PAR1:
- rAny <<= OUString ( SwStyleNameMapper::GetProgName(GetPar1(), nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL ) );
- break;
- case FIELD_PROP_PAR2:
- //I18N - if the formula contains only "TypeName+1"
- //and it's one of the initially created sequence fields
- //then the localized names has to be replaced by a programmatic name
- rAny <<= SwXFieldMaster::LocalizeFormula(*this, GetFormula(), sal_True);
- break;
- case FIELD_PROP_DOUBLE:
- rAny <<= (double)GetValue();
- break;
- case FIELD_PROP_SUBTYPE:
- {
- sal_Int16 nRet = 0;
- nRet = lcl_SubTypeToAPI(GetSubType() & 0xff);
- rAny <<= nRet;
- }
- break;
- case FIELD_PROP_PAR3:
- rAny <<= aPText;
- break;
- case FIELD_PROP_BOOL3:
- {
- sal_Bool bTmp = 0 != (nSubType & nsSwExtendedSubType::SUB_CMD);
- rAny.setValue(&bTmp, ::getBooleanCppuType());
- }
- break;
- case FIELD_PROP_BOOL1:
- {
- sal_Bool bTmp = GetInputFlag();
- rAny.setValue(&bTmp, ::getBooleanCppuType());
- }
- break;
- case FIELD_PROP_PAR4:
- rAny <<= GetExpStr();
- break;
- default:
- return SwField::QueryValue(rAny, nWhichId);
- }
- return true;
-}
-
-bool SwSetExpField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
-{
- sal_Int32 nTmp32 = 0;
- sal_Int16 nTmp16 = 0;
- switch( nWhichId )
- {
- case FIELD_PROP_BOOL2:
- if(*(sal_Bool*)rAny.getValue())
- nSubType &= ~nsSwExtendedSubType::SUB_INVISIBLE;
- else
- nSubType |= nsSwExtendedSubType::SUB_INVISIBLE;
- break;
- case FIELD_PROP_FORMAT:
- rAny >>= nTmp32;
- SetFormat(nTmp32);
- break;
- case FIELD_PROP_USHORT2:
- {
- rAny >>= nTmp16;
- if(nTmp16 <= SVX_NUMBER_NONE )
- SetFormat(nTmp16);
- else {
- }
- }
- break;
- case FIELD_PROP_USHORT1:
- rAny >>= nTmp16;
- nSeqNo = nTmp16;
- break;
- case FIELD_PROP_PAR1:
- {
- OUString sTmp;
- rAny >>= sTmp;
- SetPar1( SwStyleNameMapper::GetUIName( sTmp, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL ) );
- }
- break;
- case FIELD_PROP_PAR2:
- {
- OUString uTmp;
- rAny >>= uTmp;
- //I18N - if the formula contains only "TypeName+1"
- //and it's one of the initially created sequence fields
- //then the localized names has to be replaced by a programmatic name
- SetFormula( SwXFieldMaster::LocalizeFormula(*this, uTmp, sal_False) );
- }
- break;
- case FIELD_PROP_DOUBLE:
- {
- double fVal = 0.0;
- rAny >>= fVal;
- SetValue(fVal);
- }
- break;
- case FIELD_PROP_SUBTYPE:
- nTmp32 = lcl_APIToSubType(rAny);
- if(nTmp32 >= 0)
- SetSubType(static_cast<sal_uInt16>((GetSubType() & 0xff00) | nTmp32));
- break;
- case FIELD_PROP_PAR3:
- rAny >>= aPText;
- break;
- case FIELD_PROP_BOOL3:
- if(*(sal_Bool*) rAny.getValue())
- nSubType |= nsSwExtendedSubType::SUB_CMD;
- else
- nSubType &= (~nsSwExtendedSubType::SUB_CMD);
- break;
- case FIELD_PROP_BOOL1:
- SetInputFlag(*(sal_Bool*) rAny.getValue());
- break;
- case FIELD_PROP_PAR4:
- {
- OUString sTmp;
- rAny >>= sTmp;
- ChgExpStr( sTmp );
- }
- break;
- default:
- return SwField::PutValue(rAny, nWhichId);
- }
- return true;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index 1523740c266b..553b1eca375f 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -151,13 +151,19 @@ bool SwFieldType::PutValue( const uno::Any& , sal_uInt16 )
// Base class for all fields.
// A field (multiple can exist) references a field type (can exists only once)
-SwField::SwField(SwFieldType* pTyp, sal_uInt32 nFmt, sal_uInt16 nLng) :
- nLang(nLng),
- bIsAutomaticLanguage(sal_True),
- nFormat(nFmt)
+SwField::SwField(
+ SwFieldType* pTyp,
+ sal_uInt32 nFmt,
+ sal_uInt16 nLng,
+ bool bUseFieldValueCache )
+ : m_Cache()
+ , m_bUseFieldValueCache( bUseFieldValueCache )
+ , nLang( nLng )
+ , bIsAutomaticLanguage( sal_True )
+ , nFormat( nFmt )
+ , pType( pTyp )
{
OSL_ENSURE( pTyp, "SwField: no SwFieldType" );
- pType = pTyp;
}
SwField::~SwField()
@@ -380,11 +386,16 @@ sal_Bool SwField::IsFixed() const
OUString SwField::ExpandField(bool const bCached) const
{
- if (!bCached) // #i85766# do not expand fields in clipboard documents
+ if ( m_bUseFieldValueCache )
{
- m_Cache = Expand();
+ if (!bCached) // #i85766# do not expand fields in clipboard documents
+ {
+ m_Cache = Expand();
+ }
+ return m_Cache;
}
- return m_Cache;
+
+ return Expand();
}
SwField * SwField::CopyField() const
@@ -393,6 +404,8 @@ SwField * SwField::CopyField() const
// #i85766# cache expansion of source (for clipboard)
// use this->cache, not this->Expand(): only text formatting calls Expand()
pNew->m_Cache = m_Cache;
+ pNew->m_bUseFieldValueCache = m_bUseFieldValueCache;
+
return pNew;
}
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 3de9fe666385..d9c03a365175 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -489,6 +489,7 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr )
}
}
break;
+
default:
OSL_FAIL("<SwGetRefField::UpdateField(..)> - unknown format type");
}
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 1f49a51d61f4..1931c734c3b7 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -105,8 +105,12 @@ static bool lcl_SetNewFlyPos( const SwNode& rNode, SwFmtAnchor& rAnchor,
return bRet;
}
-static sal_Bool lcl_FindAnchorPos( SwDoc& rDoc, const Point& rPt, const SwFrm& rFrm,
- SfxItemSet& rSet )
+static sal_Bool lcl_FindAnchorPos(
+ SwEditShell& rEditShell,
+ SwDoc& rDoc,
+ const Point& rPt,
+ const SwFrm& rFrm,
+ SfxItemSet& rSet )
{
sal_Bool bRet = sal_True;
SwFmtAnchor aNewAnch( (SwFmtAnchor&)rSet.Get( RES_ANCHOR ) );
@@ -147,6 +151,13 @@ static sal_Bool lcl_FindAnchorPos( SwDoc& rDoc, const Point& rPt, const SwFrm& r
else
pCNd->MakeEndIndex( &aPos.nContent );
}
+ else
+ {
+ if ( rEditShell.PosInsideInputFld( aPos ) )
+ {
+ aPos.nContent = rEditShell.StartOfInputFldAtPos( aPos );
+ }
+ }
}
aNewAnch.SetAnchor( &aPos );
}
@@ -192,7 +203,10 @@ static sal_Bool lcl_FindAnchorPos( SwDoc& rDoc, const Point& rPt, const SwFrm& r
//
//! also used in unoframe.cxx
//
-sal_Bool sw_ChkAndSetNewAnchor( const SwFlyFrm& rFly, SfxItemSet& rSet )
+sal_Bool sw_ChkAndSetNewAnchor(
+ SwEditShell& rEditShell,
+ const SwFlyFrm& rFly,
+ SfxItemSet& rSet )
{
const SwFrmFmt& rFmt = *rFly.GetFmt();
const SwFmtAnchor &rOldAnch = rFmt.GetAnchor();
@@ -212,7 +226,7 @@ sal_Bool sw_ChkAndSetNewAnchor( const SwFlyFrm& rFly, SfxItemSet& rSet )
"forbidden anchor change in Head/Foot." );
#endif
- return ::lcl_FindAnchorPos( *pDoc, rFly.Frm().Pos(), rFly, rSet );
+ return ::lcl_FindAnchorPos( rEditShell, *pDoc, rFly.Frm().Pos(), rFly, rSet );
}
void SwFEShell::SelectFlyFrm( SwFlyFrm& rFrm, sal_Bool bNew )
@@ -401,7 +415,7 @@ Point SwFEShell::FindAnchorPos( const Point& rAbsPos, sal_Bool bMoveIt )
// #i28701#
SwAnchoredObject* pAnchoredObj = ::GetUserCall( pObj )->GetAnchoredObj( pObj );
SwFrmFmt& rFmt = pAnchoredObj->GetFrmFmt();
- RndStdIds nAnchorId = rFmt.GetAnchor().GetAnchorId();
+ const RndStdIds nAnchorId = rFmt.GetAnchor().GetAnchorId();
if ( FLY_AS_CHAR == nAnchorId )
return aRet;
@@ -442,16 +456,20 @@ Point SwFEShell::FindAnchorPos( const Point& rAbsPos, sal_Bool bMoveIt )
// Search nearest SwFlyFrm starting from the upper-left corner
// of the fly
- SwCntntFrm *pTxtFrm;
+ SwCntntFrm *pTxtFrm = NULL;
{
SwCrsrMoveState aState( MV_SETONLYTEXT );
SwPosition aPos( GetDoc()->GetNodes().GetEndOfExtras() );
Point aTmpPnt( rAbsPos );
GetLayout()->GetCrsrOfst( &aPos, aTmpPnt, &aState );
- pTxtFrm = aPos.nNode.GetNode().GetCntntNode()->getLayoutFrm( GetLayout(),0,&aPos,sal_False );
+ if ( nAnchorId != FLY_AT_CHAR
+ || !PosInsideInputFld( aPos ) )
+ {
+ pTxtFrm = aPos.nNode.GetNode().GetCntntNode()->getLayoutFrm( GetLayout(),0,&aPos,sal_False );
+ }
}
- const SwFrm *pNewAnch;
- if( pTxtFrm )
+ const SwFrm *pNewAnch = NULL;
+ if( pTxtFrm != NULL )
{
if ( FLY_AT_PAGE == nAnchorId )
{
@@ -467,8 +485,6 @@ Point SwFEShell::FindAnchorPos( const Point& rAbsPos, sal_Bool bMoveIt )
}
}
}
- else
- pNewAnch = 0;
if( pNewAnch && !pNewAnch->IsProtected() )
{
@@ -508,6 +524,7 @@ Point SwFEShell::FindAnchorPos( const Point& rAbsPos, sal_Bool bMoveIt )
GetPhyPageNum() );
break;
}
+
case FLY_AT_FLY:
{
SwPosition aPos( *((SwFlyFrm*)pNewAnch)->GetFmt()->
@@ -515,26 +532,29 @@ Point SwFEShell::FindAnchorPos( const Point& rAbsPos, sal_Bool bMoveIt )
aAnch.SetAnchor( &aPos );
break;
}
+
case FLY_AT_CHAR:
- {
- SwPosition *pPos = (SwPosition*)aAnch.GetCntntAnchor();
- Point aTmpPnt( rAbsPos );
- if( pTxtFrm->GetCrsrOfst( pPos, aTmpPnt, NULL ) )
- {
- SwRect aTmpRect;
- pTxtFrm->GetCharRect( aTmpRect, *pPos );
- aRet = aTmpRect.Pos();
- }
- else
{
- pPos->nNode = *pTxtFrm->GetNode();
- pPos->nContent.Assign(0,0);
+ SwPosition *pPos = (SwPosition*)aAnch.GetCntntAnchor();
+ Point aTmpPnt( rAbsPos );
+ if( pTxtFrm->GetCrsrOfst( pPos, aTmpPnt, NULL ) )
+ {
+ SwRect aTmpRect;
+ pTxtFrm->GetCharRect( aTmpRect, *pPos );
+ aRet = aTmpRect.Pos();
+ }
+ else
+ {
+ pPos->nNode = *pTxtFrm->GetNode();
+ pPos->nContent.Assign(0,0);
+ }
+ break;
}
- break;
- }
default:
break;
+
}
+
if( bMoveIt )
{
StartAllAction();
@@ -898,7 +918,7 @@ void SwFEShell::InsertDrawObj( SdrObject& rDrawObj,
const Point aRelPos( rInsertPosition.X() - pFrm->Frm().Left(),
rInsertPosition.Y() - pFrm->Frm().Top() );
rDrawObj.SetRelativePos( aRelPos );
- ::lcl_FindAnchorPos( *GetDoc(), rInsertPosition, *pFrm, rFlyAttrSet );
+ ::lcl_FindAnchorPos( *this, *GetDoc(), rInsertPosition, *pFrm, rFlyAttrSet );
}
// insert drawing object into the document creating a new <SwDrawFrmFmt> instance
SwDrawFrmFmt* pFmt = GetDoc()->Insert( aPam, rDrawObj, &rFlyAttrSet, 0 );
@@ -1083,7 +1103,7 @@ bool SwFEShell::SetFlyFrmAttr( SfxItemSet& rSet )
const Point aPt( pFly->Frm().Pos() );
if( SFX_ITEM_SET == rSet.GetItemState( RES_ANCHOR, sal_False ))
- sw_ChkAndSetNewAnchor( *pFly, rSet );
+ sw_ChkAndSetNewAnchor( *this, *pFly, rSet );
SwFlyFrmFmt* pFlyFmt = (SwFlyFrmFmt*)pFly->GetFmt();
if( GetDoc()->SetFlyFrmAttr( *pFlyFmt, rSet ))
@@ -1241,7 +1261,7 @@ void SwFEShell::SetFrmFmt( SwFrmFmt *pNewFmt, bool bKeepOrient, Point* pDocPos )
{
pSet = new SfxItemSet( GetDoc()->GetAttrPool(), aFrmFmtSetRange );
pSet->Put( *pItem );
- if( !sw_ChkAndSetNewAnchor( *pFly, *pSet ))
+ if( !sw_ChkAndSetNewAnchor( *this, *pFly, *pSet ))
delete pSet, pSet = 0;
}
diff --git a/sw/source/core/inc/docfld.hxx b/sw/source/core/inc/docfld.hxx
index d98b8cd760c1..f922e8557242 100644
--- a/sw/source/core/inc/docfld.hxx
+++ b/sw/source/core/inc/docfld.hxx
@@ -78,10 +78,7 @@ public:
_SetGetExpFld( const SwFlyFrmFmt& rFlyFmt, const SwPosition* pPos = 0 );
- bool operator==( const _SetGetExpFld& rFld ) const
- { return nNode == rFld.nNode && nCntnt == rFld.nCntnt &&
- ( !CNTNT.pTxtFld || !rFld.CNTNT.pTxtFld ||
- CNTNT.pTxtFld == rFld.CNTNT.pTxtFld ); }
+ bool operator==( const _SetGetExpFld& rFld ) const;
bool operator<( const _SetGetExpFld& rFld ) const;
const SwTxtFld* GetTxtFld() const
diff --git a/sw/source/core/inc/rolbck.hxx b/sw/source/core/inc/rolbck.hxx
index 7a30ea88c023..5b47c8658e35 100644
--- a/sw/source/core/inc/rolbck.hxx
+++ b/sw/source/core/inc/rolbck.hxx
@@ -392,8 +392,13 @@ public:
// helper methods for recording attribute in History
// used by Undo classes (Delete/Overwrite/Inserts)
- void CopyAttr( SwpHints* pHts, sal_uLong nNodeIdx, xub_StrLen nStart,
- xub_StrLen nEnd, bool bFields );
+ void CopyAttr(
+ SwpHints* pHts,
+ const sal_uLong nNodeIdx,
+ const xub_StrLen nStart,
+ const xub_StrLen nEnd,
+ const bool bCopyFields );
+
void CopyFmtAttr( const SfxItemSet& rSet, sal_uLong nNodeIdx );
};
diff --git a/sw/source/core/inc/rootfrm.hxx b/sw/source/core/inc/rootfrm.hxx
index a40d847cb707..32bc02285729 100644
--- a/sw/source/core/inc/rootfrm.hxx
+++ b/sw/source/core/inc/rootfrm.hxx
@@ -276,8 +276,9 @@ public:
// next page border
const SwPageFrm* GetPageAtPos( const Point& rPt, const Size* pSize = 0, bool bExtend = false ) const;
- //Der Crsr moechte die zu selektierenden Bereiche wissen.
- void CalcFrmRects( SwShellCrsr&, sal_Bool bIsTblSel );
+ void CalcFrmRects(
+ SwShellCrsr&,
+ const sal_Bool bIsTblSel );
// Calculates the cells included from the current selection
// false: There was no result because of an invalid layout
diff --git a/sw/source/core/inc/swfont.hxx b/sw/source/core/inc/swfont.hxx
index 8a4526cfe038..fb3849d9d633 100644
--- a/sw/source/core/inc/swfont.hxx
+++ b/sw/source/core/inc/swfont.hxx
@@ -123,9 +123,11 @@ public:
#define SW_SCRIPTS 3
class SwFont
-{ // CJK == Chinese, Japanese, Korean
- // CTL == Complex text layout ( Hebrew, Arabic )
+{
+ // CJK == Chinese, Japanese, Korean
+ // CTL == Complex text layout ( Hebrew, Arabic )
SwSubFont aSub[SW_SCRIPTS]; // Latin-, CJK- and CTL-font
+
Color* pBackColor; // background color (i.e. at character styles)
Color m_aHighlightColor; // highlight color
Color aUnderColor; // color of the underlining
@@ -147,10 +149,12 @@ class SwFont
sal_uInt16 m_nShadowWidth;
SvxShadowLocation m_aShadowLocation;
- sal_uInt8 nToxCnt; // Zaehlt die Schachtelungstiefe der Tox
- sal_uInt8 nRefCnt; // Zaehlt die Schachtelungstiefe der Refs
- sal_uInt8 m_nMetaCount; // count META/METAFIELD
- sal_uInt8 nActual; // actual font (Latin, CJK or CTL)
+ sal_uInt8 nToxCnt; // Zaehlt die Schachtelungstiefe der Tox
+ sal_uInt8 nRefCnt; // Zaehlt die Schachtelungstiefe der Refs
+ sal_uInt8 m_nMetaCount; // count META/METAFIELD
+ sal_uInt8 m_nInputFieldCount; // count INPUTFIELD
+
+ sal_uInt8 nActual; // actual font (Latin, CJK or CTL)
// Schalter fuer die Font-Extensions
sal_Bool bNoHyph :1; // SwTxtNoHyphenHere: keine Trennstelle
@@ -254,6 +258,9 @@ public:
inline sal_uInt8 &GetMeta() { return m_nMetaCount; }
inline sal_uInt8 GetMeta() const { return m_nMetaCount; }
inline bool IsMeta() const { return (0 != m_nMetaCount); }
+ inline sal_uInt8 &GetInputField() { return m_nInputFieldCount; }
+ inline sal_uInt8 GetInputField() const { return m_nInputFieldCount; }
+ inline bool IsInputField() const { return (0 != m_nInputFieldCount); }
inline void SetURL( const sal_Bool bURL );
inline sal_Bool IsURL() const { return bURL; }
inline void SetGreyWave( const sal_Bool bNew );
diff --git a/sw/source/core/inc/txttypes.hxx b/sw/source/core/inc/txttypes.hxx
index debef5231eec..c835b6bfd7b0 100644
--- a/sw/source/core/inc/txttypes.hxx
+++ b/sw/source/core/inc/txttypes.hxx
@@ -47,6 +47,7 @@
#define POR_PARA 0x8002
#define POR_URL 0x8003
#define POR_HNG 0x8004
+#define POR_INPUTFLD 0x8005
#define POR_DROP 0x8080
#define POR_TOX 0x8089
diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx
index 3cac75adcdab..7b7ef16b67db 100644
--- a/sw/source/core/layout/flycnt.cxx
+++ b/sw/source/core/layout/flycnt.cxx
@@ -29,6 +29,7 @@
#include <fmtornt.hxx>
#include <fmtfsize.hxx>
#include <fmtsrnd.hxx>
+#include <txatbase.hxx>
#include "tabfrm.hxx"
#include "flyfrms.hxx"
@@ -1388,6 +1389,15 @@ void SwFlyAtCntFrm::SetAbsPos( const Point &rNew )
if( pCnt->GetCrsrOfst( pPos, aPt, &eTmpState )
&& pPos->nNode == *pCnt->GetNode() )
{
+ if ( pCnt->GetNode()->GetTxtNode() != NULL )
+ {
+ const SwTxtAttr* pTxtInputFld =
+ pCnt->GetNode()->GetTxtNode()->GetTxtAttrAt( pPos->nContent.GetIndex(), RES_TXTATR_INPUTFIELD, SwTxtNode::PARENT );
+ if ( pTxtInputFld != NULL )
+ {
+ pPos->nContent = *(pTxtInputFld->GetStart());
+ }
+ }
ResetLastCharRectHeight();
if( text::RelOrientation::CHAR == pFmt->GetVertOrient().GetRelationOrient() )
nY = LONG_MAX;
@@ -1415,7 +1425,6 @@ void SwFlyAtCntFrm::SetAbsPos( const Point &rNew )
pFmt->GetDoc()->SetAttr( aAnch, *pFmt );
}
}
- // #i28701# - use new method <GetPageFrm()>
else if ( pTmpPage && pTmpPage != GetPageFrm() )
GetPageFrm()->MoveFly( this, pTmpPage );
@@ -1426,8 +1435,7 @@ void SwFlyAtCntFrm::SetAbsPos( const Point &rNew )
GetFmt()->GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
if ( pOldPage != FindPageFrm() )
- ::Notify_Background( GetVirtDrawObj(), pOldPage, aOld, PREP_FLY_LEAVE,
- sal_False );
+ ::Notify_Background( GetVirtDrawObj(), pOldPage, aOld, PREP_FLY_LEAVE, sal_False );
}
/** method to assure that anchored object is registered at the correct
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index a1dbc6bdc56e..c67008d63df9 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -1992,7 +1992,9 @@ inline void Sub( SwRegionRects& rRegion, const SwRect& rRect )
* inverted rectangles are available.
* In the end the Flys are cut out of the section.
*/
-void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, sal_Bool bIsTblMode )
+void SwRootFrm::CalcFrmRects(
+ SwShellCrsr &rCrsr,
+ const sal_Bool bIsTblMode)
{
SwPosition *pStartPos = rCrsr.Start(),
*pEndPos = rCrsr.GetPoint() == pStartPos ? rCrsr.GetMark() : rCrsr.GetPoint();
diff --git a/sw/source/core/text/atrhndl.hxx b/sw/source/core/text/atrhndl.hxx
index 2571c584e520..b8eb3d00d641 100644
--- a/sw/source/core/text/atrhndl.hxx
+++ b/sw/source/core/text/atrhndl.hxx
@@ -21,7 +21,7 @@
#define INCLUDED_SW_SOURCE_CORE_TEXT_ATRHNDL_HXX
#define INITIAL_NUM_ATTR 3
-#define NUM_ATTRIBUTE_STACKS 43
+#define NUM_ATTRIBUTE_STACKS 44
#include <txatbase.hxx>
#include <swfntcch.hxx>
diff --git a/sw/source/core/text/atrstck.cxx b/sw/source/core/text/atrstck.cxx
index b7574d8b7189..a1c8d96837ee 100644
--- a/sw/source/core/text/atrstck.cxx
+++ b/sw/source/core/text/atrstck.cxx
@@ -127,7 +127,7 @@ const sal_uInt8 StackPos[ static_cast<sal_uInt16>(RES_TXTATR_WITHEND_END) -
0, // RES_TXTATR_CHARFMT, // 51
42, // RES_TXTATR_CJK_RUBY, // 52
0, // RES_TXTATR_UNKNOWN_CONTAINER, // 53
- 0, // RES_TXTATR_DUMMY5 // 54
+ 43, // RES_TXTATR_INPUTFIELD // 54
};
/*************************************************************************
@@ -519,20 +519,21 @@ sal_Bool SwAttrHandler::Push( const SwTxtAttr& rAttr, const SfxPoolItem& rItem )
if ( RES_TXTATR_WITHEND_END <= rItem.Which() )
return sal_False;
- sal_uInt16 nStack = StackPos[ rItem.Which() ];
+ const sal_uInt16 nStack = StackPos[ rItem.Which() ];
// attributes originating from redlining have highest priority
// second priority are hyperlink attributes, which have a color replacement
const SwTxtAttr* pTopAttr = aAttrStack[ nStack ].Top();
- if ( !pTopAttr || rAttr.IsPriorityAttr() ||
- ( !pTopAttr->IsPriorityAttr() &&
- !lcl_ChgHyperLinkColor( *pTopAttr, rItem, mpShell, 0 ) ) )
+ if ( !pTopAttr
+ || rAttr.IsPriorityAttr()
+ || ( !pTopAttr->IsPriorityAttr()
+ && !lcl_ChgHyperLinkColor( *pTopAttr, rItem, mpShell, 0 ) ) )
{
aAttrStack[ nStack ].Push( rAttr );
return sal_True;
}
- sal_uInt16 nPos = aAttrStack[ nStack ].Count();
+ const sal_uInt16 nPos = aAttrStack[ nStack ].Count();
OSL_ENSURE( nPos, "empty stack?" );
aAttrStack[ nStack ].Insert( rAttr, nPos - 1 );
return sal_False;
@@ -680,6 +681,8 @@ void SwAttrHandler::ActivateTop( SwFont& rFnt, const sal_uInt16 nAttr )
bVertLayout
);
}
+ else if ( RES_TXTATR_INPUTFIELD == nAttr )
+ rFnt.GetInputField()--;
}
/*************************************************************************
@@ -948,6 +951,12 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, sal_Bool bPu
else
rFnt.GetMeta()--;
break;
+ case RES_TXTATR_INPUTFIELD :
+ if ( bPush )
+ rFnt.GetInputField()++;
+ else
+ rFnt.GetInputField()--;
+ break;
}
}
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 1ff5a9cd2e1d..adf78faa21c7 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -1226,27 +1226,37 @@ void SwTxtPaintInfo::DrawViewOpt( const SwLinePortion &rPor,
bool bDraw = false;
switch( nWhich )
{
- case POR_FTN:
- case POR_QUOVADIS:
- case POR_NUMBER:
- case POR_FLD:
- case POR_URL:
- case POR_HIDDEN:
- case POR_TOX:
- case POR_REF:
- case POR_META:
- case POR_CONTROLCHAR:
- if ( !GetOpt().IsPagePreview() &&
- !GetOpt().IsReadonly() &&
- SwViewOption::IsFieldShadings() &&
- (POR_NUMBER != nWhich ||
- m_pFrm->GetTxtNode()->HasMarkedLabel())) // #i27615#
- bDraw = true;
+ case POR_FTN:
+ case POR_QUOVADIS:
+ case POR_NUMBER:
+ case POR_FLD:
+ case POR_URL:
+ case POR_HIDDEN:
+ case POR_TOX:
+ case POR_REF:
+ case POR_META:
+ case POR_CONTROLCHAR:
+ if ( !GetOpt().IsPagePreview()
+ && !GetOpt().IsReadonly()
+ && SwViewOption::IsFieldShadings()
+ && ( POR_NUMBER != nWhich
+ || m_pFrm->GetTxtNode()->HasMarkedLabel())) // #i27615#
+ {
+ bDraw = true;
+ }
+ break;
+ case POR_INPUTFLD:
+ // input field shading also in read-only mode
+ if ( !GetOpt().IsPagePreview()
+ && SwViewOption::IsFieldShadings() )
+ {
+ bDraw = true;
+ }
break;
- case POR_TAB: if ( GetOpt().IsTab() ) bDraw = true; break;
- case POR_SOFTHYPH: if ( GetOpt().IsSoftHyph() )bDraw = true; break;
- case POR_BLANK: if ( GetOpt().IsHardBlank())bDraw = true; break;
- default:
+ case POR_TAB: if ( GetOpt().IsTab() ) bDraw = true; break;
+ case POR_SOFTHYPH: if ( GetOpt().IsSoftHyph() )bDraw = true; break;
+ case POR_BLANK: if ( GetOpt().IsHardBlank())bDraw = true; break;
+ default:
{
OSL_ENSURE( !this, "SwTxtPaintInfo::DrawViewOpt: don't know how to draw this" );
break;
@@ -1650,8 +1660,12 @@ sal_Bool SwTxtFormatInfo::LastKernPortion()
return sal_False;
}
-SwTxtSlot::SwTxtSlot( const SwTxtSizeInfo *pNew, const SwLinePortion *pPor,
- bool bTxtLen, bool bExgLists, const sal_Char *pCh )
+SwTxtSlot::SwTxtSlot(
+ const SwTxtSizeInfo *pNew,
+ const SwLinePortion *pPor,
+ bool bTxtLen,
+ bool bExgLists,
+ const sal_Char *pCh )
: pOldTxt( 0 ),
pOldSmartTagList( 0 ),
pOldGrammarCheckList( 0 ),
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index c0588496d303..12c58e46e714 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -885,7 +885,13 @@ SwTxtPortion *SwTxtFormatter::WhichTxtPor( SwTxtFormatInfo &rInf ) const
{
SwTxtPortion *pPor = 0;
if( GetFnt()->IsTox() )
+ {
pPor = new SwToxPortion;
+ }
+ else if ( GetFnt()->IsInputField() )
+ {
+ pPor = new SwTxtInputFldPortion();
+ }
else
{
if( GetFnt()->IsRef() )
@@ -915,8 +921,10 @@ SwTxtPortion *SwTxtFormatter::WhichTxtPor( SwTxtFormatInfo &rInf ) const
else
{
pPor = new SwTxtPortion;
- if( GetFnt()->IsURL() )
+ if ( GetFnt()->IsURL() )
+ {
pPor->SetWhichPor( POR_URL );
+ }
}
}
}
@@ -1335,20 +1343,18 @@ SwLinePortion *SwTxtFormatter::NewPortion( SwTxtFormatInfo &rInf )
case CHAR_ZWSP: // zero width space
case CHAR_ZWNBSP : // word joiner
-// case CHAR_RLM : // right to left mark
-// case CHAR_LRM : // left to right mark
pPor = new SwControlCharPortion( cChar ); break;
case CH_TXTATR_BREAKWORD:
case CH_TXTATR_INWORD:
- if( rInf.HasHint( rInf.GetIdx() ) )
- {
- pPor = NewExtraPortion( rInf );
- break;
- }
- // No break
+ if( rInf.HasHint( rInf.GetIdx() ) )
+ {
+ pPor = NewExtraPortion( rInf );
+ break;
+ }
+ // No break
default :
- {
+ {
SwTabPortion* pLastTabPortion = rInf.GetLastTab();
if ( pLastTabPortion && cChar == rInf.GetTabDecimal() )
{
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index 7fbc03c97d32..b0c57acf4cb8 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -388,14 +388,8 @@ sal_Bool SwFldPortion::Format( SwTxtFormatInfo &rInf )
case CHAR_HARDHYPHEN: // non-breaking hyphen
case CHAR_SOFTHYPHEN:
case CHAR_HARDBLANK:
- // #i59759# Erase additional control
- // characters from field string, otherwise we get stuck in
- // a loop.
case CHAR_ZWSP :
case CHAR_ZWNBSP :
- // #i111750#
- // - Erasing further control characters from field string in
- // to avoid loop.
case CH_TXTATR_BREAKWORD:
case CH_TXTATR_INWORD:
{
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index e9d3796a1817..0d4a2183bad0 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -2221,8 +2221,8 @@ void SwScriptInfo::selectHiddenTextProperty(const SwTxtNode& rNode, MultiSelecti
static_cast<const SvxCharHiddenItem*>( CharFmt::GetItem( *pTxtAttr, RES_CHRATR_HIDDEN ) );
if( pHiddenItem )
{
- xub_StrLen nSt = *pTxtAttr->GetStart();
- xub_StrLen nEnd = *pTxtAttr->GetEnd();
+ const xub_StrLen nSt = *pTxtAttr->GetStart();
+ const xub_StrLen nEnd = *pTxtAttr->End();
if( nEnd > nSt )
{
Range aTmp( nSt, nEnd - 1 );
diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index 9c1c05731ea1..6bff0b69a4fb 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -969,7 +969,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos,
if( pRuby )
{ // The winner is ... a ruby attribute and so
// the end of the multiportion is the end of the ruby attribute.
- rPos = *pRuby->GetEnd();
+ rPos = *pRuby->End();
SwMultiCreator *pRet = new SwMultiCreator;
pRet->pItem = NULL;
pRet->pAttr = pRuby;
@@ -995,7 +995,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos,
{
pRet->pItem = NULL;
pRet->pAttr = (*pHints)[n2Lines];
- aEnd.push_front( *pRet->pAttr->GetEnd() );
+ aEnd.push_front( *pRet->pAttr->End() );
if( pItem )
{
aEnd.front() = GetTxt().getLength();
@@ -1071,8 +1071,8 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos,
if( bTwo == bOn )
{ // .. with the same state, so the last attribute could
// be continued.
- if( aEnd.back() < *pTmp->GetEnd() )
- aEnd.back() = *pTmp->GetEnd();
+ if( aEnd.back() < *pTmp->End() )
+ aEnd.back() = *pTmp->End();
}
else
{ // .. with a different state.
@@ -1080,12 +1080,12 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos,
// If this is smaller than the last on the stack, we put
// it on the stack. If it has the same endposition, the last
// could be removed.
- if( aEnd.back() > *pTmp->GetEnd() )
- aEnd.push_back( *pTmp->GetEnd() );
+ if( aEnd.back() > *pTmp->End() )
+ aEnd.push_back( *pTmp->End() );
else if( aEnd.size() > 1 )
aEnd.pop_back();
else
- aEnd.back() = *pTmp->GetEnd();
+ aEnd.back() = *pTmp->End();
}
}
}
@@ -1143,18 +1143,18 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos,
{
if( bTwo == bOn )
{
- if( aEnd.back() < *pTmp->GetEnd() )
- aEnd.back() = *pTmp->GetEnd();
+ if( aEnd.back() < *pTmp->End() )
+ aEnd.back() = *pTmp->End();
}
else
{
bOn = bTwo;
- if( aEnd.back() > *pTmp->GetEnd() )
- aEnd.push_back( *pTmp->GetEnd() );
+ if( aEnd.back() > *pTmp->End() )
+ aEnd.push_back( *pTmp->End() );
else if( aEnd.size() > 1 )
aEnd.pop_back();
else
- aEnd.back() = *pTmp->GetEnd();
+ aEnd.back() = *pTmp->End();
}
}
}
@@ -1169,7 +1169,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos,
{
pRet->pItem = NULL;
pRet->pAttr = (*pHints)[nRotate];
- aEnd.push_front( *pRet->pAttr->GetEnd() );
+ aEnd.push_front( *pRet->pAttr->End() );
if( pRotItem )
{
aEnd.front() = GetTxt().getLength();
@@ -1214,18 +1214,18 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos,
{
if( bTwo == bOn )
{
- if( aEnd.back() < *pTmp->GetEnd() )
- aEnd.back() = *pTmp->GetEnd();
+ if( aEnd.back() < *pTmp->End() )
+ aEnd.back() = *pTmp->End();
}
else
{
bOn = bTwo;
- if( aEnd.back() > *pTmp->GetEnd() )
- aEnd.push_back( *pTmp->GetEnd() );
+ if( aEnd.back() > *pTmp->End() )
+ aEnd.push_back( *pTmp->End() );
else if( aEnd.size() > 1 )
aEnd.pop_back();
else
- aEnd.back() = *pTmp->GetEnd();
+ aEnd.back() = *pTmp->End();
}
}
}
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index ff20cc1fe98b..ca0eaf50ac20 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -701,6 +701,124 @@ void SwTxtPortion::HandlePortion( SwPortionHandler& rPH ) const
rPH.Text( GetLen(), GetWhichPor(), Height(), Width() );
}
+
+SwTxtInputFldPortion::SwTxtInputFldPortion()
+ : SwTxtPortion()
+ , mbContainsInputFieldStart( false )
+ , mbContainsInputFieldEnd( false )
+{
+ SetWhichPor( POR_INPUTFLD );
+}
+
+
+sal_Bool SwTxtInputFldPortion::Format( SwTxtFormatInfo &rInf )
+{
+ mbContainsInputFieldStart =
+ rInf.GetChar( rInf.GetIdx() ) == CH_TXT_ATR_INPUTFIELDSTART;
+ mbContainsInputFieldEnd =
+ rInf.GetChar( rInf.GetIdx() + rInf.GetLen() - 1 ) == CH_TXT_ATR_INPUTFIELDEND;
+
+ sal_Bool bRet = sal_False;
+ if ( rInf.GetLen() == 1
+ && ( mbContainsInputFieldStart || mbContainsInputFieldEnd ) )
+ {
+ Width( 0 );
+ }
+ else
+ {
+ SwTxtSlot aFormatTxt( &rInf, this, true, true, 0 );
+ if ( rInf.GetLen() == 0 )
+ {
+ Width( 0 );
+ }
+ else
+ {
+ bRet = SwTxtPortion::Format( rInf );
+
+ if ( mbContainsInputFieldEnd )
+ {
+ // adjust portion length accordingly, if complete text fits into the portion
+ if ( GetLen() == rInf.GetLen() )
+ {
+ SetLen( GetLen() + 1 );
+ }
+ }
+
+ if ( mbContainsInputFieldStart )
+ {
+ // adjust portion length accordingly
+ SetLen( GetLen() + 1 );
+ }
+ }
+ }
+
+ return bRet;
+}
+
+void SwTxtInputFldPortion::Paint( const SwTxtPaintInfo &rInf ) const
+{
+ if ( Width() )
+ {
+ rInf.DrawViewOpt( *this, POR_INPUTFLD );
+ static sal_Char sSpace = ' ';
+ SwTxtSlot aPaintTxt( &rInf, this, true, true,
+ ContainsOnlyDummyChars() ? &sSpace : 0 );
+ SwTxtPortion::Paint( rInf );
+ }
+}
+
+sal_Bool SwTxtInputFldPortion::GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const
+{
+ sal_Int32 nIdx = rInf.GetIdx();
+ sal_Int32 nLen = rInf.GetLen();
+ if ( rInf.GetChar( rInf.GetIdx() ) == CH_TXT_ATR_INPUTFIELDSTART )
+ {
+ ++nIdx;
+ --nLen;
+ }
+ if ( rInf.GetChar( rInf.GetIdx() + rInf.GetLen() - 1 ) == CH_TXT_ATR_INPUTFIELDEND )
+ {
+ --nLen;
+ }
+ rTxt = rInf.GetTxt().copy( nIdx, nLen );
+
+ return sal_True;
+}
+
+
+SwPosSize SwTxtInputFldPortion::GetTxtSize( const SwTxtSizeInfo &rInf ) const
+{
+ SwTxtSlot aFormatTxt( &rInf, this, true, false, 0 );
+ if ( rInf.GetLen() == 0 )
+ {
+ return SwPosSize( 0, 0 );
+ }
+
+ return rInf.GetTxtSize();
+}
+
+
+KSHORT SwTxtInputFldPortion::GetViewWidth( const SwTxtSizeInfo &rInf ) const
+{
+ if( !Width()
+ && ContainsOnlyDummyChars()
+ && !rInf.GetOpt().IsPagePreview()
+ && !rInf.GetOpt().IsReadonly()
+ && SwViewOption::IsFieldShadings() )
+ {
+ return rInf.GetTxtSize( " " ).Width();
+ }
+
+ return SwTxtPortion::GetViewWidth( rInf );
+}
+
+bool SwTxtInputFldPortion::ContainsOnlyDummyChars() const
+{
+ return GetLen() <= 2
+ && mbContainsInputFieldStart
+ && mbContainsInputFieldEnd;
+}
+
/*************************************************************************
* class SwHolePortion
*************************************************************************/
diff --git a/sw/source/core/text/portxt.hxx b/sw/source/core/text/portxt.hxx
index 6831661b1e17..71e6de5a3ebd 100644
--- a/sw/source/core/text/portxt.hxx
+++ b/sw/source/core/text/portxt.hxx
@@ -59,6 +59,24 @@ public:
DECL_FIXEDMEMPOOL_NEWDEL(SwTxtPortion)
};
+
+class SwTxtInputFldPortion : public SwTxtPortion
+{
+public:
+ SwTxtInputFldPortion();
+
+ virtual sal_Bool Format( SwTxtFormatInfo &rInf );
+ virtual void Paint( const SwTxtPaintInfo &rInf ) const;
+ virtual KSHORT GetViewWidth( const SwTxtSizeInfo &rInf ) const;
+ virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const;
+ virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const;
+
+private:
+ bool mbContainsInputFieldStart;
+ bool mbContainsInputFieldEnd;
+ bool ContainsOnlyDummyChars() const;
+};
+
/*************************************************************************
* class SwHolePortion
*************************************************************************/
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index 2588d2d91905..22058c36b989 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -336,37 +336,37 @@ SwLinePortion *SwTxtFormatter::NewExtraPortion( SwTxtFormatInfo &rInf )
switch( pHint->Which() )
{
- case RES_TXTATR_FLYCNT :
+ case RES_TXTATR_FLYCNT :
{
pRet = NewFlyCntPortion( rInf, pHint );
break;
}
- case RES_TXTATR_FTN :
+ case RES_TXTATR_FTN :
{
pRet = NewFtnPortion( rInf, pHint );
break;
}
- case RES_TXTATR_FIELD :
+ case RES_TXTATR_FIELD :
{
pRet = NewFldPortion( rInf, pHint );
break;
}
- case RES_TXTATR_REFMARK :
+ case RES_TXTATR_REFMARK :
{
pRet = new SwIsoRefPortion;
break;
}
- case RES_TXTATR_TOXMARK :
+ case RES_TXTATR_TOXMARK :
{
pRet = new SwIsoToxPortion;
break;
}
- case RES_TXTATR_METAFIELD:
+ case RES_TXTATR_METAFIELD:
{
pRet = lcl_NewMetaPortion( *pHint, true );
break;
}
- default: ;
+ default: ;
}
if( !pRet )
{
diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx
index b9369b363ef3..43be3a534902 100644
--- a/sw/source/core/tox/tox.cxx
+++ b/sw/source/core/tox/tox.cxx
@@ -218,7 +218,7 @@ OUString SwTOXMark::GetText() const
if( pTxtAttr && pTxtAttr->GetpTxtNd() )
{
- sal_Int32* pEndIdx = pTxtAttr->GetEnd();
+ const sal_Int32* pEndIdx = pTxtAttr->GetEnd();
OSL_ENSURE( pEndIdx, "TOXMark without mark!");
if( pEndIdx )
{
diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx
index 445940f3ffca..2cee143bb54b 100644
--- a/sw/source/core/tox/txmsrt.cxx
+++ b/sw/source/core/tox/txmsrt.cxx
@@ -213,8 +213,8 @@ bool SwTOXSortTabBase::operator==( const SwTOXSortTabBase& rCmp )
{
// Both pointers exist -> compare text
// else -> compare AlternativeText
- const sal_Int32 *pEnd = pTxtMark->GetEnd();
- const sal_Int32 *pEndCmp = rCmp.pTxtMark->GetEnd();
+ const sal_Int32 *pEnd = pTxtMark->End();
+ const sal_Int32 *pEndCmp = rCmp.pTxtMark->End();
bRet = ( ( pEnd && pEndCmp ) || ( !pEnd && !pEndCmp ) ) &&
pTOXIntl->IsEqual( GetTxt(), GetLocale(),
@@ -248,8 +248,8 @@ bool SwTOXSortTabBase::operator<( const SwTOXSortTabBase& rCmp )
if( *pTxtMark->GetStart() == *rCmp.pTxtMark->GetStart() )
{
- const sal_Int32 *pEnd = pTxtMark->GetEnd();
- const sal_Int32 *pEndCmp = rCmp.pTxtMark->GetEnd();
+ const sal_Int32 *pEnd = pTxtMark->End();
+ const sal_Int32 *pEndCmp = rCmp.pTxtMark->End();
// Both pointers exist -> compare text
// else -> compare AlternativeText
@@ -381,7 +381,7 @@ TextAndReading SwTOXIndex::GetText_Impl() const
void SwTOXIndex::FillText( SwTxtNode& rNd, const SwIndex& rInsPos, sal_uInt16 ) const
{
- const sal_Int32* pEnd = pTxtMark->GetEnd();
+ const sal_Int32* pEnd = pTxtMark->End();
TextAndReading aRet;
if( pEnd && !pTxtMark->GetTOXMark().IsAlternativeText() &&
@@ -478,7 +478,7 @@ SwTOXContent::SwTOXContent( const SwTxtNode& rNd, const SwTxtTOXMark* pMark,
TextAndReading SwTOXContent::GetText_Impl() const
{
- const sal_Int32* pEnd = pTxtMark->GetEnd();
+ const sal_Int32* pEnd = pTxtMark->End();
if( pEnd && !pTxtMark->GetTOXMark().IsAlternativeText() )
{
return TextAndReading(
@@ -493,7 +493,7 @@ TextAndReading SwTOXContent::GetText_Impl() const
void SwTOXContent::FillText( SwTxtNode& rNd, const SwIndex& rInsPos, sal_uInt16 ) const
{
- const sal_Int32* pEnd = pTxtMark->GetEnd();
+ const sal_Int32* pEnd = pTxtMark->End();
if( pEnd && !pTxtMark->GetTOXMark().IsAlternativeText() )
((SwTxtNode*)aTOXSources[0].pNd)->GetExpandTxt( rNd, &rInsPos,
*pTxtMark->GetStart(),
diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
index aac8a0476baa..4307fc2c95d6 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -46,13 +46,13 @@ TYPEINIT1(SwFmtFldHint, SfxHint);
*
****************************************************************************/
- // Konstruktor fuers Default vom Attribut-Pool
-SwFmtFld::SwFmtFld()
- : SfxPoolItem( RES_TXTATR_FIELD )
- , SwClient( 0 )
+// constructor for default item in attribute-pool
+SwFmtFld::SwFmtFld( sal_uInt16 nWhich )
+ : SfxPoolItem( nWhich )
+ , SwClient()
, SfxBroadcaster()
- , pField( 0 )
- , pTxtAttr( 0 )
+ , mpField( NULL )
+ , mpTxtFld( NULL )
{
}
@@ -60,10 +60,15 @@ SwFmtFld::SwFmtFld( const SwField &rFld )
: SfxPoolItem( RES_TXTATR_FIELD )
, SwClient( rFld.GetTyp() )
, SfxBroadcaster()
- , pField( 0 )
- , pTxtAttr( 0 )
+ , mpField( rFld.CopyField() )
+ , mpTxtFld( NULL )
{
- pField = rFld.CopyField();
+ // input field in-place editing
+ if ( GetField()->GetTyp()->Which() == RES_INPUTFLD )
+ {
+ SetWhich( RES_TXTATR_INPUTFIELD );
+ dynamic_cast<SwInputField*>(GetField())->SetFmtFld( *this );
+ }
}
// #i24434#
@@ -74,25 +79,31 @@ SwFmtFld::SwFmtFld( const SwFmtFld& rAttr )
: SfxPoolItem( RES_TXTATR_FIELD )
, SwClient()
, SfxBroadcaster()
- , pField( 0 )
- , pTxtAttr( 0 )
+ , mpField( NULL )
+ , mpTxtFld( NULL )
{
- if(rAttr.GetField())
+ if ( rAttr.GetField() )
{
rAttr.GetField()->GetTyp()->Add(this);
- pField = rAttr.GetField()->CopyField();
+ mpField = rAttr.GetField()->CopyField();
+ // input field in-place editing
+ if ( GetField()->GetTyp()->Which() == RES_INPUTFLD )
+ {
+ SetWhich( RES_TXTATR_INPUTFIELD );
+ dynamic_cast<SwInputField*>(GetField())->SetFmtFld( *this );
+ }
}
}
SwFmtFld::~SwFmtFld()
{
- SwFieldType* pType = pField ? pField->GetTyp() : 0;
+ SwFieldType* pType = mpField ? mpField->GetTyp() : 0;
if (pType && pType->Which() == RES_DBFLD)
pType = 0; // DB-Feldtypen zerstoeren sich selbst
Broadcast( SwFmtFldHint( this, SWFMTFLD_REMOVED ) );
- delete pField;
+ delete mpField;
// bei einige FeldTypen muessen wir den FeldTypen noch loeschen
if( pType && pType->IsLastDepend() )
@@ -129,21 +140,35 @@ void SwFmtFld::RegisterToFieldType( SwFieldType& rType )
// #111840#
-void SwFmtFld::SetFld(SwField * _pField)
+void SwFmtFld::SetField(SwField * _pField)
{
- delete pField;
+ delete mpField;
- pField = _pField;
+ mpField = _pField;
+ if ( GetField()->GetTyp()->Which() == RES_INPUTFLD )
+ {
+ dynamic_cast<SwInputField* >(GetField())->SetFmtFld( *this );
+ }
Broadcast( SwFmtFldHint( this, SWFMTFLD_CHANGED ) );
}
+void SwFmtFld::SetTxtFld( SwTxtFld& rTxtFld )
+{
+ mpTxtFld = &rTxtFld;
+}
+
+void SwFmtFld::ClearTxtFld()
+{
+ mpTxtFld = NULL;
+}
+
int SwFmtFld::operator==( const SfxPoolItem& rAttr ) const
{
OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
- return ( ( pField && ((SwFmtFld&)rAttr).GetField()
- && pField->GetTyp() == ((SwFmtFld&)rAttr).GetField()->GetTyp()
- && pField->GetFormat() == ((SwFmtFld&)rAttr).GetField()->GetFormat() ) )
- || ( !pField && !((SwFmtFld&)rAttr).GetField() );
+ return ( ( mpField && ((SwFmtFld&)rAttr).GetField()
+ && mpField->GetTyp() == ((SwFmtFld&)rAttr).GetField()->GetTyp()
+ && mpField->GetFormat() == ((SwFmtFld&)rAttr).GetField()->GetFormat() ) )
+ || ( !mpField && !((SwFmtFld&)rAttr).GetField() );
}
SfxPoolItem* SwFmtFld::Clone( SfxItemPool* ) const
@@ -153,7 +178,7 @@ SfxPoolItem* SwFmtFld::Clone( SfxItemPool* ) const
void SwFmtFld::SwClientNotify( const SwModify&, const SfxHint& rHint )
{
- if( !pTxtAttr )
+ if( !mpTxtFld )
return;
const SwFieldHint* pHint = dynamic_cast<const SwFieldHint*>( &rHint );
@@ -162,9 +187,9 @@ void SwFmtFld::SwClientNotify( const SwModify&, const SfxHint& rHint )
// replace field content by text
SwPaM* pPaM = pHint->GetPaM();
SwDoc* pDoc = pPaM->GetDoc();
- const SwTxtNode& rTxtNode = pTxtAttr->GetTxtNode();
+ const SwTxtNode& rTxtNode = mpTxtFld->GetTxtNode();
pPaM->GetPoint()->nNode = rTxtNode;
- pPaM->GetPoint()->nContent.Assign( (SwTxtNode*)&rTxtNode, *pTxtAttr->GetStart() );
+ pPaM->GetPoint()->nContent.Assign( (SwTxtNode*)&rTxtNode, *mpTxtFld->GetStart() );
OUString const aEntry( GetField()->ExpandField( pDoc->IsClipBoard() ) );
pPaM->SetMark();
@@ -176,14 +201,14 @@ void SwFmtFld::SwClientNotify( const SwModify&, const SfxHint& rHint )
void SwFmtFld::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
{
- if( !pTxtAttr )
+ if( !mpTxtFld )
return;
// don't do anything, especially not expand!
if( pNew && pNew->Which() == RES_OBJECTDYING )
return;
- SwTxtNode* pTxtNd = (SwTxtNode*)&pTxtAttr->GetTxtNode();
+ SwTxtNode* pTxtNd = (SwTxtNode*)&mpTxtFld->GetTxtNode();
OSL_ENSURE( pTxtNd, "wo ist denn mein Node?" );
if( pNew )
{
@@ -200,7 +225,7 @@ void SwFmtFld::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
{
// #i81002#
// ((SwGetRefField*)GetFld())->UpdateField();
- dynamic_cast<SwGetRefField*>(GetField())->UpdateField( pTxtAttr );
+ dynamic_cast<SwGetRefField*>(GetField())->UpdateField( mpTxtFld );
}
break;
case RES_DOCPOS_UPDATE:
@@ -239,14 +264,14 @@ void SwFmtFld::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
pType->GetValue( aCalc );
}
}
- pTxtAttr->Expand();
+ mpTxtFld->ExpandTxtFld();
}
bool SwFmtFld::GetInfo( SfxPoolItem& rInfo ) const
{
const SwTxtNode* pTxtNd;
if( RES_AUTOFMT_DOCNODE != rInfo.Which() ||
- !pTxtAttr || 0 == ( pTxtNd = pTxtAttr->GetpTxtNode() ) ||
+ !mpTxtFld || 0 == ( pTxtNd = mpTxtFld->GetpTxtNode() ) ||
&pTxtNd->GetNodes() != ((SwAutoFmtGetDocNode&)rInfo).pNodes )
return true;
@@ -255,81 +280,69 @@ bool SwFmtFld::GetInfo( SfxPoolItem& rInfo ) const
}
-sal_Bool SwFmtFld::IsFldInDoc() const
+bool SwFmtFld::IsFldInDoc() const
{
- const SwTxtNode* pTxtNd;
- return pTxtAttr && 0 != ( pTxtNd = pTxtAttr->GetpTxtNode() ) &&
- pTxtNd->GetNodes().IsDocNodes();
+ return mpTxtFld != NULL
+ && mpTxtFld->IsFldInDoc();
}
sal_Bool SwFmtFld::IsProtect() const
{
- const SwTxtNode* pTxtNd;
- return pTxtAttr && 0 != ( pTxtNd = pTxtAttr->GetpTxtNode() ) &&
- pTxtNd->IsProtect();
+ return mpTxtFld != NULL
+ && mpTxtFld->GetpTxtNode() != NULL
+ && mpTxtFld->GetpTxtNode()->IsProtect();
}
-/*************************************************************************
-|*
-|* SwTxtFld::SwTxtFld()
-|*
-|* Beschreibung Attribut fuer automatischen Text, Ctor
-|*
-*************************************************************************/
-SwTxtFld::SwTxtFld(SwFmtFld & rAttr, sal_Int32 const nStartPos,
- bool const bInClipboard)
+SwTxtFld::SwTxtFld(
+ SwFmtFld & rAttr,
+ sal_Int32 const nStartPos,
+ bool const bInClipboard)
: SwTxtAttr( rAttr, nStartPos )
// fdo#39694 the ExpandField here may not give the correct result in all cases,
// but is better than nothing
, m_aExpand( rAttr.GetField()->ExpandField(bInClipboard) )
- , m_pTxtNode( 0 )
+ , m_pTxtNode( NULL )
{
- rAttr.pTxtAttr = this;
+ rAttr.SetTxtFld( *this );
SetHasDummyChar(true);
}
SwTxtFld::~SwTxtFld( )
{
SwFmtFld & rFmtFld( static_cast<SwFmtFld &>(GetAttr()) );
- if (this == rFmtFld.pTxtAttr)
+ if ( this == rFmtFld.GetTxtFld() )
{
- rFmtFld.pTxtAttr = 0; // #i110140# invalidate!
+ rFmtFld.ClearTxtFld();
}
}
-/*************************************************************************
-|*
-|* SwTxtFld::Expand()
-|*
-|* Beschreibung exandiert das Feld und tauscht den Text im Node
-|*
-*************************************************************************/
-void SwTxtFld::Expand() const
+bool SwTxtFld::IsFldInDoc() const
+{
+ return GetpTxtNode() != NULL
+ && GetpTxtNode()->GetNodes().IsDocNodes();
+}
+
+void SwTxtFld::ExpandTxtFld() const
{
- // Wenn das expandierte Feld sich nicht veraendert hat, wird returnt
OSL_ENSURE( m_pTxtNode, "SwTxtFld: where is my TxtNode?" );
const SwField* pFld = GetFmtFld().GetField();
- OUString aNewExpand(
- pFld->ExpandField(m_pTxtNode->GetDoc()->IsClipBoard()) );
+ const OUString aNewExpand( pFld->ExpandField(m_pTxtNode->GetDoc()->IsClipBoard()) );
if( aNewExpand == m_aExpand )
{
// Bei Seitennummernfeldern
const sal_uInt16 nWhich = pFld->GetTyp()->Which();
- if( RES_CHAPTERFLD != nWhich && RES_PAGENUMBERFLD != nWhich &&
- RES_REFPAGEGETFLD != nWhich &&
- // #122919# Page count fields to not use aExpand
- // during formatting, therefore an invalidation of the text frame
- // has to be triggered even if aNewExpand == aExpand:
- ( RES_DOCSTATFLD != nWhich || DS_PAGE != static_cast<const SwDocStatField*>(pFld)->GetSubType() ) &&
- ( RES_GETEXPFLD != nWhich || ((SwGetExpField*)pFld)->IsInBodyTxt() ) )
+ if ( RES_CHAPTERFLD != nWhich
+ && RES_PAGENUMBERFLD != nWhich
+ && RES_REFPAGEGETFLD != nWhich
+ // Page count fields to not use aExpand during formatting,
+ // therefore an invalidation of the text frame has to be triggered even if aNewExpand == aExpand:
+ && ( RES_DOCSTATFLD != nWhich || DS_PAGE != static_cast<const SwDocStatField*>(pFld)->GetSubType() )
+ && ( RES_GETEXPFLD != nWhich || ((SwGetExpField*)pFld)->IsInBodyTxt() ) )
{
- // BP: das muesste man noch optimieren!
- //JP 12.06.97: stimmt, man sollte auf jedenfall eine Status-
- // aenderung an die Frames posten
if( m_pTxtNode->CalcHiddenParaField() )
{
m_pTxtNode->ModifyNotification( 0, 0 );
@@ -340,15 +353,11 @@ void SwTxtFld::Expand() const
m_aExpand = aNewExpand;
- // 0, this for formatting
- m_pTxtNode->ModifyNotification( 0, const_cast<SwFmtFld*>( &GetFmtFld() ) );
+ const_cast<SwTxtFld*>(this)->NotifyContentChange( const_cast<SwFmtFld&>(GetFmtFld()) );
}
-/*************************************************************************
- * SwTxtFld::CopyFld()
- *************************************************************************/
-void SwTxtFld::CopyFld( SwTxtFld *pDest ) const
+void SwTxtFld::CopyTxtFld( SwTxtFld *pDest ) const
{
OSL_ENSURE( m_pTxtNode, "SwTxtFld: where is my TxtNode?" );
OSL_ENSURE( pDest->m_pTxtNode, "SwTxtFld: where is pDest's TxtNode?" );
@@ -356,8 +365,8 @@ void SwTxtFld::CopyFld( SwTxtFld *pDest ) const
IDocumentFieldsAccess* pIDFA = m_pTxtNode->getIDocumentFieldsAccess();
IDocumentFieldsAccess* pDestIDFA = pDest->m_pTxtNode->getIDocumentFieldsAccess();
- SwFmtFld& rFmtFld = (SwFmtFld&)pDest->GetFmtFld();
- const sal_uInt16 nFldWhich = rFmtFld.GetField()->GetTyp()->Which();
+ SwFmtFld& rDestFmtFld = (SwFmtFld&)pDest->GetFmtFld();
+ const sal_uInt16 nFldWhich = rDestFmtFld.GetField()->GetTyp()->Which();
if( pIDFA != pDestIDFA )
{
@@ -365,41 +374,50 @@ void SwTxtFld::CopyFld( SwTxtFld *pDest ) const
// der Feldtyp muss im neuen Dokument angemeldet werden.
// Z.B: Kopieren ins ClipBoard.
SwFieldType* pFldType;
- if( nFldWhich != RES_DBFLD && nFldWhich != RES_USERFLD &&
- nFldWhich != RES_SETEXPFLD && nFldWhich != RES_DDEFLD &&
- RES_AUTHORITY != nFldWhich )
+ if( nFldWhich != RES_DBFLD
+ && nFldWhich != RES_USERFLD
+ && nFldWhich != RES_SETEXPFLD
+ && nFldWhich != RES_DDEFLD
+ && RES_AUTHORITY != nFldWhich )
+ {
pFldType = pDestIDFA->GetSysFldType( nFldWhich );
+ }
else
- pFldType = pDestIDFA->InsertFldType( *rFmtFld.GetField()->GetTyp() );
+ {
+ pFldType = pDestIDFA->InsertFldType( *rDestFmtFld.GetField()->GetTyp() );
+ }
// Sonderbehandlung fuer DDE-Felder
if( RES_DDEFLD == nFldWhich )
{
- if( rFmtFld.GetTxtFld() )
- ((SwDDEFieldType*)rFmtFld.GetField()->GetTyp())->DecRefCnt();
+ if( rDestFmtFld.GetTxtFld() )
+ {
+ ((SwDDEFieldType*)rDestFmtFld.GetField()->GetTyp())->DecRefCnt();
+ }
((SwDDEFieldType*)pFldType)->IncRefCnt();
}
OSL_ENSURE( pFldType, "unbekannter FieldType" );
- pFldType->Add( &rFmtFld ); // ummelden
- rFmtFld.GetField()->ChgTyp( pFldType );
+ pFldType->Add( &rDestFmtFld ); // ummelden
+ rDestFmtFld.GetField()->ChgTyp( pFldType );
}
// Expressionfelder Updaten
- if( nFldWhich == RES_SETEXPFLD || nFldWhich == RES_GETEXPFLD ||
- nFldWhich == RES_HIDDENTXTFLD )
+ if( nFldWhich == RES_SETEXPFLD
+ || nFldWhich == RES_GETEXPFLD
+ || nFldWhich == RES_HIDDENTXTFLD )
{
SwTxtFld* pFld = (SwTxtFld*)this;
pDestIDFA->UpdateExpFlds( pFld, true );
}
// Tabellenfelder auf externe Darstellung
- else if( RES_TABLEFLD == nFldWhich &&
- ((SwTblField*)rFmtFld.GetField())->IsIntrnlName() )
+ else if( RES_TABLEFLD == nFldWhich
+ && ((SwTblField*)rDestFmtFld.GetField())->IsIntrnlName() )
{
// erzeuge aus der internen (fuer CORE) die externe (fuer UI) Formel
const SwTableNode* pTblNd = m_pTxtNode->FindTableNode();
if( pTblNd ) // steht in einer Tabelle
- ((SwTblField*)rFmtFld.GetField())->PtrToBoxNm( &pTblNd->GetTable() );
+ ((SwTblField*)rDestFmtFld.GetField())->PtrToBoxNm( &pTblNd->GetTable() );
}
}
@@ -413,4 +431,86 @@ void SwTxtFld::NotifyContentChange(SwFmtFld& rFmtFld)
}
+// input field in-place editing
+SwTxtInputFld::SwTxtInputFld(
+ SwFmtFld & rAttr,
+ sal_Int32 const nStart,
+ sal_Int32 const nEnd,
+ bool const bInClipboard )
+
+ : SwTxtFld( rAttr, nStart, bInClipboard )
+ , m_nEnd( nEnd )
+{
+ SetHasDummyChar( false );
+ SetHasContent( true );
+
+ SetDontExpand( true );
+ SetLockExpandFlag( true );
+ SetDontExpandStartAttr( true );
+
+ SetNesting( true );
+}
+
+SwTxtInputFld::~SwTxtInputFld()
+{
+}
+
+sal_Int32* SwTxtInputFld::GetEnd()
+{
+ return &m_nEnd;
+}
+
+void SwTxtInputFld::NotifyContentChange( SwFmtFld& rFmtFld )
+{
+ SwTxtFld::NotifyContentChange( rFmtFld );
+
+ UpdateTextNodeContent( GetFieldContent() );
+}
+
+const OUString SwTxtInputFld::GetFieldContent() const
+{
+ return GetFmtFld().GetField()->ExpandField(false);
+}
+
+void SwTxtInputFld::UpdateFieldContent()
+{
+ if ( IsFldInDoc()
+ && (*GetStart()) != (*End()) )
+ {
+ OSL_ENSURE( (*End()) - (*GetStart()) >= 2,
+ "<SwTxtInputFld::UpdateFieldContent()> - Are CH_TXT_ATR_INPUTFIELDSTART and/or CH_TXT_ATR_INPUTFIELDEND missing?" );
+ // skip CH_TXT_ATR_INPUTFIELDSTART character
+ const xub_StrLen nIdx = (*GetStart()) + 1;
+ // skip CH_TXT_ATR_INPUTFIELDEND character
+ const xub_StrLen nLen = static_cast<xub_StrLen>(std::max( 0, ( (*End()) - 1 - nIdx ) ));
+ const OUString aNewFieldContent = GetTxtNode().GetExpandTxt( nIdx, nLen );
+
+ const SwInputField* pInputFld = dynamic_cast<const SwInputField*>(GetFmtFld().GetField());
+ OSL_ENSURE( pInputFld != NULL,
+ "<SwTxtInputFld::GetContent()> - Missing <SwInputFld> instance!" );
+ if ( pInputFld != NULL )
+ {
+ const_cast<SwInputField*>(pInputFld)->applyFieldContent( aNewFieldContent );
+ }
+ }
+}
+
+void SwTxtInputFld::UpdateTextNodeContent( const OUString& rNewContent )
+{
+ if ( !IsFldInDoc() )
+ {
+ OSL_ENSURE( false, "<SwTxtInputFld::UpdateTextNodeContent(..)> - misusage as Input Field is not in document content." );
+ return;
+ }
+
+ OSL_ENSURE( (*End()) - (*GetStart()) >= 2,
+ "<SwTxtInputFld::UpdateTextNodeContent(..)> - Are CH_TXT_ATR_INPUTFIELDSTART and/or CH_TXT_ATR_INPUTFIELDEND missing?" );
+ // skip CH_TXT_ATR_INPUTFIELDSTART character
+ const sal_Int32 nIdx = (*GetStart()) + 1;
+ // skip CH_TXT_ATR_INPUTFIELDEND character
+ const sal_Int32 nDelLen = std::max<sal_Int32>( 0, ( (*End()) - 1 - nIdx ) );
+ SwIndex aIdx( &GetTxtNode(), nIdx );
+ GetTxtNode().ReplaceText( aIdx, nDelLen, rNewContent );
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/txtnode/ndhints.cxx b/sw/source/core/txtnode/ndhints.cxx
index 4d070e1fb57a..d637a2d39020 100644
--- a/sw/source/core/txtnode/ndhints.cxx
+++ b/sw/source/core/txtnode/ndhints.cxx
@@ -270,9 +270,9 @@ bool SwpHintsArray::Check(bool bPortionsMerged) const
&& (RES_TXTATR_AUTOFMT != pHtLast->Which()))
|| ( (RES_TXTATR_CHARFMT != pHtThis->Which())
&& (RES_TXTATR_AUTOFMT != pHtThis->Which()))
- || (*pHtThis->GetStart() >= *pHtLast->GetEnd()) // no overlap
+ || (*pHtThis->GetStart() >= *pHtLast->End()) // no overlap
|| ( ( (*pHtThis->GetStart() == *pHtLast->GetStart())
- && (*pHtThis->GetEnd() == *pHtLast->GetEnd())
+ && (*pHtThis->End() == *pHtLast->End())
) // same range
&& ( (pHtThis->Which() != RES_TXTATR_AUTOFMT)
|| (pHtLast->Which() != RES_TXTATR_AUTOFMT)
@@ -285,7 +285,7 @@ bool SwpHintsArray::Check(bool bPortionsMerged) const
->GetSortNumber())
) // multiple CHARFMT on same range need distinct sortnr
)
- || (*pHtThis->GetStart() == *pHtThis->GetEnd()), // this empty
+ || (*pHtThis->GetStart() == *pHtThis->End()), // this empty
"HintsCheck: Portion inconsistency. "
"This can be temporarily ok during undo operations" );
@@ -298,7 +298,7 @@ bool SwpHintsArray::Check(bool bPortionsMerged) const
{
// mostly ignore the annoying no-length hints
// BuildPortions inserts these in the middle of an exsiting one
- bool const bNoLength(*pHt->GetStart() == *pHt->GetEnd());
+ bool const bNoLength(*pHt->GetStart() == *pHt->End());
bool bNeedContinuation(!bNoLength && pHt->IsFormatIgnoreEnd());
bool bForbidContinuation(!bNoLength && !bNeedContinuation);
if (RES_TXTATR_AUTOFMT == pHt->Which())
@@ -316,7 +316,7 @@ bool SwpHintsArray::Check(bool bPortionsMerged) const
for (sal_uInt16 j = i + 1; j < Count(); ++j)
{
SwTxtAttr *const pOther(m_HintStarts[j]);
- if (*pOther->GetStart() > *pHt->GetEnd())
+ if (*pOther->GetStart() > *pHt->End())
{
break; // done
}
@@ -324,7 +324,7 @@ bool SwpHintsArray::Check(bool bPortionsMerged) const
{
continue; // empty hint: ignore
}
- else if (*pOther->GetStart() == *pHt->GetEnd())
+ else if (*pOther->GetStart() == *pHt->End())
{
if (RES_TXTATR_AUTOFMT == pOther->Which() ||
RES_TXTATR_CHARFMT == pOther->Which())
@@ -365,8 +365,8 @@ bool SwpHintsArray::Check(bool bPortionsMerged) const
if ( pOther->IsNesting() && (i != j) )
{
SwComparePosition cmp = ComparePosition(
- *pHtThis->GetStart(), *pHtThis->GetEnd(),
- *pOther->GetStart(), *pOther->GetEnd());
+ *pHtThis->GetStart(), *pHtThis->End(),
+ *pOther->GetStart(), *pOther->End());
CHECK_ERR( (POS_OVERLAP_BEFORE != cmp) &&
(POS_OVERLAP_BEHIND != cmp),
"HintsCheck: overlapping nesting hints!!!" );
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 7958ac3568b3..6ccd35fb323a 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -20,6 +20,7 @@
#include <hintids.hxx>
#include <hints.hxx>
+#include <comphelper/string.hxx>
#include <editeng/fontitem.hxx>
#include <editeng/formatbreakitem.hxx>
#include <editeng/escapementitem.hxx>
@@ -236,9 +237,11 @@ SwTxtNode::~SwTxtNode()
m_pSwpHints = 0;
for( sal_uInt16 j = pTmpHints->Count(); j; )
+ {
// first remove the attribute from the array otherwise
// if would delete itself
DestroyAttr( pTmpHints->GetTextHint( --j ) );
+ }
delete pTmpHints;
}
@@ -829,8 +832,11 @@ void SwTxtNode::NewAttrSet( SwAttrPool& rPool )
// override SwIndexReg::Update => text hints do not need SwIndex for start/end!
-void SwTxtNode::Update( SwIndex const & rPos, const sal_Int32 nChangeLen,
- const bool bNegative, const bool bDelete )
+void SwTxtNode::Update(
+ SwIndex const & rPos,
+ const sal_Int32 nChangeLen,
+ const bool bNegative,
+ const bool bDelete )
{
SetAutoCompleteWordDirty( sal_True );
@@ -844,6 +850,8 @@ void SwTxtNode::Update( SwIndex const & rPos, const sal_Int32 nChangeLen,
const sal_Int32 nChangeEnd = nChangePos + nChangeLen;
for ( sal_uInt16 n = 0; n < m_pSwpHints->Count(); ++n )
{
+ bool bTxtAttrChanged = false;
+ bool bStartOfTxtAttrChanged = false;
SwTxtAttr * const pHint = m_pSwpHints->GetTextHint(n);
sal_Int32 * const pStart = pHint->GetStart();
if ( *pStart > nChangePos )
@@ -856,6 +864,7 @@ void SwTxtNode::Update( SwIndex const & rPos, const sal_Int32 nChangeLen,
{
*pStart = nChangePos;
}
+ bStartOfTxtAttrChanged = true;
}
sal_Int32 * const pEnd = pHint->GetEnd();
@@ -871,6 +880,17 @@ void SwTxtNode::Update( SwIndex const & rPos, const sal_Int32 nChangeLen,
{
*pEnd = nChangePos;
}
+ bTxtAttrChanged = !bStartOfTxtAttrChanged;
+ }
+ }
+
+ if ( bTxtAttrChanged
+ && pHint->Which() == RES_TXTATR_INPUTFIELD )
+ {
+ SwTxtInputFld* pTxtInputFld = dynamic_cast<SwTxtInputFld*>(pHint);
+ if ( pTxtInputFld )
+ {
+ pTxtInputFld->UpdateFieldContent();
}
}
}
@@ -882,14 +902,15 @@ void SwTxtNode::Update( SwIndex const & rPos, const sal_Int32 nChangeLen,
bool bNoExp = false;
bool bResort = false;
bool bMergePortionsNeeded = false;
- const sal_uInt16 coArrSz = static_cast<sal_uInt16>(RES_TXTATR_WITHEND_END) -
- static_cast<sal_uInt16>(RES_CHRATR_BEGIN);
+ const sal_uInt16 coArrSz =
+ static_cast<sal_uInt16>(RES_TXTATR_WITHEND_END) - static_cast<sal_uInt16>(RES_CHRATR_BEGIN);
sal_Bool aDontExp[ coArrSz ];
memset( &aDontExp, 0, coArrSz * sizeof(sal_Bool) );
for ( sal_uInt16 n = 0; n < m_pSwpHints->Count(); ++n )
{
+ bool bTxtAttrChanged = false;
SwTxtAttr * const pHint = m_pSwpHints->GetTextHint(n);
sal_Int32 * const pStart = pHint->GetStart();
sal_Int32 * const pEnd = pHint->GetEnd();
@@ -906,6 +927,7 @@ void SwTxtNode::Update( SwIndex const & rPos, const sal_Int32 nChangeLen,
if ( (*pEnd > nChangePos) || IsIgnoreDontExpand() )
{
*pEnd = *pEnd + nChangeLen;
+ bTxtAttrChanged = true;
}
else // *pEnd == nChangePos
{
@@ -946,32 +968,43 @@ void SwTxtNode::Update( SwIndex const & rPos, const sal_Int32 nChangeLen,
}
else if( bNoExp )
{
- if ( !pCollector.get() )
- {
- pCollector.reset( new SwpHts );
- }
- for(SwpHts::iterator it = pCollector->begin(); it != pCollector->end(); ++it)
- {
- SwTxtAttr *pTmp = *it;
- if( nWhich == pTmp->Which() )
- {
- pCollector->erase( it );
- SwTxtAttr::Destroy( pTmp,
- GetDoc()->GetAttrPool() );
- break;
- }
- }
- SwTxtAttr * const pTmp = MakeTxtAttr( *GetDoc(),
- pHint->GetAttr(),
- nChangePos, nChangePos + nChangeLen);
- pCollector->push_back( pTmp );
+ if ( !pCollector.get() )
+ {
+ pCollector.reset( new SwpHts );
+ }
+ for(SwpHts::iterator it = pCollector->begin(); it != pCollector->end(); ++it)
+ {
+ SwTxtAttr *pTmp = *it;
+ if( nWhich == pTmp->Which() )
+ {
+ pCollector->erase( it );
+ SwTxtAttr::Destroy( pTmp,
+ GetDoc()->GetAttrPool() );
+ break;
+ }
+ }
+ SwTxtAttr * const pTmp =
+ MakeTxtAttr( *GetDoc(),
+ pHint->GetAttr(), nChangePos, nChangePos + nChangeLen);
+ pCollector->push_back( pTmp );
}
else
{
*pEnd = *pEnd + nChangeLen;
+ bTxtAttrChanged = true;
}
}
}
+
+ if ( bTxtAttrChanged
+ && pHint->Which() == RES_TXTATR_INPUTFIELD )
+ {
+ SwTxtInputFld* pTxtInputFld = dynamic_cast<SwTxtInputFld*>(pHint);
+ if ( pTxtInputFld )
+ {
+ pTxtInputFld->UpdateFieldContent();
+ }
+ }
}
if (bMergePortionsNeeded)
{
@@ -1028,10 +1061,9 @@ void SwTxtNode::Update( SwIndex const & rPos, const sal_Int32 nChangeLen,
}
const IDocumentMarkAccess* const pMarkAccess = getIDocumentMarkAccess();
- for(IDocumentMarkAccess::const_iterator_t ppMark =
- pMarkAccess->getMarksBegin();
- ppMark != pMarkAccess->getMarksEnd();
- ++ppMark)
+ for (IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin();
+ ppMark != pMarkAccess->getMarksEnd();
+ ++ppMark)
{
// Bookmarks must never grow to either side, when
// editing (directly) to the left or right (#i29942#)!
@@ -1155,9 +1187,10 @@ static bool lcl_GetTxtAttrParent(sal_Int32 nIndex, sal_Int32 nHintStart, sal_Int
static void
lcl_GetTxtAttrs(
- ::std::vector<SwTxtAttr *> *const pVector, SwTxtAttr **const ppTxtAttr,
+ ::std::vector<SwTxtAttr *> *const pVector,
+ SwTxtAttr **const ppTxtAttr,
SwpHints *const pSwpHints,
- sal_Int32 nIndex, RES_TXTATR const nWhich,
+ sal_Int32 const nIndex, RES_TXTATR const nWhich,
enum SwTxtNode::GetTxtAttrMode const eMode)
{
sal_uInt16 const nSize = (pSwpHints) ? pSwpHints->Count() : 0;
@@ -1234,7 +1267,8 @@ SwTxtNode::GetTxtAttrAt(xub_StrLen const nIndex, RES_TXTATR const nWhich,
|| (nWhich == RES_TXTATR_AUTOFMT)
|| (nWhich == RES_TXTATR_INETFMT)
|| (nWhich == RES_TXTATR_CJK_RUBY)
- || (nWhich == RES_TXTATR_UNKNOWN_CONTAINER));
+ || (nWhich == RES_TXTATR_UNKNOWN_CONTAINER)
+ || (nWhich == RES_TXTATR_INPUTFIELD ) );
// "GetTxtAttrAt() will give wrong result for this hint!")
SwTxtAttr * pRet(0);
@@ -1242,6 +1276,40 @@ SwTxtNode::GetTxtAttrAt(xub_StrLen const nIndex, RES_TXTATR const nWhich,
return pRet;
}
+const SwTxtInputFld* SwTxtNode::GetOverlappingInputFld( const SwTxtAttr& rTxtAttr ) const
+{
+ const SwTxtInputFld* pTxtInputFld = NULL;
+
+ pTxtInputFld = dynamic_cast<const SwTxtInputFld*>(GetTxtAttrAt( *(rTxtAttr.GetStart()), RES_TXTATR_INPUTFIELD, PARENT ));
+
+ if ( pTxtInputFld == NULL && rTxtAttr.End() != NULL )
+ {
+ pTxtInputFld = dynamic_cast<const SwTxtInputFld*>(GetTxtAttrAt( *(rTxtAttr.End()), RES_TXTATR_INPUTFIELD, PARENT ));
+ }
+
+ return pTxtInputFld;
+}
+
+SwTxtFld* SwTxtNode::GetFldTxtAttrAt(
+ const xub_StrLen nIndex,
+ const bool bIncludeInputFldAtStart ) const
+{
+ SwTxtFld* pTxtFld = NULL;
+
+ pTxtFld = dynamic_cast<SwTxtFld*>(GetTxtAttrForCharAt( nIndex, RES_TXTATR_FIELD ));
+ if ( pTxtFld == NULL )
+ {
+ pTxtFld =
+ dynamic_cast<SwTxtFld*>( GetTxtAttrAt(
+ nIndex,
+ RES_TXTATR_INPUTFIELD,
+ bIncludeInputFldAtStart ? DEFAULT : PARENT ));
+ }
+
+ return pTxtFld;
+}
+
+
/*************************************************************************
* CopyHint()
*************************************************************************/
@@ -1262,77 +1330,80 @@ static SwCharFmt* lcl_FindCharFmt( const SwCharFmts* pCharFmts, const OUString&
return NULL;
}
-static void lcl_CopyHint( const sal_uInt16 nWhich, const SwTxtAttr * const pHt,
- SwTxtAttr *const pNewHt, SwDoc *const pOtherDoc, SwTxtNode *const pDest )
+void lcl_CopyHint(
+ const sal_uInt16 nWhich,
+ const SwTxtAttr * const pHt,
+ SwTxtAttr *const pNewHt,
+ SwDoc *const pOtherDoc,
+ SwTxtNode *const pDest )
{
assert(nWhich == pHt->Which()); // wrong hint-id
switch( nWhich )
{
- // copy nodesarray section with footnote content
- case RES_TXTATR_FTN :
+ // copy nodesarray section with footnote content
+ case RES_TXTATR_FTN :
assert(pDest); // "lcl_CopyHint: no destination text node?"
- static_cast<const SwTxtFtn*>(pHt)->CopyFtn(
- *static_cast<SwTxtFtn*>(pNewHt), *pDest);
+ static_cast<const SwTxtFtn*>(pHt)->CopyFtn( *static_cast<SwTxtFtn*>(pNewHt), *pDest);
break;
- // Beim Kopieren von Feldern in andere Dokumente
- // muessen die Felder bei ihren neuen Feldtypen angemeldet werden.
+ // Beim Kopieren von Feldern in andere Dokumente
+ // muessen die Felder bei ihren neuen Feldtypen angemeldet werden.
- // TabellenFormel muessen relativ kopiert werden.
- case RES_TXTATR_FIELD :
+ // TabellenFormel muessen relativ kopiert werden.
+ case RES_TXTATR_FIELD :
+ case RES_TXTATR_INPUTFIELD :
+ {
+ if( pOtherDoc )
{
- const SwFmtFld& rFld = pHt->GetFmtFld();
- if( pOtherDoc )
- {
- static_cast<const SwTxtFld*>(pHt)->CopyFld(
- static_cast<SwTxtFld*>(pNewHt) );
- }
+ static_cast<const SwTxtFld*>(pHt)->CopyTxtFld( static_cast<SwTxtFld*>(pNewHt) );
+ }
- // Tabellenformel ??
- if( RES_TABLEFLD == rFld.GetField()->GetTyp()->Which()
- && static_cast<const SwTblField*>(rFld.GetField())->IsIntrnlName())
+ // Tabellenformel ??
+ const SwFmtFld& rFld = pHt->GetFmtFld();
+ if( RES_TABLEFLD == rFld.GetField()->GetTyp()->Which()
+ && static_cast<const SwTblField*>(rFld.GetField())->IsIntrnlName())
+ {
+ // wandel die interne in eine externe Formel um
+ const SwTableNode* const pDstTblNd =
+ static_cast<const SwTxtFld*>(pHt)->GetTxtNode().FindTableNode();
+ if( pDstTblNd )
{
- // wandel die interne in eine externe Formel um
- const SwTableNode* const pDstTblNd =
- static_cast<const SwTxtFld*>(pHt)->GetTxtNode().FindTableNode();
- if( pDstTblNd )
- {
- SwTblField* const pTblFld = const_cast<SwTblField*>(
- static_cast<const SwTblField*>(pNewHt->GetFmtFld().GetField()));
- pTblFld->PtrToBoxNm( &pDstTblNd->GetTable() );
- }
+ SwTblField* const pTblFld = const_cast<SwTblField*>(
+ static_cast<const SwTblField*>(pNewHt->GetFmtFld().GetField()));
+ pTblFld->PtrToBoxNm( &pDstTblNd->GetTable() );
}
}
- break;
+ }
+ break;
- case RES_TXTATR_TOXMARK :
- if( pOtherDoc && pDest && pDest->GetpSwpHints()
- && USHRT_MAX != pDest->GetpSwpHints()->GetPos( pNewHt ) )
- {
- // Beim Kopieren von TOXMarks(Client) in andere Dokumente
- // muss der Verzeichnis (Modify) ausgetauscht werden
- static_cast<SwTxtTOXMark*>(pNewHt)->CopyTOXMark( pOtherDoc );
- }
- break;
+ case RES_TXTATR_TOXMARK :
+ if( pOtherDoc && pDest && pDest->GetpSwpHints()
+ && USHRT_MAX != pDest->GetpSwpHints()->GetPos( pNewHt ) )
+ {
+ // Beim Kopieren von TOXMarks(Client) in andere Dokumente
+ // muss der Verzeichnis (Modify) ausgetauscht werden
+ static_cast<SwTxtTOXMark*>(pNewHt)->CopyTOXMark( pOtherDoc );
+ }
+ break;
- case RES_TXTATR_CHARFMT :
- // Wenn wir es mit einer Zeichenvorlage zu tun haben,
- // muessen wir natuerlich auch die Formate kopieren.
- if( pDest && pDest->GetpSwpHints()
- && USHRT_MAX != pDest->GetpSwpHints()->GetPos( pNewHt ) )
- {
- SwCharFmt* pFmt =
- static_cast<SwCharFmt*>(pHt->GetCharFmt().GetCharFmt());
+ case RES_TXTATR_CHARFMT :
+ // Wenn wir es mit einer Zeichenvorlage zu tun haben,
+ // muessen wir natuerlich auch die Formate kopieren.
+ if( pDest && pDest->GetpSwpHints()
+ && USHRT_MAX != pDest->GetpSwpHints()->GetPos( pNewHt ) )
+ {
+ SwCharFmt* pFmt =
+ static_cast<SwCharFmt*>(pHt->GetCharFmt().GetCharFmt());
- if( pFmt && pOtherDoc )
- {
- pFmt = pOtherDoc->CopyCharFmt( *pFmt );
- }
- const_cast<SwFmtCharFmt&>( static_cast<const SwFmtCharFmt&>(
- pNewHt->GetCharFmt() ) ).SetCharFmt( pFmt );
+ if( pFmt && pOtherDoc )
+ {
+ pFmt = pOtherDoc->CopyCharFmt( *pFmt );
}
- break;
- case RES_TXTATR_INETFMT :
+ const_cast<SwFmtCharFmt&>( static_cast<const SwFmtCharFmt&>(
+ pNewHt->GetCharFmt() ) ).SetCharFmt( pFmt );
+ }
+ break;
+ case RES_TXTATR_INETFMT :
{
// Wenn wir es mit benutzerdefinierten INet-Zeichenvorlagen
// zu tun haben, muessen wir natuerlich auch die Formate kopieren.
@@ -1340,7 +1411,7 @@ static void lcl_CopyHint( const sal_uInt16 nWhich, const SwTxtAttr * const pHt,
&& USHRT_MAX != pDest->GetpSwpHints()->GetPos( pNewHt ) )
{
const SwDoc* const pDoc = static_cast<const SwTxtINetFmt*>(pHt)
- ->GetTxtNode().GetDoc();
+ ->GetTxtNode().GetDoc();
if ( pDoc )
{
const SwCharFmts* pCharFmts = pDoc->GetCharFmts();
@@ -1367,13 +1438,13 @@ static void lcl_CopyHint( const sal_uInt16 nWhich, const SwTxtAttr * const pHt,
pINetHt->GetCharFmt();
break;
}
- case RES_TXTATR_META:
- case RES_TXTATR_METAFIELD:
- OSL_ENSURE(pNewHt, "copying Meta should not fail!");
- OSL_ENSURE(pDest && (CH_TXTATR_BREAKWORD ==
- pDest->GetTxt()[*pNewHt->GetStart()]),
- "missing CH_TXTATR?");
- break;
+ case RES_TXTATR_META:
+ case RES_TXTATR_METAFIELD:
+ OSL_ENSURE( pNewHt, "copying Meta should not fail!" );
+ OSL_ENSURE( pDest
+ && (CH_TXTATR_INWORD == pDest->GetTxt()[*pNewHt->GetStart()]),
+ "missing CH_TXTATR?");
+ break;
}
}
@@ -1399,34 +1470,33 @@ void SwTxtNode::CopyAttr( SwTxtNode *pDest, const xub_StrLen nTxtStartIdx,
SwTxtAttr *const pHt = m_pSwpHints->GetTextHint(i);
sal_Int32 const nAttrStartIdx = *pHt->GetStart();
if ( nTxtStartIdx < nAttrStartIdx )
- break; // ueber das Textende, da nLen == 0
+ break; // ueber das Textende, da nLen == 0
const sal_Int32 *const pEndIdx = pHt->GetEnd();
if ( pEndIdx && !pHt->HasDummyChar() )
{
- if( ( *pEndIdx > nTxtStartIdx ||
- ( *pEndIdx == nTxtStartIdx &&
- nAttrStartIdx == nTxtStartIdx ) ) )
+ if ( ( *pEndIdx > nTxtStartIdx
+ || ( *pEndIdx == nTxtStartIdx
+ && nAttrStartIdx == nTxtStartIdx ) ) )
{
sal_uInt16 const nWhich = pHt->Which();
if ( RES_TXTATR_REFMARK != nWhich )
{
// attribute in the area => copy
- SwTxtAttr *const pNewHt = pDest->InsertItem(
- pHt->GetAttr(), nOldPos, nOldPos,
- nsSetAttrMode::SETATTR_IS_COPY);
+ SwTxtAttr *const pNewHt =
+ pDest->InsertItem( pHt->GetAttr(), nOldPos, nOldPos, nsSetAttrMode::SETATTR_IS_COPY);
if ( pNewHt )
{
lcl_CopyHint( nWhich, pHt, pNewHt,
- pOtherDoc, pDest );
+ pOtherDoc, pDest );
}
}
- else if( !pOtherDoc ? GetDoc()->IsCopyIsMove()
- : 0 == pOtherDoc->GetRefMark(
- pHt->GetRefMark().GetRefName() ) )
+ else if( !pOtherDoc
+ ? GetDoc()->IsCopyIsMove()
+ : 0 == pOtherDoc->GetRefMark( pHt->GetRefMark().GetRefName() ) )
{
- pDest->InsertItem( pHt->GetAttr(), nOldPos, nOldPos,
- nsSetAttrMode::SETATTR_IS_COPY);
+ pDest->InsertItem(
+ pHt->GetAttr(), nOldPos, nOldPos, nsSetAttrMode::SETATTR_IS_COPY);
}
}
}
@@ -1447,7 +1517,6 @@ void SwTxtNode::CopyAttr( SwTxtNode *pDest, const xub_StrLen nTxtStartIdx,
|* wird angehaengt
*************************************************************************/
-// #i96213#
// introduction of new optional parameter to control, if all attributes have to be copied.
void SwTxtNode::CopyText( SwTxtNode *const pDest,
const SwIndex &rStart,
@@ -1458,7 +1527,6 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest,
CopyText( pDest, aIdx, rStart, nLen, bForceCopyOfAllAttrs );
}
-// #i96213#
// introduction of new optional parameter to control, if all attributes have to be copied.
void SwTxtNode::CopyText( SwTxtNode *const pDest,
const SwIndex &rDestStart,
@@ -1526,8 +1594,7 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest,
if ( !nLen ) // string not longer?
return;
- SwDoc* const pOtherDoc = (pDest->GetDoc() != GetDoc()) ?
- pDest->GetDoc() : 0;
+ SwDoc* const pOtherDoc = (pDest->GetDoc() != GetDoc()) ? pDest->GetDoc() : 0;
// harte Absatz umspannende Attribute kopieren
if( HasSwAttrSet() )
@@ -1540,11 +1607,11 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest,
nLen != pDest->GetTxt().getLength()))
{
SfxItemSet aCharSet( pDest->GetDoc()->GetAttrPool(),
- RES_CHRATR_BEGIN, RES_CHRATR_END-1,
- RES_TXTATR_INETFMT, RES_TXTATR_INETFMT,
- RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
- RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
- 0 );
+ RES_CHRATR_BEGIN, RES_CHRATR_END-1,
+ RES_TXTATR_INETFMT, RES_TXTATR_INETFMT,
+ RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0 );
aCharSet.Put( *GetpSwAttrSet() );
if( aCharSet.Count() )
{
@@ -1558,7 +1625,7 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest,
}
bool const bUndoNodes = !pOtherDoc
- && GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(GetNodes());
+ && GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(GetNodes());
// Ende erst jetzt holen, weil beim Kopieren in sich selbst der
// Start-Index und alle Attribute vorher aktualisiert werden.
@@ -1579,7 +1646,7 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest,
SwpHts aRefMrkArr;
sal_uInt16 nDeletedDummyChars(0);
- //Achtung: kann ungueltig sein!!
+ //Achtung: kann ungueltig sein!!
for (sal_uInt16 n = 0; ( n < nSize ); ++n)
{
const sal_Int32 nAttrStartIdx = *(*m_pSwpHints)[n]->GetStart();
@@ -1596,16 +1663,32 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest,
// erkennen und sammeln, nach dem kopieren Loeschen.
// Nimmt sein Zeichen mit ins Grab !!
// JP 14.08.95: Duerfen RefMarks gemovt werden?
- int bCopyRefMark = RES_TXTATR_REFMARK == nWhich && ( bUndoNodes ||
- (!pOtherDoc ? GetDoc()->IsCopyIsMove()
- : 0 == pOtherDoc->GetRefMark(
- pHt->GetRefMark().GetRefName() )));
+ const bool bCopyRefMark = RES_TXTATR_REFMARK == nWhich
+ && ( bUndoNodes
+ || ( !pOtherDoc
+ ? GetDoc()->IsCopyIsMove()
+ : 0 == pOtherDoc->GetRefMark( pHt->GetRefMark().GetRefName() ) ) );
- if( pEndIdx && RES_TXTATR_REFMARK == nWhich && !bCopyRefMark )
+ if ( pEndIdx
+ && RES_TXTATR_REFMARK == nWhich
+ && !bCopyRefMark )
{
continue;
}
+ // Input Fields are only copied, if completely covered by copied text
+ if ( nWhich == RES_TXTATR_INPUTFIELD )
+ {
+ OSL_ENSURE( pEndIdx != NULL,
+ "<SwTxtNode::CopyText(..)> - RES_TXTATR_INPUTFIELD without EndIndex!" );
+ if ( nAttrStartIdx < nTxtStartIdx
+ || ( pEndIdx != NULL
+ && *(pEndIdx) > nEnd ) )
+ {
+ continue;
+ }
+ }
+
sal_Int32 nAttrStt = 0;
sal_Int32 nAttrEnd = 0;
@@ -1618,8 +1701,8 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest,
// attribute with extent and the end is in the selection
nAttrStt = nDestStart;
nAttrEnd = (*pEndIdx > nEnd)
- ? rDestStart.GetIndex()
- : nDestStart + (*pEndIdx) - nTxtStartIdx;
+ ? rDestStart.GetIndex()
+ : nDestStart + (*pEndIdx) - nTxtStartIdx;
}
else
{
@@ -1633,8 +1716,8 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest,
if( pEndIdx )
{
nAttrEnd = *pEndIdx > nEnd
- ? rDestStart.GetIndex()
- : nDestStart + ( *pEndIdx - nTxtStartIdx );
+ ? rDestStart.GetIndex()
+ : nDestStart + ( *pEndIdx - nTxtStartIdx );
}
else
{
@@ -2259,7 +2342,7 @@ void SwTxtNode::EraseText(const SwIndex &rIdx, const xub_StrLen nCount,
// 1. The hint ends before the deletion end position or
// 2. The hint ends at the deletion end position and
// we are not in empty expand mode and
- // the hint is a [toxmark|refmark|ruby] text attribute
+ // the hint is a [toxmark|refmark|ruby|inputfield] text attribute
// 3. deleting exactly the dummy char of an hint with end and dummy
// char deletes the hint
if ( (*pHtEndIdx < nEndIdx)
@@ -2267,9 +2350,8 @@ void SwTxtNode::EraseText(const SwIndex &rIdx, const xub_StrLen nCount,
!(IDocumentContentOperations::INS_EMPTYEXPAND & nMode) &&
( (RES_TXTATR_TOXMARK == nWhich) ||
(RES_TXTATR_REFMARK == nWhich) ||
- // #i62668# Ruby text attribute must be
- // treated just like toxmark and refmarks
- (RES_TXTATR_CJK_RUBY == nWhich) ) )
+ (RES_TXTATR_CJK_RUBY == nWhich) ||
+ (RES_TXTATR_INPUTFIELD == nWhich) ) )
|| ( (nHintStart < nEndIdx) &&
pHt->HasDummyChar() )
)
@@ -2322,7 +2404,7 @@ void SwTxtNode::GCAttr()
bool bChanged = false;
sal_Int32 nMin = m_Text.getLength();
sal_Int32 nMax = 0;
- bool bAll = nMin != 0; // Bei leeren Absaetzen werden nur die
+ const bool bAll = nMin != 0; // Bei leeren Absaetzen werden nur die
// INet-Formate entfernt.
for ( sal_uInt16 i = 0; m_pSwpHints && i < m_pSwpHints->Count(); ++i )
@@ -2615,7 +2697,8 @@ SwCntntNode* SwTxtNode::AppendNode( const SwPosition & rPos )
* SwTxtNode::GetTxtAttr
*************************************************************************/
-SwTxtAttr * SwTxtNode::GetTxtAttrForCharAt( const xub_StrLen nIndex,
+SwTxtAttr * SwTxtNode::GetTxtAttrForCharAt(
+ const xub_StrLen nIndex,
const RES_TXTATR nWhich ) const
{
if ( HasHints() )
@@ -2631,7 +2714,7 @@ SwTxtAttr * SwTxtNode::GetTxtAttrForCharAt( const xub_StrLen nIndex,
if ( (nIndex == nStartPos) && pHint->HasDummyChar() )
{
return ( RES_TXTATR_END == nWhich || nWhich == pHint->Which() )
- ? pHint : 0;
+ ? pHint : 0;
}
}
}
@@ -3018,6 +3101,11 @@ OUString SwTxtNode::GetExpandTxt( const sal_Int32 nIdx,
(nLen == -1) ? GetTxt().copy(nIdx) : GetTxt().copy(nIdx, nLen));
sal_Int32 nTxtStt = nIdx;
Replace0xFF(*this, aTxt, nTxtStt, aTxt.getLength(), true);
+
+ // remove dummy characters of Input Fields
+ comphelper::string::remove(aTxt, CH_TXT_ATR_INPUTFIELDSTART);
+ comphelper::string::remove(aTxt, CH_TXT_ATR_INPUTFIELDEND);
+
if( bWithNum )
{
if ( !GetNumString().isEmpty() )
@@ -3070,6 +3158,11 @@ bool SwTxtNode::GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx,
{
buf.truncate(nLen);
}
+ // remove dummy characters of Input Fields
+ {
+ comphelper::string::remove(buf, CH_TXT_ATR_INPUTFIELDSTART);
+ comphelper::string::remove(buf, CH_TXT_ATR_INPUTFIELDEND);
+ }
rDestNd.InsertText(buf.makeStringAndClear(), aDestIdx);
nLen = aDestIdx.GetIndex() - nDestStt;
@@ -3085,7 +3178,7 @@ bool SwTxtNode::GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx,
if (nIdx + nLen <= nAttrStartIdx)
break; // ueber das Textende
- const sal_Int32 *pEndIdx = pHt->GetEnd();
+ const sal_Int32 *pEndIdx = pHt->End();
if( pEndIdx && *pEndIdx > nIdx &&
( RES_CHRATR_FONT == nWhich ||
RES_TXTATR_CHARFMT == nWhich ||
@@ -3542,14 +3635,12 @@ namespace {
bParagraphStyleChanged = true;
if( rTxtNode.GetNodes().IsDocNodes() )
{
- // #i70748#
const SwNumRule* pFormerNumRuleAtTxtNode =
rTxtNode.GetNum() ? rTxtNode.GetNum()->GetNumRule() : 0;
if ( pFormerNumRuleAtTxtNode )
{
sOldNumRule = pFormerNumRuleAtTxtNode->GetName();
}
- // #i70748#
if ( rTxtNode.IsEmptyListStyleDueToSetOutlineLevelAttr() )
{
const SwNumRuleItem& rNumRuleItem = rTxtNode.GetTxtColl()->GetNumRule();
@@ -3558,7 +3649,6 @@ namespace {
rTxtNode.ResetEmptyListStyleDueToResetOutlineLevelAttr();
}
}
-
const SwNumRule* pNumRuleAtTxtNode = rTxtNode.GetNumRule();
if ( pNumRuleAtTxtNode )
{
@@ -3571,7 +3661,6 @@ namespace {
case RES_ATTRSET_CHG:
{
const SfxPoolItem* pItem = 0;
- // #i70748#
const SwNumRule* pFormerNumRuleAtTxtNode =
rTxtNode.GetNum() ? rTxtNode.GetNum()->GetNumRule() : 0;
if ( pFormerNumRuleAtTxtNode )
@@ -3645,7 +3734,7 @@ namespace {
// #i70748#
OSL_ENSURE( rTxtNode.GetTxtColl()->IsAssignedToListLevelOfOutlineStyle(),
"<HandleModifyAtTxtNode()> - text node with outline style, but its paragraph style is not assigned to outline style." );
- int nNewListLevel =
+ const int nNewListLevel =
rTxtNode.GetTxtColl()->GetAssignedOutlineStyleLevel();
if ( 0 <= nNewListLevel && nNewListLevel < MAXLEVEL )
{
diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx
index 897af654b3a5..d569db942105 100644
--- a/sw/source/core/txtnode/swfont.cxx
+++ b/sw/source/core/txtnode/swfont.cxx
@@ -732,6 +732,7 @@ SwFont::SwFont( const SwFont &rFont )
nToxCnt = 0;
nRefCnt = 0;
m_nMetaCount = 0;
+ m_nInputFieldCount = 0;
bFntChg = rFont.bFntChg;
bOrgChg = rFont.bOrgChg;
bPaintBlank = rFont.bPaintBlank;
@@ -750,6 +751,7 @@ SwFont::SwFont( const SwAttrSet* pAttrSet,
nToxCnt = 0;
nRefCnt = 0;
m_nMetaCount = 0;
+ m_nInputFieldCount = 0;
bPaintBlank = sal_False;
bPaintWrong = sal_False;
bURL = sal_False;
@@ -948,6 +950,7 @@ SwFont& SwFont::operator=( const SwFont &rFont )
nToxCnt = 0;
nRefCnt = 0;
m_nMetaCount = 0;
+ m_nInputFieldCount = 0;
bFntChg = rFont.bFntChg;
bOrgChg = rFont.bOrgChg;
bPaintBlank = rFont.bPaintBlank;
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 3e9b5f992e22..9e5647828200 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -112,7 +112,7 @@ struct TxtAttrContains
TxtAttrContains( const xub_StrLen nPos ) : m_nPos( nPos ) { }
bool operator() (SwTxtAttrEnd * const pAttr)
{
- return (*pAttr->GetStart() < m_nPos) && (m_nPos < *pAttr->GetEnd());
+ return (*pAttr->GetStart() < m_nPos) && (m_nPos < *pAttr->End());
}
};
@@ -156,7 +156,8 @@ static
bool isSelfNestable(const sal_uInt16 nWhich)
{
if ((RES_TXTATR_INETFMT == nWhich) ||
- (RES_TXTATR_CJK_RUBY == nWhich))
+ (RES_TXTATR_CJK_RUBY == nWhich) ||
+ (RES_TXTATR_INPUTFIELD == nWhich))
return false;
OSL_ENSURE((RES_TXTATR_META == nWhich) ||
(RES_TXTATR_METAFIELD == nWhich), "???");
@@ -169,8 +170,9 @@ bool isSplittable(const sal_uInt16 nWhich)
if ((RES_TXTATR_INETFMT == nWhich) ||
(RES_TXTATR_CJK_RUBY == nWhich))
return true;
- OSL_ENSURE((RES_TXTATR_META == nWhich) ||
- (RES_TXTATR_METAFIELD == nWhich), "???");
+ OSL_ENSURE((RES_TXTATR_META == nWhich) ||
+ (RES_TXTATR_METAFIELD == nWhich) ||
+ (RES_TXTATR_INPUTFIELD == nWhich), "???");
return false;
}
@@ -191,8 +193,10 @@ splitPolicy(const sal_uInt16 nWhichNew, const sal_uInt16 nWhichOther)
}
else
{
- if ((RES_TXTATR_INETFMT == nWhichNew) &&
- (RES_TXTATR_CJK_RUBY == nWhichOther))
+ if ( RES_TXTATR_INPUTFIELD == nWhichNew )
+ return FAIL;
+ else if ( (RES_TXTATR_INETFMT == nWhichNew) &&
+ (RES_TXTATR_CJK_RUBY == nWhichOther) )
return SPLIT_NEW;
else
return SPLIT_OTHER;
@@ -351,14 +355,14 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint )
const sal_uInt16 nNewWhich( rNewHint.Which() );
const xub_StrLen nNewStart( *rNewHint.GetStart() );
const xub_StrLen nNewEnd ( *rNewHint.GetEnd() );
-//??? const bool bNoLengthAttribute( nNewStart == nNewEnd );
const bool bNewSelfNestable( isSelfNestable(nNewWhich) );
OSL_ENSURE( (RES_TXTATR_INETFMT == nNewWhich) ||
(RES_TXTATR_CJK_RUBY == nNewWhich) ||
(RES_TXTATR_META == nNewWhich) ||
- (RES_TXTATR_METAFIELD == nNewWhich),
- "TryInsertNesting: Expecting INETFMT or RUBY or META or METAFIELD" );
+ (RES_TXTATR_METAFIELD == nNewWhich) ||
+ (RES_TXTATR_INPUTFIELD == nNewWhich),
+ "TryInsertNesting: Expecting INETFMT or RUBY or META or METAFIELD or INPUTFIELD" );
NestList_t OverlappingExisting; // existing hints to be split
NestList_t OverwrittenExisting; // existing hints to be replaced
@@ -670,7 +674,7 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint,
continue;
const sal_Int32 nOtherStart = *pOther->GetStart();
- const sal_Int32 nOtherEnd = *pOther->GetEnd();
+ const sal_Int32 nOtherEnd = *pOther->End();
aBounds.insert( nOtherStart );
aBounds.insert( nOtherEnd );
@@ -974,9 +978,13 @@ SwTxtAttr* MakeRedlineTxtAttr( SwDoc & rDoc, SfxPoolItem & rAttr )
}
// create new text attribute
-SwTxtAttr* MakeTxtAttr( SwDoc & rDoc, SfxPoolItem& rAttr,
- sal_Int32 const nStt, sal_Int32 const nEnd,
- CopyOrNew_t const bIsCopy, SwTxtNode *const pTxtNode)
+SwTxtAttr* MakeTxtAttr(
+ SwDoc & rDoc,
+ SfxPoolItem& rAttr,
+ sal_Int32 const nStt,
+ sal_Int32 const nEnd,
+ CopyOrNew_t const bIsCopy,
+ SwTxtNode *const pTxtNode )
{
if ( isCHRATR(rAttr.Which()) )
{
@@ -1027,6 +1035,10 @@ SwTxtAttr* MakeTxtAttr( SwDoc & rDoc, SfxPoolItem& rAttr,
pNew = new SwTxtFld( static_cast<SwFmtFld &>(rNew), nStt,
rDoc.IsClipBoard() );
break;
+ case RES_TXTATR_INPUTFIELD:
+ pNew = new SwTxtInputFld( static_cast<SwFmtFld &>(rNew), nStt, nEnd,
+ rDoc.IsClipBoard() );
+ break;
case RES_TXTATR_FLYCNT:
{
// erst hier wird das Frame-Format kopiert (mit Inhalt) !!
@@ -1112,6 +1124,7 @@ void SwTxtNode::DestroyAttr( SwTxtAttr* pAttr )
break;
case RES_TXTATR_FIELD:
+ case RES_TXTATR_INPUTFIELD:
if( !pDoc->IsInDtor() )
{
// Wenn wir ein HiddenParaField sind, dann muessen wir
@@ -1236,7 +1249,7 @@ bool SwTxtNode::InsertHint( SwTxtAttr * const pAttr, const SetAttrMode nMode )
sal_uInt16 nInsMode = nMode;
switch( pAttr->Which() )
{
- case RES_TXTATR_FLYCNT:
+ case RES_TXTATR_FLYCNT:
{
SwTxtFlyCnt *pFly = (SwTxtFlyCnt *)pAttr;
SwFrmFmt* pFmt = pAttr->GetFlyCnt().GetFrmFmt();
@@ -1250,7 +1263,7 @@ bool SwTxtNode::InsertHint( SwTxtAttr * const pAttr, const SetAttrMode nMode )
// erfolgen (Fehleranfaellig !)
const SwFmtAnchor* pAnchor = 0;
pFmt->GetItemState( RES_ANCHOR, sal_False,
- (const SfxPoolItem**)&pAnchor );
+ (const SfxPoolItem**)&pAnchor );
SwIndex aIdx( this, *pAttr->GetStart() );
const OUString c(GetCharOfTxtAttr(*pAttr));
@@ -1319,7 +1332,7 @@ bool SwTxtNode::InsertHint( SwTxtAttr * const pAttr, const SetAttrMode nMode )
break;
}
- case RES_TXTATR_FTN :
+ case RES_TXTATR_FTN :
{
// Fussnoten, man kommt an alles irgendwie heran.
// CntntNode erzeugen und in die Inserts-Section stellen
@@ -1402,8 +1415,8 @@ bool SwTxtNode::InsertHint( SwTxtAttr * const pAttr, const SetAttrMode nMode )
pDoc->GetFtnIdxs().erase( pDoc->GetFtnIdxs().begin() + n );
break;
}
- // wenn ueber Undo der StartNode gesetzt wurde, kann
- // der Index noch gar nicht in der Verwaltung stehen !!
+ // wenn ueber Undo der StartNode gesetzt wurde, kann
+ // der Index noch gar nicht in der Verwaltung stehen !!
}
if( !pTxtFtn )
pTxtFtn = (SwTxtFtn*)pAttr;
@@ -1429,9 +1442,10 @@ bool SwTxtNode::InsertHint( SwTxtAttr * const pAttr, const SetAttrMode nMode )
{
// fuer HiddenParaFields Benachrichtigungsmechanismus
// anwerfen
- if( RES_HIDDENPARAFLD ==
- pAttr->GetFmtFld().GetField()->GetTyp()->Which() )
- bHiddenPara = true;
+ if( RES_HIDDENPARAFLD == pAttr->GetFmtFld().GetField()->GetTyp()->Which() )
+ {
+ bHiddenPara = true;
+ }
}
break;
@@ -1460,25 +1474,144 @@ bool SwTxtNode::InsertHint( SwTxtAttr * const pAttr, const SetAttrMode nMode )
}
}
+ // handle attributes which provide content
+ xub_StrLen nEnd = nStart;
+ bool bInputFieldStartCharInserted = false;
+ bool bInputFieldEndCharInserted = false;
+ const bool bHasContent( pAttr->HasContent() );
+ if ( bHasContent )
+ {
+ switch( pAttr->Which() )
+ {
+ case RES_TXTATR_INPUTFIELD:
+ {
+ SwTxtInputFld* pTxtInputFld = dynamic_cast<SwTxtInputFld*>(pAttr);
+ if ( pTxtInputFld )
+ {
+ if( !(nsSetAttrMode::SETATTR_NOTXTATRCHR & nMode) )
+ {
+ SwIndex aIdx( this, *pAttr->GetStart() );
+ InsertText( OUString(CH_TXT_ATR_INPUTFIELDSTART), aIdx, nInsertFlags );
+ const OUString aContent = pTxtInputFld->GetFieldContent();
+ InsertText( aContent, aIdx, nInsertFlags );
+ InsertText( OUString(CH_TXT_ATR_INPUTFIELDEND), aIdx, nInsertFlags );
+
+ sal_Int32* const pEnd(pAttr->GetEnd());
+ OSL_ENSURE( pEnd != NULL, "<SwTxtNode::InsertHint(..)> - missing end of RES_TXTATR_INPUTFIELD!" );
+ if ( pEnd != NULL )
+ {
+ *pEnd = *pEnd + 2 + aContent.getLength();
+ nEnd = *pEnd;
+ }
+ }
+ else
+ {
+ // assure that CH_TXT_ATR_INPUTFIELDSTART and CH_TXT_ATR_INPUTFIELDEND are inserted.
+ if ( m_Text[ *(pAttr->GetStart()) ] != CH_TXT_ATR_INPUTFIELDSTART )
+ {
+ SwIndex aIdx( this, *pAttr->GetStart() );
+ InsertText( OUString(CH_TXT_ATR_INPUTFIELDSTART), aIdx, nInsertFlags );
+ bInputFieldStartCharInserted = true;
+ sal_Int32* const pEnd(pAttr->GetEnd());
+ OSL_ENSURE( pEnd != NULL, "<SwTxtNode::InsertHint(..)> - missing end of RES_TXTATR_INPUTFIELD!" );
+ if ( pEnd != NULL )
+ {
+ *pEnd = *pEnd + 1;
+ nEnd = *pEnd;
+ }
+ }
+
+ sal_Int32* const pEnd(pAttr->GetEnd());
+ OSL_ENSURE( pEnd != NULL, "<SwTxtNode::InsertHint(..)> - missing end of RES_TXTATR_INPUTFIELD!" );
+ if ( pEnd != NULL
+ && m_Text[ *(pEnd) - 1 ] != CH_TXT_ATR_INPUTFIELDEND )
+ {
+ SwIndex aIdx( this, *(pEnd) );
+ InsertText( OUString(CH_TXT_ATR_INPUTFIELDEND), aIdx, nInsertFlags );
+ bInputFieldEndCharInserted = true;
+ *pEnd = *pEnd + 1;
+ nEnd = *pEnd;
+ }
+ }
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
GetOrCreateSwpHints();
+ // handle overlap with an existing InputField
+ bool bInsertHint = true;
+ {
+ const SwTxtInputFld* pTxtInputFld = GetOverlappingInputFld( *pAttr );
+ if ( pTxtInputFld != NULL )
+ {
+ if ( pAttr->End() == NULL )
+ {
+ bInsertHint = false;
+ }
+ else
+ {
+ if ( *(pAttr->GetStart()) > *(pTxtInputFld->GetStart()) )
+ {
+ *(pAttr->GetStart()) = *(pTxtInputFld->GetStart());
+ }
+ if ( *(pAttr->End()) < *(pTxtInputFld->End()) )
+ {
+ *(pAttr->GetEnd()) = *(pTxtInputFld->End());
+ }
+ }
+ }
+ }
+
// 4263: AttrInsert durch TextInsert => kein Adjust
- const bool bRet = m_pSwpHints->TryInsertHint( pAttr, *this, nMode );
+ const bool bRet = bInsertHint
+ ? m_pSwpHints->TryInsertHint( pAttr, *this, nMode )
+ : false;
- if (!bRet && bDummyChar)
+ if ( !bRet )
{
- // undo insertion of dummy character
- // N.B. cannot insert the dummy character after inserting the hint,
- // because if the hint has no extent it will be moved in InsertText,
- // resulting in infinite recursion
- if ( !(nsSetAttrMode::SETATTR_NOTXTATRCHR & nMode) )
+ if ( bDummyChar
+ && !(nsSetAttrMode::SETATTR_NOTXTATRCHR & nMode) )
{
+ // undo insertion of dummy character
+ // N.B. cannot insert the dummy character after inserting the hint,
+ // because if the hint has no extent it will be moved in InsertText,
+ // resulting in infinite recursion
OSL_ENSURE( ( CH_TXTATR_BREAKWORD == m_Text[nStart] ||
CH_TXTATR_INWORD == m_Text[nStart] ),
"where is my attribute character?" );
SwIndex aIdx( this, nStart );
EraseText( aIdx, 1 );
}
+
+ if ( bHasContent )
+ {
+ if ( !(nsSetAttrMode::SETATTR_NOTXTATRCHR & nMode)
+ && (nEnd - nStart) > 0 )
+ {
+ SwIndex aIdx( this, nStart );
+ EraseText( aIdx, (nEnd - nStart) );
+ }
+ else
+ {
+ if ( bInputFieldEndCharInserted
+ && (nEnd - nStart) > 0 )
+ {
+ SwIndex aIdx( this, nEnd - 1 );
+ EraseText( aIdx, 1 );
+ }
+
+ if ( bInputFieldStartCharInserted )
+ {
+ SwIndex aIdx( this, nStart );
+ EraseText( aIdx, 1 );
+ }
+ }
+ }
}
if ( bHiddenPara )
@@ -1509,6 +1642,12 @@ void SwTxtNode::DeleteAttribute( SwTxtAttr * const pAttr )
// erase the CH_TXTATR, which will also delete pAttr
EraseText( aIdx, 1 );
}
+ else if ( pAttr->HasContent() )
+ {
+ const SwIndex aIdx( this, *pAttr->GetStart() );
+ OSL_ENSURE( pAttr->End() != NULL, "<SwTxtNode::DeleteAttribute(..)> - missing End() at <SwTxtAttr> instance which has content" );
+ EraseText( aIdx, *pAttr->End() - *pAttr->GetStart() );
+ }
else
{
// create MsgHint before start/end become invalid
@@ -1527,8 +1666,10 @@ void SwTxtNode::DeleteAttribute( SwTxtAttr * const pAttr )
*************************************************************************/
//FIXME: this does NOT respect SORT NUMBER (for CHARFMT)!
-void SwTxtNode::DeleteAttributes( const sal_uInt16 nWhich,
- const xub_StrLen nStart, const xub_StrLen nEnd )
+void SwTxtNode::DeleteAttributes(
+ const sal_uInt16 nWhich,
+ const xub_StrLen nStart,
+ const xub_StrLen nEnd )
{
if ( !HasHints() )
return;
@@ -1576,6 +1717,12 @@ void SwTxtNode::DeleteAttributes( const sal_uInt16 nWhich,
// erase the CH_TXTATR, which will also delete pTxtHt
EraseText( aIdx, 1 );
}
+ else if ( pTxtHt->HasContent() )
+ {
+ const SwIndex aIdx( this, nStart );
+ OSL_ENSURE( pTxtHt->End() != NULL, "<SwTxtNode::DeleteAttributes(..)> - missing End() at <SwTxtAttr> instance which has content" );
+ EraseText( aIdx, *pTxtHt->End() - nStart );
+ }
else if( *pEndIdx == nEnd )
{
// den MsgHint jetzt fuettern, weil gleich sind
@@ -1680,8 +1827,11 @@ bool SwTxtNode::TryCharSetExpandToNum(const SfxItemSet& aCharSet)
// setze diese Attribute am TextNode. Wird der gesamte Bereich umspannt,
// dann setze sie nur im AutoAttrSet (SwCntntNode:: SetAttr)
-sal_Bool SwTxtNode::SetAttr( const SfxItemSet& rSet, xub_StrLen nStt,
- xub_StrLen nEnd, const SetAttrMode nMode )
+sal_Bool SwTxtNode::SetAttr(
+ const SfxItemSet& rSet,
+ const xub_StrLen nStt,
+ const xub_StrLen nEnd,
+ const SetAttrMode nMode )
{
if( !rSet.Count() )
return sal_False;
@@ -1759,7 +1909,7 @@ sal_Bool SwTxtNode::SetAttr( const SfxItemSet& rSet, xub_StrLen nStt,
static_cast<const SwFmtCharFmt*>(pItem)->GetCharFmt()))
{
SwIndex aIndex( this, nStt );
- RstAttr( aIndex, nEnd - nStt, RES_TXTATR_CHARFMT, 0 );
+ RstTxtAttr( aIndex, nEnd - nStt, RES_TXTATR_CHARFMT, 0 );
DontExpandFmt( aIndex );
}
else
@@ -1941,7 +2091,7 @@ sal_Bool SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd,
if( nAttrStart > nEnd ) // ueber den Bereich hinaus
break;
- const sal_Int32* pAttrEnd = pHt->GetEnd();
+ const sal_Int32* pAttrEnd = pHt->End();
if ( ! pAttrEnd ) // no attributes without end
continue;
@@ -1968,7 +2118,7 @@ sal_Bool SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd,
if( nAttrStart > nEnd ) // ueber den Bereich hinaus
break;
- const sal_Int32* pAttrEnd = pHt->GetEnd();
+ const sal_Int32* pAttrEnd = pHt->End();
if ( ! pAttrEnd ) // no attributes without end
continue;
@@ -2195,7 +2345,7 @@ lcl_CollectHintSpans(const SwpHints& i_rHints, const sal_uInt16 nLength,
const sal_uInt16 nWhich(pHint->Which());
if (nWhich == RES_TXTATR_CHARFMT || nWhich == RES_TXTATR_AUTOFMT)
{
- const AttrSpan_t aSpan(*pHint->GetStart(), *pHint->GetEnd());
+ const AttrSpan_t aSpan(*pHint->GetStart(), *pHint->End());
o_rSpanMap.insert(AttrSpanMap_t::value_type(aSpan, pHint));
// < not != because there may be multiple CHARFMT at same range
@@ -2599,7 +2749,7 @@ bool SwpHints::MergePortions( SwTxtNode& rNode )
{
// first of all test if there's no gap (before skipping stuff!)
if (aIter1 != aRange1.second && aIter2 != aRange2.second &&
- *aIter1->second.first->GetEnd() < *aIter2->second.first->GetStart())
+ *aIter1->second.first->End() < *aIter2->second.first->GetStart())
{
eMerge = DIFFER;
break;
@@ -2783,7 +2933,7 @@ static void lcl_CheckSortNumber( const SwpHints& rHints, SwTxtCharFmt& rNewCharF
if ( RES_TXTATR_CHARFMT == pOtherHt->Which() )
{
- const xub_StrLen nOtherEnd = *pOtherHt->GetEnd();
+ const xub_StrLen nOtherEnd = *pOtherHt->End();
if ( nOtherStart == nHtStart && nOtherEnd == nHtEnd )
{
@@ -2862,6 +3012,7 @@ bool SwpHints::TryInsertHint( SwTxtAttr* const pHint, SwTxtNode &rNode,
static_cast<SwTxtINetFmt*>(pHint)->InitINetFmt(rNode);
break;
case RES_TXTATR_FIELD:
+ case RES_TXTATR_INPUTFIELD:
{
bool bDelFirst = 0 != ((SwTxtFld*)pHint)->GetpTxtNode();
((SwTxtFld*)pHint)->ChgTxtNode( &rNode );
@@ -3182,6 +3333,7 @@ void SwTxtNode::ClearSwpHintsArr( bool bDelFields )
break;
case RES_TXTATR_FIELD:
+ case RES_TXTATR_INPUTFIELD:
if( bDelFields )
bDel = true;
break;
@@ -3229,7 +3381,7 @@ sal_uInt16 SwTxtNode::GetLang( const xub_StrLen nBegin, const xub_StrLen nLen,
if( nWhichId == nWhich ||
( ( pHt->IsCharFmtAttr() || RES_TXTATR_AUTOFMT == nWhich ) && CharFmt::IsItemIncluded( nWhichId, pHt ) ) )
{
- const sal_Int32 *pEndIdx = pHt->GetEnd();
+ const sal_Int32 *pEndIdx = pHt->End();
// Ueberlappt das Attribut den Bereich?
if( pEndIdx &&
diff --git a/sw/source/core/txtnode/txatbase.cxx b/sw/source/core/txtnode/txatbase.cxx
index 3a1f590dab3c..8a96fc248573 100644
--- a/sw/source/core/txtnode/txatbase.cxx
+++ b/sw/source/core/txtnode/txatbase.cxx
@@ -36,6 +36,7 @@ SwTxtAttr::SwTxtAttr( SfxPoolItem& rAttr, sal_Int32 nStart )
, m_bHasDummyChar( false )
, m_bFormatIgnoreStart(false)
, m_bFormatIgnoreEnd(false)
+ , m_bHasContent( false )
{
}
diff --git a/sw/source/core/txtnode/txatritr.cxx b/sw/source/core/txtnode/txatritr.cxx
index 6ca629fa9519..b29df9fa4f1c 100644
--- a/sw/source/core/txtnode/txatritr.cxx
+++ b/sw/source/core/txtnode/txatritr.cxx
@@ -116,7 +116,7 @@ bool SwTxtAttrIterator::Next()
{
do {
const SwTxtAttr* pHt = aStack.front();
- sal_uInt16 nEndPos = *pHt->GetEnd();
+ sal_uInt16 nEndPos = *pHt->End();
if( nChgPos >= nEndPos )
aStack.pop_front();
else
@@ -131,7 +131,7 @@ bool SwTxtAttrIterator::Next()
if( !aStack.empty() )
{
const SwTxtAttr* pHt = aStack.front();
- sal_uInt16 nEndPos = *pHt->GetEnd();
+ const sal_uInt16 nEndPos = *pHt->End();
if( nChgPos >= nEndPos )
{
nChgPos = nEndPos;
@@ -159,9 +159,9 @@ bool SwTxtAttrIterator::Next()
void SwTxtAttrIterator::AddToStack( const SwTxtAttr& rAttr )
{
- sal_uInt16 nIns = 0, nEndPos = *rAttr.GetEnd();
+ sal_uInt16 nIns = 0, nEndPos = *rAttr.End();
for( ; nIns < aStack.size(); ++nIns )
- if( *aStack[ nIns ]->GetEnd() > nEndPos )
+ if( *aStack[ nIns ]->End() > nEndPos )
break;
aStack.insert( aStack.begin() + nIns, &rAttr );
@@ -205,7 +205,7 @@ void SwTxtAttrIterator::SearchNextChg()
for( ; nAttrPos < pHts->Count(); ++nAttrPos )
{
const SwTxtAttr* pHt = (*pHts)[ nAttrPos ];
- const sal_Int32* pEnd = pHt->GetEnd();
+ const sal_Int32* pEnd = pHt->End();
const sal_Int32 nHtStt = *pHt->GetStart();
if( nHtStt < nStt && ( !pEnd || *pEnd <= nStt ))
continue;
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index a10b0d3595b7..e1eb5c3378e9 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -369,7 +369,7 @@ static bool lcl_HaveCommonAttributes( IStyleAccess& rStyleAccess,
* @param bInclRefToxMark ???
*/
-void SwTxtNode::RstAttr(
+void SwTxtNode::RstTxtAttr(
const SwIndex &rIdx,
const xub_StrLen nLen,
const sal_uInt16 nWhich,
@@ -379,8 +379,27 @@ void SwTxtNode::RstAttr(
if ( !GetpSwpHints() )
return;
- const sal_Int32 nStt = rIdx.GetIndex();
- const sal_Int32 nEnd = nStt + nLen;
+ sal_Int32 nStt = rIdx.GetIndex();
+ sal_Int32 nEnd = nStt + nLen;
+ {
+ // enlarge range for the reset of text attributes in case of an overlapping input field
+ const SwTxtInputFld* pTxtInputFld = dynamic_cast<const SwTxtInputFld*>(GetTxtAttrAt( nStt, RES_TXTATR_INPUTFIELD, PARENT ));
+ if ( pTxtInputFld == NULL )
+ {
+ pTxtInputFld = dynamic_cast<const SwTxtInputFld*>(GetTxtAttrAt(nEnd, RES_TXTATR_INPUTFIELD, PARENT ));
+ }
+ if ( pTxtInputFld != NULL )
+ {
+ if ( nStt > *(pTxtInputFld->GetStart()) )
+ {
+ nStt = *(pTxtInputFld->GetStart());
+ }
+ if ( nEnd < *(pTxtInputFld->End()) )
+ {
+ nEnd = *(pTxtInputFld->End());
+ }
+ }
+ }
bool bChanged = false;
@@ -394,13 +413,13 @@ void SwTxtNode::RstAttr(
// They may not be forgotten inside the "Forget" function
//std::vector< const SwTxtAttr* > aNewAttributes;
- // iterate over attribute array until start of attribute is behind
- // deletion range
+ // iterate over attribute array until start of attribute is behind deletion range
sal_uInt16 i = 0;
sal_Int32 nAttrStart;
SwTxtAttr *pHt = NULL;
- while ((i < m_pSwpHints->Count()) &&
- ((( nAttrStart = *(*m_pSwpHints)[i]->GetStart()) < nEnd ) || nLen==0) )
+ while ( (i < m_pSwpHints->Count())
+ && ( ( ( nAttrStart = *(*m_pSwpHints)[i]->GetStart()) < nEnd )
+ || nLen==0 ) )
{
pHt = m_pSwpHints->GetTextHint(i);
@@ -420,6 +439,12 @@ void SwTxtNode::RstAttr(
i++;
continue;
}
+ // attributes with content stay in
+ if ( pHt->HasContent() )
+ {
+ ++i;
+ continue;
+ }
// Default behavior is to process all attributes:
bool bSkipAttr = false;
diff --git a/sw/source/core/undo/SwUndoField.cxx b/sw/source/core/undo/SwUndoField.cxx
index b4dbfb5d612d..210fc2ea7007 100644
--- a/sw/source/core/undo/SwUndoField.cxx
+++ b/sw/source/core/undo/SwUndoField.cxx
@@ -78,7 +78,7 @@ SwUndoFieldFromDoc::~SwUndoFieldFromDoc()
void SwUndoFieldFromDoc::UndoImpl(::sw::UndoRedoContext &)
{
- SwTxtFld * pTxtFld = SwDoc::GetTxtFld(GetPosition());
+ SwTxtFld * pTxtFld = SwDoc::GetTxtFldAtPos(GetPosition());
const SwField * pField = pTxtFld ? pTxtFld->GetFmtFld().GetField() : NULL;
if (pField)
@@ -89,7 +89,7 @@ void SwUndoFieldFromDoc::UndoImpl(::sw::UndoRedoContext &)
void SwUndoFieldFromDoc::DoImpl()
{
- SwTxtFld * pTxtFld = SwDoc::GetTxtFld(GetPosition());
+ SwTxtFld * pTxtFld = SwDoc::GetTxtFldAtPos(GetPosition());
const SwField * pField = pTxtFld ? pTxtFld->GetFmtFld().GetField() : NULL;
if (pField)
@@ -126,7 +126,7 @@ SwUndoFieldFromAPI::~SwUndoFieldFromAPI()
void SwUndoFieldFromAPI::UndoImpl(::sw::UndoRedoContext &)
{
- SwField * pField = SwDoc::GetField(GetPosition());
+ SwField * pField = SwDoc::GetFieldAtPos(GetPosition());
if (pField)
pField->PutValue(aOldVal, nWhich);
@@ -134,7 +134,7 @@ void SwUndoFieldFromAPI::UndoImpl(::sw::UndoRedoContext &)
void SwUndoFieldFromAPI::DoImpl()
{
- SwField * pField = SwDoc::GetField(GetPosition());
+ SwField * pField = SwDoc::GetFieldAtPos(GetPosition());
if (pField)
pField->PutValue(aNewVal, nWhich);
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index 45f6460b65ce..e6c39779b965 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -1210,8 +1210,12 @@ void SwHistory::CopyFmtAttr( const SfxItemSet& rSet, sal_uLong nNodeIdx )
}
}
-void SwHistory::CopyAttr( SwpHints* pHts, sal_uLong nNodeIdx,
- xub_StrLen nStart, xub_StrLen nEnd, bool bFields )
+void SwHistory::CopyAttr(
+ SwpHints* pHts,
+ const sal_uLong nNodeIdx,
+ const xub_StrLen nStart,
+ const xub_StrLen nEnd,
+ const bool bCopyFields )
{
if( !pHts )
return;
@@ -1232,9 +1236,9 @@ void SwHistory::CopyAttr( SwpHints* pHts, sal_uLong nNodeIdx,
switch( pHt->Which() )
{
case RES_TXTATR_FIELD:
- // no fields, ... copy ??
- if( !bFields )
- bNextAttr = true;
+ case RES_TXTATR_INPUTFIELD:
+ if( !bCopyFields )
+ bNextAttr = sal_True;
break;
case RES_TXTATR_FLYCNT:
case RES_TXTATR_FTN:
@@ -1243,13 +1247,12 @@ void SwHistory::CopyAttr( SwpHints* pHts, sal_uLong nNodeIdx,
}
if( bNextAttr )
- continue;
+ continue;
// save all attributes that are somehow in this area
if ( nStart <= nAttrStt )
{
- if ( nEnd > nAttrStt
- )
+ if ( nEnd > nAttrStt )
{
Add( pHt, nNodeIdx, false );
}
diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx
index f9580d9ac29c..9a760a63398f 100644
--- a/sw/source/core/undo/unsect.cxx
+++ b/sw/source/core/undo/unsect.cxx
@@ -233,15 +233,16 @@ void SwUndoInsSection::Join( SwDoc& rDoc, sal_uLong nNode )
OSL_ENSURE( pTxtNd, "Where is my TextNode?" );
{
- RemoveIdxRel( nNode + 1, SwPosition( aIdx,
- SwIndex(pTxtNd, pTxtNd->GetTxt().getLength())));
+ RemoveIdxRel(
+ nNode + 1,
+ SwPosition( aIdx, SwIndex( pTxtNd, pTxtNd->GetTxt().getLength() ) ) );
}
pTxtNd->JoinNext();
if (m_pHistory.get())
{
SwIndex aCntIdx( pTxtNd, 0 );
- pTxtNd->RstAttr( aCntIdx, pTxtNd->Len(), 0, 0, true );
+ pTxtNd->RstTxtAttr( aCntIdx, pTxtNd->Len(), 0, 0, true );
}
}
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index f15e6290532c..08701aff77cc 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -2019,8 +2019,7 @@ CHECKTABLE(pTblNd->GetTable())
// also delete not needed attributes
SwIndex aTmpIdx( pTxtNd, nDelPos );
if( pTxtNd->GetpSwpHints() && pTxtNd->GetpSwpHints()->Count() )
- pTxtNd->RstAttr(aTmpIdx, pTxtNd->GetTxt().getLength() -
- nDelPos + 1 );
+ pTxtNd->RstTxtAttr( aTmpIdx, pTxtNd->GetTxt().getLength() - nDelPos + 1 );
// delete separator
pTxtNd->EraseText( aTmpIdx, 1 );
}
diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx
index 5db8247e3fd1..418746c03b74 100644
--- a/sw/source/core/undo/untblk.cxx
+++ b/sw/source/core/undo/untblk.cxx
@@ -225,7 +225,7 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext)
pTxtNode->JoinNext();
}
// reset all text attributes in the paragraph!
- pTxtNode->RstAttr( SwIndex(pTxtNode, 0), pTxtNode->Len(), 0, 0, true );
+ pTxtNode->RstTxtAttr( SwIndex(pTxtNode, 0), pTxtNode->Len(), 0, 0, true );
pTxtNode->ResetAllAttr();
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index 5b3d1a829f77..e4404bbd0328 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -81,6 +81,7 @@
#include <comphelper/sequenceashashmap.hxx>
#include <SwNodeNum.hxx>
#include <fmtmeta.hxx>
+#include <txtfld.hxx>
using namespace ::com::sun::star;
@@ -517,11 +518,10 @@ bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry
const SwPosition *pPos = rPam.Start();
const SwTxtNode *pTxtNd =
rPam.GetDoc()->GetNodes()[pPos->nNode.GetIndex()]->GetTxtNode();
- SwTxtAttr *const pTxtAttr = (pTxtNd)
- ? pTxtNd->GetTxtAttrForCharAt(
- pPos->nContent.GetIndex(), RES_TXTATR_FIELD)
+ const SwTxtAttr* pTxtAttr = (pTxtNd)
+ ? pTxtNd->GetFldTxtAttrAt( pPos->nContent.GetIndex(), true )
: 0;
- if(pTxtAttr)
+ if ( pTxtAttr != NULL )
{
if( pAny )
{
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 7b6cbe4bd9fa..de178deb59e6 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -1205,8 +1205,7 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a
.SetFlyFmt();
//The connection is removed now the attribute can be deleted.
- pTxtNode->DeleteAttributes(
- RES_TXTATR_FLYCNT, nIdx );
+ pTxtNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIdx );
//create a new one
SwTxtNode *pNd = pInternalPam->GetNode()->GetTxtNode();
SAL_WARN_IF( !pNd, "sw.uno", "Cursor not at TxtNode." );
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index ef26f6f752a6..11f347f52661 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -1770,8 +1770,9 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
SW_SERVICE_FIELDTYPE_INPUT_USER == m_pImpl->m_nServiceId
? INP_USR : INP_TXT);
SwInputField * pTxtField =
- new SwInputField((SwInputFieldType*)pFldType,
- m_pImpl->m_pProps->sPar1, m_pImpl->m_pProps->sPar2,
+ new SwInputField(static_cast<SwInputFieldType*>(pFldType),
+ m_pImpl->m_pProps->sPar1,
+ m_pImpl->m_pProps->sPar2,
nInpSubType);
pTxtField->SetHelp(m_pImpl->m_pProps->sPar3);
pTxtField->SetToolTip(m_pImpl->m_pProps->sPar4);
@@ -1891,11 +1892,13 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
pDoc->DeleteAndJoin(aPam);
}
- SwXTextCursor const*const pTextCursor(
- dynamic_cast<SwXTextCursor*>(pCursor));
- const bool bForceExpandHints( (pTextCursor)
- ? pTextCursor->IsAtEndOfMeta() : false );
- const SetAttrMode nInsertFlags = (bForceExpandHints)
+ SwXTextCursor const*const pTextCursor(dynamic_cast<SwXTextCursor*>(pCursor));
+ const bool bForceExpandHints(
+ (pTextCursor)
+ ? pTextCursor->IsAtEndOfMeta()
+ : false );
+ const SetAttrMode nInsertFlags =
+ (bForceExpandHints)
? nsSetAttrMode::SETATTR_FORCEHINTEXPAND
: nsSetAttrMode::SETATTR_DEFAULT;
@@ -1922,8 +1925,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
else
pDoc->InsertPoolItem(aPam, aFmt, nInsertFlags);
- pTxtAttr = aPam.GetNode()->GetTxtNode()->GetTxtAttrForCharAt(
- aPam.GetPoint()->nContent.GetIndex()-1, RES_TXTATR_FIELD);
+ pTxtAttr = aPam.GetNode()->GetTxtNode()->GetFldTxtAttrAt( aPam.GetPoint()->nContent.GetIndex()-1, true );
// was passiert mit dem Update der Felder ? (siehe fldmgr.cxx)
if (pTxtAttr)
@@ -2083,7 +2085,7 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
// fdo#42073 notify SwTxtFld about changes of the expanded string
if (m_pImpl->m_pFmtFld->GetTxtFld())
{
- m_pImpl->m_pFmtFld->GetTxtFld()->Expand();
+ m_pImpl->m_pFmtFld->GetTxtFld()->ExpandTxtFld();
}
//#i100374# changing a document field should set the modify flag
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 83361354e817..035340eb98e1 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -112,7 +112,7 @@
#include <comphelper/servicehelper.hxx>
// from fefly1.cxx
-extern sal_Bool sw_ChkAndSetNewAnchor( const SwFlyFrm& rFly, SfxItemSet& rSet );
+extern sal_Bool sw_ChkAndSetNewAnchor( SwEditShell& rEditShell, const SwFlyFrm& rFly, SfxItemSet& rSet );
using namespace ::com::sun::star;
@@ -1091,21 +1091,6 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::
}
}
}
- // #i73249#
- // Attribute AlternativeText was never published.
- // Now it has been replaced by Attribute Title - valid for all <SwXFrame> instances
-// else if( FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID && eType != FLYCNTTYPE_FRM )
-// {
-// const :: SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
-// if(pIdx)
-// {
-// SwNodeIndex aIdx(*pIdx, 1);
-// SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
-// OUString uTemp;
-// aValue >>= uTemp;
-// pNoTxt->SetAlternateText(uTemp);
-// }
-// }
// New attribute Title
else if( FN_UNO_TITLE == pEntry->nWID )
{
@@ -1157,7 +1142,8 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::
{
pSet = new SfxItemSet( pDoc->GetAttrPool(), aFrmFmtSetRange );
pSet->Put( *pItem );
- if ( !sw_ChkAndSetNewAnchor( *pFly, *pSet ) )
+ if ( pFmt->GetDoc()->GetEditShell() != NULL
+ && !sw_ChkAndSetNewAnchor( *(pFmt->GetDoc()->GetEditShell()), *pFly, *pSet ) )
delete pSet, pSet = 0;
}
}
@@ -1432,7 +1418,10 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::
if( SFX_ITEM_SET == aSet.GetItemState( RES_ANCHOR, false, &pItem ))
{
aSet.Put( *pItem );
- sw_ChkAndSetNewAnchor( *pFly, aSet );
+ if ( pFmt->GetDoc()->GetEditShell() != NULL )
+ {
+ sw_ChkAndSetNewAnchor( *(pFmt->GetDoc()->GetEditShell()), *pFly, aSet );
+ }
}
}
}
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index 2db7aa13c841..0806e2225fc5 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -1758,9 +1758,9 @@ throw (uno::RuntimeException)
m_pImpl->m_pTOXMark->GetTxtTOXMark();
SwPaM aPam(pTxtMark->GetTxtNode(), *pTxtMark->GetStart());
aPam.SetMark();
- if(pTxtMark->GetEnd())
+ if(pTxtMark->End())
{
- aPam.GetPoint()->nContent = *pTxtMark->GetEnd();
+ aPam.GetPoint()->nContent = *pTxtMark->End();
}
else
aPam.GetPoint()->nContent++;
@@ -2003,9 +2003,9 @@ SwXDocumentIndexMark::getAnchor() throw (uno::RuntimeException)
const SwTxtTOXMark* pTxtMark = m_pImpl->m_pTOXMark->GetTxtTOXMark();
SwPaM aPam(pTxtMark->GetTxtNode(), *pTxtMark->GetStart());
aPam.SetMark();
- if(pTxtMark->GetEnd())
+ if(pTxtMark->End())
{
- aPam.GetPoint()->nContent = *pTxtMark->GetEnd();
+ aPam.GetPoint()->nContent = *pTxtMark->End();
}
else
{
@@ -2141,9 +2141,9 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
m_pImpl->m_pTOXMark->GetTxtTOXMark();
SwPaM aPam(pTxtMark->GetTxtNode(), *pTxtMark->GetStart());
aPam.SetMark();
- if(pTxtMark->GetEnd())
+ if(pTxtMark->End())
{
- aPam.GetPoint()->nContent = *pTxtMark->GetEnd();
+ aPam.GetPoint()->nContent = *pTxtMark->End();
}
else
{
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index 0e9634a7be69..8d5377dfbb0a 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -38,6 +38,8 @@
#include <unoredline.hxx>
#include <unofield.hxx>
#include <unometa.hxx>
+#include <fmtfld.hxx>
+#include <fldbas.hxx>
#include <fmtmeta.hxx>
#include <fmtanchr.hxx>
#include <fmtrfmrk.hxx>
@@ -417,7 +419,7 @@ lcl_CreateRefMarkPortion(
{
pPortion = new SwXTextPortion(pUnoCrsr, xParent, PORTION_REFMARK_START);
pPortion->SetRefMark(xContent);
- pPortion->SetCollapsed(rAttr.GetEnd() ? false : true);
+ pPortion->SetCollapsed(rAttr.End() ? false : true);
}
else
{
@@ -437,7 +439,7 @@ lcl_InsertRubyPortion(
SwXTextPortion* pPortion = new SwXTextPortion(pUnoCrsr,
static_cast<const SwTxtRuby&>(rAttr), xParent, bEnd);
rPortions.push_back(pPortion);
- pPortion->SetCollapsed(rAttr.GetEnd() ? false : true);
+ pPortion->SetCollapsed(rAttr.End() ? false : true);
}
static Reference<XTextRange>
@@ -739,34 +741,56 @@ lcl_ExportHints(
pPortion->SetBookmark(SwXFieldmark::CreateXFieldmark(*pDoc, *it->get()));
}
}
- break;
- case RES_TXTATR_FLYCNT :
+ break;
+
+ case RES_TXTATR_INPUTFIELD:
if(!bRightMoveForbidden)
{
- pUnoCrsr->Right(1,CRSR_SKIP_CHARS,sal_False,sal_False);
+
+ pUnoCrsr->Right(
+ pAttr->GetFmtFld().GetField()->GetPar1().getLength() + 2,
+ CRSR_SKIP_CHARS,
+ sal_False,
+ sal_False );
if( *pUnoCrsr->GetMark() == *pUnoCrsr->GetPoint() )
- break; // Robust #i81708 content in covered cells
- pUnoCrsr->Exchange();
- xRef = new SwXTextPortion(
- pUnoCrsr, xParent, PORTION_FRAME);
+ break;
+ SwXTextPortion* pPortion =
+ new SwXTextPortion( pUnoCrsr, xParent, PORTION_FIELD);
+ xRef = pPortion;
+ Reference<XTextField> xField =
+ SwXTextField::CreateXTextField(*pDoc, pAttr->GetFmtFld());
+ pPortion->SetTextField(xField);
}
- break;
- case RES_TXTATR_FTN :
- {
+ break;
+
+ case RES_TXTATR_FLYCNT:
if(!bRightMoveForbidden)
{
pUnoCrsr->Right(1,CRSR_SKIP_CHARS,sal_False,sal_False);
if( *pUnoCrsr->GetMark() == *pUnoCrsr->GetPoint() )
- break;
- SwXTextPortion* pPortion;
- xRef = pPortion = new SwXTextPortion(
+ break; // Robust #i81708 content in covered cells
+ pUnoCrsr->Exchange();
+ xRef = new SwXTextPortion( pUnoCrsr, xParent, PORTION_FRAME);
+ }
+ break;
+
+ case RES_TXTATR_FTN:
+ {
+ if(!bRightMoveForbidden)
+ {
+ pUnoCrsr->Right(1,CRSR_SKIP_CHARS,sal_False,sal_False);
+ if( *pUnoCrsr->GetMark() == *pUnoCrsr->GetPoint() )
+ break;
+ SwXTextPortion* pPortion;
+ xRef = pPortion = new SwXTextPortion(
pUnoCrsr, xParent, PORTION_FOOTNOTE);
- Reference<XFootnote> xContent =
- SwXFootnotes::GetObject(*pDoc, pAttr->GetFtn());
- pPortion->SetFootnote(xContent);
+ Reference<XFootnote> xContent =
+ SwXFootnotes::GetObject(*pDoc, pAttr->GetFtn());
+ pPortion->SetFootnote(xContent);
+ }
}
- }
- break;
+ break;
+
case RES_TXTATR_TOXMARK:
case RES_TXTATR_REFMARK:
{
diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
index 3ca9dd24c673..690637765154 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -329,8 +329,8 @@ SwXReferenceMark::getAnchor() throw (uno::RuntimeException)
{
SwTxtNode const& rTxtNode = pTxtMark->GetTxtNode();
SAL_WNODEPRECATED_DECLARATIONS_PUSH
- const ::std::auto_ptr<SwPaM> pPam( (pTxtMark->GetEnd())
- ? new SwPaM( rTxtNode, *pTxtMark->GetEnd(),
+ const ::std::auto_ptr<SwPaM> pPam( (pTxtMark->End())
+ ? new SwPaM( rTxtNode, *pTxtMark->End(),
rTxtNode, *pTxtMark->GetStart())
: new SwPaM( rTxtNode, *pTxtMark->GetStart()) );
SAL_WNODEPRECATED_DECLARATIONS_POP
@@ -359,9 +359,10 @@ void SAL_CALL SwXReferenceMark::dispose() throw (uno::RuntimeException)
&m_pImpl->m_pDoc->GetNodes()))
{
SwTxtNode const& rTxtNode = pTxtMark->GetTxtNode();
- xub_StrLen nStt = *pTxtMark->GetStart(),
- nEnd = pTxtMark->GetEnd() ? *pTxtMark->GetEnd()
- : nStt + 1;
+ const xub_StrLen nStt = *pTxtMark->GetStart();
+ const xub_StrLen nEnd = pTxtMark->End()
+ ? *pTxtMark->End()
+ : nStt + 1;
SwPaM aPam( rTxtNode, nStt, rTxtNode, nEnd );
m_pImpl->m_pDoc->DeleteAndJoin( aPam );
@@ -431,9 +432,10 @@ throw (uno::RuntimeException)
&m_pImpl->m_pDoc->GetNodes()))
{
SwTxtNode const& rTxtNode = pTxtMark->GetTxtNode();
- xub_StrLen nStt = *pTxtMark->GetStart(),
- nEnd = pTxtMark->GetEnd() ? *pTxtMark->GetEnd()
- : nStt + 1;
+ const xub_StrLen nStt = *pTxtMark->GetStart();
+ const xub_StrLen nEnd = pTxtMark->End()
+ ? *pTxtMark->End()
+ : nStt + 1;
SwPaM aPam( rTxtNode, nStt, rTxtNode, nEnd );
// deletes the m_pImpl->m_pDoc member in the SwXReferenceMark!
@@ -809,7 +811,7 @@ bool SwXMeta::SetContentRange(
{
// rStart points at the first position _within_ the meta!
rStart = *pTxtAttr->GetStart() + 1;
- rEnd = *pTxtAttr->GetEnd();
+ rEnd = *pTxtAttr->End();
return true;
}
}
diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx
index 3518523c408d..ff5ffb203687 100644
--- a/sw/source/core/view/vprint.cxx
+++ b/sw/source/core/view/vprint.cxx
@@ -568,6 +568,7 @@ sal_Bool SwViewShell::IsAnyFieldInDoc() const
const SfxPoolItem* pItem;
sal_uInt32 nMaxItems = mpDoc->GetAttrPool().GetItemCount2( RES_TXTATR_FIELD );
for( sal_uInt32 n = 0; n < nMaxItems; ++n )
+ {
if( 0 != (pItem = mpDoc->GetAttrPool().GetItem2( RES_TXTATR_FIELD, n )))
{
const SwFmtFld* pFmtFld = (SwFmtFld*)pItem;
@@ -580,6 +581,22 @@ sal_Bool SwViewShell::IsAnyFieldInDoc() const
return sal_True;
}
}
+ }
+
+ nMaxItems = mpDoc->GetAttrPool().GetItemCount2( RES_TXTATR_INPUTFIELD );
+ for( sal_uInt32 n = 0; n < nMaxItems; ++n )
+ {
+ if( 0 != (pItem = mpDoc->GetAttrPool().GetItem2( RES_TXTATR_INPUTFIELD, n )))
+ {
+ const SwFmtFld* pFmtFld = (SwFmtFld*)pItem;
+ const SwTxtFld* pTxtFld = pFmtFld->GetTxtFld();
+ if( pTxtFld && pTxtFld->GetTxtNode().GetNodes().IsDocNodes() )
+ {
+ return sal_True;
+ }
+ }
+ }
+
return sal_False;
}
diff --git a/sw/source/filter/ascii/ascatr.cxx b/sw/source/filter/ascii/ascatr.cxx
index e129c9cf9a0d..a49ef13486c6 100644
--- a/sw/source/filter/ascii/ascatr.cxx
+++ b/sw/source/filter/ascii/ascatr.cxx
@@ -51,16 +51,27 @@ class SwASC_AttrIter
public:
SwASC_AttrIter( SwASCWriter& rWrt, const SwTxtNode& rNd, xub_StrLen nStt );
- void NextPos() { nAktSwPos = SearchNext( nAktSwPos + 1 ); }
+ void NextPos()
+ {
+ nAktSwPos = SearchNext( nAktSwPos + 1 );
+ }
+
+ xub_StrLen WhereNext() const
+ {
+ return nAktSwPos;
+ }
- xub_StrLen WhereNext() const { return nAktSwPos; }
bool OutAttr( xub_StrLen nSwPos );
};
-SwASC_AttrIter::SwASC_AttrIter( SwASCWriter& rWr, const SwTxtNode& rTxtNd,
- xub_StrLen nStt )
- : rWrt( rWr ), rNd( rTxtNd ), nAktSwPos( 0 )
+SwASC_AttrIter::SwASC_AttrIter(
+ SwASCWriter& rWr,
+ const SwTxtNode& rTxtNd,
+ xub_StrLen nStt )
+ : rWrt( rWr )
+ , rNd( rTxtNd )
+ , nAktSwPos( 0 )
{
nAktSwPos = SearchNext( nStt + 1 );
}
@@ -72,12 +83,12 @@ xub_StrLen SwASC_AttrIter::SearchNext( xub_StrLen nStartPos )
const SwpHints* pTxtAttrs = rNd.GetpSwpHints();
if( pTxtAttrs )
{
-// TODO: This can be optimized, if we make use of the fact that the TxtAttrs
-// are sorted by starting position. We would need to remember two indices, however.
+ // TODO: This can be optimized, if we make use of the fact that the TxtAttrs
+ // are sorted by starting position. We would need to remember two indices, however.
for ( sal_uInt16 i = 0; i < pTxtAttrs->Count(); i++ )
{
const SwTxtAttr* pHt = (*pTxtAttrs)[i];
- if (pHt->HasDummyChar())
+ if ( pHt->HasDummyChar() )
{
xub_StrLen nPos = *pHt->GetStart();
@@ -87,6 +98,20 @@ xub_StrLen SwASC_AttrIter::SearchNext( xub_StrLen nStartPos )
if( ( ++nPos ) >= nStartPos && nPos < nMinPos )
nMinPos = nPos;
}
+ else if ( pHt->HasContent() )
+ {
+ const xub_StrLen nHintStart = *pHt->GetStart();
+ if ( nHintStart >= nStartPos && nHintStart <= nMinPos )
+ {
+ nMinPos = nHintStart;
+ }
+
+ const xub_StrLen nHintEnd = pHt->End() ? *pHt->End() : STRING_MAXLEN;
+ if ( nHintEnd >= nStartPos && nHintEnd < nMinPos )
+ {
+ nMinPos = nHintEnd;
+ }
+ }
}
}
return nMinPos;
@@ -103,15 +128,17 @@ bool SwASC_AttrIter::OutAttr( xub_StrLen nSwPos )
for( i = 0; i < pTxtAttrs->Count(); i++ )
{
const SwTxtAttr* pHt = (*pTxtAttrs)[i];
- if ( pHt->HasDummyChar() && nSwPos == *pHt->GetStart() )
+ if ( ( pHt->HasDummyChar()
+ || pHt->HasContent() )
+ && nSwPos == *pHt->GetStart() )
{
bRet = true;
OUString sOut;
switch( pHt->Which() )
{
case RES_TXTATR_FIELD:
- sOut =
- static_cast<SwTxtFld const*>(pHt)->GetFmtFld().GetField()->ExpandField(true);
+ case RES_TXTATR_INPUTFIELD:
+ sOut = static_cast<SwTxtFld const*>(pHt)->GetFmtFld().GetField()->ExpandField(true);
break;
case RES_TXTATR_FTN:
@@ -121,10 +148,10 @@ bool SwASC_AttrIter::OutAttr( xub_StrLen nSwPos )
sOut = rFtn.GetNumStr();
else if( rFtn.IsEndNote() )
sOut = rWrt.pDoc->GetEndNoteInfo().aFmt.
- GetNumStr( rFtn.GetNumber() );
+ GetNumStr( rFtn.GetNumber() );
else
sOut = rWrt.pDoc->GetFtnInfo().aFmt.
- GetNumStr( rFtn.GetNumber() );
+ GetNumStr( rFtn.GetNumber() );
}
break;
}
diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx
index 9a994fdcf683..ddc685595c86 100644
--- a/sw/source/filter/ascii/parasc.cxx
+++ b/sw/source/filter/ascii/parasc.cxx
@@ -427,8 +427,8 @@ sal_uLong SwASCIIParser::ReadChars()
InsertText( OUString( pLastStt ));
}
pDoc->SplitNode( *pPam->GetPoint(), false );
- pDoc->InsertPoolItem( *pPam, SvxFmtBreakItem(
- SVX_BREAK_PAGE_BEFORE, RES_BREAK ), 0);
+ pDoc->InsertPoolItem(
+ *pPam, SvxFmtBreakItem( SVX_BREAK_PAGE_BEFORE, RES_BREAK ), 0);
pLastStt = pStt;
nLineLen = 0;
bIns = false;
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index 2e0f9756b3ed..1377f14ff933 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -3656,7 +3656,7 @@ SwAttrFnTab aCSS1AttrFnTab = {
/* RES_TXTATR_CHARFMT */ 0,
/* RES_TXTATR_CJK_RUBY */ 0,
/* RES_TXTATR_UNKNOWN_CONTAINER */ 0,
-/* RES_TXTATR_DUMMY5 */ 0,
+/* RES_TXTATR_INPUTFIELD */ 0,
/* RES_TXTATR_FIELD */ 0,
/* RES_TXTATR_FLYCNT */ 0,
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx
index 3717c808d29a..8e0333d20843 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -2388,9 +2388,9 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt, const SwCntntNode& rNode )
if( RES_TXTATR_FIELD == pHt->Which() ) // Felder nicht
continue; // ausgeben
- if ( pHt->GetEnd() && !pHt->HasDummyChar() )
+ if ( pHt->End() && !pHt->HasDummyChar() )
{
- sal_Int32 nHtEnd = *pHt->GetEnd(),
+ const sal_Int32 nHtEnd = *pHt->End(),
nHtStt = *pHt->GetStart();
if( !rHTMLWrt.bWriteAll && nHtEnd <= nStrPos )
continue;
@@ -2449,15 +2449,15 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt, const SwCntntNode& rNode )
&& nStrPos != nEnde )
{
do {
- if ( pHt->GetEnd() && !pHt->HasDummyChar() )
+ if ( pHt->End() && !pHt->HasDummyChar() )
{
- if( *pHt->GetEnd() != nStrPos )
+ if( *pHt->End() != nStrPos )
{
// Hints mit Ende einsortieren, wenn sie keinen
// leeren Bereich aufspannen (Hints, die keinen
// Bereich aufspannen werden ignoriert
aEndPosLst.Insert( pHt->GetAttr(), nStrPos + nOffset,
- *pHt->GetEnd() + nOffset,
+ *pHt->End() + nOffset,
rHTMLWrt.aChrFmtInfos );
}
}
@@ -3288,7 +3288,7 @@ SwAttrFnTab aHTMLAttrFnTab = {
/* RES_TXTATR_CHARFMT */ OutHTML_SwTxtCharFmt,
/* RES_TXTATR_CJK_RUBY */ 0,
/* RES_TXTATR_UNKNOWN_CONTAINER */ 0,
-/* RES_TXTATR_DUMMY5 */ 0,
+/* RES_TXTATR_INPUTFIELD */ OutHTML_SwFmtFld,
/* RES_TXTATR_FIELD */ OutHTML_SwFmtFld,
/* RES_TXTATR_FLYCNT */ OutHTML_SwFlyCnt,
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 064dbb7d4ed6..916782bf51dd 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -2842,6 +2842,7 @@ void SwHTMLParser::_SetAttr( sal_Bool bChkEnd, sal_Bool bBeforeTable,
}
break;
case RES_TXTATR_FIELD:
+ case RES_TXTATR_INPUTFIELD:
{
sal_uInt16 nFldWhich =
pPostIts
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index 194e1e0aabb0..f903c331dc5a 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -866,7 +866,7 @@ sal_uInt16 SwHTMLWriter::OutHeaderAttrs()
for( sal_uInt16 i=0; i<nCntAttr; i++ )
{
const SwTxtAttr *pHt = pTxtNd->GetSwpHints()[i];
- if( !pHt->GetEnd() )
+ if( !pHt->End() )
{
xub_StrLen nPos = *pHt->GetStart();
if( nPos-nOldPos > 1 || RES_TXTATR_FIELD != pHt->Which() )
diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx
index f207b30803bc..bc8f3951d341 100644
--- a/sw/source/filter/ww1/fltshell.cxx
+++ b/sw/source/filter/ww1/fltshell.cxx
@@ -123,7 +123,7 @@ bool SwFltStackEntry::MakeRegion(SwDoc* pDoc, SwPaM& rRegion, bool bCheck,
SwNodeIndex(rMkPos.m_nNode, +1).GetNode().GetCntntNode());
if (rMkPos == rPtPos &&
((0 != rPtPos.m_nCntnt) || (pCntntNode && (0 != pCntntNode->Len())))
- && (RES_TXTATR_FIELD != nWhich)
+ && (RES_TXTATR_FIELD != nWhich && RES_TXTATR_INPUTFIELD != nWhich)
&& !(bIsParaEnd && pCntntNode && pCntntNode->IsTxtNode() && 0 != pCntntNode->Len() ))
{
return false;
@@ -517,9 +517,11 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
case RES_FLTR_STYLESHEET:
break;
case RES_TXTATR_FIELD:
+ case RES_TXTATR_INPUTFIELD:
break;
case RES_TXTATR_TOXMARK:
break;
+
case RES_FLTR_NUMRULE: // Numrule 'reinsetzen
{
const OUString& rNumNm = ((SfxStringItem*)rEntry.pAttr)->GetValue();
diff --git a/sw/source/filter/ww1/w1filter.cxx b/sw/source/filter/ww1/w1filter.cxx
index fa477d7a71f3..b6520db52c2e 100644
--- a/sw/source/filter/ww1/w1filter.cxx
+++ b/sw/source/filter/ww1/w1filter.cxx
@@ -915,9 +915,9 @@ oncemore:
}
case 39: // fillin command
pField = new SwInputField(
- (SwInputFieldType*)rOut.GetSysFldType( RES_INPUTFLD ),
+ static_cast<SwInputFieldType*>(rOut.GetSysFldType( RES_INPUTFLD )),
aEmptyOUStr, sFormel,
- INP_TXT, 0 ); // sichtbar ( geht z.Zt. nicht anders )
+ INP_TXT, 0, false );
break;
case 51: // macro button
{
diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx
index 22de507be996..34e62eec4b66 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -466,7 +466,7 @@ protected:
/// Sfx item RES_TXTATR_CHARFMT
virtual void TextCharFormat( const SwFmtCharFmt& ) = 0;
- /// Sfx item RES_TXTATR_FIELD
+ /// Sfx item RES_TXTATR_FIELD and RES_TXTATR_INPUTFIELD
void TextField( const SwFmtFld& );
/// Sfx item RES_TXTATR_FLYCNT
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 5ac0994aaff5..e3b5542d6589 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -593,11 +593,10 @@ void WW8Export::DoFormText(const SwInputField * pFld)
OutputField(0, ww::eFORMTEXT, aEmptyOUStr, WRITEFIELD_CMD_END);
- OUString const fieldStr( pFld->ExpandField(true) );
+ const OUString fieldStr( pFld->ExpandField(true) );
SwWW8Writer::WriteString16(Strm(), fieldStr, false);
static sal_uInt8 aArr2[] = {
- 0x03, 0x6a, 0x00, 0x00, 0x00, 0x00, // sprmCPicLocation
0x55, 0x08, 0x01, // sprmCFSpec
0x75, 0x08, 0x01 // ???
};
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index acc30ffe5fef..72ad2fea72da 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -315,9 +315,9 @@ xub_StrLen SwWW8AttrIter::SearchNext( xub_StrLen nStartPos )
if( nPos >= nStartPos && nPos <= nMinPos )
nMinPos = nPos;
- if( pHt->GetEnd() ) // Attr with end
+ if( pHt->End() ) // Attr with end
{
- nPos = *pHt->GetEnd(); // last Attr character + 1
+ nPos = *pHt->End(); // last Attr character + 1
if( nPos >= nStartPos && nPos <= nMinPos )
nMinPos = nPos;
}
@@ -417,7 +417,7 @@ void SwWW8AttrIter::OutAttr( xub_StrLen nSwPos, bool bRuby )
for( sal_Int32 i = 0; i < pTxtAttrs->Count(); ++i )
{
const SwTxtAttr* pHt = (*pTxtAttrs)[i];
- const sal_Int32* pEnd = pHt->GetEnd();
+ const sal_Int32* pEnd = pHt->End();
if (pEnd ? ( nSwPos >= *pHt->GetStart() && nSwPos < *pEnd)
: nSwPos == *pHt->GetStart() )
@@ -536,14 +536,17 @@ void SwWW8AttrIter::OutFlys(xub_StrLen nSwPos)
bool SwWW8AttrIter::IsTxtAttr( xub_StrLen nSwPos )
{
- // search for attrs with CH_TXTATR
+ // search for attrs with dummy character or content
if (const SwpHints* pTxtAttrs = rNd.GetpSwpHints())
{
for (sal_uInt16 i = 0; i < pTxtAttrs->Count(); ++i)
{
const SwTxtAttr* pHt = (*pTxtAttrs)[i];
- if ( pHt->HasDummyChar() && (*pHt->GetStart() == nSwPos) )
+ if ( ( pHt->HasDummyChar() || pHt->HasContent() )
+ && (*pHt->GetStart() == nSwPos) )
+ {
return true;
+ }
}
}
@@ -597,8 +600,8 @@ const SfxPoolItem* SwWW8AttrIter::HasTextItem( sal_uInt16 nWhich ) const
{
const SwTxtAttr* pHt = (*pTxtAttrs)[i];
const SfxPoolItem* pItem = &pHt->GetAttr();
- const sal_Int32* pAtrEnd = 0;
- if( 0 != ( pAtrEnd = pHt->GetEnd() ) && // only Attr with an end
+ const sal_Int32 * pAtrEnd = 0;
+ if( 0 != ( pAtrEnd = pHt->End() ) && // only Attr with an end
nTmpSwPos >= *pHt->GetStart() && nTmpSwPos < *pAtrEnd )
{
if ( nWhich == pItem->Which() )
@@ -1068,7 +1071,7 @@ void AttributeOutputBase::TOXMark( const SwTxtNode& rNode, const SwTOXMark& rAtt
ww::eField eType = ww::eNONE;
const SwTxtTOXMark& rTxtTOXMark = *rAttr.GetTxtTOXMark();
- const sal_Int32* pTxtEnd = rTxtTOXMark.GetEnd();
+ const sal_Int32* pTxtEnd = rTxtTOXMark.End();
if ( pTxtEnd ) // has range?
{
sTxt = rNode.GetExpandTxt( *rTxtTOXMark.GetStart(),
@@ -1136,7 +1139,7 @@ int SwWW8AttrIter::OutAttrWithRange(xub_StrLen nPos)
if ( m_rExport.AttrOutput().StartURL( rINet->GetValue(), rINet->GetTargetFrame() ) )
++nRet;
}
- if ( 0 != ( pEnd = pHt->GetEnd() ) && nPos == *pEnd )
+ if ( 0 != ( pEnd = pHt->End() ) && nPos == *pEnd )
{
if ( m_rExport.AttrOutput().EndURL() )
--nRet;
@@ -1148,7 +1151,7 @@ int SwWW8AttrIter::OutAttrWithRange(xub_StrLen nPos)
OutSwFmtRefMark( *static_cast< const SwFmtRefMark* >( pItem ), true );
++nRet;
}
- if ( 0 != ( pEnd = pHt->GetEnd() ) && nPos == *pEnd )
+ if ( 0 != ( pEnd = pHt->End() ) && nPos == *pEnd )
{
OutSwFmtRefMark( *static_cast< const SwFmtRefMark* >( pItem ), false );
--nRet;
@@ -1164,7 +1167,7 @@ int SwWW8AttrIter::OutAttrWithRange(xub_StrLen nPos)
m_rExport.AttrOutput().StartRuby( rNd, nPos, *static_cast< const SwFmtRuby* >( pItem ) );
++nRet;
}
- if ( 0 != ( pEnd = pHt->GetEnd() ) && nPos == *pEnd )
+ if ( 0 != ( pEnd = pHt->End() ) && nPos == *pEnd )
{
m_rExport.AttrOutput().EndRuby();
--nRet;
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 69f5900592a9..349596cc6913 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -1785,7 +1785,6 @@ void WW8Export::OutputField( const SwField* pFld, ww::eField eFldType,
WW8_WrPlcFld* pFldP = CurrentFieldPlc();
const bool bIncludeEmptyPicLocation = ( eFldType == ww::ePAGE );
-
if (WRITEFIELD_START & nMode)
{
sal_uInt8 aFld13[2] = { 0x13, 0x00 }; // will change
@@ -2544,7 +2543,7 @@ void AttributeOutputBase::TextField( const SwFmtFld& rField )
{
const SwField* pFld = rField.GetField();
bool bWriteExpand = false;
- sal_uInt16 nSubType = pFld->GetSubType();
+ const sal_uInt16 nSubType = pFld->GetSubType();
switch (pFld->GetTyp()->Which())
{
@@ -2786,8 +2785,7 @@ void AttributeOutputBase::TextField( const SwFmtFld& rField )
break;
case RES_INPUTFLD:
{
- const SwInputField * pInputField =
- dynamic_cast<const SwInputField *>(pFld);
+ const SwInputField * pInputField = dynamic_cast<const SwInputField *>(pFld);
if (pInputField->isFormField())
GetExport().DoFormText(pInputField);
@@ -5176,6 +5174,7 @@ void AttributeOutputBase::OutputItem( const SfxPoolItem& rHt )
TextCharFormat( static_cast< const SwFmtCharFmt& >( rHt ) );
break;
case RES_TXTATR_FIELD:
+ case RES_TXTATR_INPUTFIELD:
TextField( static_cast< const SwFmtFld& >( rHt ) );
break;
case RES_TXTATR_FLYCNT:
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 66b68867201e..6a1c0487fab3 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1194,6 +1194,8 @@ void SwWW8FltControlStack::NewAttr(const SwPosition& rPos,
{
OSL_ENSURE(RES_TXTATR_FIELD != rAttr.Which(), "probably don't want to put"
"fields into the control stack");
+ OSL_ENSURE(RES_TXTATR_INPUTFIELD != rAttr.Which(), "probably don't want to put"
+ "input fields into the control stack");
OSL_ENSURE(RES_FLTR_REDLINE != rAttr.Which(), "probably don't want to put"
"redlines into the control stack");
SwFltControlStack::NewAttr(rPos, rAttr);
@@ -1443,6 +1445,12 @@ void SwWW8FltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
OSL_ENSURE(!this, "What is a field doing in the control stack,"
"probably should have been in the endstack");
break;
+
+ case RES_TXTATR_INPUTFIELD:
+ OSL_ENSURE(!this, "What is a input field doing in the control stack,"
+ "probably should have been in the endstack");
+ break;
+
case RES_TXTATR_INETFMT:
{
SwPaM aRegion(rTmpPos);
@@ -1582,6 +1590,7 @@ void SwWW8FltRefStack::SetAttrInDoc(const SwPosition& rTmpPos,
do normal (?) strange stuff
*/
case RES_TXTATR_FIELD:
+ case RES_TXTATR_INPUTFIELD:
{
SwNodeIndex aIdx(rEntry.m_aMkPos.m_nNode, 1);
SwPaM aPaM(aIdx, rEntry.m_aMkPos.m_nCntnt);
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 380e342d2309..25da90283bca 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -121,48 +121,54 @@ eF_ResT SwWW8ImplReader::Read_F_FormTextBox( WW8FieldDesc* pF, OUString& rStr )
*/
const SvtFilterOptions& rOpt = SvtFilterOptions::Get();
- sal_Bool bUseEnhFields = rOpt.IsUseEnhancedFields();
-
- if (!bUseEnhFields) {
- aFormula.sDefault = GetFieldResult(pF);
+ const sal_Bool bUseEnhFields = rOpt.IsUseEnhancedFields();
- SwInputField aFld((SwInputFieldType*)rDoc.GetSysFldType( RES_INPUTFLD ),
- aFormula.sDefault , aFormula.sTitle , INP_TXT, 0 );
- aFld.SetHelp(aFormula.sHelp);
- aFld.SetToolTip(aFormula.sToolTip);
+ if (!bUseEnhFields)
+ {
+ aFormula.sDefault = GetFieldResult(pF);
+
+ SwInputField aFld(
+ static_cast<SwInputFieldType*>(rDoc.GetSysFldType( RES_INPUTFLD )),
+ aFormula.sDefault,
+ aFormula.sTitle,
+ INP_TXT,
+ 0 );
+ aFld.SetHelp(aFormula.sHelp);
+ aFld.SetToolTip(aFormula.sToolTip);
- rDoc.InsertPoolItem(*pPaM, SwFmtFld(aFld), 0);
- return FLD_OK;
- } else {
- WW8PLCFx_Book* pB = pPlcxMan->GetBook();
- OUString aBookmarkName;
- if (pB!=NULL) {
- WW8_CP currentCP=pF->nSCode;
- WW8_CP currentLen=pF->nLen;
+ rDoc.InsertPoolItem(*pPaM, SwFmtFld(aFld), 0);
+ return FLD_OK;
+ }
+ else
+ {
+ WW8PLCFx_Book* pB = pPlcxMan->GetBook();
+ OUString aBookmarkName;
+ if (pB!=NULL) {
+ WW8_CP currentCP=pF->nSCode;
+ WW8_CP currentLen=pF->nLen;
- sal_uInt16 bkmFindIdx;
- OUString aBookmarkFind=pB->GetBookmark(currentCP-1, currentCP+currentLen-1, bkmFindIdx);
+ sal_uInt16 bkmFindIdx;
+ OUString aBookmarkFind=pB->GetBookmark(currentCP-1, currentCP+currentLen-1, bkmFindIdx);
- if (!aBookmarkFind.isEmpty()) {
- pB->SetStatus(bkmFindIdx, BOOK_FIELD); // mark bookmark as consumed, such that tl'll not get inserted as a "normal" bookmark again
if (!aBookmarkFind.isEmpty()) {
- aBookmarkName=aBookmarkFind;
+ pB->SetStatus(bkmFindIdx, BOOK_FIELD); // mark bookmark as consumed, such that tl'll not get inserted as a "normal" bookmark again
+ if (!aBookmarkFind.isEmpty()) {
+ aBookmarkName=aBookmarkFind;
+ }
}
}
- }
-
- if (pB!=NULL && aBookmarkName.isEmpty()) {
- aBookmarkName=pB->GetUniqueBookmarkName(aFormula.sTitle);
- }
+ if (pB!=NULL && aBookmarkName.isEmpty()) {
+ aBookmarkName=pB->GetUniqueBookmarkName(aFormula.sTitle);
+ }
- if (!aBookmarkName.isEmpty()) {
- maFieldStack.back().SetBookmarkName(aBookmarkName);
- maFieldStack.back().SetBookmarkType(ODF_FORMTEXT);
- maFieldStack.back().getParameters()["Description"] = uno::makeAny(OUString(aFormula.sToolTip));
- maFieldStack.back().getParameters()["Name"] = uno::makeAny(OUString(aFormula.sTitle));
- }
- return FLD_TEXT;
+ if (!aBookmarkName.isEmpty()) {
+ maFieldStack.back().SetBookmarkName(aBookmarkName);
+ maFieldStack.back().SetBookmarkType(ODF_FORMTEXT);
+ maFieldStack.back().getParameters()["Description"] = uno::makeAny(OUString(aFormula.sToolTip));
+ maFieldStack.back().getParameters()["Name"] = uno::makeAny(OUString(aFormula.sTitle));
+ }
+ return FLD_TEXT;
}
}
@@ -176,7 +182,7 @@ eF_ResT SwWW8ImplReader::Read_F_FormCheckBox( WW8FieldDesc* pF, OUString& rStr )
if (rStr[pF->nLCode-1]==0x01)
ImportFormulaControl(aFormula,pF->nSCode+pF->nLCode-1, WW8_CT_CHECKBOX);
const SvtFilterOptions& rOpt = SvtFilterOptions::Get();
- sal_Bool bUseEnhFields = rOpt.IsUseEnhancedFields();
+ const sal_Bool bUseEnhFields = rOpt.IsUseEnhancedFields();
if (!bUseEnhFields)
{
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 695c81209445..605f753d6150 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -1112,8 +1112,8 @@ eF_ResT SwWW8ImplReader::Read_F_Input( WW8FieldDesc* pF, OUString& rStr )
if ( pF->nId != 0x01 ) // 0x01 fields have no result
{
- SwInputField aFld( (SwInputFieldType*)rDoc.GetSysFldType( RES_INPUTFLD ),
- aDef, aQ, INP_TXT, 0 ); // sichtbar ( geht z.Zt. nicht anders )
+ SwInputField aFld( static_cast<SwInputFieldType*>(rDoc.GetSysFldType( RES_INPUTFLD )),
+ aDef, aQ, INP_TXT, 0, false );
rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 );
}
@@ -2474,7 +2474,7 @@ eF_ResT SwWW8ImplReader::Read_F_Equation( WW8FieldDesc*, OUString& rStr )
if (aResult.sType == "Input")
{
- SwInputField aFld( (SwInputFieldType*)rDoc.GetSysFldType( RES_INPUTFLD ),
+ SwInputField aFld( static_cast<SwInputFieldType*>(rDoc.GetSysFldType( RES_INPUTFLD )),
aResult.sResult, aResult.sResult, INP_TXT, 0 );
rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 ); // insert input field
}
diff --git a/sw/source/ui/app/docst.cxx b/sw/source/ui/app/docst.cxx
index b070e8bee8f2..30ed690933d8 100644
--- a/sw/source/ui/app/docst.cxx
+++ b/sw/source/ui/app/docst.cxx
@@ -865,7 +865,7 @@ sal_uInt16 SwDocShell::ApplyStyles(const OUString &rName, sal_uInt16 nFamily,
case SFX_STYLE_FAMILY_CHAR:
{
SwFmtCharFmt aFmt(pStyle->GetCharFmt());
- pSh->SetAttr( aFmt, (nMode & KEY_SHIFT) ?
+ pSh->SetAttrItem( aFmt, (nMode & KEY_SHIFT) ?
nsSetAttrMode::SETATTR_DONTREPLACE : nsSetAttrMode::SETATTR_DEFAULT );
break;
}
@@ -1135,7 +1135,7 @@ sal_uInt16 SwDocShell::MakeByExample( const OUString &rName, sal_uInt16 nFamily,
pCurrWrtShell->FillByEx( pChar );
pChar->SetDerivedFrom( pCurrWrtShell->GetCurCharFmt() );
SwFmtCharFmt aFmt( pChar );
- pCurrWrtShell->SetAttr( aFmt );
+ pCurrWrtShell->SetAttrItem( aFmt );
pCurrWrtShell->EndAllAction();
}
}
diff --git a/sw/source/ui/docvw/edtdd.cxx b/sw/source/ui/docvw/edtdd.cxx
index cc16fe634d0e..3d77938d88d8 100644
--- a/sw/source/ui/docvw/edtdd.cxx
+++ b/sw/source/ui/docvw/edtdd.cxx
@@ -252,7 +252,9 @@ sal_uInt16 SwEditWin::GetDropDestination( const Point& rPixPnt, SdrObject ** ppO
{
SwWrtShell &rSh = m_rView.GetWrtShell();
const Point aDocPt( PixelToLogic( rPixPnt ) );
- if( rSh.ChgCurrPam( aDocPt ) || rSh.IsOverReadOnlyPos( aDocPt ) )
+ if( rSh.ChgCurrPam( aDocPt )
+ || rSh.IsOverReadOnlyPos( aDocPt )
+ || rSh.DocPtInsideInputFld( aDocPt ) )
return 0;
SdrObject *pObj = NULL;
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index bec282a160cf..64536179d567 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -83,6 +83,7 @@
#include <dselect.hxx>
#include <textsh.hxx>
#include <shdwcrsr.hxx>
+#include <txatbase.hxx>
#include <fmtanchr.hxx>
#include <fmtornt.hxx>
#include <fmtfsize.hxx>
@@ -945,7 +946,7 @@ void SwEditWin::FlushInBuffer()
if (nWhich != INVALID_HINT )
{
SvxLanguageItem aLangItem( m_eBufferLanguage, nWhich );
- rSh.SetAttr( aLangItem );
+ rSh.SetAttrItem( aLangItem );
}
rSh.Insert( m_aInBuffer );
@@ -1440,8 +1441,8 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt)
// pressing this inside a note will switch to next/previous note
if ((rKeyCode.IsMod1() && rKeyCode.IsMod2()) && ((rKeyCode.GetCode() == KEY_PAGEUP) || (rKeyCode.GetCode() == KEY_PAGEDOWN)))
{
- bool bNext = rKeyCode.GetCode()==KEY_PAGEDOWN ? true : false;
- SwFieldType* pFldType = rSh.GetFldType(0, RES_POSTITFLD);
+ const bool bNext = rKeyCode.GetCode()==KEY_PAGEDOWN ? true : false;
+ const SwFieldType* pFldType = rSh.GetFldType( 0, RES_POSTITFLD );
rSh.MoveFldType( pFldType, bNext );
return;
}
@@ -1555,9 +1556,8 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt)
KS_GotoPrevFieldMark,
KS_End };
- SW_KeyState eKeyState = bIsDocReadOnly ? KS_CheckDocReadOnlyKeys
- : KS_CheckKey,
- eNextKeyState = KS_End;
+ SW_KeyState eKeyState = bIsDocReadOnly ? KS_CheckDocReadOnlyKeys : KS_CheckKey;
+ SW_KeyState eNextKeyState = KS_End;
sal_uInt8 nDir = 0;
if (m_nKS_NUMDOWN_Count > 0)
@@ -1846,7 +1846,8 @@ KEYINPUT_CHECKTABLE_INSDEL:
case KEY_RETURN:
{
- if( !rSh.HasReadonlySel() )
+ if ( !rSh.HasReadonlySel()
+ && !rSh.CrsrInsideInputFld() )
{
const int nSelectionType = rSh.GetSelectionType();
if(nSelectionType & nsSelectionType::SEL_OLE)
@@ -1881,10 +1882,15 @@ KEYINPUT_CHECKTABLE_INSDEL:
}
}
break;
- case KEY_RETURN | KEY_MOD2: // ALT-Return
+ case KEY_RETURN | KEY_MOD2:
{
- if( !rSh.HasReadonlySel() && !rSh.IsSttPara() && rSh.GetCurNumRule() )
+ if ( !rSh.HasReadonlySel()
+ && !rSh.IsSttPara()
+ && rSh.GetCurNumRule()
+ && !rSh.CrsrInsideInputFld() )
+ {
eKeyState = KS_NoNum;
+ }
else if( rSh.CanSpecialInsert() )
eKeyState = KS_SpecialInsert;
}
@@ -1999,6 +2005,11 @@ KEYINPUT_CHECKTABLE_INSDEL:
{
eKeyState=KS_GotoNextFieldMark;
}
+ else if ( !rSh.IsMultiSelection() && rSh.CrsrInsideInputFld() )
+ {
+ GetView().GetViewFrame()->GetDispatcher()->Execute( FN_GOTO_NEXT_INPUTFLD );
+ eKeyState = KS_End;
+ }
else
if( rSh.GetCurNumRule() && rSh.IsSttOfPara() &&
!rSh.HasReadonlySel() )
@@ -2041,9 +2052,15 @@ KEYINPUT_CHECKTABLE_INSDEL:
break;
case KEY_TAB | KEY_SHIFT:
{
- if (rSh.IsFormProtected() || rSh.GetCurrentFieldmark()|| rSh.GetChar(sal_False)==CH_TXT_ATR_FORMELEMENT) {
+ if (rSh.IsFormProtected() || rSh.GetCurrentFieldmark()|| rSh.GetChar(sal_False)==CH_TXT_ATR_FORMELEMENT)
+ {
eKeyState=KS_GotoPrevFieldMark;
}
+ else if ( !rSh.IsMultiSelection() && rSh.CrsrInsideInputFld() )
+ {
+ GetView().GetViewFrame()->GetDispatcher()->Execute( FN_GOTO_PREV_INPUTFLD );
+ eKeyState = KS_End;
+ }
else if( rSh.GetCurNumRule() && rSh.IsSttOfPara() &&
!rSh.HasReadonlySel() )
{
@@ -2159,9 +2176,15 @@ KEYINPUT_CHECKTABLE_INSDEL:
eKeyState = rKeyCode.GetModifier() & KEY_SHIFT ?
KS_PrevObject : KS_NextObject;
}
+ else if ( !rSh.IsMultiSelection() && rSh.CrsrInsideInputFld() )
+ {
+ GetView().GetViewFrame()->GetDispatcher()->Execute(
+ KEY_SHIFT != rKeyCode.GetModifier() ? FN_GOTO_NEXT_INPUTFLD : FN_GOTO_PREV_INPUTFLD );
+ }
else
- rSh.SelectNextPrevHyperlink(
- KEY_SHIFT != rKeyCode.GetModifier() );
+ {
+ rSh.SelectNextPrevHyperlink( KEY_SHIFT != rKeyCode.GetModifier() );
+ }
break;
case KEY_RETURN:
{
@@ -3001,11 +3024,6 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
}
}
- // One can be in a selection state when recently the keyboard was
- // used to select but no CURSOR_KEY was moved yet after that. In
- // that case the previous selction has to be finished first.
- // MA 07. Oct. 95: Not only with left mouse button but always.
- // also see Bug: 19263
if ( rSh.IsInSelect() )
rSh.EndSelect();
@@ -4477,7 +4495,19 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
bAddMode = true;
rSh.EnterAddMode();
}
- rSh.ClickToField( *aCntntAtPos.aFnd.pFld );
+ if ( aCntntAtPos.pFndTxtAttr != NULL
+ && aCntntAtPos.pFndTxtAttr->Which() == RES_TXTATR_INPUTFIELD )
+ {
+ // select content of Input Field, but exclude CH_TXT_ATR_INPUTFIELDSTART
+ // and CH_TXT_ATR_INPUTFIELDEND
+ rSh.SttSelect();
+ rSh.SelectTxt( *(aCntntAtPos.pFndTxtAttr->GetStart()) + 1,
+ *(aCntntAtPos.pFndTxtAttr->End()) - 1 );
+ }
+ else
+ {
+ rSh.ClickToField( *aCntntAtPos.aFnd.pFld );
+ }
// a bit of a mystery what this is good for?
// in this case we assume it's valid since we
// just selected a field
@@ -4646,10 +4676,10 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
Color aColor( COL_TRANSPARENT );
if( !SwEditWin::m_bTransparentBackColor )
aColor = SwEditWin::m_aTextBackColor;
- rSh.SetAttr( SvxBrushItem( aColor, nId ) );
+ rSh.SetAttrItem( SvxBrushItem( aColor, nId ) );
}
else
- rSh.SetAttr( SvxColorItem(SwEditWin::m_aTextColor, nId) );
+ rSh.SetAttrItem( SvxColorItem(SwEditWin::m_aTextColor, nId) );
rSh.UnSetVisCrsr();
rSh.EnterStdMode();
rSh.SetVisCrsr(aDocPt);
@@ -4685,7 +4715,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
if( (( nsSelectionType::SEL_TXT | nsSelectionType::SEL_TBL )
& eSelection ) && !rSh.HasReadonlySel() )
{
- rSh.SetAttr( SwFmtCharFmt(m_pApplyTempl->aColl.pCharFmt) );
+ rSh.SetAttrItem( SwFmtCharFmt(m_pApplyTempl->aColl.pCharFmt) );
rSh.UnSetVisCrsr();
rSh.EnterStdMode();
rSh.SetVisCrsr(aDocPt);
diff --git a/sw/source/ui/fldui/fldedt.cxx b/sw/source/ui/fldui/fldedt.cxx
index a9b907af3c17..2315ce00f65c 100644
--- a/sw/source/ui/fldui/fldedt.cxx
+++ b/sw/source/ui/fldui/fldedt.cxx
@@ -24,6 +24,7 @@
#include <sfx2/app.hxx>
#include <svx/optgenrl.hxx>
#include <docufld.hxx>
+#include <expfld.hxx>
#include <view.hxx>
#include <dbfld.hxx>
#include <wrtsh.hxx>
@@ -69,10 +70,21 @@ SwFldEditDlg::SwFldEditDlg(SwView& rVw)
pSh->SetCareWin(this);
- /* #108536# Only create selection if there is none
- already. Normalize PaM instead of swapping. */
+ if ( pSh->CrsrInsideInputFld() )
+ {
+ // move cursor to start of Input Field
+ SwInputField* pInputFld = dynamic_cast<SwInputField*>(pCurFld);
+ if ( pInputFld != NULL
+ && pInputFld->GetFmtFld() != NULL )
+ {
+ pSh->GotoField( *(pInputFld->GetFmtFld()) );
+ }
+ }
+
if ( ! pSh->HasSelection() )
+ {
pSh->Right(CRSR_SKIP_CHARS, true, 1, false);
+ }
pSh->NormalizePam();
diff --git a/sw/source/ui/fldui/fldmgr.cxx b/sw/source/ui/fldui/fldmgr.cxx
index ab91a25dbd80..3d215182608d 100644
--- a/sw/source/ui/fldui/fldmgr.cxx
+++ b/sw/source/ui/fldui/fldmgr.cxx
@@ -306,7 +306,7 @@ SwField* SwFldMgr::GetCurFld()
{
SwWrtShell *pSh = pWrtShell ? pWrtShell : ::lcl_GetShell();
if ( pSh )
- pCurFld = pSh->GetCurFld();
+ pCurFld = pSh->GetCurFld( true );
else
pCurFld = NULL;
@@ -790,10 +790,12 @@ sal_Bool SwFldMgr::GoNextPrev( sal_Bool bNext, SwFieldType* pTyp )
if (pTyp && pTyp->Which() == RES_DBFLD)
{
// for fieldcommand-edit (hop to all DB fields)
- return pSh->MoveFldType( 0, bNext, USHRT_MAX, RES_DBFLD );
+ return pSh->MoveFldType( 0, (bNext ? true : false), RES_DBFLD );
}
- return pTyp && pSh ? pSh->MoveFldType( pTyp, bNext ) : sal_False;
+ return (pTyp && pSh)
+ ? pSh->MoveFldType( pTyp, (bNext ? true : false) )
+ : sal_False;
}
/*--------------------------------------------------------------------
@@ -980,7 +982,7 @@ sal_Bool SwFldMgr::InsertFld( const SwInsertFld_Data& rData, SwPaM *pPam )
{
if( !rData.sPar1.isEmpty() && CanInsertRefMark( rData.sPar1 ) )
{
- pCurShell->SetAttr( SwFmtRefMark( rData.sPar1 ) );
+ pCurShell->SetAttrItem( SwFmtRefMark( rData.sPar1 ) );
return sal_True;
}
return sal_False;
@@ -1222,7 +1224,7 @@ sal_Bool SwFldMgr::InsertFld( const SwInsertFld_Data& rData, SwPaM *pPam )
(SwInputFieldType*)pCurShell->GetFldType(0, RES_INPUTFLD);
SwInputField* pInpFld =
- new SwInputField(pTyp, rData.sPar1, rData.sPar2, nSubType|nsSwExtendedSubType::SUB_INVISIBLE, nFormatId);
+ new SwInputField( pTyp, rData.sPar1, rData.sPar2, nSubType|nsSwExtendedSubType::SUB_INVISIBLE, nFormatId);
pFld = pInpFld;
}
diff --git a/sw/source/ui/inc/wrtsh.hxx b/sw/source/ui/inc/wrtsh.hxx
index 9b792bfafbfe..946e534b07f8 100644
--- a/sw/source/ui/inc/wrtsh.hxx
+++ b/sw/source/ui/inc/wrtsh.hxx
@@ -248,7 +248,7 @@ typedef sal_Bool (SwWrtShell:: *FNSimpleMove)();
sal_Bool PageCrsr(SwTwips lOffset, sal_Bool bSelect);
// update fields
- void UpdateInputFlds( SwInputFieldList* pLst = 0, sal_Bool bOnlyInSel = sal_False );
+ void UpdateInputFlds( SwInputFieldList* pLst = 0 );
void NoEdit(bool bHideCrsr = true);
void Edit();
diff --git a/sw/source/ui/lingu/hhcwrp.cxx b/sw/source/ui/lingu/hhcwrp.cxx
index 8db9eb815375..21e0aba383ed 100644
--- a/sw/source/ui/lingu/hhcwrp.cxx
+++ b/sw/source/ui/lingu/hhcwrp.cxx
@@ -367,7 +367,7 @@ void SwHHCWrapper::ChangeText_impl( const OUString &rNewText, bool bKeepAttribut
// was deleted)
m_rWrtShell.ResetAttr();
// apply previously saved attributes to new text
- m_rWrtShell.SetAttr( aItemSet );
+ m_rWrtShell.SetAttrSet( aItemSet );
}
else
{
@@ -474,7 +474,7 @@ void SwHHCWrapper::ReplaceUnit(
SwPaM *pPaM = m_rWrtShell.GetCrsr();
(void)pPaM;
#endif
- m_rWrtShell.SetAttr(*pRuby);
+ m_rWrtShell.SetAttrItem(*pRuby);
delete pRuby;
m_rWrtShell.EndUndo( UNDO_SETRUBYATTR );
}
@@ -524,7 +524,7 @@ void SwHHCWrapper::ReplaceUnit(
aSet.Put( aFontItem );
}
- m_rWrtShell.SetAttr( aSet );
+ m_rWrtShell.SetAttrSet( aSet );
m_rWrtShell.ClearMark();
}
diff --git a/sw/source/ui/misc/insfnote.cxx b/sw/source/ui/misc/insfnote.cxx
index cddb20fd0772..52c5c187a4e6 100644
--- a/sw/source/ui/misc/insfnote.cxx
+++ b/sw/source/ui/misc/insfnote.cxx
@@ -69,7 +69,7 @@ void SwInsFootNoteDlg::Apply()
rFont.GetStyleName(), rFont.GetPitch(),
eCharSet, RES_CHRATR_FONT );
aSet.Put( aFont );
- rSh.SetAttr( aSet, nsSetAttrMode::SETATTR_DONTEXPAND );
+ rSh.SetAttrSet( aSet, nsSetAttrMode::SETATTR_DONTEXPAND );
rSh.ResetSelect(0, sal_False);
rSh.Left(CRSR_SKIP_CHARS, sal_False, 1, sal_False );
}
diff --git a/sw/source/ui/misc/titlepage.cxx b/sw/source/ui/misc/titlepage.cxx
index 21f3b51a99b9..cc24c27c9438 100644
--- a/sw/source/ui/misc/titlepage.cxx
+++ b/sw/source/ui/misc/titlepage.cxx
@@ -90,13 +90,13 @@ namespace
{
SwFmtPageDesc aPageFmtDesc(pPageFmtDesc ? *pPageFmtDesc : &rCurrentDesc);
if (nPgNo) aPageFmtDesc.SetNumOffset(nPgNo);
- pSh->SetAttr(aPageFmtDesc);
+ pSh->SetAttrItem(aPageFmtDesc);
}
else
{
SwFmtPageDesc aPageFmtDesc(pNewDesc);
if (nPgNo) aPageFmtDesc.SetNumOffset(nPgNo);
- pSh->SetAttr(aPageFmtDesc);
+ pSh->SetAttrItem(aPageFmtDesc);
}
delete pPageFmtDesc;
@@ -311,12 +311,12 @@ IMPL_LINK_NOARG(SwTitlePageDlg, OKHdl)
}
mpSh->GotoPage(GetInsertPosition(), false);
- mpSh->SetAttr(aTitleDesc);
+ mpSh->SetAttrItem(aTitleDesc);
if (nNoPages > 1 && mpSh->GotoPage(GetInsertPosition() + nNoPages, false))
{
SwFmtPageDesc aPageFmtDesc(mpNormalDesc);
- mpSh->SetAttr(aPageFmtDesc);
+ mpSh->SetAttrItem(aPageFmtDesc);
}
if (m_pRestartNumberingCB->IsChecked() || nNoPages > 1)
diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx
index 40bb4b81eab3..1106013b376e 100644
--- a/sw/source/ui/shells/annotsh.cxx
+++ b/sw/source/ui/shells/annotsh.cxx
@@ -1080,13 +1080,14 @@ void SwAnnotationShell::NoteExec(SfxRequest &rReq)
sal_uInt16 nSlot = rReq.GetSlot();
switch (nSlot)
{
- case FN_REPLY:
- case FN_POSTIT:
- case FN_DELETE_COMMENT:
- if ( pPostItMgr->HasActiveSidebarWin() )
- pPostItMgr->GetActiveSidebarWin()->ExecuteCommand(nSlot);
- break;
- case FN_DELETE_ALL_NOTES:
+ case FN_REPLY:
+ case FN_POSTIT:
+ case FN_DELETE_COMMENT:
+ if ( pPostItMgr->HasActiveSidebarWin() )
+ pPostItMgr->GetActiveSidebarWin()->ExecuteCommand(nSlot);
+ break;
+
+ case FN_DELETE_ALL_NOTES:
pPostItMgr->Delete();
break;
case FN_DELETE_NOTE_AUTHOR:
@@ -1120,22 +1121,23 @@ void SwAnnotationShell::GetNoteState(SfxItemSet &rSet)
sal_uInt16 nSlotId = GetPool().GetSlotId( nWhich );
switch( nSlotId )
{
- case FN_POSTIT:
- case FN_DELETE_NOTE_AUTHOR:
- case FN_DELETE_ALL_NOTES:
- case FN_HIDE_NOTE:
- case FN_HIDE_NOTE_AUTHOR:
- case FN_HIDE_ALL_NOTES:
- case FN_DELETE_COMMENT:
+ case FN_POSTIT:
+ case FN_DELETE_NOTE_AUTHOR:
+ case FN_DELETE_ALL_NOTES:
+ case FN_HIDE_NOTE:
+ case FN_HIDE_NOTE_AUTHOR:
+ case FN_HIDE_ALL_NOTES:
+ case FN_DELETE_COMMENT:
{
- if ( !pPostItMgr ||
- !pPostItMgr->HasActiveAnnotationWin() )
+ if( !pPostItMgr
+ || !pPostItMgr->HasActiveAnnotationWin() )
{
rSet.DisableItem(nWhich);
}
break;
}
- case FN_REPLY:
+
+ case FN_REPLY:
{
if ( !pPostItMgr ||
!pPostItMgr->HasActiveAnnotationWin() )
diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx
index c1493584cf22..4b5d9f80aa4c 100644
--- a/sw/source/ui/shells/basesh.cxx
+++ b/sw/source/ui/shells/basesh.cxx
@@ -265,11 +265,10 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq)
case SID_PASTE:
{
TransferableDataHelper aDataHelper(
- TransferableDataHelper::CreateFromSystemClipboard(
- &rSh.GetView().GetEditWin() ) );
-
- if( aDataHelper.GetXTransferable().is() &&
- SwTransferable::IsPaste( rSh, aDataHelper ))
+ TransferableDataHelper::CreateFromSystemClipboard( &rSh.GetView().GetEditWin() ) );
+ if( aDataHelper.GetXTransferable().is()
+ && SwTransferable::IsPaste( rSh, aDataHelper )
+ && !rSh.CrsrInsideInputFld() )
{
// Temporary variables, because the shell could already be
// destroyed after the paste.
@@ -317,10 +316,9 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq)
case SID_PASTE_UNFORMATTED:
{
TransferableDataHelper aDataHelper(
- TransferableDataHelper::CreateFromSystemClipboard(
- &rSh.GetView().GetEditWin()) );
- if( aDataHelper.GetXTransferable().is() &&
- SwTransferable::IsPaste( rSh, aDataHelper ))
+ TransferableDataHelper::CreateFromSystemClipboard( &rSh.GetView().GetEditWin()) );
+ if( aDataHelper.GetXTransferable().is()
+ && SwTransferable::IsPaste( rSh, aDataHelper ) )
{
// Temporary variables, because the shell could already be
// destroyed after the paste.
@@ -352,10 +350,10 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq)
case SID_PASTE_SPECIAL:
{
TransferableDataHelper aDataHelper(
- TransferableDataHelper::CreateFromSystemClipboard(
- &rSh.GetView().GetEditWin()) );
- if( aDataHelper.GetXTransferable().is() &&
- SwTransferable::IsPaste( rSh, aDataHelper ))
+ TransferableDataHelper::CreateFromSystemClipboard( &rSh.GetView().GetEditWin()) );
+ if( aDataHelper.GetXTransferable().is()
+ && SwTransferable::IsPaste( rSh, aDataHelper )
+ && !rSh.CrsrInsideInputFld() )
{
// Temporary variables, because the shell could already be
// destroyed after the paste.
@@ -368,7 +366,7 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq)
{
SfxViewFrame* pViewFrame = pView->GetViewFrame();
uno::Reference< frame::XDispatchRecorder > xRecorder =
- pViewFrame->GetBindings().GetRecorder();
+ pViewFrame->GetBindings().GetRecorder();
if(xRecorder.is()) {
SfxRequest aReq( pViewFrame, SID_CLIPBOARD_FORMAT_ITEMS );
aReq.AppendItem( SfxUInt32Item( SID_CLIPBOARD_FORMAT_ITEMS, nFormatId ) );
@@ -384,6 +382,7 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq)
return;
}
break;
+
default:
OSL_FAIL("wrong Dispatcher");
return;
@@ -419,15 +418,25 @@ void SwBaseShell::StateClpbrd(SfxItemSet &rSet)
break;
case SID_PASTE:
- if( !GetView().IsPasteAllowed() )
- rSet.DisableItem( SID_PASTE );
+ if( !GetView().IsPasteAllowed()
+ || rSh.CrsrInsideInputFld() )
+ {
+ rSet.DisableItem( nWhich );
+ }
break;
case SID_PASTE_SPECIAL:
+ if( !GetView().IsPasteSpecialAllowed()
+ || rSh.CrsrInsideInputFld() )
+ {
+ rSet.DisableItem( nWhich );
+ }
+ break;
+
+ case SID_PASTE_UNFORMATTED:
if( !GetView().IsPasteSpecialAllowed() )
{
- rSet.DisableItem( SID_PASTE_SPECIAL );
- rSet.DisableItem( SID_PASTE_UNFORMATTED );
+ rSet.DisableItem( nWhich );
}
break;
@@ -620,8 +629,9 @@ void SwBaseShell::Execute(SfxRequest &rReq)
break;
case FN_UPDATE_INPUTFIELDS:
- rSh.UpdateInputFlds(NULL, sal_False);
+ rSh.UpdateInputFlds();
break;
+
case FN_PREV_BOOKMARK:
rReq.SetReturnValue(SfxBoolItem( nSlot, rSh.GoPrevBookmark()));
break;
@@ -651,7 +661,7 @@ void SwBaseShell::Execute(SfxRequest &rReq)
rSh.ClearMark();
rSh.EndSelect();
}
- sal_Bool bRet = rSh.MoveFldType(pFldType, nSlot == FN_GOTO_NEXT_MARK);
+ sal_Bool bRet = rSh.MoveFldType( pFldType, nSlot == FN_GOTO_NEXT_MARK );
SwField* pCurField = bRet ? rSh.GetCurFld() : 0;
if (pCurField)
rSh.ClickToField(*pCurField);
@@ -1159,7 +1169,7 @@ void SwBaseShell::Execute(SfxRequest &rReq)
}
else
{
- rSh.SetAttr( *pArgs );
+ rSh.SetAttrSet( *pArgs );
}
rSh.EndAllAction();
}
@@ -1192,7 +1202,7 @@ void SwBaseShell::Execute(SfxRequest &rReq)
else
{
// Set border attributes via shell quite normally.
- rSh.SetAttr( *pItem );
+ rSh.SetAttrItem( *pItem );
}
}
break;
@@ -1326,10 +1336,14 @@ void SwBaseShell::GetState( SfxItemSet &rSet )
break;
case FN_INSERT_REGION:
- if( rSh.IsSelFrmMode() ||
- !rSh.IsInsRegionAvailable() )
+ if( rSh.CrsrInsideInputFld()
+ || rSh.IsSelFrmMode()
+ || !rSh.IsInsRegionAvailable() )
+ {
rSet.DisableItem( nWhich );
+ }
break;
+
case FN_CONVERT_TABLE_TO_TEXT:
{
sal_uInt16 eFrmType = rSh.GetFrmType(0,sal_True);
@@ -2023,7 +2037,7 @@ void SwBaseShell::ExecTxtCtrl( SfxRequest& rReq )
if (!bAuto)
{
- rSh.SetAttr( *pArgs );
+ rSh.SetAttrSet( *pArgs );
}
}
delete pSSetItem;
@@ -2268,7 +2282,7 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq)
rSh.AutoUpdatePara( pColl, aSet);
}
else
- rSh.SetAttr( aBrushItem );
+ rSh.SetAttrItem( aBrushItem );
}
rReq.Done();
@@ -2414,7 +2428,7 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq)
OSL_ENSURE(pDlg, "Dialogdiet fail!");
if ( pDlg->Execute() == RET_OK )
{
- rSh.SetAttr( *pDlg->GetOutputItemSet() );
+ rSh.SetAttrSet( *pDlg->GetOutputItemSet() );
pOutSet = pDlg->GetOutputItemSet();
}
}
@@ -2688,7 +2702,7 @@ void SwBaseShell::ExecuteGallery(SfxRequest &rReq)
SvxBrushItem aBrush( *pBrush );
aBrush.SetWhich( RES_BACKGROUND );
if ( nPos == nParagraphPos )
- rSh.SetAttr( aBrush );
+ rSh.SetAttrItem( aBrush );
else if ( nPos == nTablePos )
rSh.SetTabBackground( aBrush );
else if ( nPos == nTableRowPos )
diff --git a/sw/source/ui/shells/drwtxtex.cxx b/sw/source/ui/shells/drwtxtex.cxx
index 1d2a9828b984..56f4184df969 100644
--- a/sw/source/ui/shells/drwtxtex.cxx
+++ b/sw/source/ui/shells/drwtxtex.cxx
@@ -937,7 +937,7 @@ void SwDrawTextShell::StateClpbrd(SfxItemSet &rSet)
OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
ESelection aSel(pOLV->GetSelection());
const bool bCopy = (aSel.nStartPara != aSel.nEndPara) ||
- (aSel.nStartPos != aSel.nEndPos);
+ (aSel.nStartPos != aSel.nEndPos);
SfxWhichIter aIter(rSet);
@@ -947,32 +947,31 @@ void SwDrawTextShell::StateClpbrd(SfxItemSet &rSet)
{
switch(nWhich)
{
- case SID_CUT:
- case SID_COPY:
- if( !bCopy )
- rSet.DisableItem( nWhich );
- break;
+ case SID_CUT:
+ case SID_COPY:
+ if( !bCopy )
+ rSet.DisableItem( nWhich );
+ break;
- case SID_PASTE:
- {
- TransferableDataHelper aDataHelper(
- TransferableDataHelper::CreateFromSystemClipboard(
- &GetView().GetEditWin() ) );
+ case SID_PASTE:
+ {
+ TransferableDataHelper aDataHelper(
+ TransferableDataHelper::CreateFromSystemClipboard( &GetView().GetEditWin() ) );
- if( !aDataHelper.GetXTransferable().is() ||
- !SwTransferable::IsPaste( GetShell(), aDataHelper ))
- rSet.DisableItem( SID_PASTE );
+ if( !aDataHelper.GetXTransferable().is()
+ || !SwTransferable::IsPaste( GetShell(), aDataHelper ) )
+ {
+ rSet.DisableItem( nWhich );
}
- break;
+ }
+ break;
- case SID_PASTE_SPECIAL:
- rSet.DisableItem( SID_PASTE_SPECIAL );
- break;
- // #151110#
- case SID_CLIPBOARD_FORMAT_ITEMS:
- rSet.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS );
- break;
+ case SID_PASTE_SPECIAL:
+ case SID_CLIPBOARD_FORMAT_ITEMS:
+ rSet.DisableItem( nWhich );
+ break;
}
+
nWhich = aIter.NextWhich();
}
}
diff --git a/sw/source/ui/shells/frmsh.cxx b/sw/source/ui/shells/frmsh.cxx
index 299d3fc43983..8ffa207c3a74 100644
--- a/sw/source/ui/shells/frmsh.cxx
+++ b/sw/source/ui/shells/frmsh.cxx
@@ -1172,9 +1172,15 @@ void SwFrameShell::GetLineStyleState(SfxItemSet &rSet)
void SwFrameShell::StateInsert(SfxItemSet &rSet)
{
const int nSel = GetShell().GetSelectionType();
-
- if ((nSel & nsSelectionType::SEL_GRF) || (nSel & nsSelectionType::SEL_OLE))
+ if ( (nSel & nsSelectionType::SEL_GRF)
+ || (nSel & nsSelectionType::SEL_OLE) )
+ {
+ rSet.DisableItem(FN_INSERT_FRAME);
+ }
+ else if ( GetShell().CrsrInsideInputFld() )
+ {
rSet.DisableItem(FN_INSERT_FRAME);
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/grfsh.cxx b/sw/source/ui/shells/grfsh.cxx
index 949c7e639701..00e49bf7ac27 100644
--- a/sw/source/ui/shells/grfsh.cxx
+++ b/sw/source/ui/shells/grfsh.cxx
@@ -163,7 +163,7 @@ void SwGrfShell::Execute(SfxRequest &rReq)
Graphic aCompressedGraphic( aDialog.GetCompressedGraphic() );
rSh.ReRead(aEmptyOUStr, aEmptyOUStr, (const Graphic*) &aCompressedGraphic);
- rSh.SetAttr(aCrop);
+ rSh.SetAttrItem(aCrop);
rSh.EndUndo(UNDO_END);
rSh.EndAllAction();
@@ -417,7 +417,7 @@ void SwGrfShell::Execute(SfxRequest &rReq)
RES_GRFATR_END-1 );
aGrfSet.Put( *pSet );
if( aGrfSet.Count() )
- rSh.SetAttr( aGrfSet );
+ rSh.SetAttrSet( aGrfSet );
rSh.EndUndo(UNDO_END);
rSh.EndAllAction();
@@ -432,7 +432,7 @@ void SwGrfShell::Execute(SfxRequest &rReq)
rSh.GetCurAttr( aSet );
SwMirrorGrf aGrf((const SwMirrorGrf &)aSet.Get(RES_GRFATR_MIRRORGRF));
aGrf.SetGrfToggle(!aGrf.IsGrfToggle());
- rSh.SetAttr(aGrf);
+ rSh.SetAttrItem(aGrf);
}
break;
@@ -590,7 +590,7 @@ void SwGrfShell::ExecAttr( SfxRequest &rReq )
}
if( aGrfSet.Count() )
- GetShell().SetAttr( aGrfSet );
+ GetShell().SetAttrSet( aGrfSet );
}
GetView().GetViewFrame()->GetBindings().Invalidate(rReq.GetSlot());
}
@@ -617,6 +617,11 @@ void SwGrfShell::GetAttrState(SfxItemSet &rSet)
case SID_TWAIN_TRANSFER:
if( bParentCntProt || !bIsGrfCntnt )
bDisable = true;
+ else if ( nWhich == SID_INSERT_GRAPHIC
+ && rSh.CrsrInsideInputFld() )
+ {
+ bDisable = true;
+ }
break;
case SID_SAVE_GRAPHIC:
@@ -822,7 +827,7 @@ void SwGrfShell::ExecuteRotation(SfxRequest &rReq)
aCrop.SetBottom( aCropRectangle.Right() );
}
- rShell.SetAttr(aCrop);
+ rShell.SetAttrItem(aCrop);
rShell.EndUndo(UNDO_END);
rShell.EndAllAction();
diff --git a/sw/source/ui/shells/langhelper.cxx b/sw/source/ui/shells/langhelper.cxx
index 85e30b529e30..d3055a297f95 100644
--- a/sw/source/ui/shells/langhelper.cxx
+++ b/sw/source/ui/shells/langhelper.cxx
@@ -274,7 +274,7 @@ namespace SwLangHelper
{
rWrtSh.GetCurAttr( rCoreSet );
rCoreSet.Put( SvxLanguageItem( nLang, nLangWhichId ));
- rWrtSh.SetAttr( rCoreSet );
+ rWrtSh.SetAttrSet( rCoreSet );
}
}
else // change language for all text
@@ -308,7 +308,7 @@ namespace SwLangHelper
// #i102191: hard set respective language attribute in text document
// (for all text in the document - which should be selected by now...)
- rWrtSh.SetAttr( SvxLanguageItem( nLang, nLangWhichId ) );
+ rWrtSh.SetAttrItem( SvxLanguageItem( nLang, nLangWhichId ) );
}
}
}
@@ -356,7 +356,7 @@ namespace SwLangHelper
rWrtSh.GetCurAttr( rCoreSet );
for (sal_uInt16 i = 0; i < 3; ++i)
rCoreSet.Put( SvxLanguageItem( LANGUAGE_NONE, aLangWhichId_Writer[i] ));
- rWrtSh.SetAttr( rCoreSet );
+ rWrtSh.SetAttrSet( rCoreSet );
}
}
else // change language for all text
diff --git a/sw/source/ui/shells/listsh.cxx b/sw/source/ui/shells/listsh.cxx
index ddbc1b371dd7..dd21ec6b1b4f 100644
--- a/sw/source/ui/shells/listsh.cxx
+++ b/sw/source/ui/shells/listsh.cxx
@@ -259,6 +259,13 @@ void SwListShell::GetState(SfxItemSet &rSet)
if(nCurrentNumLevel == (MAXLEVEL - 1))
rSet.DisableItem(nWhich);
break;
+
+ case FN_NUM_BULLET_NONUM:
+ if ( rSh.CrsrInsideInputFld() )
+ {
+ rSet.DisableItem(nWhich);
+ }
+ break;
}
nWhich = aIter.NextWhich();
}
diff --git a/sw/source/ui/shells/tabsh.cxx b/sw/source/ui/shells/tabsh.cxx
index 81dd8c334590..17d7a315c4c4 100644
--- a/sw/source/ui/shells/tabsh.cxx
+++ b/sw/source/ui/shells/tabsh.cxx
@@ -1205,8 +1205,10 @@ void SwTableShell::GetState(SfxItemSet &rSet)
break;
case FN_INSERT_TABLE:
- // Put any value, so that the controller remains enabled.
- // Instead "Insert:Table" appears "Format:Table".
+ if ( rSh.CrsrInsideInputFld() )
+ {
+ rSet.DisableItem( nSlot );
+ }
break;
case FN_TABLE_OPTIMAL_HEIGHT:
diff --git a/sw/source/ui/shells/textfld.cxx b/sw/source/ui/shells/textfld.cxx
index 5e562ed73dd0..a7050c4d1fdc 100644
--- a/sw/source/ui/shells/textfld.cxx
+++ b/sw/source/ui/shells/textfld.cxx
@@ -41,6 +41,7 @@
#include <fldwrap.hxx>
#include <redline.hxx>
#include <view.hxx>
+#include <viewopt.hxx>
#include <wrtsh.hxx>
#include <basesh.hxx>
#include <flddat.hxx>
@@ -164,11 +165,26 @@ void SwTextShell::ExecField(SfxRequest &rReq)
{
sal_Bool bRet = sal_False;
SwFieldType* pFld = rSh.GetFldType( 0, RES_INPUTFLD );
- if( pFld && rSh.MoveFldType( pFld,
- FN_GOTO_NEXT_INPUTFLD == nSlot ))
+ const bool bAddSetExpressionFlds = !( rSh.GetViewOptions()->IsReadonly() );
+ if ( pFld != NULL
+ && rSh.MoveFldType(
+ pFld,
+ FN_GOTO_NEXT_INPUTFLD == nSlot,
+ USHRT_MAX,
+ bAddSetExpressionFlds ) )
{
rSh.ClearMark();
- rSh.StartInputFldDlg( rSh.GetCurFld(), sal_False );
+ if ( dynamic_cast<SwInputField*>(rSh.GetCurFld( true )) != NULL )
+ {
+ rSh.SttSelect();
+ rSh.SelectTxt(
+ rSh.StartOfInputFldAtPos( *(rSh.GetCrsr()->Start()) ) + 1,
+ rSh.EndOfInputFldAtPos( *(rSh.GetCrsr()->Start()) ) - 1 );
+ }
+ else
+ {
+ rSh.StartInputFldDlg( rSh.GetCurFld( true ), sal_False );
+ }
bRet = sal_True;
}
@@ -332,7 +348,7 @@ void SwTextShell::ExecField(SfxRequest &rReq)
break;
case FN_POSTIT:
{
- SwPostItField* pPostIt = (SwPostItField*)aFldMgr.GetCurFld();
+ SwPostItField* pPostIt = dynamic_cast<SwPostItField*>(aFldMgr.GetCurFld());
bool bNew = !(pPostIt && pPostIt->GetTyp()->Which() == RES_POSTITFLD);
if (bNew || GetView().GetPostItMgr()->IsAnswer())
{
@@ -610,26 +626,26 @@ void SwTextShell::StateField( SfxItemSet &rSet )
{
switch (nWhich)
{
- case FN_DELETE_COMMENT:
- case FN_DELETE_NOTE_AUTHOR:
- case FN_DELETE_ALL_NOTES:
- case FN_HIDE_NOTE:
- case FN_HIDE_NOTE_AUTHOR:
- case FN_HIDE_ALL_NOTES:
+ case FN_DELETE_COMMENT:
+ case FN_DELETE_NOTE_AUTHOR:
+ case FN_DELETE_ALL_NOTES:
+ case FN_HIDE_NOTE:
+ case FN_HIDE_NOTE_AUTHOR:
+ case FN_HIDE_ALL_NOTES:
+ {
+ SwPostItMgr* pPostItMgr = GetView().GetPostItMgr();
+ if ( !pPostItMgr )
+ rSet.InvalidateItem( nWhich );
+ else if ( !pPostItMgr->HasActiveSidebarWin() )
{
- SwPostItMgr* pPostItMgr = GetView().GetPostItMgr();
- if ( !pPostItMgr )
- rSet.InvalidateItem( nWhich );
- else if ( !pPostItMgr->HasActiveSidebarWin() )
- {
- rSet.InvalidateItem( FN_DELETE_COMMENT );
- rSet.InvalidateItem( FN_HIDE_NOTE );
- }
+ rSet.InvalidateItem( FN_DELETE_COMMENT );
+ rSet.InvalidateItem( FN_HIDE_NOTE );
}
+ }
break;
- case FN_EDIT_FIELD:
- {
+ case FN_EDIT_FIELD:
+ {
if( !bGetField )
{
pField = rSh.GetCurFld();
@@ -643,14 +659,15 @@ void SwTextShell::StateField( SfxItemSet &rSet )
RES_AUTHORITY == nTempWhich )
rSet.DisableItem( nWhich );
else if( RES_DDEFLD == nTempWhich &&
- !((SwDDEFieldType*)pField->GetTyp())->GetBaseLink().IsVisible())
+ !((SwDDEFieldType*)pField->GetTyp())->GetBaseLink().IsVisible())
{
// nested links cannot be edited
rSet.DisableItem( nWhich );
}
}
break;
- case FN_EXECUTE_MACROFIELD:
+
+ case FN_EXECUTE_MACROFIELD:
{
if(!bGetField)
{
@@ -662,43 +679,88 @@ void SwTextShell::StateField( SfxItemSet &rSet )
}
break;
- case FN_INSERT_FIELD:
+ case FN_INSERT_FIELD:
{
- SfxViewFrame* pVFrame = GetView().GetViewFrame();
- //#i5788# prevent closing of the field dialog while a modal dialog ( Input field dialog ) is active
- if(!pVFrame->IsInModalMode() &&
- pVFrame->KnowsChildWindow(FN_INSERT_FIELD) && !pVFrame->HasChildWindow(FN_INSERT_FIELD_DATA_ONLY) )
- rSet.Put(SfxBoolItem( FN_INSERT_FIELD, pVFrame->HasChildWindow(nWhich)));
+ if ( rSh.CrsrInsideInputFld() )
+ {
+ rSet.DisableItem(nWhich);
+ }
else
- rSet.DisableItem(FN_INSERT_FIELD);
+ {
+ SfxViewFrame* pVFrame = GetView().GetViewFrame();
+ //#i5788# prevent closing of the field dialog while a modal dialog ( Input field dialog ) is active
+ if(!pVFrame->IsInModalMode() &&
+ pVFrame->KnowsChildWindow(FN_INSERT_FIELD) && !pVFrame->HasChildWindow(FN_INSERT_FIELD_DATA_ONLY) )
+ rSet.Put(SfxBoolItem( FN_INSERT_FIELD, pVFrame->HasChildWindow(nWhich)));
+ else
+ rSet.DisableItem(FN_INSERT_FIELD);
+ }
}
break;
- case FN_INSERT_REF_FIELD:
+
+ case FN_INSERT_REF_FIELD:
{
SfxViewFrame* pVFrame = GetView().GetViewFrame();
- if (!pVFrame->KnowsChildWindow(FN_INSERT_FIELD))
+ if ( !pVFrame->KnowsChildWindow(FN_INSERT_FIELD)
+ || rSh.CrsrInsideInputFld() )
+ {
rSet.DisableItem(FN_INSERT_REF_FIELD);
+ }
}
break;
- case FN_INSERT_FIELD_CTRL:
- rSet.Put(SfxBoolItem( nWhich, GetView().GetViewFrame()->HasChildWindow(FN_INSERT_FIELD)));
- break;
- case FN_REDLINE_COMMENT:
- if (!rSh.GetCurrRedline())
+
+ case FN_INSERT_FIELD_CTRL:
+ if ( rSh.CrsrInsideInputFld() )
+ {
rSet.DisableItem(nWhich);
- break;
- case FN_POSTIT :
- case FN_JAVAEDIT :
- bool bCurField = false;
+ }
+ else
+ {
+ rSet.Put(SfxBoolItem( nWhich, GetView().GetViewFrame()->HasChildWindow(FN_INSERT_FIELD)));
+ }
+ break;
+
+ case FN_REDLINE_COMMENT:
+ if (!rSh.GetCurrRedline())
+ rSet.DisableItem(nWhich);
+ break;
+
+ case FN_POSTIT :
+ case FN_JAVAEDIT :
+ {
+ sal_Bool bCurField = sal_False;
pField = rSh.GetCurFld();
if(nWhich == FN_POSTIT)
bCurField = pField && pField->GetTyp()->Which() == RES_POSTITFLD;
else
bCurField = pField && pField->GetTyp()->Which() == RES_SCRIPTFLD;
- if(!bCurField && rSh.IsReadOnlyAvailable() && rSh.HasReadonlySel() )
+ if( !bCurField && rSh.IsReadOnlyAvailable() && rSh.HasReadonlySel() )
+ {
rSet.DisableItem(nWhich);
+ }
+ else if ( rSh.CrsrInsideInputFld() )
+ {
+ rSet.DisableItem(nWhich);
+ }
+ }
+
break;
+
+ case FN_INSERT_FLD_AUTHOR:
+ case FN_INSERT_FLD_DATE:
+ case FN_INSERT_FLD_PGCOUNT:
+ case FN_INSERT_FLD_PGNUMBER:
+ case FN_INSERT_FLD_TIME:
+ case FN_INSERT_FLD_TITLE:
+ case FN_INSERT_FLD_TOPIC:
+ case FN_INSERT_DBFIELD:
+ if ( rSh.CrsrInsideInputFld() )
+ {
+ rSet.DisableItem(nWhich);
+ }
+ break;
+
}
nWhich = aIter.NextWhich();
}
diff --git a/sw/source/ui/shells/textidx.cxx b/sw/source/ui/shells/textidx.cxx
index 054bbcfe61b4..46531183d2ea 100644
--- a/sw/source/ui/shells/textidx.cxx
+++ b/sw/source/ui/shells/textidx.cxx
@@ -199,6 +199,15 @@ void SwTextShell::GetIdxState(SfxItemSet &rSet)
rSet.Put(SfxBoolItem(FN_INSERT_AUTH_ENTRY_DLG, sal_True));
}
+ else if ( rSh.CrsrInsideInputFld() )
+ {
+ rSet.DisableItem( FN_INSERT_IDX_ENTRY_DLG );
+ rSet.DisableItem( FN_INSERT_AUTH_ENTRY_DLG );
+ rSet.DisableItem( FN_EDIT_AUTH_ENTRY_DLG );
+ rSet.DisableItem( FN_EDIT_IDX_ENTRY_DLG );
+ rSet.DisableItem( FN_INSERT_MULTI_TOX );
+ rSet.DisableItem( FN_REMOVE_CUR_TOX );
+ }
else
{
diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx
index 65b6b222d516..efc5ae3a32b8 100644
--- a/sw/source/ui/shells/textsh.cxx
+++ b/sw/source/ui/shells/textsh.cxx
@@ -144,7 +144,8 @@ void SwTextShell::ExecInsert(SfxRequest &rReq)
case FN_INSERT_STRING:
if( pItem )
rSh.InsertByWord(((const SfxStringItem *)pItem)->GetValue());
- break;
+ break;
+
case FN_INSERT_SOFT_HYPHEN:
if( CHAR_SOFTHYPHEN != rSh.SwCrsrShell::GetChar( sal_True, 0 ) &&
CHAR_SOFTHYPHEN != rSh.SwCrsrShell::GetChar( sal_True, -1 ))
@@ -154,20 +155,23 @@ void SwTextShell::ExecInsert(SfxRequest &rReq)
case FN_INSERT_HARDHYPHEN:
case FN_INSERT_HARD_SPACE:
{
- sal_Unicode cIns = FN_INSERT_HARD_SPACE == nSlot ? CHAR_HARDBLANK
- : CHAR_HARDHYPHEN;
+ const sal_Unicode cIns = FN_INSERT_HARD_SPACE == nSlot ? CHAR_HARDBLANK : CHAR_HARDHYPHEN;
SvxAutoCorrCfg& rACfg = SvxAutoCorrCfg::Get();
SvxAutoCorrect* pACorr = rACfg.GetAutoCorrect();
- if( pACorr && rACfg.IsAutoFmtByInput() &&
- pACorr->IsAutoCorrFlag( CptlSttSntnc | CptlSttWrd |
- AddNonBrkSpace | ChgOrdinalNumber |
- ChgToEnEmDash | SetINetAttr | Autocorrect ))
+ if( pACorr && rACfg.IsAutoFmtByInput()
+ && pACorr->IsAutoCorrFlag(
+ CptlSttSntnc | CptlSttWrd | AddNonBrkSpace | ChgOrdinalNumber | ChgToEnEmDash | SetINetAttr | Autocorrect ) )
+ {
rSh.AutoCorrect( *pACorr, cIns );
+ }
else
+ {
rSh.Insert( OUString( cIns ) );
+ }
}
break;
+
case SID_INSERT_RLM :
case SID_INSERT_LRM :
case SID_INSERT_ZWNBSP :
@@ -184,30 +188,46 @@ void SwTextShell::ExecInsert(SfxRequest &rReq)
rSh.Insert( OUString( cIns ) );
}
break;
+
case FN_INSERT_BREAK:
- rSh.SplitNode();
+ {
+ if( !rSh.CrsrInsideInputFld() )
+ {
+ rSh.SplitNode();
+ }
+ else
+ {
+ rSh.InsertLineBreak();
+ }
+ }
rReq.Done();
- break;
+ break;
+
case FN_INSERT_PAGEBREAK:
rSh.InsertPageBreak();
rReq.Done();
- break;
+ break;
+
case FN_INSERT_LINEBREAK:
rSh.InsertLineBreak();
rReq.Done();
- break;
+ break;
+
case FN_INSERT_COLUMN_BREAK:
rSh.InsertColumnBreak();
rReq.Done();
- break;
+ break;
+
case SID_HYPERLINK_SETLINK:
if (pItem)
InsertHyperlink(*((const SvxHyperlinkItem *)pItem));
rReq.Done();
break;
+
case SID_INSERT_AVMEDIA:
rReq.SetReturnValue(SfxBoolItem(nSlot, InsertMediaDlg( rReq )));
break;
+
case SID_INSERT_SOUND:
case SID_INSERT_VIDEO:
{
@@ -247,6 +267,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq)
}
}
break;
+
case SID_INSERT_OBJECT:
case SID_INSERT_PLUGIN:
{
@@ -666,37 +687,39 @@ void SwTextShell::StateInsert( SfxItemSet &rSet )
rSh.Push();
const sal_Bool bCrsrInHidden = rSh.SelectHiddenRange();
- // #i103839#
- // Do not call method <SwCrsrShell::Pop(..)> with 1st parameter = <sal_False>
- // in order to avoid that the view jumps to the visible cursor.
rSh.Pop();
while ( nWhich )
{
switch ( nWhich )
{
- case SID_INSERT_SOUND:
- case SID_INSERT_VIDEO:
- /*!SvxPluginFileDlg::IsAvailable( nWhich ) ||
-
- discussed with mba: for performance reasons we skip the IsAvailable call here
- */
- if ( GetShell().IsSelFrmMode() ||
- SFX_CREATE_MODE_EMBEDDED == eCreateMode || bCrsrInHidden )
- {
- rSet.DisableItem( nWhich );
- }
- break;
+ case SID_INSERT_AVMEDIA:
+ case SID_INSERT_SOUND:
+ case SID_INSERT_VIDEO:
+ if ( GetShell().IsSelFrmMode()
+ || GetShell().CrsrInsideInputFld()
+ || SFX_CREATE_MODE_EMBEDDED == eCreateMode
+ || bCrsrInHidden )
+ {
+ rSet.DisableItem( nWhich );
+ }
+ break;
- case SID_INSERT_DIAGRAM:
- if( !aMOpt.IsChart() || eCreateMode == SFX_CREATE_MODE_EMBEDDED || bCrsrInHidden )
- {
- rSet.DisableItem( nWhich );
- }
- break;
+ case SID_INSERT_DIAGRAM:
+ if( !aMOpt.IsChart()
+ || GetShell().CrsrInsideInputFld()
+ || eCreateMode == SFX_CREATE_MODE_EMBEDDED
+ || bCrsrInHidden )
+ {
+ rSet.DisableItem( nWhich );
+ }
+ break;
case FN_INSERT_SMA:
- if( !aMOpt.IsMath() || eCreateMode == SFX_CREATE_MODE_EMBEDDED || bCrsrInHidden )
+ if( !aMOpt.IsMath()
+ || eCreateMode == SFX_CREATE_MODE_EMBEDDED
+ || bCrsrInHidden
+ || rSh.CrsrInsideInputFld() )
{
rSet.DisableItem( nWhich );
}
@@ -705,29 +728,36 @@ void SwTextShell::StateInsert( SfxItemSet &rSet )
case SID_INSERT_FLOATINGFRAME:
case SID_INSERT_OBJECT:
case SID_INSERT_PLUGIN:
- {
- if( eCreateMode == SFX_CREATE_MODE_EMBEDDED || bCrsrInHidden )
{
- rSet.DisableItem( nWhich );
+ if( eCreateMode == SFX_CREATE_MODE_EMBEDDED || bCrsrInHidden )
+ {
+ rSet.DisableItem( nWhich );
+ }
+ else if( GetShell().IsSelFrmMode()
+ || GetShell().CrsrInsideInputFld() )
+ {
+ rSet.DisableItem( nWhich );
+ }
+ else if(SID_INSERT_FLOATINGFRAME == nWhich && nHtmlMode&HTMLMODE_ON)
+ {
+ SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
+ sal_uInt16 nExport = rHtmlOpt.GetExportMode();
+ if(HTML_CFG_MSIE != nExport && HTML_CFG_WRITER != nExport )
+ rSet.DisableItem(nWhich);
+ }
}
- else if( GetShell().IsSelFrmMode())
- rSet.DisableItem( nWhich );
- else if(SID_INSERT_FLOATINGFRAME == nWhich && nHtmlMode&HTMLMODE_ON)
+ break;
+
+ case FN_INSERT_FRAME_INTERACT_NOCOL :
+ case FN_INSERT_FRAME_INTERACT:
{
- SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
- sal_uInt16 nExport = rHtmlOpt.GetExportMode();
- if(HTML_CFG_MSIE != nExport && HTML_CFG_WRITER != nExport )
+ if( GetShell().IsSelFrmMode()
+ || GetShell().CrsrInsideInputFld()
+ || bCrsrInHidden )
rSet.DisableItem(nWhich);
}
- }
- break;
- case FN_INSERT_FRAME_INTERACT_NOCOL :
- case FN_INSERT_FRAME_INTERACT:
- {
- if ( GetShell().IsSelFrmMode() || bCrsrInHidden )
- rSet.DisableItem(nWhich);
- }
- break;
+ break;
+
case SID_HYPERLINK_GETLINK:
{
SfxItemSet aSet(GetPool(), RES_TXTATR_INETFMT, RES_TXTATR_INETFMT);
@@ -773,20 +803,25 @@ void SwTextShell::StateInsert( SfxItemSet &rSet )
aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() |
((nHtmlMode & HTMLMODE_ON) != 0 ? HLINK_HTMLMODE : 0)));
aHLinkItem.SetMacroEvents ( HYPERDLG_EVENT_MOUSEOVER_OBJECT|
- HYPERDLG_EVENT_MOUSECLICK_OBJECT | HYPERDLG_EVENT_MOUSEOUT_OBJECT );
+ HYPERDLG_EVENT_MOUSECLICK_OBJECT | HYPERDLG_EVENT_MOUSEOUT_OBJECT );
rSet.Put(aHLinkItem);
}
break;
case FN_INSERT_FRAME:
- if(rSh.IsSelFrmMode())
+ if (rSh.IsSelFrmMode() )
{
const int nSel = rSh.GetSelectionType();
if( ((nsSelectionType::SEL_GRF | nsSelectionType::SEL_OLE ) & nSel ) || bCrsrInHidden )
rSet.DisableItem(nWhich);
}
- break;
+ else if ( rSh.CrsrInsideInputFld() )
+ {
+ rSet.DisableItem(nWhich);
+ }
+ break;
+
case FN_FORMAT_COLUMN :
{
//#i80458# column dialog cannot work if the selection contains different page styles and different sections
@@ -1064,7 +1099,7 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq )
rSh.SetMark();
rSh.ExtendSelection( sal_False, aChars.getLength() );
- rSh.SetAttr( aSet, nsSetAttrMode::SETATTR_DONTEXPAND | nsSetAttrMode::SETATTR_NOFORMATATTR );
+ rSh.SetAttrSet( aSet, nsSetAttrMode::SETATTR_DONTEXPAND | nsSetAttrMode::SETATTR_NOFORMATATTR );
if( !rSh.IsCrsrPtAtEnd() )
rSh.SwapPam();
@@ -1074,7 +1109,7 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq )
// SETATTR_DONTEXPAND does not work if there are already hard attributes.
// Therefore we have to restore the font attributes.
rSh.SetMark();
- rSh.SetAttr( aRestoreSet );
+ rSh.SetAttrSet( aRestoreSet );
rSh.ClearMark();
rSh.UpdateAttr();
diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx
index c8e3c94ab190..547657534fcb 100644
--- a/sw/source/ui/shells/textsh1.cxx
+++ b/sw/source/ui/shells/textsh1.cxx
@@ -228,7 +228,7 @@ void sw_CharDialog( SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot,const
rWrtSh.AutoUpdatePara(pColl, aTmpSet);
}
else
- rWrtSh.SetAttr( aTmpSet );
+ rWrtSh.SetAttrSet( aTmpSet );
if (pReq)
pReq->Done(aTmpSet);
if(bInsert)
@@ -433,7 +433,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
SvxFontItem &rFont = (SvxFontItem &) aSet.Get( RES_CHRATR_FONT );
SvxFontItem aFont( rFont.GetFamily(), pFont->GetValue(),
rFont.GetStyleName(), rFont.GetPitch(), RTL_TEXTENCODING_DONTKNOW, RES_CHRATR_FONT );
- rWrtSh.SetAttr( aSet, nsSetAttrMode::SETATTR_DONTEXPAND );
+ rWrtSh.SetAttrSet( aSet, nsSetAttrMode::SETATTR_DONTEXPAND );
rWrtSh.ResetSelect(0, sal_False);
rWrtSh.EndSelect();
rWrtSh.GotoFtnTxt();
@@ -1027,7 +1027,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
if ( !((SfxStringItem*)pItem)->GetValue().isEmpty() )
rWrtSh.ReplaceDropTxt(((SfxStringItem*)pItem)->GetValue(), pPaM);
}
- rWrtSh.SetAttr( *pSet, 0, pPaM );
+ rWrtSh.SetAttrSet( *pSet, 0, pPaM );
rWrtSh.EndAction();
SwTxtFmtColl* pColl = rWrtSh.GetPaMTxtFmtColl( pPaM );
if(pColl && pColl->IsAutoUpdateFmt())
@@ -1125,7 +1125,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
// otherwise, it'll be the color for the next text to be typed
if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_EXT)
{
- rWrtSh.SetAttr(SvxColorItem (aSet, RES_CHRATR_COLOR));
+ rWrtSh.SetAttrItem(SvxColorItem (aSet, RES_CHRATR_COLOR));
}
rReq.Done();
@@ -1152,7 +1152,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
aBrushItem.SetColor(aSet); //set the selected color
else
aBrushItem.SetColor(Color(COL_TRANSPARENT));//set "no fill" color
- rWrtSh.SetAttr( aBrushItem );
+ rWrtSh.SetAttrItem( aBrushItem );
}
else if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_BACKGROUND_EXT)
{
@@ -1175,12 +1175,12 @@ void SwTextShell::Execute(SfxRequest &rReq)
if(nSlot == SID_ATTR_CHAR_COLOR_BACKGROUND_EXT)
{
- rWrtSh.SetAttr( SvxBrushItem(
- rEdtWin.GetTextBackColor(), RES_CHRATR_BACKGROUND) );
+ rWrtSh.SetAttrItem(
+ SvxBrushItem( rEdtWin.GetTextBackColor(), RES_CHRATR_BACKGROUND) );
}
else
- rWrtSh.SetAttr( SvxColorItem( rEdtWin.GetTextColor(),
- RES_CHRATR_COLOR) );
+ rWrtSh.SetAttrItem(
+ SvxColorItem( rEdtWin.GetTextColor(), RES_CHRATR_COLOR) );
}
else
{
@@ -1406,6 +1406,7 @@ void SwTextShell::GetState( SfxItemSet &rSet )
rSet.Put(SfxBoolItem(FN_NUMBER_NEWSTART,
rSh.IsNumRuleStart()));
break;
+
case FN_EDIT_FORMULA:
case SID_CHARMAP:
{
@@ -1413,7 +1414,14 @@ void SwTextShell::GetState( SfxItemSet &rSet )
if (!(nType & nsSelectionType::SEL_TXT) &&
!(nType & nsSelectionType::SEL_TBL) &&
!(nType & nsSelectionType::SEL_NUM))
+ {
rSet.DisableItem(nWhich);
+ }
+ else if ( nWhich == FN_EDIT_FORMULA
+ && rSh.CrsrInsideInputFld() )
+ {
+ rSet.DisableItem( nWhich );
+ }
}
break;
@@ -1421,16 +1429,35 @@ void SwTextShell::GetState( SfxItemSet &rSet )
case FN_INSERT_FOOTNOTE:
case FN_INSERT_FOOTNOTE_DLG:
{
- const sal_uInt16 nNoType = FRMTYPE_FLY_ANY | FRMTYPE_HEADER |
- FRMTYPE_FOOTER | FRMTYPE_FOOTNOTE;
+ const sal_uInt16 nNoType =
+ FRMTYPE_FLY_ANY | FRMTYPE_HEADER | FRMTYPE_FOOTER | FRMTYPE_FOOTNOTE;
if ( (rSh.GetFrmType(0,sal_True) & nNoType) )
rSet.DisableItem(nWhich);
+
+ if ( rSh.CrsrInsideInputFld() )
+ {
+ rSet.DisableItem( nWhich );
+ }
+ }
+ break;
+
+ case FN_INSERT_HYPERLINK:
+ case SID_INSERTDOC:
+ case FN_INSERT_GLOSSARY:
+ case FN_EXPAND_GLOSSARY:
+ if ( rSh.CrsrInsideInputFld() )
+ {
+ rSet.DisableItem( nWhich );
}
break;
+
case FN_INSERT_TABLE:
- if ( rSh.GetTableFmt() ||
- (rSh.GetFrmType(0,sal_True) & FRMTYPE_FOOTNOTE) )
+ if ( rSh.CrsrInsideInputFld()
+ || rSh.GetTableFmt()
+ || (rSh.GetFrmType(0,sal_True) & FRMTYPE_FOOTNOTE) )
+ {
rSet.DisableItem( nWhich );
+ }
break;
case FN_CALCULATE:
@@ -1494,9 +1521,22 @@ void SwTextShell::GetState( SfxItemSet &rSet )
rSet.Put(SfxBoolItem(nWhich, pApply && pApply->nColor == nWhich));
}
break;
+
case FN_INSERT_BOOKMARK:
- if( rSh.IsTableMode() )
+ if( rSh.IsTableMode()
+ || rSh.CrsrInsideInputFld() )
+ {
rSet.DisableItem( nWhich );
+ }
+ break;
+
+ case FN_INSERT_BREAK_DLG:
+ case FN_INSERT_COLUMN_BREAK:
+ case FN_INSERT_PAGEBREAK:
+ if( rSh.CrsrInsideInputFld() )
+ {
+ rSet.DisableItem( nWhich );
+ }
break;
case FN_INSERT_PAGEHEADER:
@@ -1511,40 +1551,47 @@ void SwTextShell::GetState( SfxItemSet &rSet )
(FN_TABLE_SORT_DIALOG == nWhich && !rSh.GetTableFmt()))
rSet.DisableItem( nWhich );
break;
+
case SID_RUBY_DIALOG:
- {
- SvtCJKOptions aCJKOptions;
- if(!aCJKOptions.IsRubyEnabled())
{
- GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
- rSet.DisableItem(nWhich);
+ SvtCJKOptions aCJKOptions;
+ if( !aCJKOptions.IsRubyEnabled()
+ || rSh.CrsrInsideInputFld() )
+ {
+ GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
+ rSet.DisableItem(nWhich);
+ }
+ else
+ GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
}
- else
- GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
break;
- }
- //no break!
+
case SID_HYPERLINK_DIALOG:
- if( GetView().GetDocShell()->IsReadOnly() ||
- (!GetView().GetViewFrame()->HasChildWindow(nWhich) &&
- rSh.HasReadonlySel()) )
+ if( GetView().GetDocShell()->IsReadOnly()
+ || ( !GetView().GetViewFrame()->HasChildWindow(nWhich)
+ && rSh.HasReadonlySel() )
+ || rSh.CrsrInsideInputFld() )
+ {
rSet.DisableItem(nWhich);
+ }
else
- rSet.Put(SfxBoolItem( nWhich, 0 != GetView().
- GetViewFrame()->GetChildWindow( nWhich ) ));
+ {
+ rSet.Put(SfxBoolItem( nWhich, 0 != GetView().GetViewFrame()->GetChildWindow( nWhich ) ));
+ }
break;
+
case FN_EDIT_HYPERLINK:
case FN_COPY_HYPERLINK_LOCATION:
- {
- SfxItemSet aSet(GetPool(),
- RES_TXTATR_INETFMT,
- RES_TXTATR_INETFMT);
- rSh.GetCurAttr(aSet);
- if(SFX_ITEM_SET > aSet.GetItemState( RES_TXTATR_INETFMT, sal_True ) || rSh.HasReadonlySel())
{
- rSet.DisableItem(nWhich);
+ SfxItemSet aSet(GetPool(),
+ RES_TXTATR_INETFMT,
+ RES_TXTATR_INETFMT);
+ rSh.GetCurAttr(aSet);
+ if(SFX_ITEM_SET > aSet.GetItemState( RES_TXTATR_INETFMT, sal_True ) || rSh.HasReadonlySel())
+ {
+ rSet.DisableItem(nWhich);
+ }
}
- }
break;
case FN_REMOVE_HYPERLINK:
{
@@ -1553,7 +1600,7 @@ void SwTextShell::GetState( SfxItemSet &rSet )
RES_TXTATR_INETFMT);
rSh.GetCurAttr(aSet);
- // If a hyperlink is selected, either alone or along with other text...
+ // If a hyperlink is selected, either alone or along with other text...
if( ((SFX_ITEM_DONTCARE & aSet.GetItemState( RES_TXTATR_INETFMT, sal_True )) == 0) || rSh.HasReadonlySel())
{
rSet.DisableItem(nWhich);
diff --git a/sw/source/ui/shells/txtattr.cxx b/sw/source/ui/shells/txtattr.cxx
index 347966092828..706df6231e60 100644
--- a/sw/source/ui/shells/txtattr.cxx
+++ b/sw/source/ui/shells/txtattr.cxx
@@ -124,7 +124,7 @@ void SwTextShell::ExecCharAttr(SfxRequest &rReq)
aEscape.GetEsc() = DFLT_ESC_AUTO_SUPER;
else if(eEscape == SVX_ESCAPEMENT_SUBSCRIPT)
aEscape.GetEsc() = DFLT_ESC_AUTO_SUB;
- rSh.SetAttr( aEscape );
+ rSh.SetAttrItem( aEscape );
rReq.AppendItem( aEscape );
rReq.Done();
}
@@ -153,7 +153,7 @@ void SwTextShell::ExecCharAttr(SfxRequest &rReq)
break;
}
SvxUnderlineItem aUnderline(eUnderline, RES_CHRATR_UNDERLINE );
- rSh.SetAttr( aUnderline );
+ rSh.SetAttrItem( aUnderline );
rReq.AppendItem( aUnderline );
rReq.Done();
}
@@ -209,7 +209,7 @@ void SwTextShell::ExecCharAttrArgs(SfxRequest &rReq)
if ( pColl )
pColl->SetFmtAttr( aINetFmt );
- else rWrtSh.SetAttr( aINetFmt );
+ else rWrtSh.SetAttrItem( aINetFmt );
rReq.Done();
}
break;
@@ -256,7 +256,7 @@ void SwTextShell::ExecCharAttrArgs(SfxRequest &rReq)
if( pColl )
pColl->SetFmtAttr( aAttrSet );
else
- rWrtSh.SetAttr( aAttrSet );
+ rWrtSh.SetAttrSet( aAttrSet );
}
rReq.Done();
}
@@ -405,7 +405,7 @@ SET_LINESPACE:
rWrtSh.AutoUpdatePara(pColl, aSet);
}
else
- rWrtSh.SetAttr( aSet );
+ rWrtSh.SetAttrSet( aSet );
rReq.Done();
}
@@ -432,14 +432,14 @@ void SwTextShell::ExecParaAttrArgs(SfxRequest &rReq)
pFmt = rSh.FindCharFmtByName( sCharStyleName );
aDropItem.SetCharFmt( pFmt );
aSet.Put(aDropItem);
- rSh.SetAttr(aSet);
+ rSh.SetAttrSet(aSet);
}
break;
case FN_FORMAT_DROPCAPS:
{
if(pItem)
{
- rSh.SetAttr(*pItem);
+ rSh.SetAttrItem(*pItem);
rReq.Done();
}
else
@@ -462,7 +462,7 @@ void SwTextShell::ExecParaAttrArgs(SfxRequest &rReq)
if ( !((SfxStringItem*)pItem)->GetValue().isEmpty() )
rSh.ReplaceDropTxt(((SfxStringItem*)pItem)->GetValue());
}
- rSh.SetAttr(*pDlg->GetOutputItemSet());
+ rSh.SetAttrSet(*pDlg->GetOutputItemSet());
rSh.StartUndo( UNDO_END );
rSh.EndAction();
rReq.Done(*pDlg->GetOutputItemSet());
@@ -474,7 +474,7 @@ void SwTextShell::ExecParaAttrArgs(SfxRequest &rReq)
case SID_ATTR_PARA_PAGEBREAK:
if(pItem)
{
- rSh.SetAttr( *pItem );
+ rSh.SetAttrItem( *pItem );
rReq.Done();
}
break;
@@ -487,7 +487,7 @@ void SwTextShell::ExecParaAttrArgs(SfxRequest &rReq)
SID_ATTR_PARA_MODEL, SID_ATTR_PARA_MODEL, 0);
aCoreSet.Put(*pItem);
SfxToSwPageDescAttr( rSh, aCoreSet);
- rSh.SetAttr(aCoreSet);
+ rSh.SetAttrSet(aCoreSet);
rReq.Done();
}
}
diff --git a/sw/source/ui/uiview/formatclipboard.cxx b/sw/source/ui/uiview/formatclipboard.cxx
index f44b634c48ef..108f9d32763c 100644
--- a/sw/source/ui/uiview/formatclipboard.cxx
+++ b/sw/source/ui/uiview/formatclipboard.cxx
@@ -493,7 +493,7 @@ void SwFormatClipboard::Paste( SwWrtShell& rWrtShell, SfxStyleSheetBasePool* pPo
lcl_AppendSetItems( aItemVector, aFmt.GetCharFmt()->GetAttrSet());
// apply the named format
- rWrtShell.SetAttr( aFmt );
+ rWrtShell.SetAttrItem( aFmt );
}
}
@@ -529,7 +529,7 @@ void SwFormatClipboard::Paste( SwWrtShell& rWrtShell, SfxStyleSheetBasePool* pPo
lcl_RemoveEqualItems( *pTemplateItemSet, aItemVector );
// apply the paragraph automatic attributes to all the nodes in the selection
- rWrtShell.SetAttr(*pTemplateItemSet);
+ rWrtShell.SetAttrSet(*pTemplateItemSet);
// store the attributes in aItemVector in order not to apply them as
// text automatic formating attributes later in the code
@@ -569,7 +569,7 @@ void SwFormatClipboard::Paste( SwWrtShell& rWrtShell, SfxStyleSheetBasePool* pPo
if( nSelectionType & (nsSelectionType::SEL_FRM | nsSelectionType::SEL_OLE | nsSelectionType::SEL_GRF) )
rWrtShell.SetFlyFrmAttr(*pTemplateItemSet);
else if ( !bNoCharacterFormats )
- rWrtShell.SetAttr(*pTemplateItemSet);
+ rWrtShell.SetAttrSet(*pTemplateItemSet);
delete pTemplateItemSet;
}
diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx
index 388cf6af5487..3dfe8753412e 100644
--- a/sw/source/ui/uiview/view2.cxx
+++ b/sw/source/ui/uiview/view2.cxx
@@ -823,7 +823,7 @@ void SwView::Execute(SfxRequest &rReq)
case SID_ATTR_BORDER_OUTER:
case SID_ATTR_BORDER_SHADOW:
if(pArgs)
- m_pWrtShell->SetAttr(*pArgs);
+ m_pWrtShell->SetAttrSet(*pArgs);
break;
case SID_ATTR_PAGE:
diff --git a/sw/source/ui/uiview/viewmdi.cxx b/sw/source/ui/uiview/viewmdi.cxx
index 881eabf84c38..526e8f4b3047 100644
--- a/sw/source/ui/uiview/viewmdi.cxx
+++ b/sw/source/ui/uiview/viewmdi.cxx
@@ -365,7 +365,7 @@ IMPL_STATIC_LINK( SwView, MoveNavigationHdl, bool *, pbNext )
{
if ( !pbNext )
return 0;
- bool bNext = *pbNext;
+ const bool bNext = *pbNext;
SwWrtShell& rSh = pThis->GetWrtShell();
switch( m_nMoveType )
{
@@ -468,19 +468,21 @@ IMPL_STATIC_LINK( SwView, MoveNavigationHdl, bool *, pbNext )
}
}
break;
+
case NID_POSTIT:
- {
- sw::sidebarwindows::SwSidebarWin* pPostIt = pThis->GetPostItMgr()->GetActiveSidebarWin();
- if (pPostIt)
- pThis->GetPostItMgr()->SetActiveSidebarWin(0);
- SwFieldType* pFldType = rSh.GetFldType(0, RES_POSTITFLD);
- if (rSh.MoveFldType(pFldType, bNext))
- pThis->GetViewFrame()->GetDispatcher()->Execute(FN_POSTIT);
- else
- //first/last item
- pThis->GetPostItMgr()->SetActiveSidebarWin(pPostIt);
- }
- break;
+ {
+ sw::sidebarwindows::SwSidebarWin* pPostIt = pThis->GetPostItMgr()->GetActiveSidebarWin();
+ if (pPostIt)
+ pThis->GetPostItMgr()->SetActiveSidebarWin(0);
+ SwFieldType* pFldType = rSh.GetFldType(0, RES_POSTITFLD);
+ if ( rSh.MoveFldType( pFldType, bNext ) )
+ pThis->GetViewFrame()->GetDispatcher()->Execute(FN_POSTIT);
+ else
+ //first/last item
+ pThis->GetPostItMgr()->SetActiveSidebarWin(pPostIt);
+ }
+ break;
+
case NID_SRCH_REP:
if(m_pSrchItem)
{
diff --git a/sw/source/ui/uiview/viewsrch.cxx b/sw/source/ui/uiview/viewsrch.cxx
index 58f02b262ee7..e81b4b7c7d7f 100644
--- a/sw/source/ui/uiview/viewsrch.cxx
+++ b/sw/source/ui/uiview/viewsrch.cxx
@@ -662,7 +662,7 @@ void SwView::Replace()
if( m_pReplList->Get( aReplSet ).Count() )
{
::SfxToSwPageDescAttr( *m_pWrtShell, aReplSet );
- m_pWrtShell->SwEditShell::SetAttr( aReplSet );
+ m_pWrtShell->SwEditShell::SetAttrSet( aReplSet );
}
}
}
diff --git a/sw/source/ui/uiview/viewstat.cxx b/sw/source/ui/uiview/viewstat.cxx
index 147ae0e9f693..bbc915c4e282 100644
--- a/sw/source/ui/uiview/viewstat.cxx
+++ b/sw/source/ui/uiview/viewstat.cxx
@@ -72,31 +72,47 @@ void SwView::GetState(SfxItemSet &rSet)
{
switch(nWhich)
{
- case FN_EDIT_LINK_DLG:
- if( m_pWrtShell->GetLinkManager().GetLinks().empty() )
- rSet.DisableItem(nWhich);
- else if( m_pWrtShell->IsSelFrmMode() &&
- m_pWrtShell->IsSelObjProtected(FLYPROTECT_CONTENT))
- rSet.DisableItem(nWhich);
- break;
+ case FN_EDIT_LINK_DLG:
+ if( m_pWrtShell->GetLinkManager().GetLinks().empty() )
+ rSet.DisableItem(nWhich);
+ else if( m_pWrtShell->IsSelFrmMode() &&
+ m_pWrtShell->IsSelObjProtected(FLYPROTECT_CONTENT))
+ {
+ rSet.DisableItem(nWhich);
+ }
+ break;
- case FN_INSERT_CAPTION:
+ case SID_INSERT_GRAPHIC:
+ if( m_pWrtShell->CrsrInsideInputFld() )
{
- // There are captions for graphics, OLE objects, frames and tables
- if( !bGetFrmType )
- eFrmType = m_pWrtShell->GetFrmType(0,sal_True), bGetFrmType = sal_True;
- if (! ( ((eFrmType & FRMTYPE_FLY_ANY) && m_nSelectionType != nsSelectionType::SEL_DRW_TXT)||
+ rSet.DisableItem(nWhich);
+ }
+ break;
+
+ case FN_INSERT_CAPTION:
+ {
+ // There are captions for graphics, OLE objects, frames and tables
+ if( !bGetFrmType )
+ eFrmType = m_pWrtShell->GetFrmType(0,sal_True), bGetFrmType = sal_True;
+ if (! ( ((eFrmType & FRMTYPE_FLY_ANY) && m_nSelectionType != nsSelectionType::SEL_DRW_TXT)||
m_nSelectionType & nsSelectionType::SEL_TBL ||
m_nSelectionType & nsSelectionType::SEL_DRW) )
- rSet.DisableItem(nWhich);
- else if((m_pWrtShell->IsObjSelected()||m_pWrtShell->IsFrmSelected()) &&
+ {
+ rSet.DisableItem(nWhich);
+ }
+ else if((m_pWrtShell->IsObjSelected() || m_pWrtShell->IsFrmSelected()) &&
(m_pWrtShell->IsSelObjProtected( FLYPROTECT_PARENT)||
- m_pWrtShell->IsSelObjProtected( FLYPROTECT_CONTENT )))
- rSet.DisableItem(nWhich);
- else if( m_pWrtShell->IsTableMode() )
- rSet.DisableItem(nWhich);
- }
- break;
+ m_pWrtShell->IsSelObjProtected( FLYPROTECT_CONTENT )))
+ {
+ rSet.DisableItem(nWhich);
+ }
+ else if( m_pWrtShell->IsTableMode()
+ || m_pWrtShell->CrsrInsideInputFld() )
+ {
+ rSet.DisableItem(nWhich);
+ }
+ }
+ break;
case FN_EDIT_FOOTNOTE:
{
@@ -174,24 +190,29 @@ void SwView::GetState(SfxItemSet &rSet)
rSet.Put(aImgItem);
}
break;
+
case FN_INSERT_OBJ_CTRL:
- if(bWeb)
- rSet.DisableItem(nWhich);
- else
- {
- SfxImageItem aImgItem(nWhich, SwView::m_nInsertObjectCtrlState);
- SfxSlotPool& rPool = SfxSlotPool::GetSlotPool( GetViewFrame() );
- const SfxSlot* pSlot = rPool.GetSlot( aImgItem.GetValue() );
- if(pSlot && pSlot->IsMode( SFX_SLOT_IMAGEROTATION ))
+ if( bWeb
+ || m_pWrtShell->CrsrInsideInputFld() )
{
- if(m_pWrtShell->IsInVerticalText())
- aImgItem.SetRotation(2700);
- if(m_pWrtShell->IsInRightToLeftText())
- aImgItem.SetMirrored(sal_True);
+ rSet.DisableItem(nWhich);
}
- rSet.Put(aImgItem);
- }
- break;
+ else
+ {
+ SfxImageItem aImgItem(nWhich, SwView::m_nInsertObjectCtrlState);
+ SfxSlotPool& rPool = SfxSlotPool::GetSlotPool( GetViewFrame() );
+ const SfxSlot* pSlot = rPool.GetSlot( aImgItem.GetValue() );
+ if(pSlot && pSlot->IsMode( SFX_SLOT_IMAGEROTATION ))
+ {
+ if (m_pWrtShell->IsInVerticalText())
+ aImgItem.SetRotation(2700);
+ if (m_pWrtShell->IsInRightToLeftText())
+ aImgItem.SetMirrored(sal_True);
+ }
+ rSet.Put(aImgItem);
+ }
+ break;
+
case FN_UPDATE_TOX:
if(!m_pWrtShell->GetTOXCount())
rSet.DisableItem(nWhich);
diff --git a/sw/source/ui/uiview/viewtab.cxx b/sw/source/ui/uiview/viewtab.cxx
index 513cc515ea63..5572cfacafe9 100644
--- a/sw/source/ui/uiview/viewtab.cxx
+++ b/sw/source/ui/uiview/viewtab.cxx
@@ -651,7 +651,7 @@ void SwView::ExecTabWin( SfxRequest& rReq )
rSh.AutoUpdatePara( pColl, aTmp );
}
else
- rSh.SetAttr( aTabStops );
+ rSh.SetAttrItem( aTabStops );
}
break;
@@ -691,7 +691,7 @@ void SwView::ExecTabWin( SfxRequest& rReq )
rSh.AutoUpdatePara( pColl, aSet);
}
else
- rSh.SetAttr( aParaMargin );
+ rSh.SetAttrItem( aParaMargin );
if ( aParaMargin.GetTxtFirstLineOfst() < 0 )
{
@@ -730,7 +730,7 @@ void SwView::ExecTabWin( SfxRequest& rReq )
rSh.AutoUpdatePara( pColl, aSetTmp );
}
else
- rSh.SetAttr( aTabStops );
+ rSh.SetAttrItem( aTabStops );
}
}
}
@@ -755,7 +755,7 @@ void SwView::ExecTabWin( SfxRequest& rReq )
rSh.AutoUpdatePara( pColl, aSet);
}
else
- rSh.SetAttr( aParaMargin );
+ rSh.SetAttrItem( aParaMargin );
}
break;
@@ -1006,7 +1006,7 @@ void SwView::StateTabWin(SfxItemSet& rSet)
RES_LR_SPACE, RES_UL_SPACE, 0 );
// get also the list level indent values merged as LR-SPACE item, if needed.
rSh.GetCurAttr( aCoreSet, true );
- SelectionType nSelType = rSh.GetSelectionType();
+ const SelectionType nSelType = rSh.GetSelectionType();
SfxWhichIter aIter( rSet );
sal_uInt16 nWhich = aIter.FirstWhich();
diff --git a/sw/source/ui/wrtsh/delete.cxx b/sw/source/ui/wrtsh/delete.cxx
index efd11fac7b2b..bba3c3d369d3 100644
--- a/sw/source/ui/wrtsh/delete.cxx
+++ b/sw/source/ui/wrtsh/delete.cxx
@@ -76,7 +76,7 @@ bool SwWrtShell::TryRemoveIndent()
if (bResult)
{
aAttrSet.Put(aItem);
- SetAttr(aAttrSet);
+ SetAttrSet(aAttrSet);
}
return bResult;
diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx
index 11e06415c2d8..c19438ce644c 100644
--- a/sw/source/ui/wrtsh/wrtsh1.cxx
+++ b/sw/source/ui/wrtsh/wrtsh1.cxx
@@ -847,10 +847,10 @@ void SwWrtShell::InsertPageBreak(const OUString *pPageDesc, ::boost::optional<sa
{
SwFmtPageDesc aDesc( pDesc );
aDesc.SetNumOffset( oPgNum );
- SetAttr( aDesc );
+ SetAttrItem( aDesc );
}
else
- SetAttr( SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE, RES_BREAK) );
+ SetAttrItem( SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE, RES_BREAK) );
EndUndo(UNDO_UI_INSERT_PAGE_BREAK);
}
}
@@ -892,7 +892,7 @@ void SwWrtShell::InsertColumnBreak()
DelRight();
SwFEShell::SplitNode( sal_False, sal_False );
}
- SetAttr(SvxFmtBreakItem(SVX_BREAK_COLUMN_BEFORE, RES_BREAK));
+ SetAttrItem(SvxFmtBreakItem(SVX_BREAK_COLUMN_BEFORE, RES_BREAK));
EndUndo(UNDO_UI_INSERT_COLUMN_BREAK);
}
@@ -918,7 +918,7 @@ void SwWrtShell::InsertFootnote(const OUString &rStr, sal_Bool bEndNote, sal_Boo
if(!rStr.isEmpty())
aFootNote.SetNumStr( rStr );
- SetAttr(aFootNote);
+ SetAttrItem(aFootNote);
if( bEdit )
{
@@ -1345,11 +1345,11 @@ SelectionType SwWrtShell::GetSelectionType() const
SwView &_rView = ((SwView&)GetView());
if (_rView.GetPostItMgr() && _rView.GetPostItMgr()->HasActiveSidebarWin() )
return nsSelectionType::SEL_POSTIT;
- int nCnt;
// Inserting a frame is not a DrawMode
+ int nCnt;
if ( !_rView.GetEditWin().IsFrmAction() &&
- (IsObjSelected() || (_rView.IsDrawMode() && !IsFrmSelected()) ))
+ (IsObjSelected() || (_rView.IsDrawMode() && !IsFrmSelected()) ))
{
if (GetDrawView()->IsTextEdit())
nCnt = nsSelectionType::SEL_DRW_TXT;
@@ -1366,14 +1366,14 @@ SelectionType SwWrtShell::GetSelectionType() const
nCnt |= nsSelectionType::SEL_MEDIA;
if (svx::checkForSelectedCustomShapes(
- const_cast<SdrView *>(GetDrawView()),
- true /* bOnlyExtruded */ ))
+ const_cast<SdrView *>(GetDrawView()),
+ true /* bOnlyExtruded */ ))
{
nCnt |= nsSelectionType::SEL_EXTRUDED_CUSTOMSHAPE;
}
sal_uInt32 nCheckStatus = 0;
if (svx::checkForSelectedFontWork(
- const_cast<SdrView *>(GetDrawView()), nCheckStatus ))
+ const_cast<SdrView *>(GetDrawView()), nCheckStatus ))
{
nCnt |= nsSelectionType::SEL_FONTWORK;
}
@@ -1398,9 +1398,7 @@ SelectionType SwWrtShell::GetSelectionType() const
if ( IsTableMode() )
nCnt |= (nsSelectionType::SEL_TBL | nsSelectionType::SEL_TBL_CELLS);
- // #i39855#
- // Do not pop up numbering toolbar, if the text node has a numbering
- // of type SVX_NUM_NUMBER_NONE.
+ // Do not pop up numbering toolbar, if the text node has a numbering of type SVX_NUM_NUMBER_NONE.
const SwNumRule* pNumRule = GetCurNumRule();
if ( pNumRule )
{
@@ -1546,7 +1544,7 @@ void SwWrtShell::AutoUpdatePara(SwTxtFmtColl* pColl, const SfxItemSet& rStyleSet
if(bReset)
{
ResetAttr( std::set<sal_uInt16>(), pCrsr );
- SetAttr(aCoreSet, 0, pCrsr);
+ SetAttrSet(aCoreSet, 0, pCrsr);
}
mpDoc->ChgFmt(*pColl, rStyleSet );
EndAction();
diff --git a/sw/source/ui/wrtsh/wrtsh2.cxx b/sw/source/ui/wrtsh/wrtsh2.cxx
index 56046475210d..830a4ae3083b 100644
--- a/sw/source/ui/wrtsh/wrtsh2.cxx
+++ b/sw/source/ui/wrtsh/wrtsh2.cxx
@@ -98,16 +98,13 @@ void SwWrtShell::Insert(SwField &rFld, SwPaM *pCommentRange)
// Start the field update
-void SwWrtShell::UpdateInputFlds( SwInputFieldList* pLst, sal_Bool bOnlyInSel )
+void SwWrtShell::UpdateInputFlds( SwInputFieldList* pLst )
{
// Go through the list of fields and updating
SwInputFieldList* pTmp = pLst;
if( !pTmp )
pTmp = new SwInputFieldList( this );
- if (bOnlyInSel)
- pTmp->RemoveUnselectedFlds();
-
const sal_uInt16 nCnt = pTmp->Count();
if(nCnt)
{
@@ -322,7 +319,13 @@ void SwWrtShell::ClickToField( const SwField& rFld )
break;
case RES_INPUTFLD:
- StartInputFldDlg( (SwField*)&rFld, sal_False );
+ {
+ const SwInputField* pInputField = dynamic_cast<const SwInputField*>(&rFld);
+ if ( pInputField == NULL )
+ {
+ StartInputFldDlg( (SwField*)&rFld, sal_False );
+ }
+ }
break;
case RES_SETEXPFLD: