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

Generated by: LCOV version 1.11