summaryrefslogtreecommitdiff
path: root/oox/inc
diff options
context:
space:
mode:
authorVinaya <vinaya.mandke@synerzip.com>2013-02-08 19:19:38 +0530
committerFridrich Strba <fridrich@documentfoundation.org>2013-03-13 09:27:17 +0000
commit856756ec77ac64d1caee6c1b80c3641d4e487b2d (patch)
tree8fb43999174b35c1418869c8a649416f0c86d091 /oox/inc
parent790a36d299f8470e07fc0af59960fccd637b31a6 (diff)
Changes to enable display of comments annotations in pptx files
Change-Id: Ibf7dc0c61dc46d1568abe47285662810f79410e7 Change-Id: I965798cd3a539ab8deffcdf4a8e2c52c9e8e8fc1 Reviewed-on: https://gerrit.libreoffice.org/2048 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'oox/inc')
-rw-r--r--oox/inc/oox/ppt/comments.hxx195
-rw-r--r--oox/inc/oox/ppt/presentationfragmenthandler.hxx5
-rw-r--r--oox/inc/oox/ppt/slidefragmenthandler.hxx7
-rw-r--r--oox/inc/oox/ppt/slidepersist.hxx11
4 files changed, 216 insertions, 2 deletions
diff --git a/oox/inc/oox/ppt/comments.hxx b/oox/inc/oox/ppt/comments.hxx
new file mode 100644
index 000000000000..44ea442c614c
--- /dev/null
+++ b/oox/inc/oox/ppt/comments.hxx
@@ -0,0 +1,195 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+
+#ifndef OOX_PPT_COMMENTS_HXX
+#define OOX_PPT_COMMENTS_HXX
+
+#define ELEMENT_NOT_FOUND 0
+
+using rtl::OUString;
+#include <vector>
+#include <boost/algorithm/string.hpp> //split function to tokenize for date time
+
+#include <com/sun/star/util/DateTime.hpp>
+
+
+struct commentAuthor
+{
+ ::rtl::OUString clrIdx;
+ ::rtl::OUString id;
+ ::rtl::OUString initials;
+ ::rtl::OUString lastIdx;
+ ::rtl::OUString name;
+};
+
+class commentAuthorList
+{
+ private:
+ std::vector<commentAuthor> cmAuthorLst;
+ public:
+ void setValues( commentAuthorList list)
+ {
+ std::vector<commentAuthor>::iterator it;
+ for(it=list.cmAuthorLst.begin();it!=list.cmAuthorLst.end();it++)
+ {
+ commentAuthor temp;
+ cmAuthorLst.push_back(temp);
+ cmAuthorLst.back().clrIdx = it->clrIdx;
+ cmAuthorLst.back().id = it->id;
+ cmAuthorLst.back().initials = it->initials;
+ cmAuthorLst.back().lastIdx = it->lastIdx;
+ cmAuthorLst.back().name = it->name;
+ }
+ }
+
+ std::vector<commentAuthor> getCmAuthorLst()
+ {
+ return cmAuthorLst;
+ }
+ void addAuthor(commentAuthor _author)
+ {
+ cmAuthorLst.push_back(_author);
+ }
+ friend class comment;
+};
+
+class comment
+{
+ private:
+ ::rtl::OUString authorId;
+ ::rtl::OUString dt;
+ ::rtl::OUString idx;
+ ::rtl::OUString x;
+ ::rtl::OUString y;
+ ::rtl::OUString text;
+ ::com::sun::star::util::DateTime aDateTime;
+
+ public:
+ void setAuthorId(::rtl::OUString _aId)
+ {
+ authorId = _aId;
+ }
+ void setdt(::rtl::OUString _dt)
+ {
+ dt=_dt;
+ setDateTime(_dt);
+ }
+ void setidx(::rtl::OUString _idx)
+ {
+ idx=_idx;
+ }
+ void setPoint(::rtl::OUString _x, ::rtl::OUString _y)
+ {
+ x=_x;
+ y=_y;
+ }
+ void setText(std::string _text)
+ {
+ text = rtl::OUString::createFromAscii ( _text.c_str() );
+ }
+ void setText(rtl::OUString _text)
+ {
+ text = _text;
+ }
+
+ private:
+ //DateTime is saved as : 2013-01-10T15:53:26.000
+ void setDateTime (::rtl::OUString datetime)
+ {
+ std::string _datetime = rtl::OUStringToOString(datetime, RTL_TEXTENCODING_UTF8).getStr();
+ std::vector<std::string> _dt;
+ boost::split( _dt, _datetime, boost::is_any_of( "-:T" ) );
+ aDateTime.Year = atoi(_dt.at(0).c_str());
+ aDateTime.Month = atoi(_dt.at(1).c_str());
+ aDateTime.Day = atoi(_dt.at(2).c_str());
+ aDateTime.Hours = atoi(_dt.at(3).c_str());
+ aDateTime.Minutes = atoi(_dt.at(4).c_str());
+ aDateTime.HundredthSeconds = atoi(_dt.at(5).c_str());
+ std::vector<std::string>::iterator i;
+ }
+
+ public:
+ ::rtl::OUString getAuthorId()
+ {
+ return authorId;
+ }
+ ::rtl::OUString getdt()
+ {
+ return dt;
+ }
+ ::rtl::OUString getidx()
+ {
+ return idx;
+ }
+ ::rtl::OUString get_X()
+ {
+ return x;
+ }
+ ::rtl::OUString get_Y()
+ {
+ return y;
+ }
+ ::rtl::OUString get_text()
+ {
+ return text;
+ }
+ ::com::sun::star::util::DateTime getDateTime()
+ {
+ return aDateTime;
+ }
+ int getIntX()
+ {
+ std::string temp = rtl::OUStringToOString(get_X(), RTL_TEXTENCODING_UTF8).getStr();
+ return atoi(temp.c_str());
+ }
+ int getIntY()
+ {
+ std::string temp = rtl::OUStringToOString(get_Y(), RTL_TEXTENCODING_UTF8).getStr();
+ return atoi(temp.c_str());
+ }
+ OUString getAuthor ( commentAuthorList list )
+ {
+ std::string temp = rtl::OUStringToOString(authorId, RTL_TEXTENCODING_UTF8).getStr();
+ int aId = atoi(temp.c_str());
+ std::vector<commentAuthor>::iterator it;
+ for(it = list.cmAuthorLst.begin(); it != list.cmAuthorLst.end(); it++)
+ {
+ temp = rtl::OUStringToOString(it->id, RTL_TEXTENCODING_UTF8).getStr();
+
+ int list_aId = atoi(temp.c_str());
+ std::string temp_a =rtl::OUStringToOString(it->name, RTL_TEXTENCODING_UTF8).getStr();
+ if(list_aId == aId)
+ { return it->name;
+ }
+
+ }
+ OUString _unknown = "Anonymous";
+ return _unknown;
+ }
+};
+
+class commentList
+{
+ public:
+ std::vector<comment> cmLst;
+ int getSize ()
+ {
+ return (int)cmLst.size();
+ }
+ comment getCommentAtIndex (int index)
+ {
+ if(index < (int)cmLst.size() && index >= 0)
+ return cmLst.at(index);
+ else
+ throw ELEMENT_NOT_FOUND;
+ }
+};
+
+#endif \ No newline at end of file
diff --git a/oox/inc/oox/ppt/presentationfragmenthandler.hxx b/oox/inc/oox/ppt/presentationfragmenthandler.hxx
index bb9488437266..8730352bc238 100644
--- a/oox/inc/oox/ppt/presentationfragmenthandler.hxx
+++ b/oox/inc/oox/ppt/presentationfragmenthandler.hxx
@@ -29,7 +29,7 @@
#include "oox/core/fragmenthandler2.hxx"
#include "oox/core/relations.hxx"
#include "oox/ppt/customshowlistcontext.hxx"
-
+#include "oox/ppt/comments.hxx"
#include <stack>
#include <vector>
@@ -42,6 +42,9 @@ public:
virtual ~PresentationFragmentHandler() throw();
virtual void finalizeImport();
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs );
+private:
+ commentAuthorList AuthorList;
+ int readCommentAuthors; // read commentAuthors.xml only once
protected:
bool importSlide( const ::oox::core::FragmentHandlerRef& rxSlideFragmentHandler,
diff --git a/oox/inc/oox/ppt/slidefragmenthandler.hxx b/oox/inc/oox/ppt/slidefragmenthandler.hxx
index 4bca8ccd4c12..6cd50ab9f7c7 100644
--- a/oox/inc/oox/ppt/slidefragmenthandler.hxx
+++ b/oox/inc/oox/ppt/slidefragmenthandler.hxx
@@ -39,7 +39,7 @@ public:
virtual void finalizeImport();
virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs );
-
+ void onCharacters( const ::rtl::OUString& rChars );
protected:
SlidePersistPtr mpSlidePersistPtr;
ShapeLocation meShapeLocation;
@@ -47,6 +47,11 @@ protected:
private:
::rtl::OUString maSlideName;
PropertyMap maSlideProperties;
+private:
+ ::std::vector< rtl::OUString> charVector; // handle char in OnCharacters
+public:
+ ::std::vector< rtl::OUString> getCharVector(void) { return charVector; }
+
};
} }
diff --git a/oox/inc/oox/ppt/slidepersist.hxx b/oox/inc/oox/ppt/slidepersist.hxx
index 3c8bf3371a94..68caa18db34e 100644
--- a/oox/inc/oox/ppt/slidepersist.hxx
+++ b/oox/inc/oox/ppt/slidepersist.hxx
@@ -32,6 +32,8 @@
#include <com/sun/star/animations/XAnimationNode.hpp>
#include "oox/core/fragmenthandler.hxx"
+#include "oox/ppt/comments.hxx"
+
#include <list>
namespace oox { namespace vml { class Drawing; } }
@@ -116,6 +118,15 @@ public:
::oox::drawingml::ShapePtr getShape( const ::rtl::OUString & id ) { return maShapeMap[ id ]; }
::oox::drawingml::ShapeIdMap& getShapeMap() { return maShapeMap; }
+ //comments
+private:
+ commentList commentsList;
+ commentAuthorList commentAuthors;
+
+public:
+ commentList* getCommentsList() { return &commentsList; }
+ commentAuthorList* getCommentAuthors() { return &commentAuthors; }
+
private:
rtl::OUString maPath;
rtl::OUString maLayoutPath;