Hi,

PFA the diff file...

I know that its incomplete and should have a separate handler, but as of
now I can atleast save the comment data...

This is what I have done

   - I have handled comments exactly as notes
   - In slidefragmenthandler added tokens to handle the comment attributes
   - New file: annotation_buffer.h contains a vector to save anntotation
   data of the particular slide
   - Modified fragmenthandler2.cxx: startFastElement , endFastElement to
   handle and save text characters of the comment

Regards,
Vinaya
diff --git a/oox/source/core/annotation_buffer.h 
b/oox/source/core/annotation_buffer.h
deleted file mode 100644
index 35ddc7e..0000000
--- a/oox/source/core/annotation_buffer.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <vector>
-#include <string>
-class annotation_data
-{
-public:
-std::string authorId;
-std::string dt;
-std::string idx;
-std::string x;
-std::string y;
-std::string text;
-};
-extern std::vector <annotation_data> all_comments_on_slide;
-class authors
-{
-public:
-std::string clrIdx;
-std::string id;
-std::string initials;
-std::string lastIdx;
-std::string name;
-};
-extern std::vector <authors> all_authors;



diff --git a/oox/source/core/fragmenthandler2.cxx 
b/oox/source/core/fragmenthandler2.cxx
index e9b9c28..bfc6834 100644
--- a/oox/source/core/fragmenthandler2.cxx
+++ b/oox/source/core/fragmenthandler2.cxx
@@ -20,10 +20,6 @@
 #include "oox/core/fragmenthandler2.hxx"
 #include "oox/core/xmlfilterbase.hxx"
 
-#include "../oox/source/core/annotation_buffer.h"
-
-int is_annotation_text;
-
 namespace oox {
 namespace core {
 
@@ -119,21 +115,12 @@ Reference< XFastContextHandler > SAL_CALL 
FragmentHandler2::createFastChildConte
 void SAL_CALL FragmentHandler2::startFastElement(
         sal_Int32 nElement, const Reference< XFastAttributeList >& rxAttribs ) 
throw( SAXException, RuntimeException )
 {
-    switch( nElement )
-    {
-        case PPT_TOKEN( text ):
-            is_annotation_text = 1; //set to 1 to handle chars
-            break;
-    }
     implStartElement( nElement, rxAttribs );
 }
 
 void SAL_CALL FragmentHandler2::characters( const OUString& rChars ) throw( 
SAXException, RuntimeException )
 {
     implCharacters( rChars );
-    if ( is_annotation_text == 1)
-    {  all_comments_on_slide.back().text += rtl::OUStringToOString( rChars , 
RTL_TEXTENCODING_UTF8).getStr();
-    }
 }
 
 void SAL_CALL FragmentHandler2::endFastElement( sal_Int32 nElement ) throw( 
SAXException, RuntimeException )
@@ -144,10 +131,8 @@ void SAL_CALL FragmentHandler2::endFastElement( sal_Int32 
nElement ) throw( SAXE
         case MCE_TOKEN( AlternateContent ):
             aMceState.pop_back();
             break;
-        case PPT_TOKEN( text ):
-            is_annotation_text =0; // set to 0 as comment chars are handled
-            break;
     }
+
     implEndElement( nElement );
 }
 
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx 
b/oox/source/ppt/presentationfragmenthandler.cxx
index 573c4db..c92cdad 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -41,11 +41,6 @@
 #include "oox/ppt/layoutfragmenthandler.hxx"
 #include "oox/ppt/pptimport.hxx"
 
-#include <stdio.h>
-#include "../oox/source/core/annotation_buffer.h"
-std::vector <annotation_data> all_comments_on_slide;
-std::vector <authors> all_authors;
-
 using rtl::OUString;
 using namespace ::com::sun::star;
 using namespace ::oox::core;
@@ -175,10 +170,8 @@ void PresentationFragmentHandler::finalizeImport()
 
                 FragmentHandlerRef xSlideFragmentHandler( new 
SlideFragmentHandler( rFilter, aSlideFragmentPath, pSlidePersistPtr, Slide ) );
 
-                // importing the corresponding masterpage/layout 
rtl::OUStringToOString(sString, RTL_TEXTENCODING_UTF8)
+                // importing the corresponding masterpage/layout
                 OUString aLayoutFragmentPath = 
xSlideFragmentHandler->getFragmentPathFromFirstType( 
CREATE_OFFICEDOC_RELATION_TYPE( "slideLayout" ) );
-                OUString aCommentFragmentPath = 
xSlideFragmentHandler->getFragmentPathFromFirstType( 
CREATE_OFFICEDOC_RELATION_TYPE( "comments" ) );
-                printf("\n Comment Present at :- 
%s\n",rtl::OUStringToOString(aCommentFragmentPath, 
RTL_TEXTENCODING_UTF8).getStr());
                 if ( !aLayoutFragmentPath.isEmpty() )
                 {
                     // importing layout
@@ -287,27 +280,6 @@ void PresentationFragmentHandler::finalizeImport()
                         }
                     }
                 }
-                if( !aCommentFragmentPath.isEmpty() )
-                {
-                    printf("\n Comment Present!!! \n");
-                    Reference< XPresentationPage > xPresentationPage( xSlide, 
UNO_QUERY );
-                    Reference< XDrawPage > xNotesPage( 
xPresentationPage->getNotesPage() );
-                    SlidePersistPtr pNotesPersistPtr( new SlidePersist( 
rFilter, sal_False, sal_True, xNotesPage,
-                                ShapePtr( new PPTShape( Slide, 
"com.sun.star.drawing.GroupShape" ) ), mpTextListStyle ) );
-                    FragmentHandlerRef xNotesFragmentHandler( new 
SlideFragmentHandler( getFilter(), aCommentFragmentPath, pNotesPersistPtr, 
Slide ) );
-                    all_comments_on_slide.clear();
-                    rFilter.getNotesPages().push_back( pNotesPersistPtr );
-                    rFilter.setActualSlidePersist( pNotesPersistPtr );
-                    importSlide( xNotesFragmentHandler, pNotesPersistPtr );
-                    //print the comments on console
-                    std::vector<annotation_data>::iterator it;
-                    
for(it=all_comments_on_slide.begin();it!=all_comments_on_slide.end();it++)      
              {
-                        printf("\nComment:-\n");
-                        printf("AutorId: %s , DT %s, IDX: %s, x %s y 
%s",it->authorId.c_str(),it->dt.c_str(),it->idx.c_str(),it->x.c_str(),it->y.c_str());
-                        printf("\nText: %s",it->text.c_str());
-                    }
-                }
-
             }
         }
         ResolveTextFields( rFilter );
diff --git a/oox/source/ppt/slidefragmenthandler.cxx 
b/oox/source/ppt/slidefragmenthandler.cxx
index 1f97a98..a59f2e1 100644
--- a/oox/source/ppt/slidefragmenthandler.cxx
+++ b/oox/source/ppt/slidefragmenthandler.cxx
@@ -38,7 +38,6 @@
 #include "oox/drawingml/clrschemecontext.hxx"
 #include "oox/ppt/pptimport.hxx"
 
-#include "../oox/source/core/annotation_buffer.h"
 
 using rtl::OUString;
 using namespace ::com::sun::star;
@@ -194,24 +193,11 @@ SlideFragmentHandler::~SlideFragmentHandler() throw()
     case PPT_TOKEN( custDataLst ):      // CT_CustomerDataList
     case PPT_TOKEN( tagLst ):           // CT_TagList
         return this;
-
-    //for Comments
-    //case PPT_TOKEN( cmLst ):
-    case PPT_TOKEN( cm ):
-        all_comments_on_slide.push_back(annotation_data());
-        all_comments_on_slide.back().authorId = rtl::OUStringToOString( 
rAttribs.getString(XML_authorId, OUString()),RTL_TEXTENCODING_UTF8).getStr();
-        all_comments_on_slide.back().idx = rtl::OUStringToOString( 
rAttribs.getString(XML_idx, OUString()),RTL_TEXTENCODING_UTF8).getStr();
-        all_comments_on_slide.back().dt = rtl::OUStringToOString( 
rAttribs.getString(XML_dt, OUString()),RTL_TEXTENCODING_UTF8).getStr();
-        all_comments_on_slide.back().text = "";
-        break;
-    case PPT_TOKEN( pos ):
-        all_comments_on_slide.back().x = rtl::OUStringToOString( 
rAttribs.getString(XML_x, OUString()),RTL_TEXTENCODING_UTF8).getStr();
-        all_comments_on_slide.back().y = rtl::OUStringToOString( 
rAttribs.getString(XML_y, OUString()),RTL_TEXTENCODING_UTF8).getStr();
-        break;
-   // case PPT_TOKEN( text ):
     }
+
     return this;
 }
+
 void SlideFragmentHandler::finalizeImport()
 {
     try
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to