LCOV - code coverage report
Current view: top level - oox/source/ppt - comments.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 47 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  */
       9             : 
      10             : #include "oox/ppt/comments.hxx"
      11             : #include <com/sun/star/lang/IllegalArgumentException.hpp>
      12             : #include <rtl/math.hxx>
      13             : 
      14             : namespace oox { namespace ppt {
      15             : 
      16           0 : void CommentAuthorList::setValues(const CommentAuthorList& list)
      17             : {
      18           0 :     std::vector<CommentAuthor>::const_iterator it;
      19           0 :     for(it = list.cmAuthorLst.begin(); it != list.cmAuthorLst.end(); ++it)
      20             :     {
      21           0 :         CommentAuthor temp;
      22           0 :         cmAuthorLst.push_back(temp);
      23           0 :         cmAuthorLst.back().clrIdx = it->clrIdx;
      24           0 :         cmAuthorLst.back().id = it->id;
      25           0 :         cmAuthorLst.back().initials = it->initials;
      26           0 :         cmAuthorLst.back().lastIdx = it->lastIdx;
      27           0 :         cmAuthorLst.back().name = it->name;
      28           0 :     }
      29           0 : }
      30             : 
      31             : //DateTime is saved as : 2013-01-10T15:53:26.000
      32           0 : void Comment::setDateTime (const OUString& _datetime)
      33             : {
      34           0 :     OUString datetime = _datetime;
      35           0 :     aDateTime.Year = datetime.getToken(0,'-').toInt32();
      36           0 :     aDateTime.Month = datetime.getToken(1,'-').toInt32();
      37           0 :     aDateTime.Day = datetime.getToken(2,'-').toInt32();
      38           0 :     datetime = datetime.getToken(1,'T');
      39           0 :     aDateTime.Hours = datetime.getToken(0,':').toInt32();
      40           0 :     aDateTime.Minutes = datetime.getToken(1,':').toInt32();
      41           0 :     double seconds = datetime.getToken(2,':').toDouble();
      42           0 :     aDateTime.Seconds = floor(seconds);
      43           0 :     seconds -= aDateTime.Seconds;
      44           0 :     aDateTime.NanoSeconds = ::rtl::math::round(seconds * 1000000000);
      45           0 :     const int secondsOverflow = (aDateTime.Seconds == 60) ? 61 : 60;
      46             :     // normalise time part of aDateTime
      47           0 :     if (aDateTime.NanoSeconds == 1000000000)
      48             :     {
      49           0 :         aDateTime.NanoSeconds = 0;
      50           0 :         ++aDateTime.Seconds;
      51             :     }
      52           0 :     if (aDateTime.Seconds == secondsOverflow)
      53             :     {
      54           0 :         aDateTime.Seconds = 0;
      55           0 :         ++aDateTime.Minutes;
      56             :     }
      57           0 :     if (aDateTime.Minutes == 60)
      58             :     {
      59           0 :         aDateTime.Minutes = 0;
      60           0 :         ++aDateTime.Hours;
      61           0 :     }
      62             :     // if overflow goes into date, I give up
      63           0 : }
      64             : 
      65           0 : OUString Comment::getAuthor ( const CommentAuthorList& list )
      66             : {
      67           0 :     const sal_Int32 nId = authorId.toInt32();
      68           0 :     std::vector<CommentAuthor>::const_iterator it;
      69           0 :     for(it = list.cmAuthorLst.begin(); it != list.cmAuthorLst.end(); ++it)
      70             :     {
      71           0 :         if(it->id.toInt32() == nId)
      72           0 :             return it->name;
      73             :     }
      74           0 :     return OUString("Anonymous");
      75             : }
      76             : 
      77           0 : const Comment& CommentList::getCommentAtIndex (int index)
      78             : {
      79           0 :     if(index < (int)cmLst.size() && index >= 0)
      80           0 :         return cmLst.at(index);
      81             :     else
      82           0 :         throw css::lang::IllegalArgumentException();
      83             : }
      84             : 
      85             : } }
      86             : 
      87             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11