LCOV - code coverage report
Current view: top level - sfx2/source/dialog - dialoghelper.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 1 43 2.3 %
Date: 2014-04-14 Functions: 2 10 20.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 <sfx2/dialoghelper.hxx>
      11             : #include <tools/datetime.hxx>
      12             : #include <vcl/builder.hxx>
      13             : #include <vcl/layout.hxx>
      14             : #include <vcl/settings.hxx>
      15             : #include <vector>
      16             : 
      17             : //these tab pages both have the same basic layout with a preview on the
      18             : //right, get both of their non-preview areas to request the same size
      19             : //so that the preview appears in the same place in each one so
      20             : //flipping between tabs isn't distracting as it jumps around
      21           0 : void setPreviewsToSamePlace(Window *pParent, VclBuilderContainer *pPage)
      22             : {
      23           0 :     Window *pOurGrid = pPage->get<Window>("maingrid");
      24           0 :     if (!pOurGrid)
      25           0 :         return;
      26             : 
      27           0 :     std::vector<Window*> aGrids;
      28           0 :     aGrids.push_back(pOurGrid);
      29             : 
      30           0 :     for (Window* pChild = pParent->GetWindow(WINDOW_FIRSTCHILD); pChild;
      31             :         pChild = pChild->GetWindow(WINDOW_NEXT))
      32             :     {
      33           0 :         VclBuilderContainer *pPeer = dynamic_cast<VclBuilderContainer*>(pChild);
      34           0 :         if (!pPeer || pPeer == pPage || !pPeer->hasBuilder())
      35           0 :             continue;
      36             : 
      37           0 :         Window *pOtherGrid = pPeer->get<Window>("maingrid");
      38           0 :         if (!pOtherGrid)
      39           0 :             continue;
      40             : 
      41           0 :        aGrids.push_back(pOtherGrid);
      42             :     }
      43             : 
      44           0 :     if (aGrids.size() > 1)
      45             :     {
      46           0 :         boost::shared_ptr< VclSizeGroup > xGroup(new VclSizeGroup);
      47           0 :         for (std::vector<Window*>::iterator aI = aGrids.begin(); aI != aGrids.end(); ++aI)
      48             :         {
      49           0 :             Window *pWindow = *aI;
      50           0 :             pWindow->remove_from_all_size_groups();
      51           0 :             pWindow->add_to_size_group(xGroup);
      52           0 :         }
      53           0 :     }
      54             : }
      55             : 
      56           0 : Size getParagraphPreviewOptimalSize(const Window *pReference)
      57             : {
      58           0 :     return pReference->LogicToPixel(Size(68 , 112), MAP_APPFONT);
      59             : }
      60             : 
      61           0 : Size getDrawPreviewOptimalSize(const Window *pReference)
      62             : {
      63           0 :     return pReference->LogicToPixel(Size(88, 42), MAP_APPFONT);
      64             : }
      65             : 
      66           0 : Size getDrawListBoxOptimalSize(const Window *pReference)
      67             : {
      68           0 :     return pReference->LogicToPixel(Size(88, 110), MAP_APPFONT);
      69             : }
      70             : 
      71           0 : Size SFX2_DLLPUBLIC getPreviewStripSize(const Window *pReference)
      72             : {
      73           0 :     return pReference->LogicToPixel(Size(70 , 40), MapMode(MAP_APPFONT));
      74             : }
      75             : 
      76           0 : Size SFX2_DLLPUBLIC getPreviewOptionsSize(const Window *pReference)
      77             : {
      78           0 :     return pReference->LogicToPixel(Size(70 , 27), MapMode(MAP_APPFONT));
      79             : }
      80             : 
      81           0 : OUString SFX2_DLLPUBLIC getWidestTime(const LocaleDataWrapper& rWrapper)
      82             : {
      83           0 :     Date aDate(22, 12, 2000);
      84           0 :     Time aTime(22, 59, 59);
      85           0 :     DateTime aDateTime(aDate, aTime);
      86           0 :     return formatTime(aDateTime, rWrapper);
      87             : }
      88             : 
      89           0 : OUString SFX2_DLLPUBLIC formatTime(const DateTime& rDateTime, const LocaleDataWrapper& rWrapper)
      90             : {
      91           0 :     OUString sString = rWrapper.getDate(rDateTime);
      92           0 :     sString += OUString(' ');
      93           0 :     sString += rWrapper.getTime(rDateTime, false);
      94           0 :     return sString;
      95           3 : }
      96             : 
      97             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10