LCOV - code coverage report
Current view: top level - libreoffice/sd/source/ui/dlg - inspagob.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 37 0.0 %
Date: 2012-12-17 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             : 
      21             : #ifdef SD_DLLIMPLEMENTATION
      22             : #undef SD_DLLIMPLEMENTATION
      23             : #endif
      24             : 
      25             : 
      26             : #include "inspagob.hxx"
      27             : 
      28             : #include "strings.hrc"
      29             : #include "res_bmp.hrc"
      30             : #include "sdresid.hxx"
      31             : #include "drawdoc.hxx"
      32             : #include "DrawDocShell.hxx"
      33             : #include "ViewShell.hxx"
      34             : #include "inspagob.hrc"
      35             : 
      36             : 
      37             : /*************************************************************************
      38             : |*
      39             : |*  Ctor
      40             : |*
      41             : \************************************************************************/
      42             : 
      43           0 : SdInsertPagesObjsDlg::SdInsertPagesObjsDlg(
      44             :     ::Window* pWindow,
      45             :     const SdDrawDocument* pInDoc,
      46             :     SfxMedium* pSfxMedium,
      47             :     const String& rFileName )
      48             :     : ModalDialog     ( pWindow, SdResId( DLG_INSERT_PAGES_OBJS ) ),
      49             :       aLbTree         ( this, SdResId( LB_TREE ) ),
      50             :       aCbxLink        ( this, SdResId( CBX_LINK ) ),
      51             :       aCbxMasters     ( this, SdResId( CBX_CHECK_MASTERS ) ),
      52             :       aBtnOk          ( this, SdResId( BTN_OK ) ),
      53             :       aBtnCancel      ( this, SdResId( BTN_CANCEL ) ),
      54             :       aBtnHelp        ( this, SdResId( BTN_HELP ) ),
      55             :       pMedium       ( pSfxMedium ),
      56             :       mpDoc         ( pInDoc ),
      57           0 :       rName         ( rFileName )
      58             : {
      59           0 :     FreeResource();
      60             : 
      61           0 :     aLbTree.SetViewFrame( ( (SdDrawDocument*) pInDoc )->GetDocSh()->GetViewShell()->GetViewFrame() );
      62             : 
      63           0 :     aLbTree.SetSelectHdl( LINK( this, SdInsertPagesObjsDlg, SelectObjectHdl ) );
      64             : 
      65             :     // Text wird eingefuegt
      66           0 :     if( !pMedium )
      67           0 :         SetText( String( SdResId( STR_INSERT_TEXT ) ) );
      68             : 
      69           0 :     Reset();
      70           0 : }
      71             : 
      72             : /*************************************************************************
      73             : |*
      74             : |*  Dtor
      75             : |*
      76             : \************************************************************************/
      77             : 
      78           0 : SdInsertPagesObjsDlg::~SdInsertPagesObjsDlg()
      79             : {
      80           0 : }
      81             : 
      82             : /*************************************************************************
      83             : |*
      84             : |*  Fuellt die TreeLB in Abhaengigkeit des Mediums. Ist kein Medium
      85             : |*  vorhanden, handelt es sich um ein Text- und kein Drawdokument
      86             : |*
      87             : \************************************************************************/
      88             : 
      89           0 : void SdInsertPagesObjsDlg::Reset()
      90             : {
      91           0 :     if( pMedium )
      92             :     {
      93           0 :         aLbTree.SetSelectionMode( MULTIPLE_SELECTION );
      94             : 
      95             :         // transfer ownership of Medium
      96           0 :         aLbTree.Fill( mpDoc, pMedium, rName );
      97             :     }
      98             :     else
      99             :     {
     100           0 :         Color aColor( COL_WHITE );
     101           0 :         Bitmap aBmpText( SdResId( BMP_DOC_TEXT ) );
     102           0 :         Image aImgText( aBmpText, aColor );
     103           0 :         aLbTree.InsertEntry( rName, aImgText, aImgText );
     104             :     }
     105             : 
     106           0 :     aCbxMasters.Check( sal_True );
     107           0 : }
     108             : 
     109           0 : std::vector<rtl::OUString> SdInsertPagesObjsDlg::GetList( const sal_uInt16 nType )
     110             : {
     111             :     // Bei Draw-Dokumenten muss bei der Selektion des Dokumentes NULL
     112             :     // zurueckgegeben werden
     113           0 :     if( pMedium )
     114             :     {
     115             :         // Um zu gewaehrleisten, dass die Bookmarks geoeffnet sind
     116             :         // (Wenn gesamtes Dokument ausgewaehlt wurde)
     117           0 :         aLbTree.GetBookmarkDoc();
     118             : 
     119             :         // Wenn das Dokument (mit-)selektiert oder nichst selektiert ist,
     120             :         // wird das gesamte Dokument (und nicht mehr!) eingefuegt.
     121           0 :         if( aLbTree.GetSelectionCount() == 0 ||
     122           0 :             ( aLbTree.IsSelected( aLbTree.First() ) ) )
     123           0 :             return std::vector<rtl::OUString>();
     124             :     }
     125             : 
     126           0 :     return aLbTree.GetSelectEntryList( nType );
     127             : }
     128             : 
     129             : /*************************************************************************
     130             : |*
     131             : |*  Ist Verknuepfung gechecked
     132             : |*
     133             : \************************************************************************/
     134             : 
     135           0 : sal_Bool SdInsertPagesObjsDlg::IsLink()
     136             : {
     137           0 :     return( aCbxLink.IsChecked() );
     138             : }
     139             : 
     140             : /*************************************************************************
     141             : |*
     142             : |*  Ist Verknuepfung gechecked
     143             : |*
     144             : \************************************************************************/
     145             : 
     146           0 : sal_Bool SdInsertPagesObjsDlg::IsRemoveUnnessesaryMasterPages() const
     147             : {
     148           0 :     return( aCbxMasters.IsChecked() );
     149             : }
     150             : 
     151             : /*************************************************************************
     152             : |*
     153             : |* Enabled und selektiert Endfarben-LB
     154             : |*
     155             : \************************************************************************/
     156             : 
     157           0 : IMPL_LINK_NOARG(SdInsertPagesObjsDlg, SelectObjectHdl)
     158             : {
     159           0 :     if( aLbTree.IsLinkableSelected() )
     160           0 :         aCbxLink.Enable();
     161             :     else
     162           0 :         aCbxLink.Disable();
     163             : 
     164           0 :     return( 0 );
     165             : }
     166             : 
     167             : 
     168             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10