LCOV - code coverage report
Current view: top level - sw/source/uibase/sidebar - PageColumnControl.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 43 2.3 %
Date: 2014-11-03 Functions: 2 9 22.2 %
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 "PageColumnControl.hxx"
      21             : #include "PagePropertyPanel.hxx"
      22             : #include "PagePropertyPanel.hrc"
      23             : 
      24             : #include <cmdid.h>
      25             : #include <swtypes.hxx>
      26             : 
      27             : #include <svx/sidebar/ValueSetWithTextControl.hxx>
      28             : #include <sfx2/bindings.hxx>
      29             : #include <sfx2/dispatch.hxx>
      30             : #include <vcl/settings.hxx>
      31             : 
      32             : namespace sw { namespace sidebar {
      33             : 
      34           0 : PageColumnControl::PageColumnControl(
      35             :     vcl::Window* pParent,
      36             :     PagePropertyPanel& rPanel,
      37             :     const sal_uInt16 nColumnType,
      38             :     const bool bLandscape )
      39             :     : ::svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_COLUMN) )
      40           0 :     , mpColumnValueSet( new ::svx::sidebar::ValueSetWithTextControl( ::svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_COLUMN) ) )
      41             :     , maMoreButton( this, SW_RES(CB_COLUMN_MORE) )
      42             :     , mnColumnType( nColumnType )
      43           0 :     , mrPagePropPanel(rPanel)
      44             : {
      45           0 :     mpColumnValueSet->SetStyle( mpColumnValueSet->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT );
      46           0 :     mpColumnValueSet->SetColor(GetSettings().GetStyleSettings().GetMenuColor());
      47             : 
      48           0 :     if ( bLandscape )
      49             :     {
      50           0 :         mpColumnValueSet->AddItem(Image(SW_RES(IMG_ONE_L)), 0, SW_RES(STR_ONE), 0 );
      51           0 :         mpColumnValueSet->AddItem(Image(SW_RES(IMG_TWO_L)), 0, SW_RES(STR_TWO), 0 );
      52           0 :         mpColumnValueSet->AddItem(Image(SW_RES(IMG_THREE_L)), 0, SW_RES(STR_THREE), 0 );
      53           0 :         mpColumnValueSet->AddItem(Image(SW_RES(IMG_LEFT_L)), 0, SW_RES(STR_LEFT), 0 );
      54           0 :         mpColumnValueSet->AddItem(Image(SW_RES(IMG_RIGHT_L)), 0, SW_RES(STR_RIGHT), 0 );
      55             :     }
      56             :     else
      57             :     {
      58           0 :         mpColumnValueSet->AddItem(Image(SW_RES(IMG_ONE)), 0, SW_RES(STR_ONE), 0 );
      59           0 :         mpColumnValueSet->AddItem(Image(SW_RES(IMG_TWO)), 0, SW_RES(STR_TWO), 0 );
      60           0 :         mpColumnValueSet->AddItem(Image(SW_RES(IMG_THREE)), 0, SW_RES(STR_THREE), 0 );
      61           0 :         mpColumnValueSet->AddItem(Image(SW_RES(IMG_LEFT)), 0, SW_RES(STR_LEFT), 0 );
      62           0 :         mpColumnValueSet->AddItem(Image(SW_RES(IMG_RIGHT)), 0, SW_RES(STR_RIGHT), 0 );
      63             :     }
      64             : 
      65           0 :     mpColumnValueSet->SetNoSelection();
      66           0 :     mpColumnValueSet->SetSelectHdl( LINK(this, PageColumnControl,ImplColumnHdl ) );
      67           0 :     mpColumnValueSet->Show();
      68           0 :     mpColumnValueSet->SelectItem( mnColumnType );
      69           0 :     mpColumnValueSet->Format();
      70           0 :     mpColumnValueSet->StartSelection();
      71             : 
      72           0 :     maMoreButton.SetClickHdl( LINK( this, PageColumnControl, MoreButtonClickHdl_Impl ) );
      73           0 :     maMoreButton.GrabFocus();
      74             : 
      75           0 :     FreeResource();
      76           0 : }
      77             : 
      78           0 : PageColumnControl::~PageColumnControl(void)
      79             : {
      80           0 :     delete mpColumnValueSet;
      81           0 : }
      82             : 
      83           0 : IMPL_LINK(PageColumnControl, ImplColumnHdl, void *, pControl)
      84             : {
      85           0 :     mpColumnValueSet->SetNoSelection();
      86           0 :     if ( pControl == mpColumnValueSet )
      87             :     {
      88           0 :         const sal_uInt32 nColumnType = mpColumnValueSet->GetSelectItemId();
      89           0 :         if ( nColumnType != mnColumnType )
      90             :         {
      91           0 :             mnColumnType = nColumnType;
      92           0 :             mrPagePropPanel.ExecuteColumnChange( mnColumnType );
      93             :         }
      94             :     }
      95             : 
      96           0 :     mrPagePropPanel.ClosePageColumnPopup();
      97           0 :     return 0;
      98             : }
      99             : 
     100           0 : IMPL_LINK(PageColumnControl, MoreButtonClickHdl_Impl, void *, EMPTYARG)
     101             : {
     102           0 :     mrPagePropPanel.GetBindings()->GetDispatcher()->Execute( FN_FORMAT_PAGE_COLUMN_DLG, SfxCallMode::ASYNCHRON );
     103             : 
     104           0 :     mrPagePropPanel.ClosePageColumnPopup();
     105           0 :     return 0;
     106             : }
     107             : 
     108         270 : } } // end of namespace sw::sidebar
     109             : 
     110             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10