LCOV - code coverage report
Current view: top level - sd/source/ui/dlg - inspagob.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 42 0.0 %
Date: 2014-11-03 Functions: 0 11 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( ( (SdDrawDocument*) 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 : }
      59             : 
      60             : /**
      61             :  * Fills the TreeLB dependent on the medium. Is not medium available, then
      62             :  * it is a text and not a draw document.
      63             :  */
      64           0 : void SdInsertPagesObjsDlg::Reset()
      65             : {
      66           0 :     if( pMedium )
      67             :     {
      68           0 :         m_pLbTree->SetSelectionMode( MULTIPLE_SELECTION );
      69             : 
      70             :         // transfer ownership of Medium
      71           0 :         m_pLbTree->Fill( mpDoc, pMedium, rName );
      72             :     }
      73             :     else
      74             :     {
      75           0 :         Color aColor( COL_WHITE );
      76           0 :         Bitmap aBmpText( SdResId( BMP_DOC_TEXT ) );
      77           0 :         Image aImgText( aBmpText, aColor );
      78           0 :         m_pLbTree->InsertEntry( rName, aImgText, aImgText );
      79             :     }
      80             : 
      81           0 :     m_pCbxMasters->Check( true );
      82           0 : }
      83             : 
      84           0 : std::vector<OUString> SdInsertPagesObjsDlg::GetList( const sal_uInt16 nType )
      85             : {
      86             :     // With Draw documents, we have to return NULL on selection of the document
      87           0 :     if( pMedium )
      88             :     {
      89             :         // to ensure that bookmarks are opened
      90             :         // (when the whole document is selected)
      91           0 :         m_pLbTree->GetBookmarkDoc();
      92             : 
      93             :         // If the document is selected (too) or nothing is selected,
      94             :         // the whole document is inserted (but not more!)
      95           0 :         if( m_pLbTree->GetSelectionCount() == 0 ||
      96           0 :             ( m_pLbTree->IsSelected( m_pLbTree->First() ) ) )
      97           0 :             return std::vector<OUString>();
      98             :     }
      99             : 
     100           0 :     return m_pLbTree->GetSelectEntryList( nType );
     101             : }
     102             : 
     103             : /**
     104             :  *  is link checked
     105             :  */
     106           0 : bool SdInsertPagesObjsDlg::IsLink()
     107             : {
     108           0 :     return( m_pCbxLink->IsChecked() );
     109             : }
     110             : 
     111             : /**
     112             :  *  is link checked
     113             :  */
     114           0 : bool SdInsertPagesObjsDlg::IsRemoveUnnessesaryMasterPages() const
     115             : {
     116           0 :     return( m_pCbxMasters->IsChecked() );
     117             : }
     118             : 
     119             : /**
     120             :  * Enabled and selects end-color-LB
     121             :  */
     122           0 : IMPL_LINK_NOARG(SdInsertPagesObjsDlg, SelectObjectHdl)
     123             : {
     124           0 :     if( m_pLbTree->IsLinkableSelected() )
     125           0 :         m_pCbxLink->Enable();
     126             :     else
     127           0 :         m_pCbxLink->Disable();
     128             : 
     129           0 :     return( 0 );
     130           0 : }
     131             : 
     132             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10