LCOV - code coverage report
Current view: top level - sfx2/source/dialog - newstyle.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 31 0.0 %
Date: 2014-04-11 Functions: 0 7 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             :  * 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 <comphelper/string.hxx>
      21             : 
      22             : #include <svl/style.hxx>
      23             : 
      24             : #include <sfx2/newstyle.hxx>
      25             : #include "dialog.hrc"
      26             : #include <sfx2/sfxresid.hxx>
      27             : 
      28             : // PRIVATE METHODES ------------------------------------------------------
      29             : 
      30           0 : IMPL_LINK( SfxNewStyleDlg, OKHdl, Control *, pControl )
      31             : {
      32             :     (void)pControl; //unused
      33           0 :     const OUString aName( m_pColBox->GetText() );
      34           0 :     SfxStyleSheetBase* pStyle = rPool.Find( aName, rPool.GetSearchFamily(), SFXSTYLEBIT_ALL );
      35           0 :     if ( pStyle )
      36             :     {
      37           0 :         if ( !pStyle->IsUserDefined() )
      38             :         {
      39           0 :             InfoBox( this, SfxResId( MSG_POOL_STYLE_NAME ) ).Execute();
      40           0 :             return 0;
      41             :         }
      42             : 
      43           0 :         if ( RET_YES == aQueryOverwriteBox.Execute() )
      44           0 :             EndDialog( RET_OK );
      45             :     }
      46             :     else
      47           0 :         EndDialog( RET_OK );
      48             : 
      49           0 :     return 0;
      50             : }
      51             : 
      52             : 
      53             : 
      54           0 : IMPL_LINK_INLINE_START( SfxNewStyleDlg, ModifyHdl, ComboBox *, pBox )
      55             : {
      56           0 :     m_pOKBtn->Enable( !comphelper::string::remove(pBox->GetText(), ' ').isEmpty() );
      57           0 :     return 0;
      58             : }
      59           0 : IMPL_LINK_INLINE_END( SfxNewStyleDlg, ModifyHdl, ComboBox *, pBox )
      60             : 
      61             : // CTOR / DTOR -----------------------------------------------------------
      62             : 
      63           0 : SfxNewStyleDlg::SfxNewStyleDlg( Window* pParent, SfxStyleSheetBasePool& rInPool ) :
      64             : 
      65             :     ModalDialog( pParent, "CreateStyleDialog", "sfx/ui/newstyle.ui" ),
      66             : 
      67             :     aQueryOverwriteBox  ( this, SfxResId( MSG_OVERWRITE ) ),
      68             : 
      69           0 :     rPool( rInPool )
      70             : 
      71             : {
      72           0 :     get(m_pColBox, "stylename");
      73           0 :     m_pColBox->set_width_request(m_pColBox->approximate_char_width() * 25);
      74           0 :     m_pColBox->set_height_request(m_pColBox->GetTextHeight() * 10);
      75           0 :     get(m_pOKBtn, "ok");
      76             : 
      77           0 :     m_pOKBtn->SetClickHdl(LINK(this, SfxNewStyleDlg, OKHdl));
      78           0 :     m_pColBox->SetModifyHdl(LINK(this, SfxNewStyleDlg, ModifyHdl));
      79           0 :     m_pColBox->SetDoubleClickHdl(LINK(this, SfxNewStyleDlg, OKHdl));
      80             : 
      81           0 :     SfxStyleSheetBase *pStyle = rPool.First();
      82           0 :     while ( pStyle )
      83             :     {
      84           0 :         m_pColBox->InsertEntry(pStyle->GetName());
      85           0 :         pStyle = rPool.Next();
      86             :     }
      87           0 : }
      88             : 
      89             : 
      90             : 
      91           0 : SfxNewStyleDlg::~SfxNewStyleDlg()
      92             : {
      93           0 : }
      94             : 
      95             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10