LCOV - code coverage report
Current view: top level - sd/source/ui/dlg - inspagob.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 41 0.0 %
Date: 2014-04-14 Functions: 0 9 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 "inspagob.hxx"
      21             : 
      22             : #include "strings.hrc"
      23             : #include "res_bmp.hrc"
      24             : #include "sdresid.hxx"
      25             : #include "drawdoc.hxx"
      26             : #include "DrawDocShell.hxx"
      27             : #include "ViewShell.hxx"
      28             : 
      29             : 
      30           0 : SdInsertPagesObjsDlg::SdInsertPagesObjsDlg(
      31             :     ::Window* pWindow, const SdDrawDocument* pInDoc,
      32             :     SfxMedium* pSfxMedium, const OUString& rFileName )
      33             :     : ModalDialog(pWindow, "InsertSlidesDialog",
      34             :         "modules/sdraw/ui/insertslidesdialog.ui")
      35             :     , pMedium(pSfxMedium)
      36             :     , mpDoc(pInDoc)
      37           0 :     , rName(rFileName)
      38             : {
      39           0 :     get(m_pLbTree, "tree");
      40           0 :     get(m_pCbxMasters, "backgrounds");
      41           0 :     get(m_pCbxLink, "links");
      42             : 
      43           0 :     m_pLbTree->set_width_request(m_pLbTree->approximate_char_width() * 50);
      44           0 :     m_pLbTree->set_height_request(m_pLbTree->GetTextHeight() * 12);
      45             : 
      46           0 :     m_pLbTree->SetViewFrame( ( (SdDrawDocument*) pInDoc )->GetDocSh()->GetViewShell()->GetViewFrame() );
      47             : 
      48           0 :     m_pLbTree->SetSelectHdl( LINK( this, SdInsertPagesObjsDlg, SelectObjectHdl ) );
      49             : 
      50             :     // insert text
      51           0 :     if( !pMedium )
      52           0 :         SetText( SD_RESSTR( STR_INSERT_TEXT ) );
      53             : 
      54           0 :     Reset();
      55           0 : }
      56             : 
      57             : 
      58           0 : SdInsertPagesObjsDlg::~SdInsertPagesObjsDlg()
      59             : {
      60           0 : }
      61             : 
      62             : /**
      63             :  * Fills the TreeLB dependent on the medium. Is not medium available, then
      64             :  * it is a text and not a draw document.
      65             :  */
      66           0 : void SdInsertPagesObjsDlg::Reset()
      67             : {
      68           0 :     if( pMedium )
      69             :     {
      70           0 :         m_pLbTree->SetSelectionMode( MULTIPLE_SELECTION );
      71             : 
      72             :         // transfer ownership of Medium
      73           0 :         m_pLbTree->Fill( mpDoc, pMedium, rName );
      74             :     }
      75             :     else
      76             :     {
      77           0 :         Color aColor( COL_WHITE );
      78           0 :         Bitmap aBmpText( SdResId( BMP_DOC_TEXT ) );
      79           0 :         Image aImgText( aBmpText, aColor );
      80           0 :         m_pLbTree->InsertEntry( rName, aImgText, aImgText );
      81             :     }
      82             : 
      83           0 :     m_pCbxMasters->Check( true );
      84           0 : }
      85             : 
      86           0 : std::vector<OUString> SdInsertPagesObjsDlg::GetList( const sal_uInt16 nType )
      87             : {
      88             :     // With Draw documents, we have to return NULL on selection of the document
      89           0 :     if( pMedium )
      90             :     {
      91             :         // to ensure that bookmarks are opened
      92             :         // (when the whole document is selected)
      93           0 :         m_pLbTree->GetBookmarkDoc();
      94             : 
      95             :         // If the document is selected (too) or nothing is selected,
      96             :         // the whole document is inserted (but not more!)
      97           0 :         if( m_pLbTree->GetSelectionCount() == 0 ||
      98           0 :             ( m_pLbTree->IsSelected( m_pLbTree->First() ) ) )
      99           0 :             return std::vector<OUString>();
     100             :     }
     101             : 
     102           0 :     return m_pLbTree->GetSelectEntryList( nType );
     103             : }
     104             : 
     105             : /**
     106             :  *  is link checked
     107             :  */
     108           0 : sal_Bool SdInsertPagesObjsDlg::IsLink()
     109             : {
     110           0 :     return( m_pCbxLink->IsChecked() );
     111             : }
     112             : 
     113             : /**
     114             :  *  is link checked
     115             :  */
     116           0 : sal_Bool SdInsertPagesObjsDlg::IsRemoveUnnessesaryMasterPages() const
     117             : {
     118           0 :     return( m_pCbxMasters->IsChecked() );
     119             : }
     120             : 
     121             : /**
     122             :  * Enabled and selects end-color-LB
     123             :  */
     124           0 : IMPL_LINK_NOARG(SdInsertPagesObjsDlg, SelectObjectHdl)
     125             : {
     126           0 :     if( m_pLbTree->IsLinkableSelected() )
     127           0 :         m_pCbxLink->Enable();
     128             :     else
     129           0 :         m_pCbxLink->Disable();
     130             : 
     131           0 :     return( 0 );
     132             : }
     133             : 
     134             : 
     135             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10