LCOV - code coverage report
Current view: top level - sfx2/source/dialog - dialoghelper.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 43 2.3 %
Date: 2015-06-13 12:38:46 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(vcl::Window *pParent, VclBuilderContainer *pPage)
      22             : {
      23           0 :     vcl::Window *pOurGrid = pPage->get<vcl::Window>("maingrid");
      24           0 :     if (!pOurGrid)
      25           0 :         return;
      26             : 
      27           0 :     std::vector<vcl::Window*> aGrids;
      28           0 :     aGrids.push_back(pOurGrid);
      29             : 
      30           0 :     for (vcl::Window* pChild = pParent->GetWindow(GetWindowType::FirstChild); pChild;
      31             :         pChild = pChild->GetWindow(GetWindowType::Next))
      32             :     {
      33           0 :         VclBuilderContainer *pPeer = dynamic_cast<VclBuilderContainer*>(pChild);
      34           0 :         if (!pPeer || pPeer == pPage || !pPeer->hasBuilder())
      35           0 :             continue;
      36             : 
      37           0 :         vcl::Window *pOtherGrid = pPeer->get<vcl::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 :         std::shared_ptr<VclSizeGroup> xGroup(std::make_shared<VclSizeGroup>());
      47           0 :         for (std::vector<vcl::Window*>::iterator aI = aGrids.begin(); aI != aGrids.end(); ++aI)
      48             :         {
      49           0 :             vcl::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 vcl::Window *pReference)
      57             : {
      58           0 :     return pReference->LogicToPixel(Size(68 , 112), MAP_APPFONT);
      59             : }
      60             : 
      61           0 : Size getDrawPreviewOptimalSize(const vcl::Window *pReference)
      62             : {
      63           0 :     return pReference->LogicToPixel(Size(88, 42), MAP_APPFONT);
      64             : }
      65             : 
      66           0 : Size getDrawListBoxOptimalSize(const vcl::Window *pReference)
      67             : {
      68           0 :     return pReference->LogicToPixel(Size(88, 110), MAP_APPFONT);
      69             : }
      70             : 
      71           0 : Size getPreviewStripSize(const vcl::Window *pReference)
      72             : {
      73           0 :     return pReference->LogicToPixel(Size(70 , 40), MapMode(MAP_APPFONT));
      74             : }
      75             : 
      76           0 : Size getPreviewOptionsSize(const vcl::Window *pReference)
      77             : {
      78           0 :     return pReference->LogicToPixel(Size(70 , 27), MapMode(MAP_APPFONT));
      79             : }
      80             : 
      81           0 : OUString getWidestTime(const LocaleDataWrapper& rWrapper)
      82             : {
      83           0 :     Date aDate(22, 12, 2000);
      84           0 :     tools::Time aTime(22, 59, 59);
      85           0 :     DateTime aDateTime(aDate, aTime);
      86           0 :     return formatTime(aDateTime, rWrapper);
      87             : }
      88             : 
      89           0 : OUString 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         648 : }
      96             : 
      97             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11