[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 6 commits - offapi/com sw/inc sw/source writerfilter/inc writerfilter/source xmloff/inc xmloff/source
Oliver-Rainer Wittmann
orw at apache.org
Thu Dec 19 11:49:00 PST 2013
offapi/com/sun/star/text/textfield/Annotation.idl | 15 +
sw/inc/PostItMgr.hxx | 6
sw/inc/docufld.hxx | 49 +++--
sw/inc/unobookmark.hxx | 20 +-
sw/inc/unofield.hxx | 1
sw/inc/unoprnms.hxx | 27 ---
sw/source/core/crsr/bookmrk.cxx | 37 ++++
sw/source/core/doc/docbm.cxx | 24 +-
sw/source/core/doc/docedt.cxx | 27 +++
sw/source/core/fields/docufld.cxx | 153 ++++++++++-------
sw/source/core/inc/bookmrk.hxx | 1
sw/source/core/text/EnhancedPDFExportHelper.cxx | 2
sw/source/core/text/inftxt.cxx | 35 ++-
sw/source/core/unocore/unobkm.cxx | 74 ++++++--
sw/source/core/unocore/unofield.cxx | 106 +++++++++--
sw/source/core/unocore/unomap.cxx | 30 +--
sw/source/core/unocore/unoportenum.cxx | 93 +++++++---
sw/source/core/unocore/unoprnms.cxx | 3
sw/source/core/unocore/unotext.cxx | 11 +
sw/source/filter/html/htmlfld.cxx | 8
sw/source/filter/html/swhtml.cxx | 9 -
sw/source/filter/ww8/attributeoutputbase.hxx | 6
sw/source/filter/ww8/docxattributeoutput.cxx | 30 +++
sw/source/filter/ww8/docxattributeoutput.hxx | 10 +
sw/source/filter/ww8/rtfattributeoutput.cxx | 2
sw/source/filter/ww8/wrtw8nds.cxx | 56 ++++--
sw/source/filter/ww8/wrtw8sty.cxx | 2
sw/source/filter/ww8/wrtww8.hxx | 7
sw/source/filter/ww8/ww8par.cxx | 8
sw/source/filter/xml/xmliteme.cxx | 9 +
sw/source/ui/fldui/fldmgr.cxx | 25 ++
sw/source/ui/inc/fldmgr.hxx | 7
sw/source/ui/inc/wrtsh.hxx | 6
sw/source/ui/shells/textfld.cxx | 80 ++++----
sw/source/ui/wrtsh/wrtsh2.cxx | 17 +
writerfilter/inc/ooxml/OOXMLDocument.hxx | 25 +-
writerfilter/inc/resourcemodel/WW8ResourceModel.hxx | 2
writerfilter/source/dmapper/DomainMapper.cxx | 9 +
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 91 +++++++++-
writerfilter/source/dmapper/DomainMapper_Impl.hxx | 46 +++--
writerfilter/source/doctok/WW8ResourceModelImpl.cxx | 6
writerfilter/source/doctok/WW8ResourceModelImpl.hxx | 6
writerfilter/source/ooxml/Handler.cxx | 6
writerfilter/source/ooxml/OOXMLDocumentImpl.cxx | 118 +++++++------
writerfilter/source/ooxml/OOXMLDocumentImpl.hxx | 74 +++++---
writerfilter/source/ooxml/OOXMLFastContextHandler.cxx | 45 ++---
writerfilter/source/ooxml/OOXMLFastContextHandler.hxx | 26 +-
writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx | 11 -
writerfilter/source/ooxml/OOXMLFastDocumentHandler.hxx | 5
writerfilter/source/ooxml/OOXMLParserState.cxx | 13 -
writerfilter/source/ooxml/OOXMLParserState.hxx | 4
writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx | 8
writerfilter/source/ooxml/OOXMLPropertySetImpl.hxx | 8
writerfilter/source/ooxml/model.xml | 32 ++-
xmloff/inc/txtflde.hxx | 13 -
xmloff/inc/txtfldi.hxx | 20 +-
xmloff/inc/xmloff/odffields.hxx | 2
xmloff/inc/xmloff/txtimp.hxx | 2
xmloff/inc/xmloff/xmlnmspe.hxx | 3
xmloff/inc/xmloff/xmltoken.hxx | 4
xmloff/source/core/xmlimp.cxx | 7
xmloff/source/core/xmltoken.cxx | 4
xmloff/source/text/txtflde.cxx | 28 ++-
xmloff/source/text/txtfldi.cxx | 122 +++++++++++--
xmloff/source/text/txtimp.cxx | 24 --
xmloff/source/text/txtparae.cxx | 113 +++++++-----
66 files changed, 1294 insertions(+), 579 deletions(-)
New commits:
commit d0f397f3b0e0a650df2813805a894e9a29943c1d
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Thu Dec 19 13:33:37 2013 +0000
113059: *.docx import: correct handling of comment/annotation, footnote and endnote IDs for parsing the corresponding sub streams
Kudos to Pavel <paveljanik at apache.org> for his analysis and findings
cherry-picked from branch ooxml-osba
diff --git a/writerfilter/inc/ooxml/OOXMLDocument.hxx b/writerfilter/inc/ooxml/OOXMLDocument.hxx
index 0c610e5..fab2ab3 100644
--- a/writerfilter/inc/ooxml/OOXMLDocument.hxx
+++ b/writerfilter/inc/ooxml/OOXMLDocument.hxx
@@ -156,11 +156,11 @@ public:
@param rStream stream handler to resolve to
@param rNoteType type of footnote to resolve
- @param rNoteId id of the footnote to resolve
+ @param nIDForXNoteStream id of the footnote to resolve
*/
virtual void resolveFootnote(Stream & rStream,
const Id & rNoteType,
- const rtl::OUString & rNoteId) = 0;
+ const sal_Int32 nIDForXNoteStream ) = 0;
/**
Resolves an endnote to a stream handler.
@@ -168,21 +168,21 @@ public:
note id matches.
@param rStream stream handler to resolve to
- @param rNoteType type of footnote to resolve
- @param rNoteId id of the endnote to resolve
+ @param rNoteType type of endnote to resolve
+ @param nIDForXNoteStream id of the endnote to resolve
*/
virtual void resolveEndnote(Stream & rStream,
const Id & rNoteType,
- const rtl::OUString & rNoteId) = 0;
+ const sal_Int32 nIDForXNoteStream ) = 0;
/**
Resolves a comment to a stream handler.
@param rStream stream handler to resolve to
- @param rComment id of the comment to resolve
+ @param nIDForXNoteStream id of the comment to resolve
*/
virtual void resolveComment(Stream & rStream,
- const rtl::OUString & rCommentId) = 0;
+ const sal_Int32 nIDForXNoteStream ) = 0;
/**
Resolves a picture to a stream handler.
@@ -239,12 +239,11 @@ public:
virtual uno::Reference<drawing::XDrawPage> getDrawPage() = 0;
virtual uno::Reference<io::XInputStream> getInputStream() = 0;
virtual uno::Reference<io::XInputStream> getStorageStream() = 0;
- virtual uno::Reference<io::XInputStream> getInputStreamForId
- (const ::rtl::OUString & rId) = 0;
- virtual void setXNoteId(const rtl::OUString & rId) = 0;
- virtual const ::rtl::OUString & getXNoteId() const = 0;
- virtual void setXNoteType(const Id & nId) = 0;
- virtual const Id & getXNoteType() const = 0;
+ virtual uno::Reference<io::XInputStream> getInputStreamForId( const ::rtl::OUString & rId ) = 0;
+
+ virtual void setIDForXNoteStream( const sal_Int32 nID ) = 0;
+ virtual const sal_Int32 getIDForXNoteStream() const = 0;
+
virtual const ::rtl::OUString & getTarget() const = 0;
};
diff --git a/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx b/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx
index 7a152a3..e9950e5 100644
--- a/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx
+++ b/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx
@@ -298,7 +298,7 @@ public:
/**
Returns integer representation of the value.
*/
- virtual int getInt() const = 0;
+ virtual sal_Int32 getInt() const = 0;
/**
Returns string representation of the value.
diff --git a/writerfilter/source/doctok/WW8ResourceModelImpl.cxx b/writerfilter/source/doctok/WW8ResourceModelImpl.cxx
index d078399..3eb6d9e 100644
--- a/writerfilter/source/doctok/WW8ResourceModelImpl.cxx
+++ b/writerfilter/source/doctok/WW8ResourceModelImpl.cxx
@@ -316,7 +316,7 @@ string WW8Sprm::getName() const
return (*SprmIdToString::Instance())(getId());
}
-int WW8Value::getInt() const
+sal_Int32 WW8Value::getInt() const
{
return 0;
}
@@ -351,7 +351,7 @@ writerfilter::Reference<BinaryObj>::Pointer_t WW8Value::getBinary()
return writerfilter::Reference<BinaryObj>::Pointer_t();
}
-int WW8IntValue::getInt() const
+sal_Int32 WW8IntValue::getInt() const
{
return mValue;
}
@@ -389,7 +389,7 @@ WW8Value::Pointer_t createValue(WW8Value::Pointer_t value)
return value;
}
-int WW8StringValue::getInt() const
+sal_Int32 WW8StringValue::getInt() const
{
return 0;
}
diff --git a/writerfilter/source/doctok/WW8ResourceModelImpl.hxx b/writerfilter/source/doctok/WW8ResourceModelImpl.hxx
index 2d6a644..8f74c98d 100644
--- a/writerfilter/source/doctok/WW8ResourceModelImpl.hxx
+++ b/writerfilter/source/doctok/WW8ResourceModelImpl.hxx
@@ -158,7 +158,7 @@ public:
virtual ~WW8Value() {}
virtual string toString() const;
- virtual int getInt() const;
+ virtual sal_Int32 getInt() const;
virtual ::rtl::OUString getString() const;
virtual uno::Any getAny() const;
virtual writerfilter::Reference<Properties>::Pointer_t getProperties();
@@ -174,7 +174,7 @@ public:
WW8IntValue(int value) : mValue(value) {}
virtual ~WW8IntValue() {}
- virtual int getInt() const;
+ virtual sal_Int32 getInt() const;
virtual ::rtl::OUString getString() const;
virtual uno::Any getAny() const;
@@ -200,7 +200,7 @@ public:
WW8StringValue(::rtl::OUString string_) : mString(string_) {}
virtual ~WW8StringValue() {}
- virtual int getInt() const;
+ virtual sal_Int32 getInt() const;
virtual ::rtl::OUString getString() const;
virtual uno::Any getAny() const;
diff --git a/writerfilter/source/ooxml/Handler.cxx b/writerfilter/source/ooxml/Handler.cxx
index 391e229..f7c14b0 100644
--- a/writerfilter/source/ooxml/Handler.cxx
+++ b/writerfilter/source/ooxml/Handler.cxx
@@ -46,7 +46,7 @@ void OOXMLFootnoteHandler::attribute(Id name, Value & val)
switch (name)
{
case NS_ooxml::LN_CT_FtnEdnRef_id:
- mpFastContext->resolveFootnote(val.getString());
+ mpFastContext->resolveFootnote(val.getInt());
break;
default:
break;
@@ -74,7 +74,7 @@ void OOXMLEndnoteHandler::attribute(Id name, Value & val)
switch (name)
{
case NS_ooxml::LN_CT_FtnEdnRef_id:
- mpFastContext->resolveEndnote(val.getString());
+ mpFastContext->resolveEndnote(val.getInt());
break;
default:
break;
@@ -102,7 +102,7 @@ void OOXMLCommentHandler::attribute(Id name, Value & val)
switch (name)
{
case NS_ooxml::LN_CT_Markup_id:
- mpFastContext->resolveComment(val.getString());
+ mpFastContext->resolveComment(val.getInt());
break;
default:
;
diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
index fc743f8..cd92bdf 100644
--- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
+++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
@@ -45,9 +45,37 @@ TagLogger::Pointer_t debug_logger(TagLogger::getInstance("DEBUG"));
using namespace ::std;
-OOXMLDocumentImpl::OOXMLDocumentImpl
-(OOXMLStream::Pointer_t pStream)
-: mpStream(pStream), mXNoteType(0), mbIsSubstream( false )
+OOXMLDocumentImpl::OOXMLDocumentImpl(
+ OOXMLStream::Pointer_t pStream )
+ : mpStream(pStream)
+ , mnIDForXNoteStream( -1 )
+ , mxModel()
+ , mxDrawPage()
+ , mbIsSubstream( false )
+{
+}
+
+OOXMLDocumentImpl::OOXMLDocumentImpl(
+ OOXMLStream::Pointer_t pStream,
+ uno::Reference<frame::XModel> xModel,
+ uno::Reference<drawing::XDrawPage> xDrawPage,
+ const bool bIsSubstream )
+ : mpStream(pStream)
+ , mnIDForXNoteStream( -1 )
+ , mxModel( xModel )
+ , mxDrawPage( xDrawPage )
+ , mbIsSubstream( bIsSubstream )
+{
+}
+
+OOXMLDocumentImpl::OOXMLDocumentImpl(
+ OOXMLStream::Pointer_t pStream,
+ const sal_Int32 nIDForXNoteStream )
+ : mpStream(pStream)
+ , mnIDForXNoteStream( nIDForXNoteStream )
+ , mxModel()
+ , mxDrawPage()
+ , mbIsSubstream( false )
{
}
@@ -68,8 +96,7 @@ void OOXMLDocumentImpl::resolveFastSubStream(Stream & rStreamHandler,
{
uno::Reference<uno::XComponentContext> xContext(mpStream->getContext());
OOXMLFastDocumentHandler * pDocHandler =
- new OOXMLFastDocumentHandler(
- xContext, &rStreamHandler, this, msXNoteId );
+ new OOXMLFastDocumentHandler( xContext, &rStreamHandler, this );
uno::Reference < xml::sax::XFastDocumentHandler > xDocumentHandler
(pDocHandler);
@@ -100,25 +127,16 @@ void OOXMLDocumentImpl::resolveFastSubStreamWithId(Stream & rStream,
rStream.substream(nId, pStream);
}
-void OOXMLDocumentImpl::setXNoteId(const rtl::OUString & rId)
-{
- msXNoteId = rId;
-}
-
-const rtl::OUString & OOXMLDocumentImpl::getXNoteId() const
+void OOXMLDocumentImpl::setIDForXNoteStream( const sal_Int32 nID )
{
- return msXNoteId;
+ mnIDForXNoteStream = nID;
}
-void OOXMLDocumentImpl::setXNoteType(const Id & nId)
+const sal_Int32 OOXMLDocumentImpl::getIDForXNoteStream() const
{
- mXNoteType = nId;
+ return mnIDForXNoteStream;
}
-const Id & OOXMLDocumentImpl::getXNoteType() const
-{
- return mXNoteType;
-}
const ::rtl::OUString & OOXMLDocumentImpl::getTarget() const
{
@@ -131,17 +149,19 @@ OOXMLDocumentImpl::getSubStream(const rtl::OUString & rId)
OOXMLStream::Pointer_t pStream
(OOXMLDocumentFactory::createStream(mpStream, rId));
- OOXMLDocumentImpl * pTemp;
- writerfilter::Reference<Stream>::Pointer_t pRet( pTemp = new OOXMLDocumentImpl(pStream) );
- pTemp->setModel(mxModel);
- pTemp->setDrawPage(mxDrawPage);
- pTemp->setIsSubstream( true );
+ writerfilter::Reference<Stream>::Pointer_t pRet(
+ new OOXMLDocumentImpl(
+ pStream,
+ mxModel,
+ mxDrawPage,
+ true ) );
+
return pRet;
}
-writerfilter::Reference<Stream>::Pointer_t
-OOXMLDocumentImpl::getXNoteStream(OOXMLStream::StreamType_t nType, const Id & rType,
- const rtl::OUString & rId)
+writerfilter::Reference<Stream>::Pointer_t OOXMLDocumentImpl::getXNoteStream(
+ OOXMLStream::StreamType_t nType,
+ const sal_Int32 nIDForXNoteStream )
{
#ifdef DEBUG_ELEMENT
debug_logger->startElement("getXNoteStream");
@@ -151,19 +171,21 @@ OOXMLDocumentImpl::getXNoteStream(OOXMLStream::StreamType_t nType, const Id & rT
OOXMLStream::Pointer_t pStream =
(OOXMLDocumentFactory::createStream(mpStream, nType));
- OOXMLDocumentImpl * pDocument = new OOXMLDocumentImpl(pStream);
- pDocument->setXNoteId(rId);
- pDocument->setXNoteType(rType);
+ OOXMLDocumentImpl * pDocument =
+ new OOXMLDocumentImpl(
+ pStream,
+ nIDForXNoteStream );
return writerfilter::Reference<Stream>::Pointer_t(pDocument);
}
-void OOXMLDocumentImpl::resolveFootnote(Stream & rStream,
- const Id & rType,
- const rtl::OUString & rNoteId)
+void OOXMLDocumentImpl::resolveFootnote(
+ Stream & rStream,
+ const Id & rType,
+ const sal_Int32 nIDForXNoteStream )
{
writerfilter::Reference<Stream>::Pointer_t pStream =
- getXNoteStream(OOXMLStream::FOOTNOTES, rType, rNoteId);
+ getXNoteStream( OOXMLStream::FOOTNOTES, nIDForXNoteStream );
Id nId;
switch (rType)
@@ -177,15 +199,16 @@ void OOXMLDocumentImpl::resolveFootnote(Stream & rStream,
break;
}
- resolveFastSubStreamWithId(rStream, pStream, nId);
+ resolveFastSubStreamWithId( rStream, pStream, nId );
}
-void OOXMLDocumentImpl::resolveEndnote(Stream & rStream,
- const Id & rType,
- const rtl::OUString & rNoteId)
+void OOXMLDocumentImpl::resolveEndnote(
+ Stream & rStream,
+ const Id & rType,
+ const sal_Int32 nIDForXNoteStream )
{
writerfilter::Reference<Stream>::Pointer_t pStream =
- getXNoteStream(OOXMLStream::ENDNOTES, rType, rNoteId);
+ getXNoteStream( OOXMLStream::ENDNOTES, nIDForXNoteStream );
Id nId;
switch (rType)
@@ -199,16 +222,17 @@ void OOXMLDocumentImpl::resolveEndnote(Stream & rStream,
break;
}
- resolveFastSubStreamWithId(rStream, pStream, nId);
+ resolveFastSubStreamWithId( rStream, pStream, nId );
}
-void OOXMLDocumentImpl::resolveComment(Stream & rStream,
- const rtl::OUString & rId)
+void OOXMLDocumentImpl::resolveComment(
+ Stream & rStream,
+ const sal_Int32 nIDForXNoteStream )
{
writerfilter::Reference<Stream>::Pointer_t pStream =
- getXNoteStream(OOXMLStream::COMMENTS, 0, rId);
+ getXNoteStream(OOXMLStream::COMMENTS, nIDForXNoteStream );
- resolveFastSubStreamWithId(rStream, pStream, NS_rtf::LN_annotation);
+ resolveFastSubStreamWithId( rStream, pStream, NS_rtf::LN_annotation );
}
OOXMLPropertySet * OOXMLDocumentImpl::getPicturePropSet
@@ -315,8 +339,7 @@ void OOXMLDocumentImpl::resolve(Stream & rStream)
uno::Reference<uno::XComponentContext> xContext(mpStream->getContext());
OOXMLFastDocumentHandler * pDocHandler =
- new OOXMLFastDocumentHandler(
- xContext, &rStream, this, msXNoteId );
+ new OOXMLFastDocumentHandler( xContext, &rStream, this );
pDocHandler->setIsSubstream( mbIsSubstream );
uno::Reference < xml::sax::XFastDocumentHandler > xDocumentHandler
(pDocHandler);
@@ -392,9 +415,8 @@ uno::Reference<io::XInputStream> OOXMLDocumentImpl::getStorageStream()
return mpStream->getStorageStream();
}
-OOXMLDocument *
-OOXMLDocumentFactory::createDocument
-(OOXMLStream::Pointer_t pStream)
+OOXMLDocument * OOXMLDocumentFactory::createDocument(
+ OOXMLStream::Pointer_t pStream )
{
return new OOXMLDocumentImpl(pStream);
}
diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
index faa9c84..1d1ca53 100644
--- a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
+++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
@@ -40,46 +40,64 @@ using namespace ::com::sun::star;
class OOXMLDocumentImpl : public OOXMLDocument
{
OOXMLStream::Pointer_t mpStream;
- rtl::OUString msXNoteId;
- Id mXNoteType;
+ // ID for parsing certain item in a XNote stream
+ // used for footnotes, endnotes and comments streams
+ sal_Int32 mnIDForXNoteStream;
uno::Reference<frame::XModel> mxModel;
uno::Reference<drawing::XDrawPage> mxDrawPage;
- bool mbIsSubstream;
+ const bool mbIsSubstream;
protected:
- virtual void resolveFastSubStream(Stream & rStream,
- OOXMLStream::StreamType_t nType);
+ virtual void resolveFastSubStream(
+ Stream & rStream,
+ OOXMLStream::StreamType_t nType);
- virtual void resolveFastSubStreamWithId(Stream & rStream,
- writerfilter::Reference<Stream>::Pointer_t pStream,
- sal_uInt32 nId);
+ virtual void resolveFastSubStreamWithId(
+ Stream & rStream,
+ writerfilter::Reference<Stream>::Pointer_t pStream,
+ sal_uInt32 nId);
- writerfilter::Reference<Stream>::Pointer_t
- getSubStream(const rtl::OUString & rId);
+ writerfilter::Reference<Stream>::Pointer_t getSubStream(
+ const rtl::OUString & rId );
- writerfilter::Reference<Stream>::Pointer_t
- getXNoteStream(OOXMLStream::StreamType_t nType,
- const Id & rType,
- const rtl::OUString & rNoteId);
-
- void setIsSubstream( bool bSubstream ) { mbIsSubstream = bSubstream; };
+ writerfilter::Reference<Stream>::Pointer_t getXNoteStream(
+ OOXMLStream::StreamType_t nType,
+ const sal_Int32 nIDForXNoteStream );
public:
- OOXMLDocumentImpl(OOXMLStream::Pointer_t pStream);
+ explicit OOXMLDocumentImpl(
+ OOXMLStream::Pointer_t pStream );
+
+ OOXMLDocumentImpl(
+ OOXMLStream::Pointer_t pStream,
+ uno::Reference<frame::XModel> xModel,
+ uno::Reference<drawing::XDrawPage> xDrawPage,
+ const bool bIsSubstream );
+
+ OOXMLDocumentImpl(
+ OOXMLStream::Pointer_t pStream,
+ const sal_Int32 nIDForXNoteStream );
+
virtual ~OOXMLDocumentImpl();
virtual void resolve(Stream & rStream);
virtual string getType() const;
- virtual void resolveFootnote(Stream & rStream,
- const Id & rType,
- const rtl::OUString & rNoteId);
- virtual void resolveEndnote(Stream & rStream,
- const Id & rType,
- const rtl::OUString & rNoteId);
+ virtual void resolveFootnote(
+ Stream & rStream,
+ const Id & rType,
+ const sal_Int32 nIDForXNoteStream );
+ virtual void resolveEndnote(
+ Stream & rStream,
+ const Id & rType,
+ const sal_Int32 nIDForXNoteStream );
+ virtual void resolveComment(
+ Stream & rStream,
+ const sal_Int32 nIDForXNoteStream );
+
virtual void resolveHeader(Stream & rStream,
const sal_Int32 type,
const rtl::OUString & rId);
@@ -87,8 +105,6 @@ public:
const sal_Int32 type,
const rtl::OUString & rId);
- virtual void resolveComment(Stream & rStream, const rtl::OUString & rId);
-
virtual OOXMLPropertySet * getPicturePropSet
(const ::rtl::OUString & rId);
virtual void resolvePicture(Stream & rStream, const rtl::OUString & rId);
@@ -102,10 +118,10 @@ public:
virtual uno::Reference<io::XInputStream> getInputStream();
virtual uno::Reference<io::XInputStream> getStorageStream();
virtual uno::Reference<io::XInputStream> getInputStreamForId(const rtl::OUString & rId);
- virtual void setXNoteId(const rtl::OUString & rId);
- virtual const ::rtl::OUString & getXNoteId() const;
- virtual void setXNoteType(const Id & rId);
- virtual const Id & getXNoteType() const;
+
+ virtual void setIDForXNoteStream( const sal_Int32 nID );
+ virtual const sal_Int32 getIDForXNoteStream() const;
+
virtual const ::rtl::OUString & getTarget() const;
};
}}
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 67cb9ac..d1b13b4 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -1032,37 +1032,31 @@ bool OOXMLFastContextHandler::isForwardEvents() const
return mpParserState->isForwardEvents();
}
-void OOXMLFastContextHandler::setXNoteId(const ::rtl::OUString & rId)
-{
- mpParserState->setXNoteId(rId);
-}
-void OOXMLFastContextHandler::setXNoteId(OOXMLValue::Pointer_t pValue)
+void OOXMLFastContextHandler::setIDForXNoteStream(OOXMLValue::Pointer_t pValue)
{
- mpParserState->setXNoteId(pValue->getString());
+ mpParserState->getDocument()->setIDForXNoteStream(pValue->getInt());
}
-const rtl::OUString & OOXMLFastContextHandler::getXNoteId() const
-{
- return mpParserState->getXNoteId();
-}
-void OOXMLFastContextHandler::resolveFootnote
-(const rtl::OUString & rId)
+void OOXMLFastContextHandler::resolveFootnote(
+ const sal_Int32 nIDForXNoteStream )
{
mpParserState->getDocument()->resolveFootnote
- (*mpStream, 0, rId);
+ (*mpStream, 0, nIDForXNoteStream);
}
-void OOXMLFastContextHandler::resolveEndnote(const rtl::OUString & rId)
+void OOXMLFastContextHandler::resolveEndnote(
+ const sal_Int32 nIDForXNoteStream )
{
mpParserState->getDocument()->resolveEndnote
- (*mpStream, 0, rId);
+ (*mpStream, 0, nIDForXNoteStream);
}
-void OOXMLFastContextHandler::resolveComment(const rtl::OUString & rId)
+void OOXMLFastContextHandler::resolveComment(
+ const sal_Int32 nIDForXNoteStream )
{
- mpParserState->getDocument()->resolveComment(*mpStream, rId);
+ mpParserState->getDocument()->resolveComment(*mpStream, nIDForXNoteStream);
}
void OOXMLFastContextHandler::resolvePicture(const rtl::OUString & rId)
@@ -1624,7 +1618,7 @@ OOXMLFastContextHandlerXNote::OOXMLFastContextHandlerXNote
( OOXMLFastContextHandler * pContext )
: OOXMLFastContextHandlerProperties( pContext )
, mbForwardEventsSaved( false )
- , msMyXNoteId()
+ , mnMyXNoteId( -1 )
{
}
@@ -1639,7 +1633,7 @@ void OOXMLFastContextHandlerXNote::lcl_startFastElement
{
mbForwardEventsSaved = isForwardEvents();
- if (msMyXNoteId.compareTo(getXNoteId()) == 0)
+ if ( mnMyXNoteId == mpParserState->getDocument()->getIDForXNoteStream() )
setForwardEvents(true);
else
setForwardEvents(false);
@@ -1661,12 +1655,12 @@ void OOXMLFastContextHandlerXNote::checkId(OOXMLValue::Pointer_t pValue)
{
#ifdef DEBUG_ELEMENT
debug_logger->startElement("checkId");
- debug_logger->attribute("myId", pValue->getString());
- debug_logger->attribute("id", getXNoteId());
+ debug_logger->attribute("myId", pValue->getInt());
+ debug_logger->attribute("id", mpParserState->getDocument()->getXNoteId());
debug_logger->endElement("checkId");
#endif
- msMyXNoteId = pValue->getString();
+ mnMyXNoteId = pValue->getInt();
}
/*
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
index 09ec3a8..fc0bec3 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
@@ -59,11 +59,12 @@ public:
enum ResourceEnum_t { UNKNOWN, STREAM, PROPERTIES, TABLE, SHAPE };
OOXMLFastContextHandler();
- explicit OOXMLFastContextHandler
- (uno::Reference< uno::XComponentContext > const & context);
- explicit OOXMLFastContextHandler
- (OOXMLFastContextHandler * pContext);
+ explicit OOXMLFastContextHandler(
+ uno::Reference< uno::XComponentContext > const & context );
+
+ explicit OOXMLFastContextHandler(
+ OOXMLFastContextHandler * pContext );
virtual ~OOXMLFastContextHandler();
@@ -141,9 +142,10 @@ public:
void mark(const Id & rId, OOXMLValue::Pointer_t pVal);
- void resolveFootnote(const rtl::OUString & rId);
- void resolveEndnote(const rtl::OUString & rId);
- void resolveComment(const rtl::OUString & rId);
+ void resolveFootnote( const sal_Int32 nIDForXNoteStream );
+ void resolveEndnote( const sal_Int32 nIDForXNoteStream );
+ void resolveComment( const sal_Int32 nIDForXNoteStream );
+
void resolvePicture(const rtl::OUString & rId);
void resolveHeader(const sal_Int32 type,
const rtl::OUString & rId);
@@ -160,9 +162,9 @@ public:
void setDocument(OOXMLDocument * pDocument);
OOXMLDocument * getDocument();
- void setXNoteId(OOXMLValue::Pointer_t pValue);
- void setXNoteId(const ::rtl::OUString & rId);
- const rtl::OUString & getXNoteId() const;
+
+ void setIDForXNoteStream(OOXMLValue::Pointer_t pValue);
+
void setForwardEvents(bool bForwardEvents);
bool isForwardEvents() const;
virtual void setParent(OOXMLFastContextHandler * pParent);
@@ -430,7 +432,7 @@ public:
private:
bool mbForwardEventsSaved;
- ::rtl::OUString msMyXNoteId;
+ sal_Int32 mnMyXNoteId;
virtual void lcl_startFastElement
(Token_t Element,
diff --git a/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx b/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx
index 792b611..f6b6ff3 100644
--- a/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx
@@ -42,15 +42,13 @@ using namespace ::std;
OOXMLFastDocumentHandler::OOXMLFastDocumentHandler(
uno::Reference< uno::XComponentContext > const & context,
Stream* pStream,
- OOXMLDocument* pDocument,
- const ::rtl::OUString& rXNoteId )
+ OOXMLDocument* pDocument )
: m_xContext(context)
, mpStream( pStream )
#ifdef DEBUG_ELEMENT
, mpTmpStream()
#endif
, mpDocument( pDocument )
- , msXNoteId( rXNoteId )
, mpContextHandler()
{
#ifdef DEBUG_PROTOCOL
@@ -140,11 +138,10 @@ OOXMLFastDocumentHandler::getContextHandler() const
{
if (mpContextHandler == OOXMLFastContextHandler::Pointer_t())
{
- mpContextHandler.reset
- (new OOXMLFastContextHandler(m_xContext));
+ mpContextHandler.reset(
+ new OOXMLFastContextHandler(m_xContext) );
mpContextHandler->setStream(mpStream);
mpContextHandler->setDocument(mpDocument);
- mpContextHandler->setXNoteId(msXNoteId);
mpContextHandler->setForwardEvents(true);
}
@@ -196,7 +193,7 @@ Name
#endif
return uno::Reference< xml::sax::XFastContextHandler >
- ( new OOXMLFastDocumentHandler( m_xContext, 0, 0, ::rtl::OUString() ) );
+ ( new OOXMLFastDocumentHandler( m_xContext, 0, 0 ) );
}
void SAL_CALL OOXMLFastDocumentHandler::characters(const ::rtl::OUString & /*aChars*/)
diff --git a/writerfilter/source/ooxml/OOXMLFastDocumentHandler.hxx b/writerfilter/source/ooxml/OOXMLFastDocumentHandler.hxx
index ead44ed..7da0c34 100644
--- a/writerfilter/source/ooxml/OOXMLFastDocumentHandler.hxx
+++ b/writerfilter/source/ooxml/OOXMLFastDocumentHandler.hxx
@@ -47,8 +47,8 @@ public:
OOXMLFastDocumentHandler(
uno::Reference< uno::XComponentContext > const & context,
Stream* pStream,
- OOXMLDocument* pDocument,
- const ::rtl::OUString& rXNoteId );
+ OOXMLDocument* pDocument );
+
virtual ~OOXMLFastDocumentHandler() {}
// ::com::sun::star::xml::sax::XFastDocumentHandler:
@@ -103,7 +103,6 @@ private:
Stream::Pointer_t mpTmpStream;
#endif
OOXMLDocument * mpDocument;
- ::rtl::OUString msXNoteId;
mutable boost::shared_ptr<OOXMLFastContextHandler> mpContextHandler;
boost::shared_ptr<OOXMLFastContextHandler> getContextHandler() const;
};
diff --git a/writerfilter/source/ooxml/OOXMLParserState.cxx b/writerfilter/source/ooxml/OOXMLParserState.cxx
index de563f1..551f672 100644
--- a/writerfilter/source/ooxml/OOXMLParserState.cxx
+++ b/writerfilter/source/ooxml/OOXMLParserState.cxx
@@ -123,15 +123,6 @@ OOXMLDocument * OOXMLParserState::getDocument() const
return mpDocument;
}
-void OOXMLParserState::setXNoteId(const rtl::OUString & rId)
-{
- mpDocument->setXNoteId(rId);
-}
-
-const rtl::OUString & OOXMLParserState::getXNoteId() const
-{
- return mpDocument->getXNoteId();
-}
const ::rtl::OUString & OOXMLParserState::getTarget() const
{
@@ -308,9 +299,7 @@ XMLTag::Pointer_t OOXMLParserState::toTag() const
sTmp += "-";
pTag->addAttr("state", sTmp);
- pTag->addAttr("XNoteId",
- OUStringToOString(getXNoteId(),
- RTL_TEXTENCODING_ASCII_US).getStr());
+ pTag->addAttr("XNoteId", getDocument()->getIDForXNoteStream() );
if (mpCharacterProps != OOXMLPropertySet::Pointer_t())
pTag->chars(mpCharacterProps->toString());
diff --git a/writerfilter/source/ooxml/OOXMLParserState.hxx b/writerfilter/source/ooxml/OOXMLParserState.hxx
index 731adcc..fae4ae2 100644
--- a/writerfilter/source/ooxml/OOXMLParserState.hxx
+++ b/writerfilter/source/ooxml/OOXMLParserState.hxx
@@ -48,7 +48,6 @@ class OOXMLParserState
unsigned int mnContexts;
unsigned int mnHandle;
OOXMLDocument * mpDocument;
- rtl::OUString msXNoteId;
rtl::OUString msTarget;
OOXMLPropertySet::Pointer_t mpCharacterProps;
stack<OOXMLPropertySet::Pointer_t> mCellProps;
@@ -85,9 +84,6 @@ public:
void setDocument(OOXMLDocument * pDocument);
OOXMLDocument * getDocument() const;
- void setXNoteId(const rtl::OUString & rId);
- const rtl::OUString & getXNoteId() const;
-
const rtl::OUString & getTarget() const;
void resolveCharacterProperties(Stream & rStream);
diff --git a/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx b/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx
index e4d6e85..c8887d6 100644
--- a/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx
+++ b/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx
@@ -201,7 +201,7 @@ bool OOXMLValue::getBool() const
return false;
}
-int OOXMLValue::getInt() const
+sal_Int32 OOXMLValue::getInt() const
{
return 0;
}
@@ -301,7 +301,7 @@ bool OOXMLBooleanValue::getBool() const
return mbValue;
}
-int OOXMLBooleanValue::getInt() const
+sal_Int32 OOXMLBooleanValue::getInt() const
{
return mbValue ? 1 : 0;
}
@@ -594,7 +594,7 @@ OOXMLIntegerValue::~OOXMLIntegerValue()
{
}
-int OOXMLIntegerValue::getInt() const
+sal_Int32 OOXMLIntegerValue::getInt() const
{
return mnValue;
}
@@ -637,7 +637,7 @@ OOXMLHexValue::~OOXMLHexValue()
{
}
-int OOXMLHexValue::getInt() const
+sal_Int32 OOXMLHexValue::getInt() const
{
return mnValue;
}
diff --git a/writerfilter/source/ooxml/OOXMLPropertySetImpl.hxx b/writerfilter/source/ooxml/OOXMLPropertySetImpl.hxx
index c8892f8..c6e5492 100644
--- a/writerfilter/source/ooxml/OOXMLPropertySetImpl.hxx
+++ b/writerfilter/source/ooxml/OOXMLPropertySetImpl.hxx
@@ -47,7 +47,7 @@ public:
OOXMLValue();
virtual ~OOXMLValue();
- virtual int getInt() const;
+ virtual sal_Int32 getInt() const;
virtual bool getBool() const;
virtual ::rtl::OUString getString() const;
virtual uno::Any getAny() const;
@@ -108,7 +108,7 @@ public:
explicit OOXMLBooleanValue(const rtl::OUString & rValue);
virtual ~OOXMLBooleanValue();
- virtual int getInt() const;
+ virtual sal_Int32 getInt() const;
virtual bool getBool() const;
virtual uno::Any getAny() const;
virtual string toString() const;
@@ -197,7 +197,7 @@ public:
explicit OOXMLIntegerValue(const rtl::OUString & rValue);
virtual ~OOXMLIntegerValue();
- virtual int getInt() const;
+ virtual sal_Int32 getInt() const;
virtual uno::Any getAny() const;
virtual string toString() const;
virtual OOXMLValue * clone() const;
@@ -212,7 +212,7 @@ public:
explicit OOXMLHexValue(const rtl::OUString & rValue);
virtual ~OOXMLHexValue();
- virtual int getInt() const;
+ virtual sal_Int32 getInt() const;
virtual string toString() const;
virtual OOXMLValue * clone() const;
};
diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml
index 4b5812a..245d44d 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -14439,10 +14439,6 @@
</optional>
</define>
<define name="CT_MarkupRangeBookmark">
- <attribute name="id">
- <text/>
- <xs:documentation>Annotation Identifier</xs:documentation>
- </attribute>
<ref name="CT_MarkupRange"/>
</define>
<define name="CT_MarkupRangeCommentStart">
@@ -14485,10 +14481,6 @@
</attribute>
</define>
<define name="CT_Comment">
- <attribute name="id">
- <ref name="ST_DecimalNumber"/>
- <xs:documentation>Annotation Identifier</xs:documentation>
- </attribute>
<ref name="CT_TrackChange"/>
<zeroOrMore>
<ref name="EG_BlockLevelElts"/>
@@ -18159,13 +18151,13 @@
</attribute>
</optional>
<attribute name="id">
- <text/>
+ <ref name="ST_DecimalNumber"/>
<xs:documentation>Footnote/Endnote ID Reference</xs:documentation>
</attribute>
</define>
<define name="CT_FtnEdnSepRef">
<attribute name="id">
- <text/>
+ <ref name="ST_DecimalNumber"/>
<xs:documentation>Footnote/Endnote ID</xs:documentation>
</attribute>
</define>
@@ -18180,7 +18172,7 @@
</attribute>
</optional>
<attribute name="id">
- <text/>
+ <ref name="ST_DecimalNumber"/>
<xs:documentation>Footnote/Endnote ID</xs:documentation>
</attribute>
</define>
@@ -22859,7 +22851,7 @@
</resource>
<resource name="CT_FtnEdnRef" resource="Properties" tag="reference">
<attribute name="customMarkFollows" tokenid="ooxml:CT_FtnEdnRef_customMarkFollows"/>
- <attribute name="id" tokenid="ooxml:CT_FtnEdnRef_id" action="setXNoteId"/>
+ <attribute name="id" tokenid="ooxml:CT_FtnEdnRef_id" action="setIDForXNoteStream"/>
<action name="end" action="handleXNotes"/>
</resource>
<resource name="CT_FtnEdnSepRef" resource="Properties" tag="reference">
commit fb7d72f102e097a2a8154b8d9300aa367f3057c0
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Thu Dec 19 13:17:40 2013 +0000
97631: *.docx import: import annotation's author and creation date
cherry-picked from branch ooxml-osba
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index cd86ef4..84328e0 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3769,9 +3769,18 @@ sal_Int32 DomainMapper_Impl::GetCurrentRedlineToken( )
void DomainMapper_Impl::SetCurrentRedlineAuthor( rtl::OUString sAuthor )
{
- RedlineParamsPtr pCurrent( GetTopRedline( ) );
- if ( pCurrent.get( ) )
- pCurrent->m_sAuthor = sAuthor;
+ if (m_xAnnotationField.is())
+ {
+ m_xAnnotationField->setPropertyValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Author")),
+ uno::makeAny(sAuthor) );
+ }
+ else
+ {
+ RedlineParamsPtr pCurrent( GetTopRedline( ) );
+ if ( pCurrent.get( ) )
+ pCurrent->m_sAuthor = sAuthor;
+ }
}
void DomainMapper_Impl::SetCurrentRedlineInitials( rtl::OUString sInitials )
@@ -3786,9 +3795,18 @@ void DomainMapper_Impl::SetCurrentRedlineInitials( rtl::OUString sInitials )
void DomainMapper_Impl::SetCurrentRedlineDate( rtl::OUString sDate )
{
- RedlineParamsPtr pCurrent( GetTopRedline( ) );
- if ( pCurrent.get( ) )
- pCurrent->m_sDate = sDate;
+ if (m_xAnnotationField.is())
+ {
+ m_xAnnotationField->setPropertyValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DateTimeValue")),
+ uno::makeAny( ConversionHelper::convertDateTime( sDate ) ) );
+ }
+ else
+ {
+ RedlineParamsPtr pCurrent( GetTopRedline( ) );
+ if ( pCurrent.get( ) )
+ pCurrent->m_sDate = sDate;
+ }
}
void DomainMapper_Impl::SetCurrentRedlineId( sal_Int32 sId )
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 8e133c6..975befd 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -173,8 +173,10 @@ struct TextAppendContext
::com::sun::star::uno::Reference< ::com::sun::star::text::XTextAppend > xTextAppend;
ParagraphPropertiesPtr pLastParagraphProperties;
- TextAppendContext( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextAppend >& xAppend ) :
- xTextAppend( xAppend ){}
+ TextAppendContext( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextAppend >& xAppend )
+ : xTextAppend( xAppend )
+ {
+ }
};
typedef boost::shared_ptr<FieldContext> FieldContextPtr;
@@ -211,11 +213,16 @@ class FIB
struct DeletableTabStop : public ::com::sun::star::style::TabStop
{
bool bDeleted;
- DeletableTabStop() :
- bDeleted( false ){}
- DeletableTabStop( const ::com::sun::star::style::TabStop& rTabStop ) :
- TabStop( rTabStop ),
- bDeleted( false ){}
+
+ DeletableTabStop()
+ : TabStop()
+ , bDeleted( false )
+ {}
+
+ DeletableTabStop( const ::com::sun::star::style::TabStop& rTabStop )
+ : TabStop( rTabStop )
+ , bDeleted( false )
+ {}
};
/*-- 12.06.2007 07:15:31---------------------------------------------------
/// helper to remember bookmark start position
@@ -225,10 +232,14 @@ struct BookmarkInsertPosition
bool m_bIsStartOfText;
::rtl::OUString m_sBookmarkName;
::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > m_xTextRange;
- BookmarkInsertPosition(bool bIsStartOfText, const ::rtl::OUString& rName, ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xTextRange):
- m_bIsStartOfText( bIsStartOfText ),
- m_sBookmarkName( rName ),
- m_xTextRange( xTextRange )
+
+ BookmarkInsertPosition(
+ bool bIsStartOfText,
+ const ::rtl::OUString& rName,
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xTextRange )
+ : m_bIsStartOfText( bIsStartOfText )
+ , m_sBookmarkName( rName )
+ , m_xTextRange( xTextRange )
{}
};
@@ -352,8 +363,8 @@ private:
bool m_bIsInComments;
//annotation import
- uno::Reference< beans::XPropertySet > m_xAnnotationField;
- AnnotationPosition m_aAnnotationPosition;
+ uno::Reference< beans::XPropertySet > m_xAnnotationField;
+ AnnotationPosition m_aAnnotationPosition;
void GetCurrentLocale(::com::sun::star::lang::Locale& rLocale);
void SetNumberFormat( const ::rtl::OUString& rCommand,
commit f1b290cdb3683a4fb05dc68145f480b54e2850cf
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Thu Dec 19 13:03:05 2013 +0000
123771: ODF export: export annotation's author initials in own namespace only in ODF 1.2 (extended) file format
annotation's author initials is currently not standardized in ODF 1.2
a corresponding proposal is available at the OASIS ODF TC - see JIRA isssue OFFICE-3776 at OASIS
cherry-picked from branch ooxml-osba
diff --git a/sw/source/filter/xml/xmliteme.cxx b/sw/source/filter/xml/xmliteme.cxx
index d9372f1..6f3efc9 100644
--- a/sw/source/filter/xml/xmliteme.cxx
+++ b/sw/source/filter/xml/xmliteme.cxx
@@ -32,6 +32,7 @@
#include <xmloff/xmluconv.hxx>
#include "xmlexpit.hxx"
#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmlnmspe.hxx>
#include <xmloff/xmltabe.hxx>
#include "xmlbrshe.hxx"
#include <editeng/tstpitem.hxx>
@@ -236,6 +237,14 @@ void SwXMLExport::_InitItemExport()
xTableCellItemMap = new SvXMLItemMapEntries( aXMLTableCellItemMap );
pTableItemMapper = new SwXMLTableItemMapper_Impl( xTableItemMap, *this );
+
+ if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 )
+ {
+ _GetNamespaceMap().Add(
+ GetXMLToken(XML_NP_TEXT_EXT),
+ GetXMLToken(XML_N_TEXT_EXT),
+ XML_NAMESPACE_TEXT_EXT);
+ }
}
void SwXMLExport::_FinitItemExport()
diff --git a/xmloff/inc/xmloff/xmlnmspe.hxx b/xmloff/inc/xmloff/xmlnmspe.hxx
index 01fe40e..0a4ffa4 100644
--- a/xmloff/inc/xmloff/xmlnmspe.hxx
+++ b/xmloff/inc/xmloff/xmlnmspe.hxx
@@ -85,8 +85,9 @@ XML_NAMESPACE_EXT( OFFICE, 37U )
XML_NAMESPACE_EXT( TABLE, 38U )
XML_NAMESPACE_EXT( CHART, 39U )
XML_NAMESPACE_EXT( DRAW, 40U )
+XML_NAMESPACE_EXT( TEXT, 41U )
-#define _XML_OLD_NAMESPACE_BASE 41U
+#define _XML_OLD_NAMESPACE_BASE 42U
// namespaces used in the technical preview (SO 5.2)
XML_OLD_NAMESPACE( FO, 0U )
diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx
index ceb43bf..a7503c0 100644
--- a/xmloff/inc/xmloff/xmltoken.hxx
+++ b/xmloff/inc/xmloff/xmltoken.hxx
@@ -147,6 +147,9 @@ namespace xmloff { namespace token {
XML_NP_DRAW_EXT,
XML_N_DRAW_EXT,
+ XML_NP_TEXT_EXT,
+ XML_N_TEXT_EXT,
+
// units
XML_UNIT_MM,
XML_UNIT_M,
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 08b0756..bdeda83 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -92,6 +92,7 @@ sal_Char __READONLY_DATA sXML_np__oooc[] = "_oooc";
sal_Char __READONLY_DATA sXML_np__of[] = "_of";
sal_Char __READONLY_DATA sXML_np__style[] = "_style";
sal_Char __READONLY_DATA sXML_np__text[] = "_text";
+sal_Char __READONLY_DATA sXML_np__text_ext[] = "_text_ooo";
sal_Char __READONLY_DATA sXML_np__table[] = "_table";
sal_Char __READONLY_DATA sXML_np__table_ext[] = "_table_ooo";
sal_Char __READONLY_DATA sXML_np__draw[] = "_draw";
@@ -308,8 +309,7 @@ void SvXMLImport::_InitCtor()
if( mnImportFlags != 0 )
{
// implicit "xml" namespace prefix
- mpNamespaceMap->Add( GetXMLToken(XML_XML), GetXMLToken(XML_N_XML),
- XML_NAMESPACE_XML );
+ mpNamespaceMap->Add( GetXMLToken(XML_XML), GetXMLToken(XML_N_XML), XML_NAMESPACE_XML );
mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__office ) ),
GetXMLToken(XML_N_OFFICE),
XML_NAMESPACE_OFFICE );
@@ -323,6 +323,9 @@ void SvXMLImport::_InitCtor()
mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__text) ),
GetXMLToken(XML_N_TEXT),
XML_NAMESPACE_TEXT );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__text_ext ) ),
+ GetXMLToken(XML_N_TEXT_EXT),
+ XML_NAMESPACE_TEXT_EXT );
mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__table ) ),
GetXMLToken(XML_N_TABLE),
XML_NAMESPACE_TABLE );
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index aa9639c..e2bce8b 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -155,6 +155,9 @@ namespace xmloff { namespace token {
TOKEN( "drawooo", XML_NP_DRAW_EXT ),
TOKEN( "http://openoffice.org/2010/draw", XML_N_DRAW_EXT ),
+ TOKEN( "textooo", XML_NP_TEXT_EXT ),
+ TOKEN( "http://openoffice.org/2013/office", XML_N_TEXT_EXT ),
+
// units
TOKEN( "mm", XML_UNIT_MM ),
TOKEN( "m", XML_UNIT_M ),
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index 9c995c7..26aaf1e 100644
--- a/xmloff/source/text/txtflde.cxx
+++ b/xmloff/source/text/txtflde.cxx
@@ -1764,13 +1764,14 @@ void XMLTextFieldExport::ExportFieldHelper(
}
// initials
+ if ( GetExport().getDefaultVersion() > SvtSaveOptions::ODFVER_012 )
{
OUString aInitials( GetStringProperty(sPropertyInitials, rPropSet) );
if ( aInitials.getLength() > 0 )
{
SvXMLElementExport aCreatorElem(
GetExport(),
- XML_NAMESPACE_TEXT,
+ XML_NAMESPACE_TEXT_EXT,
XML_SENDER_INITIALS,
sal_True,
sal_False );
diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index f60a846..761a961 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -3682,7 +3682,8 @@ SvXMLImportContext* XMLAnnotationImportContext::CreateChildContext(
new XMLStringBufferImportContext( GetImport(), nPrefix, rLocalName, aDateBuffer);
}
}
- else if ( XML_NAMESPACE_TEXT == nPrefix )
+ else if ( XML_NAMESPACE_TEXT == nPrefix
+ || XML_NAMESPACE_TEXT_EXT == nPrefix )
{
if( IsXMLToken( rLocalName, XML_SENDER_INITIALS ) )
{
commit aca4c3f0c6aa4986d1d5a266102ed141b8368be7
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Thu Dec 19 12:49:19 2013 +0000
123771: fix <Fieldmark> implementation for OSBA OOXML improvement use case 4
cherry-picked from branch ooxml-osba
diff --git a/sw/inc/unobookmark.hxx b/sw/inc/unobookmark.hxx
index e6c86b8..63f8d1c 100644
--- a/sw/inc/unobookmark.hxx
+++ b/sw/inc/unobookmark.hxx
@@ -81,13 +81,14 @@ protected:
/// @param pDoc and pMark != 0, but not & because of ImplInheritanceHelper
SwXBookmark(::sw::mark::IMark *const pMark, SwDoc *const pDoc);
+ void registerInMark( ::sw::mark::IMark *const pBkmk );
+
public:
/// descriptor
SwXBookmark();
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::text::XTextContent>
+ static ::com::sun::star::uno::Reference<::com::sun::star::text::XTextContent>
CreateXBookmark(SwDoc & rDoc, ::sw::mark::IMark & rBookmark);
/// @return IMark for this, but only if it lives in pDoc
@@ -234,10 +235,21 @@ private:
bool isReplacementObject;
+ SwXFieldmark(
+ bool _isReplacementObject,
+ ::sw::mark::IMark *const pMark,
+ SwDoc *const pDoc );
+
public:
- SwXFieldmark(bool isReplacementObject,
- ::sw::mark::IMark* pBkm = 0, SwDoc* pDoc = 0);
+ // <SwXFieldmark> instance not attached to the document - property descriptor available
+ SwXFieldmark( bool isReplacementObject );
+
+ // (as the parent class) newly created <SwXFieldmark> instances for an existing <IMark> instance needs to be registered in the Mark
+ static ::com::sun::star::uno::Reference<::com::sun::star::text::XTextContent>
+ CreateXFieldmark(
+ SwDoc & rDoc,
+ ::sw::mark::IMark & rBookmark );
virtual void attachToRange(
const ::com::sun::star::uno::Reference<
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index fd6452a..bfe3485 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -87,6 +87,7 @@ namespace
if(ch_start != aStartMark)
{
io_pDoc->InsertString(aStartPaM, aStartMark);
+ rStart.nContent--;
}
if ( aEndMark && ( ch_end != aEndMark ) && ( rStart != rEnd ) )
{
diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx
index 1ac63b5..69c1017 100644
--- a/sw/source/core/unocore/unobkm.cxx
+++ b/sw/source/core/unocore/unobkm.cxx
@@ -103,8 +103,9 @@ void SwXBookmark::Impl::Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew)
}
}
-void SwXBookmark::Impl::registerInMark(SwXBookmark & rThis,
- ::sw::mark::IMark *const pBkmk)
+void SwXBookmark::Impl::registerInMark(
+ SwXBookmark & rThis,
+ ::sw::mark::IMark *const pBkmk)
{
if (pBkmk)
{
@@ -157,23 +158,23 @@ SwXBookmark::CreateXBookmark(SwDoc & rDoc, ::sw::mark::IMark & rBookmark)
uno::Reference<text::XTextContent> xBookmark(pMarkBase->GetXBookmark());
if (!xBookmark.is())
{
- // FIXME: These belong in XTextFieldsSupplier
- //if (dynamic_cast< ::sw::mark::TextFieldmark* >(&rBkmk))
- // pXBkmk = new SwXFieldmark(false, &rBkmk, pDoc);
- //else if (dynamic_cast< ::sw::mark::CheckboxFieldmark* >(&rBkmk))
- // pXBkmk = new SwXFieldmark(true, &rBkmk, pDoc);
- //else
OSL_ENSURE(
dynamic_cast< ::sw::mark::IBookmark* >(&rBookmark),
"<SwXBookmark::GetObject(..)>"
"SwXBookmark requested for non-bookmark mark.");
SwXBookmark *const pXBookmark = new SwXBookmark(&rBookmark, &rDoc);
xBookmark.set(pXBookmark);
- pXBookmark->m_pImpl->registerInMark(*pXBookmark, pMarkBase);
+ pXBookmark->registerInMark( pMarkBase);
}
return xBookmark;
}
+
+void SwXBookmark::registerInMark( ::sw::mark::IMark *const pBkmk )
+{
+ m_pImpl->registerInMark( *this, pBkmk );
+}
+
::sw::mark::IMark const* SwXBookmark::GetBookmarkInDoc(SwDoc const*const pDoc,
const uno::Reference< lang::XUnoTunnel> & xUT)
{
@@ -246,10 +247,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
{
eType = IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK;
}
- m_pImpl->registerInMark(*this,
- m_pImpl->m_pDoc->getIDocumentMarkAccess()->makeMark(
- aPam, m_pImpl->m_sMarkName, eType));
- // --> OD 2007-10-23 #i81002#
+ registerInMark( m_pImpl->m_pDoc->getIDocumentMarkAccess()->makeMark( aPam, m_pImpl->m_sMarkName, eType ) );
// Check, if bookmark has been created.
// E.g., the creation of a cross-reference bookmark is suppress,
// if the PaM isn't a valid one for cross-reference bookmarks.
@@ -260,7 +258,6 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
" - could not create Mark.");
throw lang::IllegalArgumentException();
}
- // <--
}
void SwXBookmark::attachToRange(
@@ -514,10 +511,53 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
* SwXFieldmark
******************************************************************/
-SwXFieldmark::SwXFieldmark(bool _isReplacementObject, ::sw::mark::IMark* pBkm, SwDoc* pDc)
- : SwXFieldmark_Base(pBkm, pDc)
+SwXFieldmark::SwXFieldmark( bool _isReplacementObject )
+ : SwXFieldmark_Base()
, isReplacementObject(_isReplacementObject)
-{ }
+{
+}
+
+
+SwXFieldmark::SwXFieldmark(
+ bool _isReplacementObject,
+ ::sw::mark::IMark *const pMark,
+ SwDoc *const pDoc )
+ : SwXFieldmark_Base( pMark, pDoc )
+ , isReplacementObject( _isReplacementObject )
+{
+}
+
+
+uno::Reference<text::XTextContent> SwXFieldmark::CreateXFieldmark(
+ SwDoc & rDoc,
+ ::sw::mark::IMark & rBookmark )
+{
+ // do not iterate over the registered clients: race condition
+ ::sw::mark::MarkBase *const pMarkBase( dynamic_cast< ::sw::mark::MarkBase * >(&rBookmark));
+ OSL_ENSURE(pMarkBase, "CreateXFieldmark: no MarkBase?");
+ if (!pMarkBase) { return 0; }
+
+ uno::Reference<text::XTextContent> xBookmark(pMarkBase->GetXBookmark());
+ if (!xBookmark.is())
+ {
+ SwXFieldmark* pXFieldmark = NULL;
+ if ( dynamic_cast< ::sw::mark::TextFieldmark* >(&rBookmark) )
+ {
+ pXFieldmark = new SwXFieldmark( false, &rBookmark, &rDoc );
+ }
+ else if ( dynamic_cast< ::sw::mark::CheckboxFieldmark* >(&rBookmark) )
+ {
+ pXFieldmark = new SwXFieldmark( true, &rBookmark, &rDoc );
+ }
+ if ( pXFieldmark != NULL )
+ {
+ xBookmark.set( pXFieldmark );
+ pXFieldmark->registerInMark( pMarkBase );
+ }
+ }
+ return xBookmark;
+}
+
void SwXFieldmarkParameters::insertByName(const OUString& aName, const uno::Any& aElement)
throw (lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException)
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index ef4b413..6d67533 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -399,17 +399,19 @@ lcl_ExportFieldMark(
if (CH_TXT_ATR_FIELDSTART == Char)
{
::sw::mark::IFieldmark* pFieldmark = NULL;
- if (pDoc)
+ if ( pDoc != NULL )
{
pFieldmark =
pDoc->getIDocumentMarkAccess()->getFieldmarkFor(*pUnoCrsr->GetMark());
}
SwXTextPortion* pPortion =
- new SwXTextPortion( pUnoCrsr, i_xParentText, PORTION_FIELD_START);
+ new SwXTextPortion( pUnoCrsr, i_xParentText, PORTION_FIELD_START );
xRef = pPortion;
- if ( pPortion && pFieldmark && pDoc )
+ if ( pPortion != NULL
+ && pFieldmark != NULL
+ && pDoc != NULL )
{
- pPortion->SetBookmark( new SwXFieldmark( false, pFieldmark, pDoc ) );
+ pPortion->SetBookmark( SwXFieldmark::CreateXFieldmark( *pDoc, *pFieldmark ) );
Reference<XTextField> xField;
const SwFmtFld* pField = lcl_getFieldByName( pDoc, pFieldmark->GetName() );
if (pField)
@@ -420,30 +422,38 @@ lcl_ExportFieldMark(
else if (CH_TXT_ATR_FIELDEND == Char)
{
::sw::mark::IFieldmark* pFieldmark = NULL;
- if (pDoc)
+ if ( pDoc != NULL )
{
- pFieldmark = pDoc->getIDocumentMarkAccess()->
- getFieldmarkFor(*pUnoCrsr->GetMark());
+ pFieldmark =
+ pDoc->getIDocumentMarkAccess()->getFieldmarkFor(*pUnoCrsr->GetMark());
}
- SwXTextPortion* pPortion = new SwXTextPortion(
- pUnoCrsr, i_xParentText, PORTION_FIELD_END);
+ SwXTextPortion* pPortion =
+ new SwXTextPortion( pUnoCrsr, i_xParentText, PORTION_FIELD_END );
xRef = pPortion;
- if (pPortion && pFieldmark && pDoc)
- pPortion->SetBookmark(new SwXFieldmark(false, pFieldmark, pDoc));
+ if ( pPortion != NULL
+ && pFieldmark != NULL
+ && pDoc != NULL )
+ {
+ pPortion->SetBookmark( SwXFieldmark::CreateXFieldmark( *pDoc, *pFieldmark ) );
+ }
}
else if (CH_TXT_ATR_FORMELEMENT == Char)
{
::sw::mark::IFieldmark* pFieldmark = NULL;
- if (pDoc)
+ if ( pDoc != NULL )
{
pFieldmark = pDoc->getIDocumentMarkAccess()->
getFieldmarkFor(*pUnoCrsr->GetMark());
}
- SwXTextPortion* pPortion = new SwXTextPortion(
- pUnoCrsr, i_xParentText, PORTION_FIELD_START_END);
+ SwXTextPortion* pPortion =
+ new SwXTextPortion( pUnoCrsr, i_xParentText, PORTION_FIELD_START_END );
xRef = pPortion;
- if (pPortion && pFieldmark && pDoc)
- pPortion->SetBookmark(new SwXFieldmark(true, pFieldmark, pDoc));
+ if ( pPortion != NULL
+ && pFieldmark != NULL
+ && pDoc != NULL )
+ {
+ pPortion->SetBookmark( SwXFieldmark::CreateXFieldmark( *pDoc, *pFieldmark ) );
+ }
}
else
{
commit 1b5627354188efe436c8a04eb39b72f3eba89d50
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Thu Dec 19 12:36:16 2013 +0000
123771: *.docx import - handle properties of annotations
intrinsic patches from OSBA OOXML improvement project which introduced the import of author initials of annotations does not work, because properties of imported annotations are not handled.
cherry-picked from branch ooxml-osba
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 807fc1d..67cb9ac 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -1621,8 +1621,10 @@ void OOXMLFastContextHandlerTable::newPropertySet
*/
OOXMLFastContextHandlerXNote::OOXMLFastContextHandlerXNote
-(OOXMLFastContextHandler * pContext)
-: OOXMLFastContextHandler(pContext)
+ ( OOXMLFastContextHandler * pContext )
+ : OOXMLFastContextHandlerProperties( pContext )
+ , mbForwardEventsSaved( false )
+ , msMyXNoteId()
{
}
@@ -1649,7 +1651,8 @@ void OOXMLFastContextHandlerXNote::lcl_endFastElement
(Token_t Element)
throw (uno::RuntimeException, xml::sax::SAXException)
{
- endAction(Element);
+ // handle properties by calling parent class' method
+ OOXMLFastContextHandlerProperties::lcl_endFastElement( Element );
setForwardEvents(mbForwardEventsSaved);
}
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
index 621cf14..09ec3a8 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
@@ -418,7 +418,7 @@ protected:
void addCurrentChild();
};
-class OOXMLFastContextHandlerXNote : public OOXMLFastContextHandler
+class OOXMLFastContextHandlerXNote : public OOXMLFastContextHandlerProperties
{
public:
OOXMLFastContextHandlerXNote(OOXMLFastContextHandler * pContext);
commit ff2b22bd1114187b54a8fcf70485ce70026bfaa7
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Thu Dec 19 12:31:35 2013 +0000
123771: integration of OSBA OOXML improvement project's use case 4 patches
changes for RTF filter, for *.docx export and for *.xslx export are not usable as they base on code which is not available
Patch by: SUSE, Miklos Vajna <vmiklos at suse.cz>
Review by: Oliver <orw at apache.org>
cherry-picked from branch ooxml-osba
diff --git a/offapi/com/sun/star/text/textfield/Annotation.idl b/offapi/com/sun/star/text/textfield/Annotation.idl
index dd0dd78..92a5d95 100644
--- a/offapi/com/sun/star/text/textfield/Annotation.idl
+++ b/offapi/com/sun/star/text/textfield/Annotation.idl
@@ -42,12 +42,27 @@ published service Annotation
/** contains the name of the author of the annotation.
*/
[property]string Author;
+
+ /** contains the initials of the author of the annotation.
+
+ @since Apache OpenOffice 4.1
+ */
+ [optional, property]string Initials;
+
+ /** contains the name of the annotation.
+
+ @since Apache OpenOffice 4.1
+ */
+ [optional, property]string Name;
+
/** contains the annotation's content
*/
[property]string Content;
+
/** contains the creation date.
*/
[property]com::sun::star::util::Date Date;
+
/** contains the creation date.
*/
[optional, property]com::sun::star::util::DateTime DateTimeValue;
diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx
index 76d6a7e..6dac352 100644
--- a/sw/inc/PostItMgr.hxx
+++ b/sw/inc/PostItMgr.hxx
@@ -268,9 +268,9 @@ class SwPostItMgr: public SfxListener
void SetSpellChecking();
- Color GetColorDark(sal_uInt16 aAuthorIndex);
- Color GetColorLight(sal_uInt16 aAuthorIndex);
- Color GetColorAnchor(sal_uInt16 aAuthorIndex);
+ static Color GetColorDark(sal_uInt16 aAuthorIndex);
+ static Color GetColorLight(sal_uInt16 aAuthorIndex);
+ static Color GetColorAnchor(sal_uInt16 aAuthorIndex);
void RegisterAnswer(OutlinerParaObject* pAnswer) { mpAnswer = pAnswer;}
diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx
index 88b7cc4..2374293 100644
--- a/sw/inc/docufld.hxx
+++ b/sw/inc/docufld.hxx
@@ -508,28 +508,40 @@ public:
SwDoc* GetDoc() {return mpDoc;};
};
-/*--------------------------------------------------------------------
- Beschreibung: PostIt
- --------------------------------------------------------------------*/
+// representation for a comment/an annotation
class SW_DLLPUBLIC SwPostItField : public SwField
{
- String sTxt; // die Anmerkung
- String sAuthor; // der Author
- DateTime aDateTime; // Datum und Zeit der Anmerkung
+ String msCommentContent; // content of the comment/annotation
+ String msAuthor; // author
+ String msAuthorInitials; // author's initials
+ String msName; // name (identifier) of the comment/annotation
+ DateTime maDateTime; // creation date and time
+
OutlinerParaObject* mpText;
SwTextAPIObject* m_pTextObject;
public:
- SwPostItField( SwPostItFieldType*,
- const String& rAuthor, const String& rTxt, const DateTime& rDate);
+ SwPostItField(
+ SwPostItFieldType*,
+ const String& rCommentContent,
+ const String& rAuthor,
+ const String& rAuthorInitials,
+ const String& rName,
+ const DateTime& rDate);
~SwPostItField();
- virtual String Expand() const;
- virtual SwField* Copy() const;
+ virtual String Expand() const;
+ virtual SwField* Copy() const;
- inline const Date GetDate() const { return aDateTime.GetDate(); }
- inline const Time GetTime() const { return aDateTime.GetTime(); }
+ inline const Date GetDate() const
+ {
+ return maDateTime.GetDate();
+ }
+ inline const Time GetTime() const
+ {
+ return maDateTime.GetTime();
+ }
// Author
virtual const String& GetPar1() const;
@@ -538,15 +550,22 @@ public:
// Text
virtual String GetPar2() const;
virtual void SetPar2(const String& rStr);
- const String& GetTxt() const { return sTxt; }
+ inline const String& GetContent() const
+ {
+ return msCommentContent;
+ }
+
+ // Name
+ void SetName(const String& rStr);
+ const String& GetName() const;
const OutlinerParaObject* GetTextObject() const;
void SetTextObject( OutlinerParaObject* pText );
sal_uInt32 GetNumberOfParagraphs() const;
- virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
- virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
virtual String GetDescription() const;
};
diff --git a/sw/inc/unofield.hxx b/sw/inc/unofield.hxx
index 866cac3..13fb148 100644
--- a/sw/inc/unofield.hxx
+++ b/sw/inc/unofield.hxx
@@ -203,6 +203,7 @@ public:
/// @return an SwXTextField, either an already existing one or a new one
static SwXTextField* CreateSwXTextField(SwDoc & rDoc, SwFmtFld const& rFmt);
+ sal_uInt16 GetServiceId();
};
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index f5b60a8..d92c7b5 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -716,11 +716,8 @@ enum SwPropNameIds
// <--
/* 0675 */ UNO_NAME_NUMBERING_IS_OUTLINE,
///* 0676 */ UNO_NAME_DEFAULT_OUTLINE_LEVEL, //#outline level, removed by zhaojianwei
-// --> OD 2004-10-28 #i36248#
/* 0677 */ UNO_NAME_STARTPOSITION_IN_HORI_L2R,
/* 0678 */ UNO_NAME_ENDPOSITION_IN_HORI_L2R,
-// <--
-// --> OS 2004-12-13 #30916#
/* 0679 */ UNO_NAME_SUBJECT,
/* 0680 */ UNO_NAME_ADDRESS_FROM_COLUMN,
/* 0681 */ UNO_NAME_SEND_AS_HTML,
@@ -735,71 +732,51 @@ enum SwPropNameIds
/* 0690 */ UNO_NAME_BLIND_COPIES_TO,
/* 0691 */ UNO_NAME_IN_SERVER_PASSWORD,
/* 0692 */ UNO_NAME_OUT_SERVER_PASSWORD,
-// <--
/* 0693 */ UNO_NAME_SAVE_FILTER_OPTIONS,
/* 0694 */ UNO_NAME_SAVE_FILTER_DATA,
/* 0695 */ UNO_NAME_LOCK_UPDATES,
-// --> TL 2005-02-14 #i37766#
/* 0696 */ UNO_NAME_PAGE_COUNT,
/* 0697 */ UNO_NAME_LINE_COUNT,
/* 0698 */ UNO_NAME_IS_CONSTANT_SPELLCHECK,
/* 0699 */ UNO_NAME_IS_HIDE_SPELL_MARKS, // deprecated #i91949
-// <--
/* 0700 */ UNO_NAME_IS_FIELD_USED,
/* 0701 */ UNO_NAME_IS_FIELD_DISPLAYED,
/* 0702 */ UNO_NAME_BUILDID,
/* 0703 */ UNO_NAME_PARA_STYLE_CONDITIONS,
-// --> FME 2005-12-13 #b6354161# Print empty pages
/* 0704 */ UNO_NAME_PRINT_EMPTY_PAGES,
-// <--
-// --> BM 2006 New Chart (chart2)
/* 0705 */ UNO_NAME_ROLE,
-// <--
/* 0706 */ UNO_NAME_FIELD_CODE,
/* 0707 */ UNO_NAME_HAS_VALID_SIGNATURES,
-// --> AMA #i65476# automatic styles
/* 0708 */ UNO_NAME_CHAR_AUTO_STYLE_NAME,
/* 0709 */ UNO_NAME_PARA_AUTO_STYLE_NAME,
-// --> OD 2006-03-21 #b6375613#
/* 0710 */ UNO_NAME_APPLY_WORKAROUND_FOR_B6375613,
/* 0711 */ UNO_NAME_LAYOUT_SIZE,
-// --> HB #144146#
/* 0712 */ UNO_NAME_HELP,
/* 0713 */ UNO_NAME_TOOLTIP,
-// --> #i73329# / 2007-01-11 / frank.schoenheit at sun.com
/* 0714 */ UNO_NAME_DIALOG_LIBRARIES,
/* 0715 */ UNO_NAME_HEADER_ROW_COUNT,
/* 0716 */ UNO_NAME_INPUT,
/* 0717 */ UNO_NAME_ROW_SPAN,
-// --> OD 2008-01-15 #newlistlevelattrs#
/* 0718 */ UNO_NAME_POSITION_AND_SPACE_MODE,
/* 0719 */ UNO_NAME_LABEL_FOLLOWED_BY,
/* 0720 */ UNO_NAME_LISTTAB_STOP_POSITION,
/* 0721 */ UNO_NAME_FIRST_LINE_INDENT,
/* 0722 */ UNO_NAME_INDENT_AT,
-// --> #i52420# / 2008-02-07 / beppec56 at openoffice.org
/* 0723 */ UNO_NAME_CHAPTER_LEVEL,
-// --> 2007-03-27 text grid enhancement for better CJK support
/* 0724 */ UNO_NAME_GRID_BASE_WIDTH,
/* 0725 */ UNO_NAME_GRID_SNAP_TO_CHARS,
/* 0726 */ UNO_NAME_GRID_STANDARD_PAGE_MODE,
/* 0727 */ UNO_NAME_TABLE_BORDER_DISTANCES,
-// --> OD 2008-04-22 #refactorlists#
/* 0728 */ UNO_NAME_LIST_ID,
/* 0729 */ UNO_NAME_DEFAULT_LIST_ID,
-// <--
/* 0730 */ UNO_NAME_STREAM_NAME,
-// --> OD 2008-11-26 #158694#
/* 0731 */ UNO_NAME_PARA_CONTINUEING_PREVIOUS_SUB_TREE,
/* 0732 */ UNO_NAME_PARA_LIST_LABEL_STRING,
-// <--
/* 0733 */ UNO_NAME_CHAR_OVERLINE,
/* 0734 */ UNO_NAME_CHAR_OVERLINE_COLOR,
/* 0735 */ UNO_NAME_CHAR_OVERLINE_HAS_COLOR,
/* 0736 */ UNO_NAME_OUTLINE_LEVEL, //#outline level,add<-zhaojianwei outlinelevel
-// --> OD 2009-07-13 #i73249#
/* 0737 */ UNO_NAME_DESCRIPTION,
-// <--
/* 0738 */ UNO_NAME_META, // #i91565#
/* 0739 */ UNO_NAME_NESTED_TEXT_CONTENT, // #i109601#
/* 0740 */ UNO_NAME_EMBEDDED_OBJECT,
@@ -807,7 +784,9 @@ enum SwPropNameIds
/* 0741 */ UNO_NAME_REPLACEMENT_GRAPHIC_URL,
/* 0742 */ UNO_NAME_DEFAULT_PAGE_MODE,
-/* 0743 */ SW_PROPNAME_END
+/* 0743 */ UNO_NAME_INITIALS,
+
+/* 0744 */ SW_PROPNAME_END
};
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index e6d5dce..fd6452a 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -94,6 +94,37 @@ namespace
}
io_pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_UI_REPLACE, NULL);
};
+
+ static void lcl_RemoveFieldMarks(Fieldmark* const pField,
+ SwDoc* const io_pDoc,
+ const sal_Unicode aStartMark,
+ const sal_Unicode aEndMark)
+ {
+ SwPosition& rStart = pField->GetMarkStart();
+ SwPosition& rEnd = pField->GetMarkEnd();
+ SwTxtNode const*const pStartTxtNode = rStart.nNode.GetNode().GetTxtNode();
+ SwTxtNode const*const pEndTxtNode = rEnd.nNode.GetNode().GetTxtNode();
+ const sal_Unicode ch_start=pStartTxtNode->GetTxt().GetChar(rStart.nContent.GetIndex());
+ xub_StrLen nEndPos = ( rEnd == rStart || rEnd.nContent.GetIndex() == 0 ) ?
+ rEnd.nContent.GetIndex() : rEnd.nContent.GetIndex() - 1;
+ const sal_Unicode ch_end=pEndTxtNode->GetTxt().GetChar( nEndPos );
+ SwPaM aStartPaM(rStart);
+ SwPaM aEndPaM(rEnd);
+ io_pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_UI_REPLACE, NULL);
+ if( ch_start == aStartMark )
+ {
+ SwPaM aStart(rStart, rStart);
+ aStart.End()->nContent++;
+ io_pDoc->DeleteRange(aStart);
+ }
+ if ( ch_end == aEndMark )
+ {
+ SwPaM aEnd(rEnd, rEnd);
+ aEnd.Start()->nContent--;
+ io_pDoc->DeleteRange(aEnd);
+ }
+ io_pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_UI_REPLACE, NULL);
+ };
}
namespace sw { namespace mark
@@ -317,6 +348,11 @@ namespace sw { namespace mark
lcl_AssureFieldMarksSet(this, io_pDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND);
}
+ void TextFieldmark::ReleaseDoc(SwDoc* const pDoc)
+ {
+ lcl_RemoveFieldMarks(this, pDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND);
+ }
+
CheckboxFieldmark::CheckboxFieldmark(const SwPaM& rPaM)
: Fieldmark(rPaM)
{ }
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index ad88fb6..41d790d 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -440,8 +440,8 @@ namespace sw { namespace mark
const rtl::OUString& rName,
const rtl::OUString& rType )
{
- sw::mark::IMark* pMark = makeMark( rPaM, rName,
- IDocumentMarkAccess::TEXT_FIELDMARK );
+ sw::mark::IMark* pMark =
+ makeMark( rPaM, rName, IDocumentMarkAccess::TEXT_FIELDMARK );
sw::mark::IFieldmark* pFieldMark = dynamic_cast<sw::mark::IFieldmark*>( pMark );
pFieldMark->SetFieldname( rType );
@@ -620,18 +620,17 @@ namespace sw { namespace mark
isPosInRange = true, isOtherPosInRange = true;
}
- if(isPosInRange && (isOtherPosInRange || !pMark->IsExpanded()))
+ if ( isPosInRange
+ && ( isOtherPosInRange
+ || !pMark->IsExpanded() ) )
{
// completely in range
- // --> OD 2009-08-07 #i92125#
bool bKeepCrossRefBkmk( false );
{
- if ( rStt == rEnd &&
- ( IDocumentMarkAccess::GetType(*pMark) ==
- IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK ||
- IDocumentMarkAccess::GetType(*pMark) ==
- IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK ) )
+ if ( rStt == rEnd
+ && ( IDocumentMarkAccess::GetType(*pMark) == IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK
+ || IDocumentMarkAccess::GetType(*pMark) == IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK ) )
{
bKeepCrossRefBkmk = true;
}
@@ -642,7 +641,6 @@ namespace sw { namespace mark
pSaveBkmk->push_back(SaveBookmark(true, true, *pMark, rStt, pSttIdx));
vMarksToDelete.push_back(ppMark);
}
- // <--
}
else if(isPosInRange ^ isOtherPosInRange)
{
@@ -725,6 +723,12 @@ namespace sw { namespace mark
"<MarkManager::deleteMark(..)>"
" - Bookmark not found.");
m_vFieldmarks.erase(ppFieldmark);
+
+ sw::mark::TextFieldmark* pTextFieldmark = dynamic_cast<sw::mark::TextFieldmark*>(ppMark->get());
+ if ( pTextFieldmark )
+ {
+ pTextFieldmark->ReleaseDoc(m_pDoc);
+ }
break;
}
case IDocumentMarkAccess::NAVIGATOR_REMINDER:
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index e42bfe5..8ffe087 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -72,6 +72,9 @@
#include <vcl/msgbox.hxx>
#include "comcore.hrc"
#include "editsh.hxx"
+#include <fldbas.hxx>
+#include <fmtfld.hxx>
+#include <docufld.hxx>
#include <unoflatpara.hxx>
#include <SwGrammarMarkUp.hxx>
@@ -1687,6 +1690,30 @@ bool SwDoc::DeleteRangeImplImpl(SwPaM & rPam)
}
}
+ // Delete fieldmarks before postits, but let's leave them alone during import.
+ if ( GetIDocumentUndoRedo().DoesUndo()
+ && pStt->nNode == pEnd->nNode
+ && (pEnd->nContent.GetIndex() - pStt->nContent.GetIndex()) == 1 )
+ {
+ SwTxtNode* pTxtNd = rPam.Start()->nNode.GetNode().GetTxtNode();
+ xub_StrLen nIndex = rPam.Start()->nContent.GetIndex();
+ // We may have a postit here.
+ if (pTxtNd->GetTxt().GetChar(nIndex) == CH_TXTATR_INWORD)
+ {
+ SwTxtAttr* pTxtAttr = pTxtNd->GetTxtAttrForCharAt(nIndex, RES_TXTATR_FIELD);
+ if ( pTxtAttr != NULL
+ && pTxtAttr->GetFmtFld().GetField()->Which() == RES_POSTITFLD )
+ {
+ const SwPostItField* pField = dynamic_cast<const SwPostItField*>(pTxtAttr->GetFmtFld().GetField());
+ IDocumentMarkAccess::const_iterator_t ppMark = getIDocumentMarkAccess()->findMark(pField->GetName());
+ if (ppMark != getIDocumentMarkAccess()->getMarksEnd())
+ {
+ getIDocumentMarkAccess()->deleteMark(ppMark);
+ }
+ }
+ }
+ }
+
{
// Bug 26675: DataChanged vorm loeschen verschicken, dann bekommt
// man noch mit, welche Objecte sich im Bereich befinden.
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index d6efc7a..42be67b 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -1775,13 +1775,23 @@ SwFieldType* SwPostItFieldType::Copy() const
}
-/*--------------------------------------------------------------------
- Beschreibung: SwPostItFieldType
- --------------------------------------------------------------------*/
-SwPostItField::SwPostItField( SwPostItFieldType* pT,
- const String& rAuthor, const String& rTxt, const DateTime& rDateTime )
- : SwField( pT ), sTxt( rTxt ), sAuthor( rAuthor ), aDateTime( rDateTime ), mpText(0), m_pTextObject(0)
+
+SwPostItField::SwPostItField(
+ SwPostItFieldType* pT,
+ const String& rCommentContent,
+ const String& rAuthor,
+ const String& rAuthorInitials,
+ const String& rName,
+ const DateTime& rDateTime )
+ : SwField( pT )
+ , msCommentContent( rCommentContent )
+ , msAuthor( rAuthor )
+ , msAuthorInitials( rAuthorInitials )
+ , msName( rName )
+ , maDateTime( rDateTime )
+ , mpText(0)
+ , m_pTextObject(0)
{
}
@@ -1797,9 +1807,7 @@ SwPostItField::~SwPostItField()
delete mpText;
}
-/* ---------------------------------------------------------------------------
- ---------------------------------------------------------------------------*/
String SwPostItField::Expand() const
{
return aEmptyStr;
@@ -1811,47 +1819,59 @@ String SwPostItField::GetDescription() const
return SW_RES(STR_NOTE);
}
-/* ---------------------------------------------------------------------------
- ---------------------------------------------------------------------------*/
SwField* SwPostItField::Copy() const
{
- SwPostItField* pRet = new SwPostItField( (SwPostItFieldType*)GetTyp(), sAuthor,
- sTxt, aDateTime);
- if (mpText)
+ SwPostItField* pRet =
+ new SwPostItField(
+ (SwPostItFieldType*)GetTyp(),
+ msCommentContent,
+ msAuthor,
+ msAuthorInitials,
+ msName,
+ maDateTime);
+ if ( mpText != NULL )
+ {
pRet->SetTextObject( new OutlinerParaObject(*mpText) );
+ }
+
return pRet;
}
-/*--------------------------------------------------------------------
- Beschreibung: Author setzen
- --------------------------------------------------------------------*/
+
void SwPostItField::SetPar1(const String& rStr)
{
- sAuthor = rStr;
+ msAuthor = rStr;
}
const String& SwPostItField::GetPar1() const
{
- return sAuthor;
+ return msAuthor;
}
-/*--------------------------------------------------------------------
- Beschreibung: Text fuers PostIt setzen
- --------------------------------------------------------------------*/
void SwPostItField::SetPar2(const String& rStr)
{
- sTxt = rStr;
+ msCommentContent = rStr;
}
-/* ---------------------------------------------------------------------------
- ---------------------------------------------------------------------------*/
String SwPostItField::GetPar2() const
{
- return sTxt;
+ return msCommentContent;
}
+
+void SwPostItField::SetName(const String& rName)
+{
+ msName = rName;
+}
+
+const String& SwPostItField::GetName() const
+{
+ return msName;
+}
+
+
const OutlinerParaObject* SwPostItField::GetTextObject() const
{
return mpText;
@@ -1863,23 +1883,31 @@ void SwPostItField::SetTextObject( OutlinerParaObject* pText )
mpText = pText;
}
+
sal_uInt32 SwPostItField::GetNumberOfParagraphs() const
{
return (mpText) ? mpText->Count() : 1;
}
+
sal_Bool SwPostItField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
{
switch( nWhichId )
{
case FIELD_PROP_PAR1:
- rAny <<= OUString(sAuthor);
+ rAny <<= OUString(msAuthor);
break;
case FIELD_PROP_PAR2:
{
- rAny <<= OUString(sTxt);
- break;
+ rAny <<= OUString(msCommentContent);
+ break;
}
+ case FIELD_PROP_PAR3:
+ rAny <<= OUString(msAuthorInitials);
+ break;
+ case FIELD_PROP_PAR4:
+ rAny <<= OUString(msName);
+ break;
case FIELD_PROP_TEXT:
{
if ( !m_pTextObject )
@@ -1894,7 +1922,7 @@ sal_Bool SwPostItField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
if ( mpText )
m_pTextObject->SetText( *mpText );
else
- m_pTextObject->SetString( sTxt );
+ m_pTextObject->SetString( msCommentContent );
uno::Reference < text::XText > xText( m_pTextObject );
rAny <<= xText;
@@ -1903,23 +1931,23 @@ sal_Bool SwPostItField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
case FIELD_PROP_DATE:
{
util::Date aSetDate;
- aSetDate.Day = aDateTime.GetDay();
- aSetDate.Month = aDateTime.GetMonth();
- aSetDate.Year = aDateTime.GetYear();
+ aSetDate.Day = maDateTime.GetDay();
+ aSetDate.Month = maDateTime.GetMonth();
+ aSetDate.Year = maDateTime.GetYear();
rAny.setValue(&aSetDate, ::getCppuType((util::Date*)0));
}
break;
case FIELD_PROP_DATE_TIME:
{
- util::DateTime DateTimeValue;
- DateTimeValue.HundredthSeconds = aDateTime.Get100Sec();
- DateTimeValue.Seconds = aDateTime.GetSec();
- DateTimeValue.Minutes = aDateTime.GetMin();
- DateTimeValue.Hours = aDateTime.GetHour();
- DateTimeValue.Day = aDateTime.GetDay();
- DateTimeValue.Month = aDateTime.GetMonth();
- DateTimeValue.Year = aDateTime.GetYear();
- rAny <<= DateTimeValue;
+ util::DateTime DateTimeValue;
+ DateTimeValue.HundredthSeconds = maDateTime.Get100Sec();
+ DateTimeValue.Seconds = maDateTime.GetSec();
+ DateTimeValue.Minutes = maDateTime.GetMin();
+ DateTimeValue.Hours = maDateTime.GetHour();
+ DateTimeValue.Day = maDateTime.GetDay();
+ DateTimeValue.Month = maDateTime.GetMonth();
+ DateTimeValue.Year = maDateTime.GetYear();
+ rAny <<= DateTimeValue;
}
break;
default:
@@ -1928,15 +1956,16 @@ sal_Bool SwPostItField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
return sal_True;
}
+
sal_Bool SwPostItField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
{
switch( nWhichId )
{
case FIELD_PROP_PAR1:
- ::GetString( rAny, sAuthor );
+ ::GetString( rAny, msAuthor );
break;
case FIELD_PROP_PAR2:
- ::GetString( rAny, sTxt );
+ ::GetString( rAny, msCommentContent );
//#i100374# new string via api, delete complex text object so SwPostItNote picks up the new string
if (mpText)
{
@@ -1944,36 +1973,44 @@ sal_Bool SwPostItField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
mpText = 0;
}
break;
+ case FIELD_PROP_PAR3:
+ ::GetString( rAny, msAuthorInitials );
+ break;
+ case FIELD_PROP_PAR4:
+ ::GetString( rAny, msName );
+ break;
case FIELD_PROP_TEXT:
DBG_ERROR("Not implemented!");
- // ::GetString( rAny, sTxt );
+ // ::GetString( rAny, msCommentContent );
break;
case FIELD_PROP_DATE:
if( rAny.getValueType() == ::getCppuType((util::Date*)0) )
{
util::Date aSetDate = *(util::Date*)rAny.getValue();
- aDateTime = Date(aSetDate.Day, aSetDate.Month, aSetDate.Year);
+ maDateTime = Date(aSetDate.Day, aSetDate.Month, aSetDate.Year);
}
break;
case FIELD_PROP_DATE_TIME:
- {
- util::DateTime aDateTimeValue;
- if(!(rAny >>= aDateTimeValue))
- return sal_False;
- aDateTime.Set100Sec(aDateTimeValue.HundredthSeconds);
- aDateTime.SetSec(aDateTimeValue.Seconds);
- aDateTime.SetMin(aDateTimeValue.Minutes);
- aDateTime.SetHour(aDateTimeValue.Hours);
- aDateTime.SetDay(aDateTimeValue.Day);
- aDateTime.SetMonth(aDateTimeValue.Month);
- aDateTime.SetYear(aDateTimeValue.Year);
- }
- break;
+ {
+ util::DateTime aDateTimeValue;
+ if(!(rAny >>= aDateTimeValue))
+ return sal_False;
+ maDateTime.Set100Sec(aDateTimeValue.HundredthSeconds);
+ maDateTime.SetSec(aDateTimeValue.Seconds);
+ maDateTime.SetMin(aDateTimeValue.Minutes);
+ maDateTime.SetHour(aDateTimeValue.Hours);
+ maDateTime.SetDay(aDateTimeValue.Day);
+ maDateTime.SetMonth(aDateTimeValue.Month);
+ maDateTime.SetYear(aDateTimeValue.Year);
+ }
+ break;
default:
DBG_ERROR("illegal property");
}
return sal_True;
}
+
+
/*--------------------------------------------------------------------
Beschreibung: DokumentinfoFields
--------------------------------------------------------------------*/
diff --git a/sw/source/core/inc/bookmrk.hxx b/sw/source/core/inc/bookmrk.hxx
index aabf6dd..0816408 100644
--- a/sw/source/core/inc/bookmrk.hxx
+++ b/sw/source/core/inc/bookmrk.hxx
@@ -244,6 +244,7 @@ namespace sw { namespace mark
public:
TextFieldmark(const SwPaM& rPaM);
virtual void InitDoc(SwDoc* const io_pDoc);
+ void ReleaseDoc(SwDoc* const pDoc);
};
class CheckboxFieldmark
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 1b09633..a34bcfa 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -1628,7 +1628,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
sTitle += sDate;
aNote.Title = sTitle;
// Guess what the contents contains...
- aNote.Contents = pField->GetTxt();
+ aNote.Contents = pField->GetContent();
// Link Export
pPDFExtOutDevData->CreateNote( rNoteRect.SVRect(), aNote, nNotePageNum );
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index b66cbe9..9d8ba29 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -37,11 +37,8 @@
#include <editeng/brshitem.hxx>
#include <editeng/splwrap.hxx>
#include <editeng/pgrditem.hxx>
-// --> OD 2008-01-17 #newlistlevelattrs#
-#ifndef _SVX_TSTPITEM_HXX
#include <editeng/tstpitem.hxx>
-#endif
-// <--
+#include <xmloff/odffields.hxx>
#include <SwSmartTagMgr.hxx>
#include <linguistic/lngprops.hxx>
@@ -50,6 +47,9 @@
#include <editeng/forbiddenruleitem.hxx>
#include <txatbase.hxx>
#include <fmtinfmt.hxx>
+#include <fmtfld.hxx>
+#include <fldbas.hxx>
+#include <PostItMgr.hxx>
#include <swmodule.hxx>
#include <vcl/svapp.hxx>
#include <vcl/wrkwin.hxx>
@@ -57,9 +57,7 @@
#include <viewopt.hxx> // SwViewOptions
#include <frmtool.hxx> // DrawGraphic
#include <IDocumentSettingAccess.hxx>
-#ifndef IDOCUMENTDEVICEACCESS_HXX_INCLUDED
#include <IDocumentDeviceAccess.hxx>
-#endif
#include <paratr.hxx> // SwFmtDrop
#include <rootfrm.hxx> // SwRootFrm
#include <inftxt.hxx> // SwTxtInfo
@@ -74,9 +72,7 @@
#include <pam.hxx>
#include <SwGrammarMarkUp.hxx>
#include <cstdio>
-// --> FME 2004-06-08 #i12836# enhanced pdf export
#include <EnhancedPDFExportHelper.hxx>
-// <--
#include <unomid.h>
@@ -1207,7 +1203,7 @@ void SwTxtPaintInfo::_DrawBackBrush( const SwLinePortion &rPor ) const
if(aIntersect.HasArea())
{
SwTxtNode *pNd = pFrm->GetTxtNode();
- const ::sw::mark::IMark* pFieldmark = NULL;
+ const ::sw::mark::IFieldmark* pFieldmark = NULL;
if(pNd)
{
const SwDoc *doc=pNd->GetDoc();
@@ -1233,7 +1229,26 @@ void SwTxtPaintInfo::_DrawBackBrush( const SwLinePortion &rPor ) const
{
OutputDevice* pOutDev = (OutputDevice*)GetOut();
pOutDev->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
- pOutDev->SetFillColor( SwViewOption::GetFieldShadingsColor() );
+ bool bFilled = false;
+ // If this is a comment range, need to look up the color of the comment author.
+ if ( pFieldmark->GetFieldname().equalsAscii( ODF_COMMENTRANGE ) )
+ {
+ // Search for the position of the postit field
+ const sal_Unicode fld[] = { CH_TXTATR_INWORD, 0 };
+ xub_StrLen nEndIdx = GetTxt().SearchChar(fld, GetIdx());
+ if (nEndIdx != STRING_NOTFOUND)
+ {
+ SwTxtAttr* pTxtAttr = pNd->GetTxtAttrForCharAt(nEndIdx, RES_TXTATR_FIELD);
+ const SwFmtFld& rPostItField = pTxtAttr->GetFmtFld();
+ // Look up the author name
+ const rtl::OUString& rAuthor = rPostItField.GetField()->GetPar1();
+ sal_uInt16 nIndex = pNd->GetDoc()->InsertRedlineAuthor(rAuthor);
+ pOutDev->SetFillColor( SwPostItMgr::GetColorLight(nIndex) );
+ bFilled = true;
+ }
+ }
+ if (!bFilled)
+ pOutDev->SetFillColor( SwViewOption::GetFieldShadingsColor() );
pOutDev->SetLineColor( );
pOutDev->DrawRect( aIntersect.SVRect() );
pOutDev->Pop();
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index e24af3a..19e7c65 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -90,6 +90,9 @@
#include <docsh.hxx>
#include <fmtmeta.hxx> // MetaFieldManager
#include <switerator.hxx>
+#include <bookmrk.hxx>
+#include <xmloff/odffields.hxx>
+
using ::rtl::OUString;
using namespace ::com::sun::star;
@@ -1221,7 +1224,7 @@ void SwXTextField::attachToRange(
SwField* pFld = 0;
switch(m_nServiceId)
{
- case SW_SERVICE_FIELDTYPE_ANNOTATION:
+ case SW_SERVICE_FIELDTYPE_ANNOTATION:
{
SwFieldType* pFldType = pDoc->GetSysFldType(RES_POSTITFLD);
@@ -1235,24 +1238,31 @@ void SwXTextField::attachToRange(
aDateTime.SetMin(m_pProps->pDateTime->Minutes);
aDateTime.SetSec(m_pProps->pDateTime->Seconds);
}
- pFld = new SwPostItField((SwPostItFieldType*)pFldType,
- m_pProps->sPar1, m_pProps->sPar2,aDateTime);
+ pFld = new SwPostItField(
+ (SwPostItFieldType*)pFldType,
+ m_pProps->sPar2, // content
+ m_pProps->sPar1, // author
+ m_pProps->sPar3, // author's initials
+ m_pProps->sPar4, // name
+ aDateTime );
if ( m_pTextObject )
{
((SwPostItField*)pFld)->SetTextObject( m_pTextObject->CreateText() );
- ((SwPostItField*)pFld)->SetPar2(m_pTextObject->GetText());
+ ((SwPostItField*)pFld)->SetPar2(m_pTextObject->GetText());
}
}
break;
- case SW_SERVICE_FIELDTYPE_SCRIPT:
+
+ case SW_SERVICE_FIELDTYPE_SCRIPT:
{
SwFieldType* pFldType = pDoc->GetSysFldType(RES_SCRIPTFLD);
pFld = new SwScriptField((SwScriptFieldType*)pFldType,
- m_pProps->sPar1, m_pProps->sPar2,
- m_pProps->bBool1);
+ m_pProps->sPar1, m_pProps->sPar2,
+ m_pProps->bBool1);
}
break;
- case SW_SERVICE_FIELDTYPE_DATETIME:
+
+ case SW_SERVICE_FIELDTYPE_DATETIME:
{
sal_uInt16 nSub = 0;
if(m_pProps->bBool1)
@@ -1263,7 +1273,7 @@ void SwXTextField::attachToRange(
nSub |= TIMEFLD;
SwFieldType* pFldType = pDoc->GetSysFldType(RES_DATETIMEFLD);
pFld = new SwDateTimeField((SwDateTimeFieldType*)pFldType,
- nSub, m_pProps->nFormat);
+ nSub, m_pProps->nFormat);
if(m_pProps->fDouble > 0.)
((SwDateTimeField*)pFld)->SetValue( m_pProps->fDouble );
if(m_pProps->pDateTime)
@@ -1274,7 +1284,8 @@ void SwXTextField::attachToRange(
((SwDateTimeField*)pFld)->SetOffset(m_pProps->nSubType);
}
break;
- case SW_SERVICE_FIELDTYPE_FILE_NAME:
+
+ case SW_SERVICE_FIELDTYPE_FILE_NAME:
{
SwFieldType* pFldType = pDoc->GetSysFldType(RES_FILENAMEFLD);
sal_Int32 nFormat = m_pProps->nFormat;
@@ -1287,16 +1298,18 @@ void SwXTextField::attachToRange(
pFld->PutValue( aFormat, FIELD_PROP_FORMAT );
}
break;
- case SW_SERVICE_FIELDTYPE_TEMPLATE_NAME:
+
+ case SW_SERVICE_FIELDTYPE_TEMPLATE_NAME:
{
SwFieldType* pFldType = pDoc->GetSysFldType(RES_TEMPLNAMEFLD);
pFld = new SwTemplNameField((SwTemplNameFieldType*)pFldType,
- m_pProps->nFormat);
+ m_pProps->nFormat);
uno::Any aFormat(&m_pProps->nFormat, ::getCppuType(&m_pProps->nFormat));
pFld->PutValue(aFormat, FIELD_PROP_FORMAT);
}
break;
- case SW_SERVICE_FIELDTYPE_CHAPTER:
+
+ case SW_SERVICE_FIELDTYPE_CHAPTER:
{
SwFieldType* pFldType = pDoc->GetSysFldType(RES_CHAPTERFLD);
pFld = new SwChapterField((SwChapterFieldType*)pFldType, m_pProps->nUSHORT1);
@@ -1305,7 +1318,7 @@ void SwXTextField::attachToRange(
pFld->PutValue(aVal, FIELD_PROP_USHORT1 );
}
break;
- case SW_SERVICE_FIELDTYPE_AUTHOR:
+ case SW_SERVICE_FIELDTYPE_AUTHOR:
{
long nFormat = m_pProps->bBool1 ? AF_NAME : AF_SHORTCUT;
if(m_pProps->bBool2)
@@ -1316,20 +1329,21 @@ void SwXTextField::attachToRange(
((SwAuthorField*)pFld)->SetExpansion(m_pProps->sPar1);
}
break;
- case SW_SERVICE_FIELDTYPE_CONDITIONED_TEXT:
- case SW_SERVICE_FIELDTYPE_HIDDEN_TEXT:
+
+ case SW_SERVICE_FIELDTYPE_CONDITIONED_TEXT:
+ case SW_SERVICE_FIELDTYPE_HIDDEN_TEXT:
{
SwFieldType* pFldType = pDoc->GetSysFldType(RES_HIDDENTXTFLD);
pFld = new SwHiddenTxtField(((SwHiddenTxtFieldType*)pFldType),
- m_pProps->sPar1,
- m_pProps->sPar2, m_pProps->sPar3,
- static_cast< sal_uInt16 >(SW_SERVICE_FIELDTYPE_HIDDEN_TEXT == m_nServiceId ?
- TYP_HIDDENTXTFLD : TYP_CONDTXTFLD));
+ m_pProps->sPar1,
+ m_pProps->sPar2, m_pProps->sPar3,
+ static_cast< sal_uInt16 >(SW_SERVICE_FIELDTYPE_HIDDEN_TEXT == m_nServiceId ? TYP_HIDDENTXTFLD : TYP_CONDTXTFLD));
((SwHiddenTxtField*)pFld)->SetValue(m_pProps->bBool1);
uno::Any aVal; aVal <<= (OUString)m_pProps->sPar4;
pFld->PutValue(aVal, FIELD_PROP_PAR4 );
}
break;
+
case SW_SERVICE_FIELDTYPE_HIDDEN_PARA:
{
SwFieldType* pFldType = pDoc->GetSysFldType(RES_HIDDENPARAFLD);
@@ -1723,15 +1737,18 @@ void SwXTextField::attachToRange(
break;
default: DBG_ERROR("was ist das fuer ein Typ?");
}
- if(pFld)
+ if ( pFld )
{
pFld->SetAutomaticLanguage(!m_pProps->bBool4);
SwFmtFld aFmt( *pFld );
UnoActionContext aCont(pDoc);
SwTxtAttr* pTxtAttr = 0;
- if(aPam.HasMark())
+ if ( aPam.HasMark()
+ && m_nServiceId != SW_SERVICE_FIELDTYPE_ANNOTATION )
+ {
pDoc->DeleteAndJoin(aPam);
+ }
SwXTextCursor const*const pTextCursor( dynamic_cast<SwXTextCursor*>(pCursor) );
const bool bForceExpandHints(
@@ -1743,7 +1760,41 @@ void SwXTextField::attachToRange(
? nsSetAttrMode::SETATTR_FORCEHINTEXPAND
: nsSetAttrMode::SETATTR_DEFAULT;
- pDoc->InsertPoolItem(aPam, aFmt, nInsertFlags);
+ if ( *aPam.GetPoint() != *aPam.GetMark()
+ && m_nServiceId == SW_SERVICE_FIELDTYPE_ANNOTATION )
+ {
+ IDocumentMarkAccess* pMarksAccess = pDoc->getIDocumentMarkAccess();
+ sw::mark::IFieldmark* pFieldmark =
+ pMarksAccess->makeFieldBookmark(
+ aPam,
+ OUString(),
+ ::rtl::OUString::createFromAscii( ODF_COMMENTRANGE ) );
+ ASSERT( pFieldmark != NULL, "<SwXTextField::attachToRange(..)> - <IFieldmark> instance for SW_SERVICE_FIELDTYPE_ANNOTATION not created!" );
+ if ( pFieldmark != NULL )
+ {
+ SwPostItField* pPostItField = dynamic_cast<SwPostItField*>(aFmt.GetField());
+ ASSERT( pPostItField != NULL, "<SwXTextField::attachToRange(..)> - missing <SwPostItField> instance for SW_SERVICE_FIELDTYPE_ANNOTATION!" );
+ if ( pPostItField != NULL )
+ {
+ if ( pPostItField->GetName().Len() > 0 )
+ {
+ // The field has a name already, use it.
+ pMarksAccess->renameMark(pFieldmark, pPostItField->GetName());
+ }
+ else
+ {
+ // The fieldmark always has a (generated) name.
+ pPostItField->SetName( pFieldmark->GetName() );
+ }
+ }
+ }
+
+ // Make sure we always insert the field at the end
+ SwPaM aEnd(*aPam.End(), *aPam.End());
+ pDoc->InsertPoolItem(aEnd, aFmt, nInsertFlags);
+ }
+ else
+ pDoc->InsertPoolItem(aPam, aFmt, nInsertFlags);
pTxtAttr = aPam.GetNode()->GetTxtNode()->GetFldTxtAttrAt( aPam.GetPoint()->nContent.GetIndex()-1, true );
// was passiert mit dem Update der Felder ? (siehe fldmgr.cxx)
@@ -2330,7 +2381,14 @@ uno::Sequence< OUString > SwXTextField::getSupportedServiceNames(void) throw( un
return aRet;
}
-void SwXTextField::Invalidate()
+
+sal_uInt16 SwXTextField::GetServiceId()
+{
+ return m_nServiceId;
+}
+
+
+ void SwXTextField::Invalidate()
{
if (GetRegisteredIn())
{
diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx
index 7dce13c..010a221 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -1934,21 +1934,25 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
aMapEntriesArr[nPropertyId] = aHiddenTxtFieldPropMap;
}
break;
+
case PROPERTY_MAP_FLDTYP_ANNOTATION :
- {
- static SfxItemPropertyMapEntry aAnnotationFieldPropMap [] =
{
- {SW_PROP_NMID(UNO_NAME_AUTHOR), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
- {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
- {SW_PROP_NMID(UNO_NAME_DATE_TIME_VALUE), FIELD_PROP_DATE_TIME, CPPU_E2T(CPPUTYPE_DATETIME), PROPERTY_NONE, 0},
- {SW_PROP_NMID(UNO_NAME_DATE), FIELD_PROP_DATE, CPPU_E2T(CPPUTYPE_DATE), PROPERTY_NONE, 0},
- {SW_PROP_NMID(UNO_NAME_TEXT_RANGE), FIELD_PROP_TEXT, CPPU_E2T(CPPUTYPE_REFINTERFACE), PropertyAttribute::READONLY, 0},
- COMMON_FLDTYP_PROPERTIES
- {0,0,0,0,0,0}
- };
- aMapEntriesArr[nPropertyId] = aAnnotationFieldPropMap;
- }
- break;
+ static SfxItemPropertyMapEntry aAnnotationFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_AUTHOR), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_INITIALS), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_NAME), FIELD_PROP_PAR4, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATE_TIME_VALUE), FIELD_PROP_DATE_TIME, CPPU_E2T(CPPUTYPE_DATETIME), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATE), FIELD_PROP_DATE, CPPU_E2T(CPPUTYPE_DATE), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_TEXT_RANGE), FIELD_PROP_TEXT, CPPU_E2T(CPPUTYPE_REFINTERFACE), PropertyAttribute::READONLY, 0},
+ COMMON_FLDTYP_PROPERTIES
+ {0,0,0,0,0,0}
+ };
+ aMapEntriesArr[nPropertyId] = aAnnotationFieldPropMap;
+ }
+ break;
+
case PROPERTY_MAP_FLDTYP_INPUT:
{
static SfxItemPropertyMapEntry aInputFieldPropMap [] =
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index 1cd9b56..ef4b413 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -27,9 +27,7 @@
#include <unoport.hxx>
#include <IMark.hxx>
-// --> OD 2007-10-23 #i81002#
#include <crossrefbookmark.hxx>
-// <--
#include <doc.hxx>
#include <txatbase.hxx>
#include <txtatr.hxx>
@@ -55,6 +53,9 @@
#include <unoidx.hxx>
#include <redline.hxx>
#include <crsskip.hxx>
+#include <switerator.hxx>
+#include <docufld.hxx>
+#include <fmtfld.hxx>
#include <vos/mutex.hxx>
#include <vcl/svapp.hxx>
#include <set>
@@ -329,9 +330,10 @@ throw( container::NoSuchElementException, lang::WrappedTargetException,
typedef ::std::deque< xub_StrLen > FieldMarks_t;
-static void
-lcl_FillFieldMarkArray(FieldMarks_t & rFieldMarks, SwUnoCrsr const & rUnoCrsr,
- const sal_Int32 i_nStartPos)
+static void lcl_FillFieldMarkArray(
+ FieldMarks_t & rFieldMarks,
+ SwUnoCrsr const & rUnoCrsr,
+ const sal_Int32 i_nStartPos)
{
const SwTxtNode * const pTxtNode =
rUnoCrsr.GetPoint()->nNode.GetNode().GetTxtNode();
@@ -347,6 +349,32 @@ lcl_FillFieldMarkArray(FieldMarks_t & rFieldMarks, SwUnoCrsr const & rUnoCrsr,
}
}
+static const SwFmtFld* lcl_getFieldByName(
+ SwDoc* pDoc,
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list