Update ooo320-m1
[ooovba.git] / applied_patches / 0513-field-patch.diff
blob06cae96a2306a4e309d2a900aef6f3278b34bf1e
1 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' offapi/com/sun/star/text/XFormField.idl offapi/com/sun/star/text/XFormField.idl
2 --- offapi/com/sun/star/text/XFormField.idl 2009-08-13 16:13:57.000000000 +0200
3 +++ offapi/com/sun/star/text/XFormField.idl 2009-10-09 10:53:45.000000000 +0200
4 @@ -11,14 +11,13 @@
5 */
6 interface XFormField: com::sun::star::uno::XInterface
8 - short getType();
9 - short getRes();
10 - string getDescription( );
12 - void setType([in] short fieldType );
13 - void setRes([in] short res );
14 - void setDescription([in] string description );
16 + string getFieldType();
17 + void setFieldType([in] string fieldType);
19 + short getParamCount();
20 + string getParamName([in] short i);
21 + string getParamValue([in] short i);
22 + void addParam([in] string name, [in] string value, [in] boolean replaceExisting);
25 }; }; }; };
26 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' svtools/source/config/fltrcfg.cxx svtools/source/config/fltrcfg.cxx
27 --- svtools/source/config/fltrcfg.cxx 2009-08-04 15:49:29.000000000 +0200
28 +++ svtools/source/config/fltrcfg.cxx 2009-10-09 10:53:45.000000000 +0200
29 @@ -312,7 +312,7 @@
30 "Export/EnablePowerPointPreview", // 8
31 "Export/EnableExcelPreview", // 9
32 "Export/EnableWordPreview", // 10
33 - "Import/ImportWWFieldsAsEnhancedFields" // 11
34 + "Import/ImportWWFieldsAsEnhancedFields" // 11
36 OUString* pNames = aNames.getArray();
37 for(int i = 0; i < nCount; i++)
38 @@ -525,8 +525,7 @@
40 BOOL SvtFilterOptions::IsUseEnhancedFields() const
42 - return false; // disable for now;
43 -// return pImp->IsFlag( FILTERCFG_USE_ENHANCED_FIELDS );
44 + return pImp->IsFlag( FILTERCFG_USE_ENHANCED_FIELDS );
47 void SvtFilterOptions::SetUseEnhancedFields( BOOL bFlag )
48 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/inc/IDocumentMarkAccess.hxx sw/inc/IDocumentMarkAccess.hxx
49 --- sw/inc/IDocumentMarkAccess.hxx 2009-08-13 16:14:38.000000000 +0200
50 +++ sw/inc/IDocumentMarkAccess.hxx 2009-10-09 10:53:45.000000000 +0200
51 @@ -86,6 +86,13 @@
52 const ::rtl::OUString& rProposedName,
53 MarkType eMark) =0;
55 + virtual sw::mark::IMark* makeFieldBookmark( const SwPaM& rPaM,
56 + const rtl::OUString& rName,
57 + const rtl::OUString& rType) = 0;
58 + virtual sw::mark::IMark* makeNoTextFieldBookmark( const SwPaM& rPaM,
59 + const rtl::OUString& rName,
60 + const rtl::OUString& rType) = 0;
62 /** Returns a mark in the document for a paragraph.
63 If there is none, a mark will be created.
65 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/inc/IMark.hxx sw/inc/IMark.hxx
66 --- sw/inc/IMark.hxx 2009-08-13 16:14:38.000000000 +0200
67 +++ sw/inc/IMark.hxx 2009-10-09 10:53:45.000000000 +0200
68 @@ -51,12 +51,12 @@
70 public:
71 //getters
72 - virtual const SwPosition& GetMarkPos() const =0;
73 + virtual SwPosition& GetMarkPos() const =0;
74 // GetOtherMarkPos() is only guaranteed to return a valid
75 // reference if IsExpanded() returned true
76 - virtual const SwPosition& GetOtherMarkPos() const =0;
77 - virtual const SwPosition& GetMarkStart() const =0;
78 - virtual const SwPosition& GetMarkEnd() const =0;
79 + virtual SwPosition& GetOtherMarkPos() const =0;
80 + virtual SwPosition& GetMarkStart() const =0;
81 + virtual SwPosition& GetMarkEnd() const =0;
82 virtual const ::rtl::OUString& GetName() const =0;
83 virtual bool IsExpanded() const =0;
84 virtual bool IsCoveringPosition(const SwPosition& rPos) const =0;
85 @@ -79,6 +79,9 @@
86 { return GetMarkEnd() < rPos; }
87 bool EndsAfter(const SwPosition& rPos) const
88 { return GetMarkEnd() > rPos; }
90 + // Use for debugging purpose
91 + virtual rtl::OUString toString( ) const = 0;
94 class IBookmark
95 @@ -95,13 +98,25 @@
96 : virtual public IMark
98 public:
99 + typedef std::pair< ::rtl::OUString, ::rtl::OUString > ParamPair_t;
101 //getters
102 virtual ::rtl::OUString GetFieldname() const =0;
103 virtual ::rtl::OUString GetFieldHelptext() const =0;
105 + virtual void addParam( rtl::OUString rParamName,
106 + rtl::OUString rParamValue,
107 + bool bReplaceExisting = true ) = 0;
108 + virtual void addParam( const char* paramName, int value ) = 0;
109 + virtual void addParams( std::vector<ParamPair_t>& params ) = 0;
110 + virtual int getNumOfParams() const = 0;
111 + virtual ParamPair_t getParam( int pos ) const = 0;
112 + virtual ParamPair_t getParam( const char *name, const char *defaultValue = NULL ) const = 0;
114 //setters
115 virtual void SetFieldname(const ::rtl::OUString& rFieldname) =0;
116 virtual void SetFieldHelptext(const ::rtl::OUString& rFieldHelptext) =0;
117 + virtual void invalidate( ) = 0;
120 class ICheckboxFieldmark
121 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/inc/crsrsh.hxx sw/inc/crsrsh.hxx
122 --- sw/inc/crsrsh.hxx 2009-09-09 11:44:12.000000000 +0200
123 +++ sw/inc/crsrsh.hxx 2009-10-09 10:53:45.000000000 +0200
124 @@ -45,6 +45,7 @@
125 #include <node.hxx>
126 #include <tblsel.hxx>
127 #include <IDocumentMarkAccess.hxx>
128 +#include <IMark.hxx>
131 // einige Forward Deklarationen
132 @@ -110,7 +111,8 @@
133 SW_REFMARK = 0x0100,
134 SW_NUMLABEL = 0x0200, // #i23726#
135 SW_CONTENT_CHECK = 0x0400, // --> FME 2005-05-13 #i43742# <--
136 - SW_SMARTTAG = 0x0800
137 + SW_SMARTTAG = 0x0800,
138 + SW_FORMCTRL = 0x1000
139 #ifndef PRODUCT
140 ,SW_CURR_ATTRS = 0x4000 // nur zum Debuggen
141 ,SW_TABLEBOXVALUE = 0x8000 // nur zum Debuggen
142 @@ -122,6 +124,7 @@
143 const SfxPoolItem* pAttr;
144 const SwRedline* pRedl;
145 SwCntntNode * pNode; // #i23726#
146 + const sw::mark::IFieldmark* pFldmark;
147 } aFnd;
149 int nDist; // #i23726#
150 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/inc/ecmaflds.hxx sw/inc/ecmaflds.hxx
151 --- sw/inc/ecmaflds.hxx 1970-01-01 01:00:00.000000000 +0100
152 +++ sw/inc/ecmaflds.hxx 2009-10-09 10:53:45.000000000 +0200
153 @@ -0,0 +1,68 @@
154 +/*************************************************************************
156 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
157 + *
158 + * Copyright 2008 by Sun Microsystems, Inc.
160 + * OpenOffice.org - a multi-platform office productivity suite
162 + * $RCSfile: $
163 + * $Revision: $
165 + * This file is part of OpenOffice.org.
167 + * OpenOffice.org is free software: you can redistribute it and/or modify
168 + * it under the terms of the GNU Lesser General Public License version 3
169 + * only, as published by the Free Software Foundation.
171 + * OpenOffice.org is distributed in the hope that it will be useful,
172 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
173 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
174 + * GNU Lesser General Public License version 3 for more details
175 + * (a copy is included in the LICENSE file that accompanied this code).
177 + * You should have received a copy of the GNU Lesser General Public License
178 + * version 3 along with OpenOffice.org. If not, see
179 + * <http://www.openoffice.org/license.html>
180 + * for a copy of the LGPLv3 License.
182 + ************************************************************************/
183 +/* and also:
184 + * Author: Florian Reuter <freuter@novell.com>
185 + * Copyright 2008 by Novell, Inc.
187 +#ifndef _ECMAFLDS_HXX
188 +#define _ECMAFLDS_HXX
191 +#define ECMA_FORMTEXT "ecma.office-open-xml.field.FORMTEXT"
192 +#define ECMA_FORMTEXT_NAME "name"
193 +#define ECMA_FORMTEXT_HELPTEXT "helpText"
194 +#define ECMA_FORMTEXT_STATUSTEXT "statusText"
195 +#define ECMA_FORMTEXT_DEFAULT "default"
196 +#define ECMA_FORMTEXT_FORMAT "format"
197 +#define ECMA_FORMTEXT_MAXLENGTH "maxLength"
198 +#define ECMA_FORMTEXT_TYPE "type"
200 +#define ECMA_FORMCHECKBOX "ecma.office-open-xml.field.FORMCHECKBOX"
201 +#define ECMA_FORMCHECKBOX_NAME "name"
202 +#define ECMA_FORMCHECKBOX_HELPTEXT "helpText"
203 +#define ECMA_FORMCHECKBOX_STATUSTEXT "statusText"
204 +#define ECMA_FORMCHECKBOX_CHECKED "checked"
205 +#define ECMA_FORMCHECKBOX_DEFAULT "default"
206 +#define ECMA_FORMCHECKBOX_SIZE "size"
207 +#define ECMA_FORMCHECKBOX_SIZEAUTO "sizeAuto"
210 +#define ECMA_FORMDROPDOWN "ecma.office-open-xml.field.FORMDROPDOWN"
211 +#define ECMA_FORMDROPDOWN_DEFAULT "default"
212 +#define ECMA_FORMDROPDOWN_LISTENTRY "listEntry"
213 +#define ECMA_FORMDROPDOWN_RESULT "result"
215 +#define ECMA_TOC "ecma.office-open-xml.field.TOC"
217 +#define ECMA_HYPERLINK "ecma.office-open-xml.field.HYPERLINK"
219 +#define ECMA_PAGEREF "ecma.office-open-xml.field.PAGEREF"
221 +#endif /* _ECMAFLDS_HXX */
222 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/inc/editsh.hxx sw/inc/editsh.hxx
223 --- sw/inc/editsh.hxx 2009-10-07 17:44:55.000000000 +0200
224 +++ sw/inc/editsh.hxx 2009-10-09 10:53:45.000000000 +0200
225 @@ -44,6 +44,7 @@
226 #include <com/sun/star/linguistic2/ProofreadingResult.hpp>
227 #include <fldupde.hxx>
228 #include <tblenum.hxx>
229 +#include <IMark.hxx>
231 #include <vector>
232 #include <swundo.hxx>
233 @@ -415,6 +416,9 @@
234 const SwTOXType* GetTOXType(TOXTypes eTyp, USHORT nId) const;
235 void InsertTOXType(const SwTOXType& rTyp);
237 + // new field stuff
238 + BOOL UpdateField(sw::mark::IFieldmark &fieldBM);
240 //AutoMark file
241 const String& GetTOIAutoMarkURL() const;
242 void SetTOIAutoMarkURL(const String& rSet);
243 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/inc/hintids.hxx sw/inc/hintids.hxx
244 --- sw/inc/hintids.hxx 2009-10-07 17:44:55.000000000 +0200
245 +++ sw/inc/hintids.hxx 2009-10-09 10:53:45.000000000 +0200
246 @@ -44,12 +44,8 @@
247 #define CH_TXT_ATR_FIELDEND ((sal_Unicode)0x05)
248 #define CH_TXT_ATR_SUBST_FIELDSTART ("[")
249 #define CH_TXT_ATR_SUBST_FIELDEND ("]")
250 -//#define CH_TXT_ATR_FORMELEMENT ((sal_Unicode)'#')
251 #define CH_TXT_ATR_FORMELEMENT ((sal_Unicode)0x06)
253 -#define FIELD_BOOKMARK_PREFIX "__"
254 -#define FIELD_FORM_BOOKMARK_PREFIX "__FORM"
258 * Hier kommen erst mal die enums fuer die Hints
260 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/inc/pam.hxx sw/inc/pam.hxx
261 --- sw/inc/pam.hxx 2009-08-13 16:14:38.000000000 +0200
262 +++ sw/inc/pam.hxx 2009-10-09 10:53:45.000000000 +0200
263 @@ -272,6 +272,7 @@
264 DECL_FIXEDMEMPOOL_NEWDEL(SwPaM);
266 String GetTxt() const;
267 + void Invalidate();
271 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/inc/unoobj.hxx sw/inc/unoobj.hxx
272 --- sw/inc/unoobj.hxx 2009-10-09 14:56:15.000000000 +0200
273 +++ sw/inc/unoobj.hxx 2009-10-09 15:15:42.000000000 +0200
274 @@ -675,13 +675,13 @@
275 SwXFieldmark(bool isReplacementObject, ::sw::mark::IMark* pBkm = 0, SwDoc* pDoc = 0);
277 virtual void attachToRange(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
278 - virtual ::rtl::OUString SAL_CALL getDescription(void) throw( ::com::sun::star::uno::RuntimeException );
279 - virtual ::sal_Int16 SAL_CALL getType( ) throw (::com::sun::star::uno::RuntimeException);
280 - virtual ::sal_Int16 SAL_CALL getRes( ) throw (::com::sun::star::uno::RuntimeException);
281 + virtual ::rtl::OUString SAL_CALL getFieldType(void) throw( ::com::sun::star::uno::RuntimeException );
282 + virtual void SAL_CALL setFieldType( const ::rtl::OUString& description ) throw (::com::sun::star::uno::RuntimeException);
284 - virtual void SAL_CALL setType( ::sal_Int16 fieldType ) throw (::com::sun::star::uno::RuntimeException);
285 - virtual void SAL_CALL setRes( ::sal_Int16 res ) throw (::com::sun::star::uno::RuntimeException);
286 - virtual void SAL_CALL setDescription( const ::rtl::OUString& description ) throw (::com::sun::star::uno::RuntimeException);
287 + virtual ::sal_Int16 SAL_CALL getParamCount( ) throw (::com::sun::star::uno::RuntimeException);
288 + virtual ::rtl::OUString SAL_CALL getParamName(::sal_Int16 i) throw( ::com::sun::star::uno::RuntimeException );
289 + virtual ::rtl::OUString SAL_CALL getParamValue(::sal_Int16 i) throw( ::com::sun::star::uno::RuntimeException );
290 + virtual void SAL_CALL addParam( const ::rtl::OUString& name, const ::rtl::OUString& value, ::sal_Bool replaceExisting ) throw (::com::sun::star::uno::RuntimeException);
293 /*-----------------23.02.98 10:45-------------------
294 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/core/crsr/bookmrk.cxx sw/source/core/crsr/bookmrk.cxx
295 --- sw/source/core/crsr/bookmrk.cxx 2009-10-07 17:44:56.000000000 +0200
296 +++ sw/source/core/crsr/bookmrk.cxx 2009-10-09 10:57:57.000000000 +0200
297 @@ -77,20 +77,20 @@
298 const sal_Unicode aStartMark,
299 const sal_Unicode aEndMark)
301 - const SwPosition& rStart = pField->GetMarkStart();
302 - const SwPosition& rEnd = pField->GetMarkEnd();
303 + SwPosition& rStart = pField->GetMarkStart();
304 + SwPosition& rEnd = pField->GetMarkEnd();
305 SwTxtNode const * const pStartTxtNode = io_pDoc->GetNodes()[rStart.nNode]->GetTxtNode();
306 SwTxtNode const * const pEndTxtNode = io_pDoc->GetNodes()[rEnd.nNode]->GetTxtNode();
307 const sal_Unicode ch_start=pStartTxtNode->GetTxt().GetChar(rStart.nContent.GetIndex());
308 const sal_Unicode ch_end=pEndTxtNode->GetTxt().GetChar(rEnd.nContent.GetIndex()-1);
309 - const SwPaM aStartPaM(rStart);
310 - const SwPaM aEndPaM(rEnd);
311 + SwPaM aStartPaM(rStart);
312 + SwPaM aEndPaM(rEnd);
313 io_pDoc->StartUndo(UNDO_UI_REPLACE, NULL);
314 if(ch_start != aStartMark)
316 io_pDoc->InsertString(aStartPaM, aStartMark);
318 - if(aEndMark && ch_end != aEndMark)
319 + if ( aEndMark && ( ch_end != aEndMark ) && ( rStart != rEnd ) )
321 io_pDoc->InsertString(aEndPaM, aEndMark);
323 @@ -114,6 +114,11 @@
327 + bool MarkBase::IsCoveringPosition(const SwPosition& rPos) const
329 + return GetMarkStart() <= rPos && rPos <= GetMarkEnd();
332 void MarkBase::SetMarkPos(const SwPosition& rNewPos)
334 ::boost::scoped_ptr<SwPosition>(new SwPosition(rNewPos)).swap(m_pPos1);
335 @@ -126,6 +131,17 @@
336 //lcl_FixPosition(*m_pPos2);
339 + rtl::OUString MarkBase::toString( ) const
341 + rtl::OUStringBuffer buf;
342 + buf.appendAscii( "Mark: ( Name, [ Node1, Index1 ] ): ( " );
343 + buf.append( m_aName ).appendAscii( ", [ " );
344 + buf.append( sal_Int32( GetMarkPos().nNode.GetIndex( ) ) ).appendAscii( ", " );
345 + buf.append( sal_Int32( GetMarkPos().nContent.GetIndex( ) ) ).appendAscii( " ] )" );
347 + return buf.makeStringAndClear( );
350 MarkBase::~MarkBase()
353 @@ -267,6 +283,96 @@
354 if(!IsExpanded())
355 SetOtherMarkPos(GetMarkPos());
358 + rtl::OUString Fieldmark::toString( ) const
360 + rtl::OUStringBuffer buf;
361 + buf.appendAscii( "Fieldmark: ( Name, Type, [ Nd1, Id1 ], [ Nd2, Id2 ] ): ( " );
362 + buf.append( m_aName ).appendAscii( ", " );
363 + buf.append( m_aFieldname ).appendAscii( ", [ " );
364 + buf.append( sal_Int32( GetMarkPos().nNode.GetIndex( ) ) ).appendAscii( ", " );
365 + buf.append( sal_Int32( GetMarkPos( ).nContent.GetIndex( ) ) ).appendAscii( " ], [" );
366 + buf.append( sal_Int32( GetOtherMarkPos().nNode.GetIndex( ) ) ).appendAscii( ", " );
367 + buf.append( sal_Int32( GetOtherMarkPos( ).nContent.GetIndex( ) ) ).appendAscii( " ] ) " );
369 + return buf.makeStringAndClear( );
372 + void Fieldmark::addParam( ::rtl::OUString paramName,
373 + ::rtl::OUString paramValue,
374 + bool replaceExisting )
376 + if ( replaceExisting )
378 + bool replaced = false;
379 + const int len = m_params.size( );
380 + for ( int i = 0; i < len; i++ )
382 + if ( m_params[i].first.compareTo( paramName ) == 0 )
384 + m_params[i] = ParamPair_t( paramName, paramValue );
385 + replaced = true;
388 + if ( !replaced )
390 + m_params.push_back( ParamPair_t( paramName, paramValue ) );
393 + else
395 + m_params.push_back( ParamPair_t( paramName, paramValue ) );
399 + void Fieldmark::addParam( const char *paramName, int value )
401 + rtl::OUString sName = rtl::OUString::createFromAscii( paramName );
402 + rtl::OUString sValue =::rtl::OUString::valueOf( ( sal_Int32 ) value );
403 + addParam( sName, sValue );
406 + void Fieldmark::addParams( std::vector < ParamPair_t > &params )
408 + for ( std::vector < ParamPair_t >::iterator i = params.begin( );
409 + i != params.end( ); i++ )
411 + m_params.push_back( *i );
415 + int Fieldmark::getNumOfParams( ) const
417 + return m_params.size( );
420 + Fieldmark::ParamPair_t Fieldmark::getParam( int pos ) const
422 + return m_params[pos];
425 + Fieldmark::ParamPair_t Fieldmark::getParam( const char *name,
426 + const char *defaultValue ) const
428 + for ( std::vector < ParamPair_t >::iterator i = const_cast< Fieldmark* >( this )->m_params.begin( );
429 + i != m_params.end( ); i++ )
431 + if ( i->first.compareToAscii( name ) == 0 )
433 + return *i;
436 + return ParamPair_t( rtl::OUString( ),
437 + ( defaultValue ?
438 + rtl::OUString::createFromAscii( defaultValue ) :
439 + rtl::OUString( ) ) );
442 + void Fieldmark::invalidate( )
444 + SwPaM aPaM( this->GetMarkPos(), this->GetOtherMarkPos() );
445 + aPaM.Invalidate();
448 const ::rtl::OUString Fieldmark::our_sNamePrefix = ::rtl::OUString::createFromAscii("__Fieldmark__");
450 @@ -285,7 +391,11 @@
452 void CheckboxFieldmark::InitDoc(SwDoc* const io_pDoc)
454 - lcl_AssureFieldMarksSet(this, io_pDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND);
455 + lcl_AssureFieldMarksSet(this, io_pDoc, CH_TXT_ATR_FORMELEMENT, CH_TXT_ATR_FIELDEND);
457 + // For some reason the end mark is moved from 1 by the Insert: we don't
458 + // want this for checkboxes
459 + this->GetMarkEnd( ).nContent--;
462 void CheckboxFieldmark::SetChecked(bool checked)
463 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/core/crsr/crossrefbookmark.cxx sw/source/core/crsr/crossrefbookmark.cxx
464 --- sw/source/core/crsr/crossrefbookmark.cxx 2009-09-09 11:44:12.000000000 +0200
465 +++ sw/source/core/crsr/crossrefbookmark.cxx 2009-10-09 10:53:45.000000000 +0200
466 @@ -67,7 +67,7 @@
467 MarkBase::SetMarkPos(rNewPos);
470 - const SwPosition& CrossRefBookmark::GetOtherMarkPos() const
471 + SwPosition& CrossRefBookmark::GetOtherMarkPos() const
473 OSL_PRECOND(false,
474 "<SwCrossRefBookmark::GetOtherMarkPos(..)>"
475 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/core/crsr/crstrvl.cxx sw/source/core/crsr/crstrvl.cxx
476 --- sw/source/core/crsr/crstrvl.cxx 2009-10-07 17:44:56.000000000 +0200
477 +++ sw/source/core/crsr/crstrvl.cxx 2009-10-09 10:53:45.000000000 +0200
478 @@ -1175,6 +1175,17 @@
482 + if( !bRet && SwContentAtPos::SW_FORMCTRL & rCntntAtPos.eCntntAtPos )
484 + IDocumentMarkAccess* pMarksAccess = GetDoc()->getIDocumentMarkAccess( );
485 + sw::mark::IFieldmark* pFldBookmark = pMarksAccess->getFieldmarkFor( aPos );
486 + if( bCrsrFoundExact && pTxtNd && pFldBookmark) {
487 + rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FORMCTRL;
488 + rCntntAtPos.aFnd.pFldmark = pFldBookmark;
489 + bRet=TRUE;
493 if( !bRet && SwContentAtPos::SW_FTN & rCntntAtPos.eCntntAtPos )
495 if( aTmpState.bFtnNoInfo )
496 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/core/crsr/pam.cxx sw/source/core/crsr/pam.cxx
497 --- sw/source/core/crsr/pam.cxx 2009-10-07 17:44:56.000000000 +0200
498 +++ sw/source/core/crsr/pam.cxx 2009-10-09 10:53:45.000000000 +0200
499 @@ -56,6 +56,7 @@
500 #include <ndtxt.hxx> // #111827#
502 #include <IMark.hxx>
503 +#include <hints.hxx>
505 // fuer den dummen ?MSC-? Compiler
506 inline xub_StrLen GetSttOrEnd( BOOL bCondition, const SwCntntNode& rNd )
507 @@ -827,16 +828,21 @@
509 //FIXME FieldBk
510 // TODO: Form Protection when Enhanced Fields are enabled
511 -// if( !bRet )
512 -// {
513 -// const SwDoc *pDoc=GetDoc();
514 -// SwBookmark *pA = ( pDoc && pPoint ? pDoc->getFieldmarkFor( *pPoint ) : NULL );
515 -// SwBookmark *pB = ( pDoc && pMark ? pDoc->getFieldmarkFor( *pMark ) : pA );
516 -// bRet = ( pA != pB );
517 -// bool bProtectForm = pDoc->get( IDocumentSettingAccess::PROTECT_FORM );
518 -// if( bProtectForm )
519 -// bRet |= ( pA==NULL || pB==NULL );
520 -// }
521 + if (!bRet) {
522 + const SwDoc *pDoc = GetDoc();
523 + sw::mark::IMark* pA = NULL;
524 + sw::mark::IMark* pB = NULL;
525 + if ( pDoc )
527 + const IDocumentMarkAccess* pMarksAccess = pDoc->getIDocumentMarkAccess( );
528 + pA = GetPoint() ? pMarksAccess->getFieldmarkFor( *GetPoint( ) ) : NULL;
529 + pB = GetMark( ) ? pMarksAccess->getFieldmarkFor( *GetMark( ) ) : pA;
530 + bRet = ( pA != pB );
532 + bool bProtectForm = pDoc->get( IDocumentSettingAccess::PROTECT_FORM );
533 + if ( bProtectForm )
534 + bRet |= ( pA == NULL || pB == NULL );
536 return bRet;
539 @@ -1223,6 +1229,18 @@
540 return !(*b.End() <= *a.Start() || *a.End() <= *b.End());
543 +void SwPaM::Invalidate()
545 + const SwNode *_pNd=this->GetNode();
546 + const SwTxtNode *_pTxtNd=(_pNd!=NULL?_pNd->GetTxtNode():NULL);
547 + if (_pTxtNd!=NULL) {
548 + //pretent we've added a char to force layout to recalc the portion...
549 + SwInsChr aHint(_pTxtNd->GetIndex());
550 + SwModify *_pModify=(SwModify*)_pTxtNd;
551 + _pModify->Modify( 0, &aHint);
555 BOOL SwPaM::LessThan(const SwPaM & a, const SwPaM & b)
557 return (*a.Start() < *b.Start()) || (*a.Start() == *b.Start() && *a.End() < *b.End());
558 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/core/doc/docbm.cxx sw/source/core/doc/docbm.cxx
559 --- sw/source/core/doc/docbm.cxx 2009-10-07 17:44:56.000000000 +0200
560 +++ sw/source/core/doc/docbm.cxx 2009-10-09 10:53:45.000000000 +0200
561 @@ -41,6 +41,7 @@
562 #include <dcontact.hxx>
563 #include <doc.hxx>
564 #include <docary.hxx>
565 +#include <ecmaflds.hxx>
566 #include <editsh.hxx>
567 #include <errhdl.hxx>
568 #include <fmtanchr.hxx>
569 @@ -66,6 +67,23 @@
570 #include <viscrs.hxx>
571 #include <stdio.h>
573 +static void lcl_docbm_FixPosition( SwPosition& rPos )
575 + // make sure the position has 1) the proper node, and 2) a proper index
576 + SwTxtNode* pTxtNode = rPos.nNode.GetNode().GetTxtNode();
578 + if( rPos.nContent.GetIndex() > ( pTxtNode == NULL ? 0 : pTxtNode->Len() ) )
580 + DBG_ERROR( "illegal position" );
581 + xub_StrLen nLen = rPos.nContent.GetIndex();
582 + if( pTxtNode == NULL )
583 + nLen = 0;
584 + else if( nLen >= pTxtNode->Len() )
585 + nLen = pTxtNode->Len();
586 + rPos.nContent.Assign( pTxtNode, nLen );
591 using namespace ::std;
592 using namespace ::boost;
593 @@ -309,6 +327,17 @@
594 : m_pDoc(&rDoc)
597 + void MarkManager::dumpFieldmarks( ) const
599 + const_iterator_t pIt = m_vFieldmarks.begin( );
600 + for ( ; pIt != m_vFieldmarks.end( ); pIt++ )
602 + rtl::OUString str = ( *pIt )->toString( );
603 + fprintf( stderr, "%s\n",
604 + rtl::OUStringToOString( str, RTL_TEXTENCODING_UTF8 ).getStr( ) );
608 ::sw::mark::IMark* MarkManager::makeMark(const SwPaM& rPaM,
609 const ::rtl::OUString& rName,
610 const IDocumentMarkAccess::MarkType eType)
611 @@ -414,6 +443,30 @@
612 return pMark.get();
615 + ::sw::mark::IMark* MarkManager::makeFieldBookmark( const SwPaM& rPaM,
616 + const rtl::OUString& rName,
617 + const rtl::OUString& rType )
619 + sw::mark::IMark* pMark = makeMark( rPaM, rName,
620 + IDocumentMarkAccess::TEXT_FIELDMARK );
621 + sw::mark::IFieldmark* pFieldMark = dynamic_cast<sw::mark::IFieldmark*>( pMark );
622 + pFieldMark->SetFieldname( rType );
624 + return pMark;
627 + ::sw::mark::IMark* MarkManager::makeNoTextFieldBookmark( const SwPaM& rPaM,
628 + const rtl::OUString& rName,
629 + const rtl::OUString& rType)
631 + sw::mark::IMark* pMark = makeMark( rPaM, rName,
632 + IDocumentMarkAccess::CHECKBOX_FIELDMARK );
633 + sw::mark::IFieldmark* pFieldMark = dynamic_cast<sw::mark::IFieldmark*>( pMark );
634 + pFieldMark->SetFieldname( rType );
636 + return pMark;
639 ::sw::mark::IMark* MarkManager::getMarkForTxtNode(const SwTxtNode& rTxtNode,
640 const IDocumentMarkAccess::MarkType eType)
642 @@ -767,12 +820,7 @@
644 const_iterator_t pFieldmark = find_if(
645 m_vFieldmarks.begin(),
646 - // we do not need to check marks starting behind the positon
647 - lower_bound(
648 - m_vFieldmarks.begin(),
649 - m_vFieldmarks.end(),
650 - rPos,
651 - bind(&IMark::StartsAfter, _1, _2)),
652 + m_vFieldmarks.end( ),
653 bind(&IMark::IsCoveringPosition, _1, rPos));
654 if(pFieldmark == m_vFieldmarks.end()) return NULL;
655 return dynamic_cast<IFieldmark*>(pFieldmark->get());
656 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/core/edit/edtox.cxx sw/source/core/edit/edtox.cxx
657 --- sw/source/core/edit/edtox.cxx 2009-10-07 17:44:57.000000000 +0200
658 +++ sw/source/core/edit/edtox.cxx 2009-10-09 12:06:44.000000000 +0200
659 @@ -60,6 +60,9 @@
660 #ifndef _STATSTR_HRC
661 #include <statstr.hrc>
662 #endif
663 +#include <bookmrk.hxx>
664 +#include <ecmaflds.hxx>
667 using namespace ::com::sun::star;
668 using namespace ::com::sun::star::i18n;
669 @@ -235,6 +238,25 @@
670 return bRet;
673 +BOOL SwEditShell::UpdateField( sw::mark::IFieldmark &fieldBM)
675 +// SwDocShell* pDocSh = pDoc->GetDocShell();
676 + //@TODO implement me...; add undo etc...
677 + if ( pDoc && fieldBM.IsExpanded( ) ) {
678 + SwPosition aSttPos = fieldBM.GetMarkStart( );
679 + aSttPos.nContent++;
681 + SwPosition aEndPos = fieldBM.GetMarkEnd( );
682 + aEndPos.nContent--;
684 + SwPaM aPaM( aSttPos, aEndPos );
685 + pDoc->DeleteRange(aPaM);
686 + pDoc->InsertString(aPaM, String::CreateFromAscii("Implement me ;-)") );
688 + return TRUE;
692 /*--------------------------------------------------------------------
693 Beschreibung: Aktuelles Verzeichnis vor oder in dem der Cursor
694 steht
695 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/core/inc/MarkManager.hxx sw/source/core/inc/MarkManager.hxx
696 --- sw/source/core/inc/MarkManager.hxx 2009-08-13 16:14:40.000000000 +0200
697 +++ sw/source/core/inc/MarkManager.hxx 2009-10-09 10:53:45.000000000 +0200
698 @@ -43,8 +43,18 @@
699 public:
700 MarkManager(/*[in/out]*/ SwDoc& rDoc);
702 + void dumpFieldmarks( ) const;
704 // IDocumentMarkAccess
705 virtual ::sw::mark::IMark* makeMark(const SwPaM& rPaM, const ::rtl::OUString& rName, IDocumentMarkAccess::MarkType eMark);
707 + virtual sw::mark::IMark* makeFieldBookmark( const SwPaM& rPaM,
708 + const rtl::OUString& rName,
709 + const rtl::OUString& rType);
710 + virtual sw::mark::IMark* makeNoTextFieldBookmark( const SwPaM& rPaM,
711 + const rtl::OUString& rName,
712 + const rtl::OUString& rType);
714 virtual ::sw::mark::IMark* getMarkForTxtNode(const SwTxtNode& rTxtNode, IDocumentMarkAccess::MarkType eMark);
716 virtual void repositionMark(::sw::mark::IMark* io_pMark, const SwPaM& rPaM);
717 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/core/inc/bookmrk.hxx sw/source/core/inc/bookmrk.hxx
718 --- sw/source/core/inc/bookmrk.hxx 2009-10-07 17:44:57.000000000 +0200
719 +++ sw/source/core/inc/bookmrk.hxx 2009-10-09 10:53:45.000000000 +0200
720 @@ -48,26 +48,31 @@
722 public:
723 //getters
724 - virtual const SwPosition& GetMarkPos() const
725 + virtual SwPosition& GetMarkPos() const
726 { return *m_pPos1; }
727 virtual const ::rtl::OUString& GetName() const
728 { return m_aName; }
729 - virtual bool IsCoveringPosition(const SwPosition& rPos) const
730 - { return GetMarkStart() <= rPos && rPos <= GetMarkEnd(); };
731 - virtual const SwPosition& GetOtherMarkPos() const
732 + virtual bool IsCoveringPosition(const SwPosition& rPos) const;
733 + virtual SwPosition& GetOtherMarkPos() const
735 OSL_PRECOND(IsExpanded(), "<SwPosition::GetOtherMarkPos(..)> - I have no other Pos set." );
736 return *m_pPos2;
738 - virtual const SwPosition& GetMarkStart() const
739 + virtual SwPosition& GetMarkStart() const
741 - if(!m_pPos2 /* !IsExpanded()*/) return *m_pPos1;
742 - return *m_pPos1 < *m_pPos2 ? *m_pPos1 : *m_pPos2;
743 + if( !IsExpanded() ) return GetMarkPos( );
744 + if ( GetMarkPos( ) < GetOtherMarkPos( ) )
745 + return GetMarkPos();
746 + else
747 + return GetOtherMarkPos( );
749 - virtual const SwPosition& GetMarkEnd() const
750 + virtual SwPosition& GetMarkEnd() const
752 - if(!m_pPos2 /* !IsExpanded()*/ ) return *m_pPos1;
753 - return *m_pPos1 > *m_pPos2 ? *m_pPos1 : *m_pPos2;
754 + if( !IsExpanded() ) return GetMarkPos();
755 + if ( GetMarkPos( ) > GetOtherMarkPos( ) )
756 + return GetMarkPos( );
757 + else
758 + return GetOtherMarkPos( );
760 virtual bool IsExpanded() const
761 { return m_pPos2; }
762 @@ -80,6 +85,8 @@
763 virtual void ClearOtherMarkPos()
764 { m_pPos2.reset(); }
766 + virtual rtl::OUString toString( ) const;
768 virtual void Swap()
770 if(m_pPos2)
771 @@ -183,18 +190,30 @@
773 public:
774 Fieldmark(const SwPaM& rPaM);
777 // getters
778 ::rtl::OUString GetFieldname() const
779 { return m_aFieldname; }
780 ::rtl::OUString GetFieldHelptext() const
781 { return m_aFieldHelptext; }
783 + void addParam( rtl::OUString rParamName,
784 + rtl::OUString rParamValue,
785 + bool bReplaceExisting = true );
786 + void addParam( const char* paramName, int value );
787 + void addParams(std::vector<ParamPair_t>& params);
788 + int getNumOfParams() const;
789 + ParamPair_t getParam(int pos) const;
790 + ParamPair_t getParam(const char *name, const char *defaultValue) const;
792 // setters
793 void SetFieldname(const ::rtl::OUString& aFieldname)
794 { m_aFieldname = aFieldname; }
795 void SetFieldHelptext(const ::rtl::OUString& aFieldHelptext)
796 { m_aFieldHelptext = aFieldHelptext; }
797 + void invalidate( );
799 + virtual rtl::OUString toString( ) const;
800 private:
801 //int fftype; // Type: 0 = Text, 1 = Check Box, 2 = List
802 //bool ffprot;
803 @@ -202,7 +221,7 @@
804 ::rtl::OUString m_aFieldname;
805 ::rtl::OUString m_aFieldHelptext;
806 static const ::rtl::OUString our_sNamePrefix;
808 + std::vector<ParamPair_t> m_params;
811 class TextFieldmark
812 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/core/inc/crossrefbookmark.hxx sw/source/core/inc/crossrefbookmark.hxx
813 --- sw/source/core/inc/crossrefbookmark.hxx 2009-09-09 11:44:13.000000000 +0200
814 +++ sw/source/core/inc/crossrefbookmark.hxx 2009-10-09 10:53:45.000000000 +0200
815 @@ -48,10 +48,10 @@
816 const ::rtl::OUString& rPrefix);
818 // getters
819 - virtual const SwPosition& GetOtherMarkPos() const;
820 - virtual const SwPosition& GetMarkStart() const
821 + virtual SwPosition& GetOtherMarkPos() const;
822 + virtual SwPosition& GetMarkStart() const
823 { return *m_pPos1; }
824 - virtual const SwPosition& GetMarkEnd() const
825 + virtual SwPosition& GetMarkEnd() const
826 { return *m_pPos1; }
827 virtual bool IsExpanded() const
828 { return false; }
829 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/core/text/inftxt.cxx sw/source/core/text/inftxt.cxx
830 --- sw/source/core/text/inftxt.cxx 2009-10-07 17:44:57.000000000 +0200
831 +++ sw/source/core/text/inftxt.cxx 2009-10-09 10:53:45.000000000 +0200
832 @@ -1145,27 +1145,30 @@
834 SwRect aIntersect;
835 CalcRect( rPor, &aIntersect, 0 );
836 - if ( aIntersect.HasArea() ) {
837 - if (OnWin()) {
838 - OutputDevice* pOutDev = (OutputDevice*)GetOut();
839 - pOutDev->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
840 - pOutDev->SetLineColor( Color(220, 233, 245));
841 - pOutDev->SetFillColor( Color(220, 233, 245));
842 - pOutDev->DrawRect( aIntersect.SVRect() );
843 - pOutDev->Pop();
845 - const int delta=10;
846 - Rectangle r(aIntersect.Left()+delta, aIntersect.Top()+delta, aIntersect.Right()-delta, aIntersect.Bottom()-delta);
847 - pOut->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
848 - pOut->SetLineColor( Color(0, 0, 0));
849 - pOut->SetFillColor();
850 - pOut->DrawRect( r );
851 - if (checked) {
852 - pOut->DrawLine(r.TopLeft(), r.BottomRight());
853 - pOut->DrawLine(r.TopRight(), r.BottomLeft());
854 + if ( aIntersect.HasArea() )
856 + if (OnWin() && SwViewOption::IsFieldShadings() &&
857 + !GetOpt().IsPagePreview())
859 + OutputDevice* pOut_ = (OutputDevice*)GetOut();
860 + pOut_->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
861 + pOut_->SetFillColor( SwViewOption::GetFieldShadingsColor() );
862 + pOut_->SetLineColor();
863 + pOut_->DrawRect( aIntersect.SVRect() );
864 + pOut_->Pop();
866 + const int delta=10;
867 + Rectangle r(aIntersect.Left()+delta, aIntersect.Top()+delta, aIntersect.Right()-delta, aIntersect.Bottom()-delta);
868 + pOut->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
869 + pOut->SetLineColor( Color(0, 0, 0));
870 + pOut->SetFillColor();
871 + pOut->DrawRect( r );
872 + if (checked) {
873 + pOut->DrawLine(r.TopLeft(), r.BottomRight());
874 + pOut->DrawLine(r.TopRight(), r.BottomLeft());
876 pOut->Pop();
881 /*************************************************************************
882 @@ -1219,14 +1222,22 @@
885 bool bIsStartMark=(1==GetLen() && CH_TXT_ATR_FIELDSTART==GetTxt().GetChar(GetIdx()));
886 - if(pFieldmark) OSL_TRACE("Found Fieldmark");
887 + if(pFieldmark) {
888 + OSL_TRACE("Found Fieldmark");
889 +#if DEBUG
890 + rtl::OUString str = pFieldmark->toString( );
891 + fprintf( stderr, "%s\n", rtl::OUStringToOString( str, RTL_TEXTENCODING_UTF8 ).getStr( ) );
892 +#endif
894 if(bIsStartMark) OSL_TRACE("Found StartMark");
895 - if (OnWin() && (pFieldmark!=NULL || bIsStartMark))
896 + if (OnWin() && (pFieldmark!=NULL || bIsStartMark) &&
897 + SwViewOption::IsFieldShadings() &&
898 + !GetOpt().IsPagePreview())
900 OutputDevice* pOutDev = (OutputDevice*)GetOut();
901 pOutDev->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
902 - pOutDev->SetLineColor( Color(220, 233, 245));
903 - pOutDev->SetFillColor( Color(220, 233, 245));
904 + pOutDev->SetFillColor( SwViewOption::GetFieldShadingsColor() );
905 + pOutDev->SetLineColor( );
906 pOutDev->DrawRect( aIntersect.SVRect() );
907 pOutDev->Pop();
909 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/core/text/portxt.cxx sw/source/core/text/portxt.cxx
910 --- sw/source/core/text/portxt.cxx 2009-09-14 10:18:22.000000000 +0200
911 +++ sw/source/core/text/portxt.cxx 2009-10-09 10:53:45.000000000 +0200
912 @@ -55,11 +55,13 @@
913 #include <IMark.hxx>
914 #include <pam.hxx>
915 #include <doc.hxx>
916 +#include <ecmaflds.hxx>
918 #if OSL_DEBUG_LEVEL > 1
919 const sal_Char *GetLangName( const MSHORT nLang );
920 #endif
922 +using namespace ::sw::mark;
923 using namespace ::com::sun::star;
924 using namespace ::com::sun::star::i18n::ScriptType;
926 @@ -769,9 +771,10 @@
927 rPH.Text( GetLen(), GetWhichPor() );
930 -void SwFieldMarkPortion::Paint( const SwTxtPaintInfo & rInf) const
931 +void SwFieldMarkPortion::Paint( const SwTxtPaintInfo & /*rInf*/) const
933 - SwTxtPortion::Paint(rInf);
934 + // These shouldn't be painted!
935 + // SwTxtPortion::Paint(rInf);
938 sal_Bool SwFieldMarkPortion::Format( SwTxtFormatInfo & )
939 @@ -781,38 +784,95 @@
940 return ret;
943 +namespace ecma {
944 + static int getCurrentListIndex( IFieldmark* pBM,
945 + ::rtl::OUString *currentText = NULL )
947 + int currentIndex = pBM->getParam( ECMA_FORMDROPDOWN_RESULT, "0" ).second.toInt32();
948 + int idx = 0;
949 + for( int i = 0; i < pBM->getNumOfParams(); i++ )
951 + IFieldmark::ParamPair_t p = pBM->getParam( i );
952 + if ( p.first.compareToAscii( ECMA_FORMDROPDOWN_LISTENTRY ) == 0 )
954 + if ( idx == currentIndex )
956 + if ( currentText!=NULL ) *currentText=p.second;
957 + break;
958 + }
959 + else
960 + idx++;
961 + }
962 + }
963 + return idx;
965 +} /* ecma */
967 //FIXME Fieldbk
968 -//void SwFieldFormPortion::Paint( const SwTxtPaintInfo& rInf ) const
969 -void SwFieldFormPortion::Paint( const SwTxtPaintInfo& ) const
970 +void SwFieldFormPortion::Paint( const SwTxtPaintInfo& rInf ) const
972 -// SwTxtNode *pNd=const_cast<SwTxtNode*>(rInf.GetTxtFrm()->GetTxtNode());
973 -// const SwDoc *doc=pNd->GetDoc();
974 -// SwIndex aIndex( pNd, rInf.GetIdx() );
975 -// SwPosition aPosition(*pNd, aIndex);
976 -// pMark = dynamic_cast< doc->getFieldmarkFor(aPosition);
977 -// OSL_ENSURE(pMark,
978 -// "SwFieldFormPortion::Paint(..)"
979 -// " - Where is my form field bookmark???");
980 + SwTxtNode* pNd = const_cast<SwTxtNode*>(rInf.GetTxtFrm()->GetTxtNode());
981 + const SwDoc *doc=pNd->GetDoc();
982 + SwIndex aIndex( pNd, rInf.GetIdx() );
983 + SwPosition aPosition(*pNd, aIndex);
985 + IFieldmark* pBM = doc->getIDocumentMarkAccess( )->getFieldmarkFor( aPosition );
987 + OSL_ENSURE( pBM,
988 + "SwFieldFormPortion::Paint(..)"
989 + " - Where is my form field bookmark???");
991 -// bool checked=(pBM!=NULL?pBM->IsChecked():false);
992 -// rInf.DrawCheckBox(*this , checked);
993 + if ( pBM != NULL )
995 + if ( pBM->GetFieldname( ).equalsAscii( ECMA_FORMCHECKBOX ) )
996 + { // a checkbox...
997 + bool checked = pBM->getParam( ECMA_FORMCHECKBOX_CHECKED ).second.compareToAscii("on") == 0;
998 + rInf.DrawCheckBox( *this , checked);
999 + }
1000 + else if ( pBM->GetFieldname( ).equalsAscii( ECMA_FORMDROPDOWN ) )
1001 + { // a list...
1002 + rtl::OUString aTxt;
1003 + rInf.DrawViewOpt( *this, POR_FLD );
1004 + rInf.DrawText( aTxt, *this, 0, aTxt.getLength(), false );
1005 + }
1006 + else
1008 + assert(0); // unknown type...
1013 -sal_Bool SwFieldFormPortion::Format( SwTxtFormatInfo &rInf )
1014 +sal_Bool SwFieldFormPortion::Format( SwTxtFormatInfo & rInf )
1016 - sal_Bool ret=0;
1017 -// ret=SwTxtPortion::Format(rInf);
1019 - Width(rInf.GetTxtHeight());
1020 - Height(rInf.GetTxtHeight());
1021 - SetAscent(rInf.GetAscent());
1022 - //int h=rInf.GetTxtHeight();
1025 - Height(100);
1026 - SetAscent(100);
1028 + sal_Bool ret = 0;
1029 + SwTxtNode *pNd = const_cast < SwTxtNode * >( rInf.GetTxtFrm( )->GetTxtNode( ) );
1030 + const SwDoc *doc = pNd->GetDoc( );
1031 + SwIndex aIndex( pNd, rInf.GetIdx( ) );
1032 + SwPosition aPosition( *pNd, aIndex );
1033 + IFieldmark *pBM = doc->getIDocumentMarkAccess( )->getFieldmarkFor( aPosition );
1034 + ASSERT( pBM != NULL, "Where is my form field bookmark???" );
1035 + if ( pBM != NULL )
1037 + if ( pBM->GetFieldname( ).equalsAscii( ECMA_FORMCHECKBOX ) )
1039 + Width( rInf.GetTxtHeight( ) );
1040 + Height( rInf.GetTxtHeight( ) );
1041 + SetAscent( rInf.GetAscent( ) );
1043 + else if ( pBM->GetFieldname( ).equalsAscii( ECMA_FORMDROPDOWN ) )
1045 + ::rtl::OUString aTxt;
1046 + ecma::getCurrentListIndex( pBM, &aTxt );
1047 + SwPosSize aPosSize = rInf.GetTxtSize( aTxt );
1048 + Width( aPosSize.Width( ) );
1049 + Height( aPosSize.Height( ) );
1050 + SetAscent( rInf.GetAscent( ) );
1052 + else
1054 + assert( 0 ); // unknown type...
1057 return ret;
1060 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/core/unocore/unobkm.cxx sw/source/core/unocore/unobkm.cxx
1061 --- sw/source/core/unocore/unobkm.cxx 2009-10-07 17:44:57.000000000 +0200
1062 +++ sw/source/core/unocore/unobkm.cxx 2009-10-09 10:53:45.000000000 +0200
1063 @@ -7,7 +7,7 @@
1064 * OpenOffice.org - a multi-platform office productivity suite
1066 * $RCSfile: unobkm.cxx,v $
1067 - * $Revision: 1.17 $
1068 + * $Revision: 1.16 $
1070 * This file is part of OpenOffice.org.
1072 @@ -49,6 +49,7 @@
1073 #include <docsh.hxx>
1076 +using namespace ::sw::mark;
1077 using namespace ::com::sun::star;
1078 using namespace ::com::sun::star::lang;
1079 using namespace ::com::sun::star::uno;
1080 @@ -357,66 +358,85 @@
1081 , isReplacementObject(_isReplacementObject)
1084 -void SwXFieldmark::attachToRange(const uno::Reference< text::XTextRange > & xTextRange)
1085 +void SwXFieldmark::attachToRange( const uno::Reference < text::XTextRange >& xTextRange )
1086 throw( lang::IllegalArgumentException, uno::RuntimeException )
1088 - attachToRangeEx(xTextRange, (isReplacementObject?IDocumentMarkAccess::CHECKBOX_FIELDMARK:IDocumentMarkAccess::TEXT_FIELDMARK));
1089 + attachToRangeEx( xTextRange,
1090 + ( isReplacementObject ? IDocumentMarkAccess::CHECKBOX_FIELDMARK : IDocumentMarkAccess::TEXT_FIELDMARK ) );
1093 -::rtl::OUString SwXFieldmark::getDescription(void) throw( ::com::sun::star::uno::RuntimeException )
1094 +::rtl::OUString SwXFieldmark::getFieldType( void )
1095 + throw( ::com::sun::star::uno::RuntimeException )
1097 - vos::OGuard aGuard(Application::GetSolarMutex());
1098 -// TODO implement...
1099 -// if(!GetBookmark())
1100 - ::sw::mark::IFieldmark const * const pMark =
1101 - dynamic_cast< ::sw::mark::IFieldmark const * const>(GetBookmark());
1102 - if(!pMark)
1103 - throw uno::RuntimeException();
1104 - return pMark->GetFieldHelptext();
1105 + vos::OGuard aGuard( Application::GetSolarMutex( ) );
1106 + IMark* pMark = const_cast< IMark* >( GetBookmark( ) );
1107 + IFieldmark *pBkm = dynamic_cast< IFieldmark* > ( pMark );
1108 + if ( pBkm )
1109 + return pBkm->GetFieldname( );
1110 + else
1111 + throw uno::RuntimeException( );
1114 -::sal_Int16 SAL_CALL SwXFieldmark::getType() throw (::com::sun::star::uno::RuntimeException)
1115 +void SwXFieldmark::setFieldType( const::rtl::OUString & fieldType )
1116 + throw( ::com::sun::star::uno::RuntimeException )
1118 - vos::OGuard aGuard(Application::GetSolarMutex());
1119 - ::sw::mark::ICheckboxFieldmark const * const pAsCheckbox =
1120 - dynamic_cast< ::sw::mark::ICheckboxFieldmark const * const>(GetBookmark());
1121 - if(pAsCheckbox)
1122 - return 1;
1123 - return 0;
1124 + vos::OGuard aGuard( Application::GetSolarMutex( ) );
1125 + IMark* pMark = const_cast< IMark* >( GetBookmark( ) );
1126 + IFieldmark *pBkm = dynamic_cast< IFieldmark* >( pMark );
1127 + if ( pBkm )
1128 + pBkm->SetFieldname( fieldType );
1129 + else
1130 + throw uno::RuntimeException( );
1133 -::sal_Int16 SAL_CALL SwXFieldmark::getRes() throw (::com::sun::star::uno::RuntimeException)
1134 +sal_Int16 SwXFieldmark::getParamCount( )
1135 + throw( ::com::sun::star::uno::RuntimeException )
1137 - vos::OGuard aGuard(Application::GetSolarMutex());
1138 - ::sw::mark::ICheckboxFieldmark const * const pAsCheckbox =
1139 - dynamic_cast< ::sw::mark::ICheckboxFieldmark const * const>(GetBookmark());
1140 - if(pAsCheckbox && pAsCheckbox->IsChecked())
1141 - return 1;
1142 - return 0;
1143 + vos::OGuard aGuard( Application::GetSolarMutex( ) );
1144 + IMark* pMark = const_cast< IMark* >( GetBookmark( ) );
1145 + IFieldmark *pBkm = dynamic_cast< IFieldmark* >( pMark );
1146 + if ( pBkm )
1147 + return pBkm->getNumOfParams( );
1148 + else
1149 + throw uno::RuntimeException( );
1152 -//FIXME Remove Method
1153 -void SAL_CALL SwXFieldmark::setType( ::sal_Int16 ) throw (::com::sun::star::uno::RuntimeException)
1154 +rtl::OUString SwXFieldmark::getParamName( sal_Int16 i )
1155 + throw( ::com::sun::star::uno::RuntimeException )
1157 - vos::OGuard aGuard(Application::GetSolarMutex());
1158 - throw uno::RuntimeException();
1159 + vos::OGuard aGuard( Application::GetSolarMutex( ) );
1160 + IMark* pMark = const_cast< IMark* >( GetBookmark( ) );
1161 + IFieldmark *pBkm = dynamic_cast< IFieldmark* >( pMark );
1162 + if ( pBkm )
1163 + return pBkm->getParam( i ).first;
1164 + else
1165 + throw uno::RuntimeException( );
1168 -//FIXME Remove Method
1169 -void SAL_CALL SwXFieldmark::setRes( ::sal_Int16 ) throw (::com::sun::star::uno::RuntimeException)
1170 +::rtl::OUString SwXFieldmark::getParamValue( ::sal_Int16 i )
1171 + throw( ::com::sun::star::uno::RuntimeException )
1173 - vos::OGuard aGuard(Application::GetSolarMutex());
1174 - throw uno::RuntimeException();
1175 + vos::OGuard aGuard( Application::GetSolarMutex( ) );
1176 + IMark* pMark = const_cast< IMark* >( GetBookmark( ) );
1177 + IFieldmark *pBkm = dynamic_cast< IFieldmark* >( pMark );
1178 + if ( pBkm )
1179 + return pBkm->getParam( i ).second;
1180 + else
1181 + throw uno::RuntimeException( );
1184 -void SAL_CALL SwXFieldmark::setDescription( const ::rtl::OUString& description )
1185 - throw (::com::sun::star::uno::RuntimeException)
1187 - vos::OGuard aGuard(Application::GetSolarMutex());
1188 - const ::sw::mark::IFieldmark* pMark =
1189 - dynamic_cast<const ::sw::mark::IFieldmark*>(GetBookmark());
1190 - if(pMark)
1191 - const_cast< ::sw::mark::IFieldmark*>(pMark)->SetFieldHelptext(description);
1192 +void SwXFieldmark::addParam( const ::rtl::OUString & name,
1193 + const ::rtl::OUString & value,
1194 + sal_Bool replaceExisting )
1195 + throw( ::com::sun::star::uno::RuntimeException )
1197 + vos::OGuard aGuard( Application::GetSolarMutex( ) );
1198 + IMark* pMark = const_cast< IMark* >( GetBookmark( ) );
1199 + IFieldmark *pBkm = dynamic_cast< IFieldmark* >( pMark );
1200 + if ( pBkm )
1201 + pBkm->addParam( const_cast< rtl::OUString& >( name ),
1202 + const_cast< rtl::OUString& >( value ),
1203 + replaceExisting );
1204 else
1205 - throw uno::RuntimeException();
1206 + throw uno::RuntimeException( );
1208 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/filter/ww8/wrtw8nds.cxx sw/source/filter/ww8/wrtw8nds.cxx
1209 --- sw/source/filter/ww8/wrtw8nds.cxx 2009-10-09 14:55:24.000000000 +0200
1210 +++ sw/source/filter/ww8/wrtw8nds.cxx 2009-10-09 10:53:45.000000000 +0200
1211 @@ -110,8 +110,48 @@
1212 using namespace ::com::sun::star::i18n;
1213 using namespace sw::util;
1214 using namespace sw::types;
1215 +using namespace sw::mark;
1216 using namespace nsFieldFlags;
1219 +static String lcl_getFieldCode( const IFieldmark* pFieldmark ) {
1220 + ASSERT(pFieldmark!=NULL, "where is my fieldmark???");
1221 + if ( pFieldmark->GetFieldname( ).equalsAscii( ECMA_FORMTEXT ) ) {
1222 + return String::CreateFromAscii(" FORMTEXT ");
1223 + } else if ( pFieldmark->GetFieldname( ).equalsAscii( ECMA_FORMDROPDOWN ) ) {
1224 + return String::CreateFromAscii(" FORMDROPDOWN ");
1225 + } else if ( pFieldmark->GetFieldname( ).equalsAscii( ECMA_FORMCHECKBOX ) ) {
1226 + return String::CreateFromAscii(" FORMCHECKBOX ");
1227 + } else if ( pFieldmark->GetFieldname( ).equalsAscii( ECMA_TOC ) ) {
1228 + return String::CreateFromAscii(" TOC ");
1229 + } else if ( pFieldmark->GetFieldname( ).equalsAscii( ECMA_HYPERLINK ) ) {
1230 + return String::CreateFromAscii(" HYPERLINK ");
1231 + } else if ( pFieldmark->GetFieldname( ).equalsAscii( ECMA_PAGEREF ) ) {
1232 + return String::CreateFromAscii(" PAGEREF ");
1233 + } else {
1234 + return pFieldmark->GetFieldname();
1238 +ww::eField lcl_getFieldId( const IFieldmark* pFieldmark ) {
1239 + ASSERT(pFieldmark!=NULL, "where is my fieldmark???");
1240 + if ( pFieldmark->GetFieldname( ).equalsAscii( ECMA_FORMTEXT ) ) {
1241 + return ww::eFORMTEXT;
1242 + } else if ( pFieldmark->GetFieldname( ).equalsAscii( ECMA_FORMDROPDOWN ) ) {
1243 + return ww::eFORMDROPDOWN;
1244 + } else if ( pFieldmark->GetFieldname( ).equalsAscii( ECMA_FORMCHECKBOX ) ) {
1245 + return ww::eFORMCHECKBOX;
1246 + } else if ( pFieldmark->GetFieldname( ).equalsAscii( ECMA_TOC ) ) {
1247 + return ww::eTOC;
1248 + } else if ( pFieldmark->GetFieldname( ).equalsAscii( ECMA_HYPERLINK ) ) {
1249 + return ww::eHYPERLINK;
1250 + } else if ( pFieldmark->GetFieldname( ).equalsAscii( ECMA_PAGEREF ) ) {
1251 + return ww::ePAGEREF;
1252 + } else {
1253 + return ww::eUNKNOWN;
1254 + }
1257 /* \f */
1259 MSWordAttrIter::MSWordAttrIter( MSWordExportBase& rExport )
1260 @@ -266,19 +306,17 @@
1262 xub_StrLen nPos;
1263 xub_StrLen nMinPos = STRING_MAXLEN;
1264 + xub_StrLen i=0;
1266 const String aTxt = rNd.GetTxt();
1267 xub_StrLen pos = aTxt.Search(CH_TXT_ATR_FIELDSTART, nStartPos);
1268 - if( pos==STRING_NOTFOUND )
1270 - pos = aTxt.Search(CH_TXT_ATR_FIELDEND, nStartPos);
1271 - if( pos==STRING_NOTFOUND )
1272 - pos = aTxt.Search(CH_TXT_ATR_FORMELEMENT, nStartPos);
1274 - if( pos!=STRING_NOTFOUND )
1275 + if (pos==STRING_NOTFOUND)
1276 + pos=aTxt.Search(CH_TXT_ATR_FIELDEND, nStartPos);
1277 + if (pos==STRING_NOTFOUND)
1278 + pos=aTxt.Search(CH_TXT_ATR_FORMELEMENT, nStartPos);
1279 + if (pos!=STRING_NOTFOUND)
1280 nMinPos=pos;
1282 - xub_StrLen i=0;
1284 // first the redline, then the attributes
1285 if( pCurRedline )
1287 @@ -1704,12 +1742,14 @@
1288 ::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition );
1289 OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??" );
1291 - if ( pFieldmark )
1292 - AppendBookmark( pFieldmark->GetName(), true );
1293 - OutputField( NULL, ww::eFORMTEXT, String::CreateFromAscii( " FORMTEXT " ), WRITEFIELD_START | WRITEFIELD_CMD_START );
1294 - if ( pFieldmark )
1295 + if ( pFieldmark->GetFieldname().equalsAscii( ECMA_FORMTEXT ) )
1296 + AppendBookmark( pFieldmark->GetName(), false );
1297 + OutputField( NULL, lcl_getFieldId( pFieldmark ), lcl_getFieldCode( pFieldmark ), WRITEFIELD_START | WRITEFIELD_CMD_START );
1298 + if ( pFieldmark->GetFieldname( ).equalsAscii( ECMA_FORMTEXT ) )
1299 WriteFormData( *pFieldmark );
1300 - OutputField( NULL, ww::eFORMTEXT, String(), WRITEFIELD_CMD_END );
1301 + else if ( pFieldmark->GetFieldname( ).equalsAscii( ECMA_HYPERLINK ) )
1302 + WriteHyperlinkData( *pFieldmark );
1303 + OutputField( NULL, lcl_getFieldId( pFieldmark ), String(), WRITEFIELD_CMD_END );
1305 else if ( ch == CH_TXT_ATR_FIELDEND )
1307 @@ -1717,8 +1757,8 @@
1308 ::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition );
1309 OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??" );
1311 - OutputField( NULL, ww::eFORMTEXT, String(), WRITEFIELD_CLOSE );
1312 - if ( pFieldmark )
1313 + OutputField( NULL, lcl_getFieldId( pFieldmark ), String(), WRITEFIELD_CLOSE );
1314 + if ( pFieldmark->GetFieldname().equalsAscii( ECMA_FORMTEXT ) )
1315 AppendBookmark( pFieldmark->GetName(), false );
1317 else if ( ch == CH_TXT_ATR_FORMELEMENT )
1318 @@ -1727,13 +1767,18 @@
1319 ::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition );
1320 OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??" );
1322 - if ( pFieldmark )
1323 - AppendBookmark( pFieldmark->GetName(), true );
1324 - OutputField( NULL, ww::eFORMCHECKBOX, String::CreateFromAscii( " FORMCHECKBOX " ), WRITEFIELD_START | WRITEFIELD_CMD_START );
1325 - if ( pFieldmark )
1326 + bool isEcma = pFieldmark->GetFieldname( ).equalsAscii( ECMA_FORMDROPDOWN ) ||
1327 + pFieldmark->GetFieldname( ).equalsAscii( ECMA_FORMCHECKBOX );
1329 + if ( isEcma )
1330 + AppendBookmark( pFieldmark->GetName(), 0 );
1331 + OutputField( NULL, lcl_getFieldId( pFieldmark ),
1332 + lcl_getFieldCode( pFieldmark ),
1333 + WRITEFIELD_START | WRITEFIELD_CMD_START );
1334 + if ( isEcma )
1335 WriteFormData( *pFieldmark );
1336 - OutputField( NULL, ww::eFORMCHECKBOX, String(), WRITEFIELD_CMD_END | WRITEFIELD_CLOSE );
1337 - if ( pFieldmark )
1338 + OutputField( NULL, lcl_getFieldId( pFieldmark ), String(), WRITEFIELD_CMD_END | WRITEFIELD_CLOSE );
1339 + if ( isEcma )
1340 AppendBookmark( pFieldmark->GetName(), false );
1342 nLen -= static_cast< USHORT >( ofs );
1343 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/filter/ww8/wrtww8.cxx sw/source/filter/ww8/wrtww8.cxx
1344 --- sw/source/filter/ww8/wrtww8.cxx 2009-10-07 17:45:00.000000000 +0200
1345 +++ sw/source/filter/ww8/wrtww8.cxx 2009-10-09 10:53:45.000000000 +0200
1346 @@ -105,6 +105,7 @@
1347 #include "ww8attributeoutput.hxx"
1349 #include <IDocumentMarkAccess.hxx>
1350 +#include <ecmaflds.hxx>
1352 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
1353 #include <com/sun/star/document/XDocumentProperties.hpp>
1354 @@ -3435,11 +3436,20 @@
1355 const ::sw::mark::IFieldmark* pFieldmark = &rFieldmark;
1356 const ::sw::mark::ICheckboxFieldmark* pAsCheckbox = dynamic_cast< const ::sw::mark::ICheckboxFieldmark* >( pFieldmark );
1359 + ASSERT(rFieldmark.GetFieldname().equalsAscii( ECMA_FORMTEXT ) || rFieldmark.GetFieldname().equalsAscii( ECMA_FORMDROPDOWN ) || rFieldmark.GetFieldname().equalsAscii( ECMA_FORMCHECKBOX ), "Unknown field type!!!");
1360 + if ( ! ( rFieldmark.GetFieldname().equalsAscii( ECMA_FORMTEXT ) ||
1361 + rFieldmark.GetFieldname().equalsAscii( ECMA_FORMDROPDOWN ) ||
1362 + rFieldmark.GetFieldname().equalsAscii( ECMA_FORMCHECKBOX ) ) )
1363 + return;
1365 int type = 0; // TextFieldmark
1366 if ( pAsCheckbox )
1367 type = 1;
1368 + if ( rFieldmark.GetFieldname().equalsAscii( ECMA_FORMDROPDOWN ) )
1369 + type=2;
1371 - const ::rtl::OUString ffname = rFieldmark.GetFieldname();
1372 + const String ffname = rFieldmark.getParam("name").second;
1374 ULONG nDataStt = pDataStrm->Tell();
1375 pChpPlc->AppendFkpEntry(Strm().Tell());
1376 @@ -3461,14 +3471,27 @@
1377 sal_uInt8 aFldHeader[] =
1379 0xFF, 0xFF, 0xFF, 0xFF, // Unicode Marker...
1380 - 0, 0, 0, 0//, 0, 0, 0, 0
1381 + 0, 0, 0, 0, 0, 0 //, 0, 0
1384 aFldHeader[4] |= (type & 0x03);
1385 int ffres = 0; // rFieldmark.GetFFRes();
1386 if ( pAsCheckbox && pAsCheckbox->IsChecked() )
1387 ffres = 1;
1388 + else if ( type == 2 )
1389 + ffres = rFieldmark.getParam( ECMA_FORMDROPDOWN_RESULT, "0" ).second.toInt32();
1390 aFldHeader[4] |= ( (ffres<<2) & 0x7C );
1392 + std::vector< ::rtl::OUString > aListItems;
1393 + if (type==2)
1395 + aFldHeader[5] |= 0x80; // ffhaslistbox
1396 + for ( int i = 0; i < rFieldmark.getNumOfParams() ; i++ )
1398 + if (rFieldmark.getParam(i).first.compareToAscii(ECMA_FORMDROPDOWN_LISTENTRY)==0)
1399 + aListItems.push_back(rFieldmark.getParam(i).second);
1403 const ::rtl::OUString ffdeftext;
1404 const ::rtl::OUString ffformat;
1405 @@ -3477,6 +3500,7 @@
1406 const ::rtl::OUString ffentrymcr;
1407 const ::rtl::OUString ffexitmcr;
1410 const sal_uInt8 aFldData[] =
1412 0,0,0,0, // len of struct
1413 @@ -3489,13 +3513,22 @@
1415 int slen = sizeof( aFldData )
1416 + sizeof( aFldHeader )
1417 - + 2*ffname.getLength() + 4
1418 + + 2*ffname.Len() + 4
1419 + 2*ffdeftext.getLength() + 4
1420 + 2*ffformat.getLength() + 4
1421 + 2*ffhelptext.getLength() + 4
1422 + 2*ffstattext.getLength() + 4
1423 + 2*ffentrymcr.getLength() + 4
1424 + 2*ffexitmcr.getLength() + 4;
1425 + if ( type==2 ) {
1426 + slen += 2; // for 0xFF, 0xFF
1427 + slen += 4; // for num of list items
1428 + const int items = aListItems.size();
1429 + for( int i = 0; i < items; i++ ) {
1430 + rtl::OUString item = aListItems[i];
1431 + slen += 2 * item.getLength() + 2;
1434 #ifdef OSL_BIGENDIAN
1435 slen = SWAPLONG( slen );
1436 #endif // OSL_BIGENDIAN
1437 @@ -3506,6 +3539,7 @@
1439 len = sizeof( aFldHeader );
1440 OSL_ENSURE( len == 8, "SwWW8Writer::WriteFormData(..) - wrong aFldHeader length" );
1442 pDataStrm->Write( aFldHeader, len );
1444 SwWW8Writer::WriteString_xstz( *pDataStrm, ffname, true ); // Form field name
1445 @@ -3520,11 +3554,20 @@
1446 SwWW8Writer::WriteString_xstz( *pDataStrm, String( ffstattext ), true );
1447 SwWW8Writer::WriteString_xstz( *pDataStrm, String( ffentrymcr ), true );
1448 SwWW8Writer::WriteString_xstz( *pDataStrm, String( ffexitmcr ), true );
1449 -// if (type==2) {
1450 -// // 0xFF, 0xFF
1451 -// // sal_uInt32 number of strings
1452 -// // (sal_uInt16 len; sal_uInt16 unicode char[len])*num of strings
1453 -// }
1454 + if (type==2) {
1455 + *pDataStrm<<(sal_uInt16)0xFFFF;
1456 + const int items=aListItems.size();
1457 + *pDataStrm<<(sal_uInt32)items;
1458 + for(int i=0;i<items;i++) {
1459 + rtl::OUString item=aListItems[i];
1460 + SwWW8Writer::WriteString_xstz( *pDataStrm, item, false );
1465 +void WW8Export::WriteHyperlinkData( const sw::mark::IFieldmark& rFieldmark )
1467 + //@TODO implement me !!!
1470 void WW8AttributeOutput::TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer_t pNodeInfoInner )
1471 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/filter/ww8/wrtww8.hxx sw/source/filter/ww8/wrtww8.hxx
1472 --- sw/source/filter/ww8/wrtww8.hxx 2009-09-09 11:44:15.000000000 +0200
1473 +++ sw/source/filter/ww8/wrtww8.hxx 2009-10-09 10:53:45.000000000 +0200
1474 @@ -709,6 +709,7 @@
1476 /// Write the data of the form field
1477 virtual void WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ) = 0;
1478 + virtual void WriteHyperlinkData( const ::sw::mark::IFieldmark& rFieldmark ) = 0;
1480 virtual void DoComboBox(const rtl::OUString &rName,
1481 const rtl::OUString &rHelp,
1482 @@ -1076,6 +1077,7 @@
1484 /// Write the data of the form field
1485 virtual void WriteFormData( const ::sw::mark::IFieldmark& rFieldmark );
1486 + virtual void WriteHyperlinkData( const ::sw::mark::IFieldmark& rFieldmark );
1488 /// Fields.
1489 WW8_WrPlcFld* CurrentFieldPlc() const;
1490 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par.cxx
1491 --- sw/source/filter/ww8/ww8par.cxx 2009-10-09 14:56:40.000000000 +0200
1492 +++ sw/source/filter/ww8/ww8par.cxx 2009-10-09 10:53:45.000000000 +0200
1493 @@ -1664,7 +1664,6 @@
1494 maOldApos.push_back(false);
1495 maOldApos.swap(pRdr->maApos);
1496 maOldFieldStack.swap(pRdr->maFieldStack);
1497 - maFieldCtxStack.swap(pRdr->maNewFieldCtxStack);
1500 void WW8ReaderSave::Restore( SwWW8ImplReader* pRdr )
1501 @@ -1711,7 +1710,6 @@
1502 pRdr->pPlcxMan->RestoreAllPLCFx(maPLCFxSave);
1503 pRdr->maApos.swap(maOldApos);
1504 pRdr->maFieldStack.swap(maOldFieldStack);
1505 - pRdr->maNewFieldCtxStack.swap(maFieldCtxStack);
1508 void SwWW8ImplReader::Read_HdFtFtnText( const SwNodeIndex* pSttIdx,
1509 @@ -2830,29 +2828,6 @@
1510 case 0x15:
1511 if( !bSpec ) // Juristenparagraph
1512 cInsert = '\xa7';
1513 - else
1515 - // 0x15 is special --> so it's our field end mark...;
1516 - // hmmm what about field marks not handled by us??, maybe a problem with nested fields;
1517 - // probably an area of bugs... [well release quick and release often....]
1518 - if (!maNewFieldCtxStack.empty() && pPaM!=NULL && pPaM->GetPoint()!=NULL)
1520 - ::boost::scoped_ptr<WW8NewFieldCtx> pFieldCtx(maNewFieldCtxStack.back());
1521 - maNewFieldCtxStack.pop_back();
1522 - SwPosition aEndPos = *pPaM->GetPoint();
1523 - SwPaM aFldPam(pFieldCtx->GetPtNode(), pFieldCtx->GetPtCntnt(), aEndPos.nNode, aEndPos.nContent.GetIndex());
1524 - IDocumentMarkAccess* const pMarkAccess = rDoc.getIDocumentMarkAccess();
1525 - ::sw::mark::IFieldmark* pFieldmark =
1526 - dynamic_cast< ::sw::mark::IFieldmark*>(pMarkAccess->makeMark(
1527 - aFldPam,
1528 - pFieldCtx->GetBookmarkName(),
1529 - IDocumentMarkAccess::TEXT_FIELDMARK));
1530 - OSL_ENSURE(pFieldmark!=NULL,
1531 - "hmmm; why was the bookmark not created?");
1532 - if (pFieldmark)
1533 - pFieldCtx->SetCurrentFieldParamsTo(pFieldmark);
1536 break;
1537 case 0x9:
1538 cInsert = '\x9'; // Tab
1539 @@ -3664,7 +3639,14 @@
1541 bool bInsertSection = (aIter != aStart) ? (aIter->IsContinous() && bThisAndPreviousAreCompatible): false;
1542 bool bInsertPageDesc = !bInsertSection;
1543 - bool bProtected = !bUseEnhFields && SectionIsProtected(*aIter); // do we really need this ?? I guess I have a different logic in editshell which disales this...
1544 + bool bProtected = SectionIsProtected(*aIter); // do we really need this ?? I guess I have a different logic in editshell which disales this...
1545 + if (bUseEnhFields && mrReader.pWDop->fProtEnabled && aIter->IsNotProtected()) {
1546 + // here we have the special case that the whole document is protected, with the execption of this section.
1547 + // I want to address this when I do the section rework, so for the moment we disable the overall protection then...
1548 + mrReader.rDoc.set(IDocumentSettingAccess::PROTECT_FORM, false );
1552 if (bInsertPageDesc)
1555 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/filter/ww8/ww8par.hxx sw/source/filter/ww8/ww8par.hxx
1556 --- sw/source/filter/ww8/ww8par.hxx 2009-10-09 14:56:35.000000000 +0200
1557 +++ sw/source/filter/ww8/ww8par.hxx 2009-10-09 10:53:45.000000000 +0200
1558 @@ -60,6 +60,8 @@
1559 #include "ww8glsy.hxx"
1560 #include "wrtww8.hxx"
1561 #include "../inc/msfilter.hxx"
1562 +#include <ecmaflds.hxx>
1563 +#include <IMark.hxx>
1565 class SwDoc;
1566 class SwPaM;
1567 @@ -362,6 +364,8 @@
1568 Position(const SwPosition &rPos);
1569 Position(const Position &rPos);
1570 operator SwPosition() const;
1571 + SwNodeIndex GetPtNode() { return maPtNode; };
1572 + xub_StrLen GetPtCntnt() { return mnPtCntnt; };
1576 @@ -369,36 +373,30 @@
1577 class FieldEntry
1579 public:
1580 - sw::hack::Position maStartPos;
1581 - sal_uInt16 mnFieldId;
1582 - FieldEntry(SwPosition &rPos, sal_uInt16 nFieldId) throw();
1583 - FieldEntry(const FieldEntry &rOther) throw();
1584 - FieldEntry &operator=(const FieldEntry &rOther) throw();
1585 - void Swap(FieldEntry &rOther) throw();
1587 + typedef ::std::vector<sw::mark::IFieldmark::ParamPair_t> Params_t;
1589 -class WW8NewFieldCtx
1591 private:
1592 - SwNodeIndex maPtNode;
1593 - xub_StrLen mnPtCntnt;
1594 ::rtl::OUString msBookmarkName;
1595 ::rtl::OUString msMarkType;
1596 - typedef ::std::pair< ::rtl::OUString, ::rtl::OUString> Param_t;
1597 - typedef ::std::vector< Param_t > Params_t;
1598 Params_t maParams;
1599 - SwPaM * mpPaM;
1601 public:
1602 - WW8NewFieldCtx(SwPosition &aStartPos, ::rtl::OUString sBookmarkName, ::rtl::OUString sMarkType);
1603 - ~WW8NewFieldCtx();
1604 + sw::hack::Position maStartPos;
1605 + sal_uInt16 mnFieldId;
1606 + FieldEntry(SwPosition &rPos, sal_uInt16 nFieldId) throw();
1607 + FieldEntry(const FieldEntry &rOther) throw();
1608 + FieldEntry &operator=(const FieldEntry &rOther) throw();
1609 + void Swap(FieldEntry &rOther) throw();
1611 + SwNodeIndex GetPtNode() { return maStartPos.GetPtNode(); };
1612 + xub_StrLen GetPtCntnt() { return maStartPos.GetPtCntnt(); };
1614 - SwNodeIndex GetPtNode() { return maPtNode; };
1615 - xub_StrLen GetPtCntnt() { return mnPtCntnt; };
1616 ::rtl::OUString GetBookmarkName();
1617 - ::rtl::OUString GetMarkType();
1618 + ::rtl::OUString GetBookmarkType();
1619 + void SetBookmarkName(::rtl::OUString bookmarkName);
1620 + void SetBookmarkType(::rtl::OUString bookmarkType);
1621 void AddParam(::rtl::OUString name, ::rtl::OUString value);
1622 - void SetCurrentFieldParamsTo(::sw::mark::IFieldmark* pFieldmark);
1623 + Params_t &getParams();
1627 @@ -434,7 +432,6 @@
1628 bool mbWasParaEnd;
1629 bool mbHasBorder;
1630 bool mbFirstPara;
1631 - std::deque<WW8NewFieldCtx *> maFieldCtxStack;
1632 public:
1633 WW8ReaderSave(SwWW8ImplReader* pRdr, WW8_CP nStart=-1);
1634 void Restore(SwWW8ImplReader* pRdr);
1635 @@ -889,9 +886,6 @@
1636 std::deque<FieldEntry> maFieldStack;
1637 typedef std::deque<FieldEntry>::const_iterator mycFieldIter;
1639 - typedef std::deque<WW8NewFieldCtx *> WW8NewFieldCtxStack_t;
1640 - WW8NewFieldCtxStack_t maNewFieldCtxStack;
1643 A stack of open footnotes. Should only be one in it at any time.
1645 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/filter/ww8/ww8par3.cxx sw/source/filter/ww8/ww8par3.cxx
1646 --- sw/source/filter/ww8/ww8par3.cxx 2009-10-09 16:13:55.000000000 +0200
1647 +++ sw/source/filter/ww8/ww8par3.cxx 2009-10-09 16:30:58.000000000 +0200
1648 @@ -96,66 +96,14 @@
1650 #include <IMark.hxx>
1651 #include <svtools/fltrcfg.hxx>
1652 +#include <ecmaflds.hxx>
1654 #include <stdio.h>
1656 using namespace com::sun::star;
1657 using namespace sw::util;
1658 using namespace sw::types;
1660 -WW8NewFieldCtx::WW8NewFieldCtx(SwPosition &aStartPos, ::rtl::OUString sBookmarkName, ::rtl::OUString sMarkType)
1661 - : maPtNode(aStartPos.nNode)
1662 - , mnPtCntnt(aStartPos.nContent.GetIndex())
1663 - , msBookmarkName(sBookmarkName)
1664 - , msMarkType(sMarkType)
1665 - , mpPaM(NULL)
1670 -WW8NewFieldCtx::~WW8NewFieldCtx()
1672 - if (mpPaM) delete mpPaM;
1675 -::rtl::OUString WW8NewFieldCtx::GetBookmarkName()
1677 - return msBookmarkName;
1680 -::rtl::OUString WW8NewFieldCtx::GetMarkType()
1682 - return msMarkType;
1685 -void WW8NewFieldCtx::AddParam(::rtl::OUString name, ::rtl::OUString value)
1687 - maParams.push_back( Param_t(name, value) );
1690 -void WW8NewFieldCtx::SetCurrentFieldParamsTo(::sw::mark::IFieldmark* pFieldmark)
1692 - for(Params_t::iterator i=maParams.begin();i!=maParams.end();i++)
1694 - ::rtl::OUString aName=i->first;
1695 - ::rtl::OUString aValue=i->second;
1696 - if(aName.compareToAscii("Description")==0)
1698 - pFieldmark->SetFieldHelptext(aValue);
1700 - else if(aName.compareToAscii("Name")==0)
1702 - pFieldmark->SetFieldname(aValue);
1704 - else if(aName.compareToAscii("Result")==0)
1706 - ::sw::mark::ICheckboxFieldmark* pAsCheckbox =
1707 - dynamic_cast< ::sw::mark::ICheckboxFieldmark* >(pFieldmark);
1708 - if(pAsCheckbox)
1709 - pAsCheckbox->SetChecked(aValue.toInt32()==0);
1713 +using namespace sw::mark;
1715 //-----------------------------------------
1716 // UNO-Controls
1717 @@ -233,10 +181,10 @@
1720 if (aBookmarkName.Len()>0) {
1721 - WW8NewFieldCtx *pFieldCtx=new WW8NewFieldCtx(*pPaM->GetPoint(), aBookmarkName, ::rtl::OUString::createFromAscii("ecma.office-open-xml.field.FORMTEXT"));
1722 - maNewFieldCtxStack.push_back(pFieldCtx);
1723 - pFieldCtx->AddParam(::rtl::OUString::createFromAscii("Description"), aFormula.sToolTip);
1724 - pFieldCtx->AddParam(::rtl::OUString::createFromAscii("Name"), aFormula.sTitle);
1725 + maFieldStack.back().SetBookmarkName(aBookmarkName);
1726 + maFieldStack.back().SetBookmarkType(::rtl::OUString::createFromAscii(ECMA_FORMTEXT));
1727 + maFieldStack.back().AddParam(::rtl::OUString::createFromAscii("Description"), aFormula.sToolTip);
1728 + maFieldStack.back().AddParam(::rtl::OUString::createFromAscii("Name"), aFormula.sTitle);
1730 return FLD_TEXT;
1732 @@ -279,19 +227,22 @@
1733 aBookmarkName=pB->GetUniqueBookmarkName(aFormula.sTitle);
1736 - if (aBookmarkName.Len()>0) {
1737 - ::sw::mark::ICheckboxFieldmark* pFieldmark =
1738 - dynamic_cast< ::sw::mark::ICheckboxFieldmark*>(rDoc.getIDocumentMarkAccess()->makeMark(
1739 - *pPaM,
1740 - aBookmarkName,
1741 - IDocumentMarkAccess::CHECKBOX_FIELDMARK));
1742 - OSL_ENSURE(pFieldmark,
1743 - "hmmm; why was the bookmark not created?");
1744 - if(pFieldmark)
1746 - pFieldmark->SetFieldname(aFormula.sTitle);
1747 - pFieldmark->SetFieldHelptext(aFormula.sToolTip);
1748 - pFieldmark->SetChecked(aFormula.nChecked!=0);
1749 + if (aBookmarkName.Len()>0)
1751 + IDocumentMarkAccess* pMarksAccess = rDoc.getIDocumentMarkAccess( );
1752 + IFieldmark* pFieldmark = dynamic_cast<IFieldmark*>( pMarksAccess->makeNoTextFieldBookmark(
1753 + *pPaM, aBookmarkName,
1754 + rtl::OUString::createFromAscii( ECMA_FORMCHECKBOX ) ) );
1755 + ASSERT(pFieldmark!=NULL, "hmmm; why was the bookmark not created?");
1756 + if (pFieldmark!=NULL) {
1757 + pFieldmark->addParam(
1758 + rtl::OUString::createFromAscii(ECMA_FORMCHECKBOX_NAME),
1759 + rtl::OUString( aFormula.sTitle ) );
1760 + pFieldmark->addParam(
1761 + rtl::OUString::createFromAscii(ECMA_FORMCHECKBOX_HELPTEXT), aFormula.sToolTip);
1762 + pFieldmark->addParam(
1763 + rtl::OUString::createFromAscii(ECMA_FORMCHECKBOX_CHECKED),
1764 + ::rtl::OUString::createFromAscii(aFormula.nChecked!=0?"on":"off"));
1765 // set field data here...
1768 @@ -306,24 +257,75 @@
1769 if (0x01 == rStr.GetChar(writer_cast<xub_StrLen>(pF->nLCode-1)))
1770 ImportFormulaControl(aFormula,pF->nSCode+pF->nLCode-1, WW8_CT_DROPDOWN);
1772 - SwDropDownField aFld(
1773 - (SwDropDownFieldType*)rDoc.GetSysFldType(RES_DROPDOWN));
1774 + const SvtFilterOptions* pOpt = SvtFilterOptions::Get();
1775 + sal_Bool bUseEnhFields=(pOpt && pOpt->IsUseEnhancedFields());
1777 + if (!bUseEnhFields)
1779 + SwDropDownField aFld((SwDropDownFieldType*)rDoc.GetSysFldType(RES_DROPDOWN));
1781 - aFld.SetName(aFormula.sTitle);
1782 - aFld.SetHelp(aFormula.sHelp);
1783 - aFld.SetToolTip(aFormula.sToolTip);
1784 + aFld.SetName(aFormula.sTitle);
1785 + aFld.SetHelp(aFormula.sHelp);
1786 + aFld.SetToolTip(aFormula.sToolTip);
1788 + if (!aFormula.maListEntries.empty())
1790 + aFld.SetItems(aFormula.maListEntries);
1791 + int nIndex = aFormula.fDropdownIndex < aFormula.maListEntries.size() ? aFormula.fDropdownIndex : 0;
1792 + aFld.SetSelectedItem(aFormula.maListEntries[nIndex]);
1795 - if (!aFormula.maListEntries.empty())
1796 + rDoc.InsertPoolItem(*pPaM, SwFmtFld(aFld), 0);
1797 + return FLD_OK;
1799 + else
1801 - aFld.SetItems(aFormula.maListEntries);
1802 - int nIndex = aFormula.fDropdownIndex < aFormula.maListEntries.size()
1803 - ? aFormula.fDropdownIndex : 0;
1804 - aFld.SetSelectedItem(aFormula.maListEntries[nIndex]);
1806 + //@TODO fix: copy pasting here!!!!!!!!!!!!!!
1807 + //REVIEW: don't let this throught.... sometime I forget to get rid of my proof of concept stuff. Please kindly remind me!!!!!
1809 + String aBookmarkName;
1810 + WW8PLCFx_Book* pB = pPlcxMan->GetBook();
1811 + if (pB!=NULL)
1813 + WW8_CP currentCP=pF->nSCode;
1814 + WW8_CP currentLen=pF->nLen;
1816 + USHORT bkmFindIdx;
1817 + String aBookmarkFind=pB->GetBookmark(currentCP-1, currentCP+currentLen-1, bkmFindIdx);
1819 - rDoc.InsertPoolItem(*pPaM, SwFmtFld(aFld), 0);
1820 + if (aBookmarkFind.Len()>0)
1822 + pB->SetStatus(bkmFindIdx, BOOK_FIELD); // mark as consumed by field
1823 + if (aBookmarkFind.Len()>0)
1824 + aBookmarkName=aBookmarkFind;
1828 - return FLD_OK;
1829 + if (pB!=NULL && aBookmarkName.Len()==0)
1830 + aBookmarkName=pB->GetUniqueBookmarkName(aFormula.sTitle);
1832 + if (aBookmarkName.Len()>0)
1834 + IDocumentMarkAccess* pMarksAccess = rDoc.getIDocumentMarkAccess( );
1835 + IFieldmark *pFieldmark = dynamic_cast<IFieldmark*>(
1836 + pMarksAccess->makeNoTextFieldBookmark( *pPaM, aBookmarkName,
1837 + ::rtl::OUString::createFromAscii( ECMA_FORMDROPDOWN ) ) );
1838 + ASSERT(pFieldmark!=NULL, "hmmm; why was the bookmark not created?");
1839 + if ( pFieldmark != NULL )
1841 + rtl::OUString sListEntry=rtl::OUString::createFromAscii( ECMA_FORMDROPDOWN_LISTENTRY );
1842 + std::vector<String>::iterator it = aFormula.maListEntries.begin();
1843 + for( ; it != aFormula.maListEntries.end(); it++ )
1844 + pFieldmark->addParam(sListEntry, *it, false);
1846 + int nIndex = aFormula.fDropdownIndex < aFormula.maListEntries.size() ? aFormula.fDropdownIndex : 0;
1847 + pFieldmark->addParam(ECMA_FORMDROPDOWN_RESULT, nIndex);
1848 + // set field data here...
1852 + return FLD_OK;
1856 void SwWW8ImplReader::DeleteFormImpl()
1857 @@ -2140,11 +2142,18 @@
1859 if((aPic.lcb > 0x3A) && !pDataStream->GetError() )
1861 - pDataStream->Seek( nPicLocFc + aPic.cbHeader );
1862 +#if 0 // some debug fun; remove this later...
1863 int len=aPic.lcb-aPic.cbHeader;
1864 char *pBuf=(char*)malloc(len);
1865 pDataStream->Read( pBuf, len);
1866 + static int _h=0;
1867 + char fname[255];
1868 + sprintf(fname, "data%03i.data", _h++);
1869 + FILE *out=fopen(fname, "wb");
1870 + fwrite(pBuf, len, 1, out);
1871 + fclose(out);
1872 pDataStream->Seek( nPicLocFc + aPic.cbHeader );
1873 +#endif
1874 aFormula.FormulaRead(nWhich,pDataStream);
1875 bRet = true;
1877 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/filter/ww8/ww8par5.cxx sw/source/filter/ww8/ww8par5.cxx
1878 --- sw/source/filter/ww8/ww8par5.cxx 2009-10-09 14:56:35.000000000 +0200
1879 +++ sw/source/filter/ww8/ww8par5.cxx 2009-10-09 10:53:45.000000000 +0200
1880 @@ -88,22 +88,26 @@
1881 #include <fmtclds.hxx>
1882 #include <pagedesc.hxx>
1883 #include <SwStyleNameMapper.hxx>
1885 +#include <IMark.hxx>
1887 #include "ww8scan.hxx" // WW8FieldDesc
1888 #include "ww8par.hxx"
1889 #include "ww8par2.hxx"
1890 #include "writerhelper.hxx"
1891 #include "fields.hxx"
1892 +#include <svtools/fltrcfg.hxx>
1894 #include <algorithm> // #i24377#
1896 +//#define WW_NATIVE_TOC 0
1898 #define MAX_FIELDLEN 64000
1900 #define WW8_TOX_LEVEL_DELIM ':'
1902 using namespace ::com::sun::star;
1903 using namespace sw::util;
1904 +using namespace sw::mark;
1905 using namespace std; // #i24377#
1906 using namespace nsSwDocInfoSubType;
1908 @@ -328,9 +332,11 @@
1910 //"_Toc*" and "_Hlt*" are unnecessary
1911 const String* pName = pB->GetName();
1912 +#if !defined(WW_NATIVE_TOC)
1913 if( !pName || pName->EqualsIgnoreCaseAscii( "_Toc", 0, 4 )
1914 || pName->EqualsIgnoreCaseAscii( "_Hlt", 0, 4 ) )
1915 return 0;
1916 +#endif
1918 //JP 16.11.98: ToUpper darf auf keinen Fall gemacht werden, weil der
1919 //Bookmark- name ein Hyperlink-Ziel sein kann!
1920 @@ -672,6 +678,9 @@
1921 if (!pF || !pF->EndPosIsFieldEnd())
1922 return nRet;
1924 + const SvtFilterOptions* pOpt = SvtFilterOptions::Get();
1925 + sal_Bool bUseEnhFields=(pOpt && pOpt->IsUseEnhancedFields());
1927 ASSERT(!maFieldStack.empty(), "Empty field stack\n");
1928 if (!maFieldStack.empty())
1930 @@ -683,9 +692,40 @@
1931 nRet = maFieldStack.back().mnFieldId;
1932 switch (nRet)
1934 + case 70:
1935 + if (bUseEnhFields && pPaM!=NULL && pPaM->GetPoint()!=NULL) {
1936 + SwPosition aEndPos = *pPaM->GetPoint();
1937 + SwPaM aFldPam( maFieldStack.back().GetPtNode(), maFieldStack.back().GetPtCntnt(), aEndPos.nNode, aEndPos.nContent.GetIndex());
1938 + IDocumentMarkAccess* pMarksAccess = rDoc.getIDocumentMarkAccess( );
1939 + IFieldmark *pFieldmark = dynamic_cast<IFieldmark*>( pMarksAccess->makeFieldBookmark(
1940 + aFldPam, maFieldStack.back().GetBookmarkName(), ::rtl::OUString::createFromAscii(ECMA_FORMTEXT ) ) );
1941 + ASSERT(pFieldmark!=NULL, "hmmm; why was the bookmark not created?");
1942 + if (pFieldmark!=NULL) {
1943 + pFieldmark->addParams(maFieldStack.back().getParams());
1946 + break;
1947 +#if defined(WW_NATIVE_TOC)
1948 + case 8: // TOX_INDEX
1949 + case 13: // TOX_CONTENT
1950 + case 88: // HYPERLINK
1951 + case 37: // REF
1952 + if (pPaM!=NULL && pPaM->GetPoint()!=NULL) {
1954 + SwPosition aEndPos = *pPaM->GetPoint();
1955 + SwPaM aFldPam( maFieldStack.back().GetPtNode(), maFieldStack.back().GetPtCntnt(), aEndPos.nNode, aEndPos.nContent.GetIndex());
1956 + SwFieldBookmark *pFieldmark=(SwFieldBookmark*)rDoc.makeFieldBookmark(aFldPam, maFieldStack.back().GetBookmarkName(), maFieldStack.back().GetBookmarkType());
1957 + ASSERT(pFieldmark!=NULL, "hmmm; why was the bookmark not created?");
1958 + if (pFieldmark!=NULL) {
1959 + pFieldmark->addParams(maFieldStack.back().getParams());
1962 + break;
1963 +#else
1964 case 88:
1965 pCtrlStck->SetAttr(*pPaM->GetPoint(),RES_TXTATR_INETFMT);
1966 break;
1967 +#endif
1968 case 36:
1969 case 68:
1970 //Move outside the section associated with this type of field
1971 @@ -703,6 +743,10 @@
1973 switch (nFieldCode)
1975 +#if defined(WW_NATIVE_TOC)
1976 + case 8: // allow recursive field in TOC...
1977 + case 13: // allow recursive field in TOC...
1978 +#endif
1979 case 36:
1980 case 68:
1981 case 79:
1982 @@ -741,6 +785,36 @@
1983 return *this;
1986 +::rtl::OUString FieldEntry::GetBookmarkName()
1988 + return msBookmarkName;
1991 +::rtl::OUString FieldEntry::GetBookmarkType()
1993 + return msMarkType;
1996 +void FieldEntry::SetBookmarkName(::rtl::OUString bookmarkName)
1998 + msBookmarkName=bookmarkName;
2001 +void FieldEntry::SetBookmarkType(::rtl::OUString bookmarkType)
2003 + msMarkType=bookmarkType;
2006 +void FieldEntry::AddParam(::rtl::OUString name, ::rtl::OUString value)
2008 + maParams.push_back( IFieldmark::ParamPair_t( name, value ) );
2011 +FieldEntry::Params_t &FieldEntry::getParams() {
2012 + return maParams;
2016 // Read_Field liest ein Feld ein oder, wenn es nicht gelesen werden kann,
2017 // wird 0 zurueckgegeben, so dass das Feld vom Aufrufer textuell gelesen wird.
2018 // Returnwert: Gesamtlaenge des Feldes ( zum UEberlesen )
2019 @@ -2073,6 +2147,17 @@
2021 String sName(GetMappedBookmark(sOrigName));
2023 +#if defined(WW_NATIVE_TOC)
2024 + if (1) {
2025 + ::rtl::OUString aBookmarkName=::rtl::OUString::createFromAscii("_REF");
2026 + maFieldStack.back().SetBookmarkName(aBookmarkName);
2027 + maFieldStack.back().SetBookmarkType(::rtl::OUString::createFromAscii(ECMA_PAGEREF));
2028 + maFieldStack.back().AddParam(rtl::OUString(), sName);
2029 + return FLD_TEXT;
2031 +#endif
2034 SwGetRefField aFld(
2035 (SwGetRefFieldType*)rDoc.GetSysFldType( RES_GETREFFLD ), sName,
2036 REF_BOOKMARK, 0, REF_PAGE );
2037 @@ -2771,6 +2856,16 @@
2039 eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, String& rStr )
2041 +#if defined(WW_NATIVE_TOC)
2042 + if (1) {
2043 + ::rtl::OUString aBookmarkName=::rtl::OUString::createFromAscii("_TOC");
2044 + maFieldStack.back().SetBookmarkName(aBookmarkName);
2045 + maFieldStack.back().SetBookmarkType(::rtl::OUString::createFromAscii(ECMA_TOC));
2046 +// maFieldStack.back().AddParam(::rtl::OUString::createFromAscii("Description"), aFormula.sToolTip);
2047 + return FLD_TEXT;
2049 +#endif
2051 if (pF->nLRes < 3)
2052 return FLD_TEXT; // ignore (#i25440#)
2054 @@ -3289,6 +3384,16 @@
2056 eF_ResT SwWW8ImplReader::Read_F_Hyperlink( WW8FieldDesc* /*pF*/, String& rStr )
2058 +#if defined(WW_NATIVE_TOC)
2059 + if (1) {
2060 + ::rtl::OUString aBookmarkName=::rtl::OUString::createFromAscii("_HYPERLINK");
2061 + maFieldStack.back().SetBookmarkName(aBookmarkName);
2062 + maFieldStack.back().SetBookmarkType(::rtl::OUString::createFromAscii(ECMA_HYPERLINK));
2063 +// maFieldStack.back().AddParam(::rtl::OUString::createFromAscii("Description"), aFormula.sToolTip);
2064 + return FLD_TEXT;
2066 +#endif
2068 String sURL, sTarget, sMark;
2069 bool bDataImport = false;
2070 //HYPERLINk "filename" [switches]
2071 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/ui/docvw/edtwin.cxx sw/source/ui/docvw/edtwin.cxx
2072 --- sw/source/ui/docvw/edtwin.cxx 2009-10-09 14:56:43.000000000 +0200
2073 +++ sw/source/ui/docvw/edtwin.cxx 2009-10-09 10:53:45.000000000 +0200
2074 @@ -152,6 +152,7 @@
2076 #include <IMark.hxx>
2077 #include <doc.hxx>
2078 +#include <ecmaflds.hxx>
2080 #include "PostItMgr.hxx"
2081 #include "postit.hxx"
2082 @@ -161,6 +162,7 @@
2083 //#define TEST_FOR_BUG91313
2084 #endif
2086 +using namespace sw::mark;
2087 using namespace ::com::sun::star;
2089 /*--------------------------------------------------------------------
2090 @@ -4199,7 +4201,7 @@
2092 SwContentAtPos aCntntAtPos( SwContentAtPos::SW_CLICKFIELD |
2093 SwContentAtPos::SW_INETATTR |
2094 - SwContentAtPos::SW_SMARTTAG );
2095 + SwContentAtPos::SW_SMARTTAG | SwContentAtPos::SW_FORMCTRL);
2097 if( rSh.GetContentAtPos( aDocPt, aCntntAtPos, TRUE ) )
2099 @@ -4220,7 +4222,33 @@
2100 if ( bExecSmarttags && SwSmartTagMgr::Get().IsSmartTagsEnabled() )
2101 rView.ExecSmartTagPopup( aDocPt );
2103 - else // if ( SwContentAtPos::SW_INETATTR == aCntntAtPos.eCntntAtPos )
2104 + else if ( SwContentAtPos::SW_FORMCTRL == aCntntAtPos.eCntntAtPos )
2106 + ASSERT( aCntntAtPos.aFnd.pFldmark != NULL, "where is my field ptr???");
2107 + if ( aCntntAtPos.aFnd.pFldmark != NULL)
2109 + IFieldmark *fieldBM = const_cast< IFieldmark* > ( aCntntAtPos.aFnd.pFldmark );
2110 + SwDocShell* pDocSh = rView.GetDocShell();
2111 + SwDoc *pDoc=pDocSh->GetDoc();
2112 + if (fieldBM->GetFieldname( ).equalsAscii( ECMA_FORMCHECKBOX ) )
2114 + bool isChecked = fieldBM->getParam( ECMA_FORMCHECKBOX_CHECKED ).second.compareToAscii("on") == 0;
2115 + isChecked = !isChecked; // swap it...
2116 + fieldBM->addParam(
2117 + rtl::OUString::createFromAscii( ECMA_FORMCHECKBOX_CHECKED ),
2118 + rtl::OUString::createFromAscii( isChecked?"on":"off" ) );
2119 + fieldBM->invalidate();
2120 + rSh.InvalidateWindows( rView.GetVisArea() );
2121 + } else if (fieldBM->GetFieldname().equalsAscii( ECMA_FORMDROPDOWN) ) {
2122 + rView.ExecFieldPopup( aDocPt, fieldBM );
2123 + fieldBM->invalidate();
2124 + rSh.InvalidateWindows( rView.GetVisArea() );
2125 + } else {
2126 + // unknown type..
2130 + else // if ( SwContentAtPos::SW_INETATTR == aCntntAtPos.eCntntAtPos )
2132 if ( bExecHyperlinks )
2133 rSh.ClickToINetAttr( *(SwFmtINetFmt*)aCntntAtPos.aFnd.pAttr, nFilter );
2134 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/ui/inc/view.hxx sw/source/ui/inc/view.hxx
2135 --- sw/source/ui/inc/view.hxx 2009-08-13 16:14:46.000000000 +0200
2136 +++ sw/source/ui/inc/view.hxx 2009-10-09 10:53:45.000000000 +0200
2137 @@ -42,6 +42,7 @@
2138 #include <swtypes.hxx>
2139 #include <shellid.hxx>
2140 #include <layout/layout.hxx>
2141 +#include <IMark.hxx>
2143 class SwBaseShell;
2144 class Button;
2145 @@ -94,6 +95,7 @@
2146 class Graphic;
2147 class GraphicFilter;
2148 class SwPostItMgr;
2149 +class SwFieldBookmark;
2151 namespace com{ namespace sun { namespace star {
2152 namespace view{ class XSelectionSupplier; }
2153 @@ -465,7 +467,7 @@
2155 DECL_LINK( SpellError, LanguageType * );
2156 BOOL ExecSpellPopup( const Point& rPt );
2158 + BOOL ExecFieldPopup( const Point& rPt, sw::mark::IFieldmark *fieldBM );
2159 // SMARTTAGS
2160 BOOL ExecSmartTagPopup( const Point& rPt );
2162 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/ui/inc/wrtsh.hxx sw/source/ui/inc/wrtsh.hxx
2163 --- sw/source/ui/inc/wrtsh.hxx 2009-10-07 17:45:01.000000000 +0200
2164 +++ sw/source/ui/inc/wrtsh.hxx 2009-10-09 10:53:45.000000000 +0200
2165 @@ -35,6 +35,7 @@
2166 #include <fesh.hxx>
2167 #include <sortopt.hxx>
2168 #include <swurl.hxx>
2169 +#include <IMark.hxx>
2171 class Window;
2172 class OutputDevice;
2173 @@ -322,6 +323,9 @@
2174 void InsertTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet = 0);
2175 BOOL UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet = 0);
2177 + // new fields
2178 + BOOL UpdateField( sw::mark::IFieldmark &fieldBM);
2180 // Numerierung und Bullets
2182 Turns on numbering or bullets.
2183 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/ui/uiview/viewling.cxx sw/source/ui/uiview/viewling.cxx
2184 --- sw/source/ui/uiview/viewling.cxx 2009-08-04 15:48:03.000000000 +0200
2185 +++ sw/source/ui/uiview/viewling.cxx 2009-10-09 10:53:45.000000000 +0200
2186 @@ -114,9 +114,12 @@
2187 #include <svx/dialogs.hrc>
2189 #include <unomid.h>
2190 +#include <IMark.hxx>
2191 +#include <ecmaflds.hxx>
2193 #include <memory>
2195 +using namespace sw::mark;
2196 using ::rtl::OUString;
2197 using namespace ::com::sun::star;
2198 using namespace ::com::sun::star::beans;
2199 @@ -927,6 +930,139 @@
2201 pWrtShell->Pop( sal_False );
2202 pWrtShell->LockView( bOldViewLock );
2204 + return bRet;
2209 +class SwFieldPopup : public PopupMenu
2211 +public:
2212 + SwFieldPopup() {
2213 + InsertItem(1, ::rtl::OUString::createFromAscii("Hello"));
2217 +class SwFieldListBox : public ListBox
2219 +public:
2220 + SwFieldListBox(Window* pParent) : ListBox(pParent /*, WB_DROPDOWN*/) {
2223 + void *GetImplWin() {
2224 + return NULL; //FIXME!!!
2225 +// return mpImplWin;
2228 +protected:
2229 + virtual void LoseFocus() {
2230 +// printf("ListBox: lose focus!!\n");
2231 + ListBox::LoseFocus();
2232 + }
2234 + virtual void Select() {
2235 +// printf("SELECT!!! IsTravelSelect=%i\n", IsTravelSelect());
2236 + ListBox::Select();
2240 +class SwFieldDialog : public Dialog
2242 +private:
2243 + SwFieldListBox aListBox;
2244 + Edit aText;
2245 + int selection;
2247 + DECL_LINK( MyListBoxHandler, ListBox * );
2249 +public:
2250 + SwFieldDialog(Window* parent, IFieldmark *fieldBM) : Dialog(parent, WB_BORDER | WB_SYSTEMWINDOW | WB_NOSHADOW ), aListBox(this), aText(this, WB_RIGHT | WB_READONLY), selection(-1) {
2252 + assert(fieldBM!=NULL);
2253 + if (fieldBM!=NULL) {
2254 + int items=fieldBM->getNumOfParams();
2255 + for(int i=0;i<items;i++) {
2256 + IFieldmark::ParamPair_t p=fieldBM->getParam(i);
2257 + if (p.first.compareToAscii(ECMA_FORMDROPDOWN_LISTENTRY)==0) {
2258 + aListBox.InsertEntry(p.second);
2262 + Size lbSize=aListBox.GetOptimalSize(WINDOWSIZE_PREFERRED);
2263 + lbSize.Width()+=50;
2264 + lbSize.Height()+=20;
2265 + aListBox.SetSizePixel(lbSize);
2266 + aListBox.SetSelectHdl( LINK( this, SwFieldDialog, MyListBoxHandler ) );
2267 + aListBox.Show();
2268 + aText.SetText(rtl::OUString::createFromAscii("Cancel"));
2269 + Size tSize=aText.GetOptimalSize(WINDOWSIZE_PREFERRED);
2270 + aText.SetSizePixel(Size(lbSize.Width(), tSize.Height()));
2271 + aText.SetPosPixel(Point(0, lbSize.Height()));
2272 + aText.Show();
2273 + SetSizePixel(Size(lbSize.Width(), lbSize.Height()+tSize.Height()));
2274 +// SetSizePixel(Size(200, 200));
2277 + int getSelection() {
2278 + return selection;
2280 +protected:
2281 + /*
2282 + virtual void LoseFocus() {
2283 + printf("lose focus!!\n");
2284 + Dialog::LoseFocus();
2285 + printf("close:\n");
2286 + EndDialog(8);
2288 + */
2290 + virtual long PreNotify( NotifyEvent& rNEvt ) {
2291 + if (rNEvt.GetType() == EVENT_LOSEFOCUS && aListBox.GetImplWin()==rNEvt.GetWindow()) {
2292 + EndDialog(8);
2293 + return 1;
2295 + if (rNEvt.GetType() == EVENT_KEYINPUT) {
2296 +// printf("PreNotify::KEYINPUT\n");
2298 + return Dialog::PreNotify(rNEvt);
2302 +IMPL_LINK( SwFieldDialog, MyListBoxHandler, ListBox *, pBox )
2304 +// printf("### DROP DOWN SELECT... IsTravelSelect=%i\n", pBox->IsTravelSelect());
2305 + if (pBox->IsTravelSelect()) {
2306 + return 0;
2307 + } else {
2308 + this->selection=pBox->GetSelectEntryPos();
2309 + EndDialog(9); //@TODO have meaningfull returns...
2310 + return 1;
2315 +BOOL SwView::ExecFieldPopup( const Point& rPt, IFieldmark *fieldBM )
2317 + sal_Bool bRet = sal_False;
2318 + const sal_Bool bOldViewLock = pWrtShell->IsViewLocked();
2319 + pWrtShell->LockView( sal_True );
2320 + pWrtShell->Push();
2322 + bRet=sal_True;
2323 + const Point aPixPos = GetEditWin().LogicToPixel( rPt );
2325 + SwFieldDialog aFldDlg(pEditWin, fieldBM);
2326 + aFldDlg.SetPosPixel(pEditWin->OutputToScreenPixel(aPixPos));
2328 + short ret=aFldDlg.Execute();
2329 + int selection=aFldDlg.getSelection();
2330 + if (selection>=0) {
2331 + fieldBM->addParam(ECMA_FORMDROPDOWN_RESULT, selection);
2334 + pWrtShell->Pop( sal_False );
2335 + pWrtShell->LockView( bOldViewLock );
2337 return bRet;
2339 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/ui/wrtsh/wrtsh1.cxx sw/source/ui/wrtsh/wrtsh1.cxx
2340 --- sw/source/ui/wrtsh/wrtsh1.cxx 2009-10-09 14:56:41.000000000 +0200
2341 +++ sw/source/ui/wrtsh/wrtsh1.cxx 2009-10-09 10:53:45.000000000 +0200
2342 @@ -112,6 +112,7 @@
2343 #include <paratr.hxx>
2344 #include <ndtxt.hxx>
2345 #include <svx/acorrcfg.hxx>
2346 +#include <IMark.hxx>
2348 // -> #111827#
2349 #include <SwRewriter.hxx>
2350 @@ -126,6 +127,7 @@
2352 #include "PostItMgr.hxx"
2354 +using namespace sw::mark;
2355 using namespace com::sun::star;
2357 #define COMMON_INI_LIST \
2358 @@ -1756,6 +1758,12 @@
2360 SetSfxViewShell( (SfxViewShell *)&rShell );
2361 SetFlyMacroLnk( LINK(this, SwWrtShell, ExecFlyMac) );
2363 + // place the cursor on the first field...
2364 + IFieldmark *pBM = NULL;
2365 + if ( IsFormProtected() && ( pBM = GetFieldmarkAfter( ) ) !=NULL ) {
2366 + GotoFieldmark(pBM);
2371 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/ui/wrtsh/wrtsh2.cxx sw/source/ui/wrtsh/wrtsh2.cxx
2372 --- sw/source/ui/wrtsh/wrtsh2.cxx 2009-10-07 17:45:01.000000000 +0200
2373 +++ sw/source/ui/wrtsh/wrtsh2.cxx 2009-10-09 10:53:45.000000000 +0200
2374 @@ -242,6 +242,13 @@
2375 return bResult;
2378 +BOOL SwWrtShell::UpdateField( sw::mark::IFieldmark &fieldBM )
2380 + return SwEditShell::UpdateField(fieldBM);
2385 // ein Klick aus das angegebene Feld. Der Cursor steht auf diesem.
2386 // Fuehre die vor definierten Aktionen aus.
2388 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' xmloff/inc/xmloff/ecmaflds.hxx xmloff/inc/xmloff/ecmaflds.hxx
2389 --- xmloff/inc/xmloff/ecmaflds.hxx 1970-01-01 01:00:00.000000000 +0100
2390 +++ xmloff/inc/xmloff/ecmaflds.hxx 2009-10-09 10:53:45.000000000 +0200
2391 @@ -0,0 +1,68 @@
2392 +/*************************************************************************
2394 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2395 + *
2396 + * Copyright 2008 by Sun Microsystems, Inc.
2398 + * OpenOffice.org - a multi-platform office productivity suite
2400 + * $RCSfile: $
2401 + * $Revision: $
2403 + * This file is part of OpenOffice.org.
2405 + * OpenOffice.org is free software: you can redistribute it and/or modify
2406 + * it under the terms of the GNU Lesser General Public License version 3
2407 + * only, as published by the Free Software Foundation.
2409 + * OpenOffice.org is distributed in the hope that it will be useful,
2410 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2411 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2412 + * GNU Lesser General Public License version 3 for more details
2413 + * (a copy is included in the LICENSE file that accompanied this code).
2415 + * You should have received a copy of the GNU Lesser General Public License
2416 + * version 3 along with OpenOffice.org. If not, see
2417 + * <http://www.openoffice.org/license.html>
2418 + * for a copy of the LGPLv3 License.
2420 + ************************************************************************/
2421 +/* and also:
2422 + * Author: Florian Reuter <freuter@novell.com>
2423 + * Copyright 2008 by Novell, Inc.
2425 +#ifndef _ECMAFLDS_HXX
2426 +#define _ECMAFLDS_HXX
2429 +#define ECMA_FORMTEXT "ecma.office-open-xml.field.FORMTEXT"
2430 +#define ECMA_FORMTEXT_NAME "name"
2431 +#define ECMA_FORMTEXT_HELPTEXT "helpText"
2432 +#define ECMA_FORMTEXT_STATUSTEXT "statusText"
2433 +#define ECMA_FORMTEXT_DEFAULT "default"
2434 +#define ECMA_FORMTEXT_FORMAT "format"
2435 +#define ECMA_FORMTEXT_MAXLENGTH "maxLength"
2436 +#define ECMA_FORMTEXT_TYPE "type"
2438 +#define ECMA_FORMCHECKBOX "ecma.office-open-xml.field.FORMCHECKBOX"
2439 +#define ECMA_FORMCHECKBOX_NAME "name"
2440 +#define ECMA_FORMCHECKBOX_HELPTEXT "helpText"
2441 +#define ECMA_FORMCHECKBOX_STATUSTEXT "statusText"
2442 +#define ECMA_FORMCHECKBOX_CHECKED "checked"
2443 +#define ECMA_FORMCHECKBOX_DEFAULT "default"
2444 +#define ECMA_FORMCHECKBOX_SIZE "size"
2445 +#define ECMA_FORMCHECKBOX_SIZEAUTO "sizeAuto"
2448 +#define ECMA_FORMDROPDOWN "ecma.office-open-xml.field.FORMDROPDOWN"
2449 +#define ECMA_FORMDROPDOWN_DEFAULT "default"
2450 +#define ECMA_FORMDROPDOWN_LISTENTRY "listEntry"
2451 +#define ECMA_FORMDROPDOWN_RESULT "result"
2453 +#define ECMA_TOC "ecma.office-open-xml.field.TOC"
2455 +#define ECMA_HYPERLINK "ecma.office-open-xml.field.HYPERLINK"
2457 +#define ECMA_PAGEREF "ecma.office-open-xml.field.PAGEREF"
2459 +#endif /* _ECMAFLDS_HXX */
2460 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' xmloff/source/text/XMLTextMarkImportContext.cxx xmloff/source/text/XMLTextMarkImportContext.cxx
2461 --- xmloff/source/text/XMLTextMarkImportContext.cxx 2009-10-07 17:47:24.000000000 +0200
2462 +++ xmloff/source/text/XMLTextMarkImportContext.cxx 2009-10-09 11:41:16.000000000 +0200
2463 @@ -41,6 +41,7 @@
2464 #include <xmloff/xmltoken.hxx>
2465 #include <xmloff/xmlimp.hxx>
2466 #include <xmloff/nmspmap.hxx>
2467 +#include <xmloff/ecmaflds.hxx>
2468 #include "xmlnmspe.hxx"
2469 #include <com/sun/star/xml/sax/XAttributeList.hpp>
2470 #include <com/sun/star/text/XTextContent.hpp>
2471 @@ -138,6 +139,33 @@
2472 { XML_TOKEN_INVALID, 0 },
2476 +static const char *lcl_getFormFieldmarkName(rtl::OUString &name)
2478 + static const char sCheckbox[]=ECMA_FORMCHECKBOX;
2479 + static const char sFormDropDown[]=ECMA_FORMDROPDOWN;
2480 + if (name.compareToAscii("msoffice.field.FORMCHECKBOX")==0)
2481 + return sCheckbox;
2482 + else if (name.compareToAscii(ECMA_FORMCHECKBOX)==0)
2483 + return sCheckbox;
2484 + if (name.compareToAscii(ECMA_FORMDROPDOWN)==0)
2485 + return sFormDropDown;
2486 + else
2487 + return NULL;
2490 +static rtl::OUString lcl_getFieldmarkName(rtl::OUString &name)
2492 + static const char sFormtext[]=ECMA_FORMTEXT;
2493 + if (name.compareToAscii("msoffice.field.FORMTEXT")==0)
2494 + return rtl::OUString::createFromAscii(sFormtext);
2495 + else if (name.compareToAscii(ECMA_FORMTEXT)==0)
2496 + return rtl::OUString::createFromAscii(sFormtext);
2497 + else
2498 + return name;
2502 void XMLTextMarkImportContext::StartElement(
2503 const Reference<XAttributeList> & xAttrList)
2505 @@ -194,7 +222,8 @@
2506 case TypeFieldmark:
2507 case TypeBookmark:
2509 - bool bImportAsField=((lcl_MarkType)nTmp==TypeFieldmark && m_sFieldName.compareToAscii("msoffice.field.FORMCHECKBOX")==0); // for now only import FORMCHECKBOX boxes
2510 + const char *formFieldmarkName=lcl_getFormFieldmarkName(m_sFieldName);
2511 + bool bImportAsField=((lcl_MarkType)nTmp==TypeFieldmark && formFieldmarkName!=NULL); //@TODO handle abbreviation cases..
2512 // export point bookmark
2513 const Reference<XInterface> xContent(
2514 CreateAndInsertMark(GetImport(),
2515 @@ -213,10 +242,8 @@
2516 if (xContent.is() && bImportAsField) {
2517 // setup fieldmark...
2518 Reference< ::com::sun::star::text::XFormField> xFormField(xContent, UNO_QUERY);
2519 - xFormField->setType(1); // Checkbox...
2520 + xFormField->setFieldType(rtl::OUString::createFromAscii(formFieldmarkName));
2521 if (xFormField.is() && m_rHelper.hasCurrentFieldCtx()) {
2522 -// xFormField->setDescription(::rtl::OUString::createFromAscii("HELLO CHECKBOX"));
2523 -// xFormField->setRes(1);
2524 m_rHelper.setCurrentFieldParamsTo(xFormField);
2527 @@ -263,11 +290,6 @@
2528 xInsertionCursor, UNO_QUERY);
2530 bool bImportAsField=((lcl_MarkType)nTmp==TypeFieldmarkEnd && m_rHelper.hasCurrentFieldCtx());
2531 - if (bImportAsField) {
2532 - ::rtl::OUString currentFieldType =
2533 - m_rHelper.getCurrentFieldType();
2534 - bImportAsField=currentFieldType.compareToAscii("msoffice.field.FORMTEXT")==0; // for now only import FORMTEXT boxes
2537 // insert reference
2538 const Reference<XInterface> xContent(
2539 @@ -288,10 +310,12 @@
2540 if (xContent.is() && bImportAsField) {
2541 // setup fieldmark...
2542 Reference< ::com::sun::star::text::XFormField> xFormField(xContent, UNO_QUERY);
2543 - xFormField->setType(0); // Text
2544 if (xFormField.is() && m_rHelper.hasCurrentFieldCtx()) {
2545 + rtl::OUString givenTypeName=m_rHelper.getCurrentFieldType();
2546 + rtl::OUString fieldmarkTypeName=lcl_getFieldmarkName(givenTypeName);
2548 + xFormField->setFieldType(fieldmarkTypeName);
2549 m_rHelper.setCurrentFieldParamsTo(xFormField);
2550 -// xFormField->setDescription(::rtl::OUString::createFromAscii("HELLO"));
2553 m_rHelper.popFieldCtx();
2554 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' xmloff/source/text/txtimp.cxx xmloff/source/text/txtimp.cxx
2555 --- xmloff/source/text/txtimp.cxx 2009-10-09 14:56:37.000000000 +0200
2556 +++ xmloff/source/text/txtimp.cxx 2009-10-09 10:53:45.000000000 +0200
2557 @@ -2310,14 +2310,10 @@
2558 if (!aFieldStack.empty() && xFormField.is()) {
2559 field_params_t &params=aFieldStack.top().second;
2560 for (field_params_t::iterator i=params.begin();i!=params.end();i++) {
2561 - rtl::OUString name=i->first;
2562 - rtl::OUString value=i->second;
2563 - if (name.compareToAscii("Description")==0){
2564 - xFormField->setDescription(value);
2565 - } else if (name.compareToAscii("Result")==0){
2566 - xFormField->setRes((sal_Int16)value.toInt32());
2569 + rtl::OString aOString1 = ::rtl::OUStringToOString (i->first, RTL_TEXTENCODING_UTF8);
2570 + rtl::OString aOString2 = ::rtl::OUStringToOString (i->second, RTL_TEXTENCODING_UTF8);
2571 + /* printf("param[\"%s\"]=\"%s\"\n", aOString1.getStr(), aOString2.getStr()); */
2572 + xFormField->addParam(i->first, i->second, false);
2576 diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' xmloff/source/text/txtparae.cxx xmloff/source/text/txtparae.cxx
2577 --- xmloff/source/text/txtparae.cxx 2009-10-09 14:56:45.000000000 +0200
2578 +++ xmloff/source/text/txtparae.cxx 2009-10-09 10:53:45.000000000 +0200
2579 @@ -2242,14 +2242,16 @@
2581 Reference< ::com::sun::star::text::XFormField > xFormField(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
2582 if (xFormField.is()) {
2583 - GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_TYPE, ::rtl::OUString::createFromAscii("msoffice.field.FORMTEXT"));
2584 + GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_TYPE, xFormField->getFieldType());
2586 GetExport().StartElement(XML_NAMESPACE_FIELD, XML_FIELDMARK_START, sal_False);
2587 if (xFormField.is()) {
2588 - GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_NAME, ::rtl::OUString::createFromAscii("Description"));
2589 - GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_VALUE, xFormField->getDescription());
2590 + for(sal_Int16 i=0;i<xFormField->getParamCount();i++) {
2591 + GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_NAME, xFormField->getParamName(i));
2592 + GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_VALUE, xFormField->getParamValue(i));
2593 GetExport().StartElement(XML_NAMESPACE_FIELD, XML_PARAM, sal_False);
2594 GetExport().EndElement(XML_NAMESPACE_FIELD, XML_PARAM, sal_False);
2597 GetExport().EndElement(XML_NAMESPACE_FIELD, XML_FIELDMARK_START, sal_False);
2599 @@ -2266,27 +2268,16 @@
2601 Reference< ::com::sun::star::text::XFormField > xFormField(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
2602 if (xFormField.is()) {
2603 - sal_Int16 fftype=xFormField->getType();
2604 - switch (fftype) {
2605 - case 1:
2606 - GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_TYPE, ::rtl::OUString::createFromAscii("msoffice.field.FORMCHECKBOX"));
2607 - break;
2608 - default:
2609 - DBG_ASSERT(false, "hey ---- add your export stuff here!!");
2610 - break;
2612 + GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_TYPE, xFormField->getFieldType());
2614 GetExport().StartElement(XML_NAMESPACE_FIELD, XML_FIELDMARK, sal_False);
2615 if (xFormField.is()) {
2616 - GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_NAME, ::rtl::OUString::createFromAscii("Description"));
2617 - GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_VALUE, xFormField->getDescription());
2618 - GetExport().StartElement(XML_NAMESPACE_FIELD, XML_PARAM, sal_False);
2619 - GetExport().EndElement(XML_NAMESPACE_FIELD, XML_PARAM, sal_False);
2621 - GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_NAME, ::rtl::OUString::createFromAscii("Result"));
2622 - GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_VALUE, ::rtl::OUString::valueOf((sal_Int32 )xFormField->getRes()));
2623 + for(sal_Int16 i=0;i<xFormField->getParamCount();i++) {
2624 + GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_NAME, xFormField->getParamName(i));
2625 + GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_VALUE, xFormField->getParamValue(i));
2626 GetExport().StartElement(XML_NAMESPACE_FIELD, XML_PARAM, sal_False);
2627 GetExport().EndElement(XML_NAMESPACE_FIELD, XML_PARAM, sal_False);
2630 GetExport().EndElement(XML_NAMESPACE_FIELD, XML_FIELDMARK, sal_False);