LCOV - code coverage report
Current view: top level - sw/source/uibase/sidebar - PageOrientationControl.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 33 3.0 %
Date: 2014-11-03 Functions: 2 7 28.6 %
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             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "PageOrientationControl.hxx"
      21             : #include "PagePropertyPanel.hxx"
      22             : #include "PagePropertyPanel.hrc"
      23             : 
      24             : #include <swtypes.hxx>
      25             : 
      26             : #include <svx/sidebar/ValueSetWithTextControl.hxx>
      27             : #include <vcl/settings.hxx>
      28             : 
      29             : namespace sw { namespace sidebar {
      30             : 
      31           0 : PageOrientationControl::PageOrientationControl(
      32             :     vcl::Window* pParent,
      33             :     PagePropertyPanel& rPanel,
      34             :     const bool bLandscape )
      35             :     : ::svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_ORIENTATION) )
      36           0 :     , mpOrientationValueSet( new ::svx::sidebar::ValueSetWithTextControl( ::svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_ORIENTATION) ) )
      37             :     , mbLandscape( bLandscape )
      38           0 :     , mrPagePropPanel(rPanel)
      39             : {
      40           0 :     mpOrientationValueSet->SetStyle( mpOrientationValueSet->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT );
      41           0 :     mpOrientationValueSet->SetColor(GetSettings().GetStyleSettings().GetMenuColor());
      42             : 
      43             :     // initialize <ValueSetWithText> control
      44             :     {
      45             :         mpOrientationValueSet->AddItem(Image(SW_RES(IMG_PORTRAIT)), 0,
      46           0 :                 SW_RES(STR_PORTRAIT), 0);
      47             :         mpOrientationValueSet->AddItem(Image(SW_RES(IMG_LANDSCAPE)), 0,
      48           0 :                     SW_RES(STR_LANDSCAPE), 0 );
      49             :     }
      50             : 
      51           0 :     Link aLink = LINK(this, PageOrientationControl,ImplOrientationHdl );
      52           0 :     mpOrientationValueSet->SetSelectHdl(aLink);
      53           0 :     mpOrientationValueSet->SetNoSelection();
      54           0 :     mpOrientationValueSet->StartSelection();
      55           0 :     mpOrientationValueSet->Show();
      56           0 :     mpOrientationValueSet->SelectItem( mbLandscape ? 2 : 1 );
      57           0 :     mpOrientationValueSet->GrabFocus();
      58           0 :     mpOrientationValueSet->Format();
      59           0 :     mpOrientationValueSet->StartSelection();
      60             : 
      61           0 :     FreeResource();
      62           0 : }
      63             : 
      64           0 : PageOrientationControl::~PageOrientationControl(void)
      65             : {
      66           0 :     delete mpOrientationValueSet;
      67           0 : }
      68             : 
      69           0 : IMPL_LINK(PageOrientationControl, ImplOrientationHdl, void *, pControl)
      70             : {
      71           0 :     mpOrientationValueSet->SetNoSelection();
      72           0 :     if ( pControl == mpOrientationValueSet )
      73             :     {
      74           0 :         const sal_uInt32 iPos = mpOrientationValueSet->GetSelectItemId();
      75           0 :         const bool bChanged = ( ( iPos == 1 ) && mbLandscape ) ||
      76           0 :                               ( ( iPos == 2 ) && !mbLandscape );
      77           0 :         if ( bChanged )
      78             :         {
      79           0 :             mbLandscape = !mbLandscape;
      80           0 :             mrPagePropPanel.ExecuteOrientationChange( mbLandscape );
      81             :         }
      82             :     }
      83             : 
      84           0 :     mrPagePropPanel.ClosePageOrientationPopup();
      85           0 :     return 0;
      86             : }
      87             : 
      88         270 : } } // end of namespace sw::sidebar
      89             : 
      90             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10