<commit_before>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: preview.cxx,v $
 *
 *  $Revision: 1.28 $
 *
 *  last change: $Author: kz $ $Date: 2006-07-21 15:06:38 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/

// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"



// INCLUDE ---------------------------------------------------------------
#include <tools/pstm.hxx>
#include "scitems.hxx"
#include <svx/eeitem.hxx>
#define ITEMID_FIELD EE_FEATURE_FIELD

#include <svtools/colorcfg.hxx>
#include <svx/fmview.hxx>
#include <svx/sizeitem.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/dispatch.hxx>
#include <svtools/accessibilityoptions.hxx>
#include <svtools/itemset.hxx>
#include <tools/multisel.hxx>
#include <vcl/waitobj.hxx>
#include <vcl/sound.hxx>

#include "preview.hxx"
#include "prevwsh.hxx"
#include "prevloc.hxx"
#include "docsh.hxx"
#include "printfun.hxx"
#include "printopt.hxx"
#include "stlpool.hxx"
#include "drwlayer.hxx"
#include "scmod.hxx"
#include "globstr.hrc"
#include "sc.hrc"           // fuer ShellInvalidate
#include "AccessibleDocumentPagePreview.hxx"
#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_
#include <com/sun/star/accessibility/XAccessible.hpp>
#endif
#ifndef SC_ACCESSIBILITYHINTS_HXX
#include "AccessibilityHints.hxx"
#endif

// STATIC DATA -----------------------------------------------------------

//==================================================================

#define SC_PREVIEW_SHADOWSIZE   2

long lcl_GetDisplayStart( SCTAB nTab, ScDocument* pDoc, long* pPages )
{
    long nDisplayStart = 0;
    for (SCTAB i=0; i<nTab; i++)
    {
        if ( pDoc->NeedPageResetAfterTab(i) )
            nDisplayStart = 0;
        else
            nDisplayStart += pPages[i];
    }
    return nDisplayStart;
}


ScPreview::ScPreview( Window* pParent, ScDocShell* pDocSh, ScPreviewShell* pViewSh ) :
    Window( pParent ),
    pDocShell( pDocSh ),
    pViewShell( pViewSh ),
    bInPaint( FALSE ),
    bValid( FALSE ),
    bStateValid( FALSE ),
    bLocationValid( FALSE ),
    bInGetState( FALSE ),
    pLocationData( NULL ),
    pDrawView( NULL ),
    nTabsTested( 0 ),
    nPageNo( 0 ),
    nZoom( 100 ),
    nTab( 0 ),
    nTotalPages( 0 ),
    nTabStart( 0 ),
    nDisplayStart( 0 )
{
    SetOutDevViewType( OUTDEV_VIEWTYPE_PRINTPREVIEW ); //#106611#
    SetBackground();

    SetHelpId( HID_SC_WIN_PREVIEW );
    SetUniqueId( HID_SC_WIN_PREVIEW );

    SetDigitLanguage( SC_MOD()->GetOptDigitLanguage() );
}


__EXPORT ScPreview::~ScPreview()
{
    delete pDrawView;
    delete pLocationData;
}


void ScPreview::UpdateDrawView()        // nTab muss richtig sein
{
    ScDocument* pDoc = pDocShell->GetDocument();
    ScDrawLayer* pModel = pDoc->GetDrawLayer();     // ist nicht 0

    // #114135#
    if ( pModel )
    {
        if ( pDrawView && !pDrawView->GetPageViewPgNum(static_cast<sal_uInt16>(nTab)) )
        {
            //  die angezeigte Page der DrawView umzustellen (s.u.) funktioniert nicht ?!?
            delete pDrawView;
            pDrawView = NULL;
        }

        if ( !pDrawView )                                   // neu anlegen?
        {
            pDrawView = new FmFormView( pModel, this );
            // #55259# die DrawView uebernimmt den Design-Modus vom Model
            // (Einstellung "Im Entwurfsmodus oeffnen"), darum hier zuruecksetzen
            pDrawView->SetDesignMode( TRUE );
            pDrawView->SetPrintPreview( TRUE );
            pDrawView->ShowPagePgNum( static_cast<sal_uInt16>(nTab), Point() );
        }
#if 0
        else if ( !pDrawView->GetPageViewPgNum(nTab) )      // angezeigte Page umstellen
        {
            pDrawView->HideAllPages();
            pDrawView->ShowPagePgNum( nTab, Point() );
        }
#endif
    }<commit_msg>INTEGRATION: CWS aw024 (1.25.136); FILE MERGED 2006/08/03 19:31:32 aw 172.16.31.10: RESYNC: (1.27-1.28); FILE MERGED 2006/05/17 10:31:41 aw 192.168.3.11: changes after resync 2006/05/13 00:08:42 aw 172.16.31.10: RESYNC: (1.26-1.27); FILE MERGED 2005/09/20 03:53:17 aw 192.168.3.11: RESYNC: (1.25-1.26); FILE MERGED 2005/05/26 16:10:15 aw 192.168.3.11: #i39531# 2005/05/26 11:16:17 aw 192.168.3.11: #i39531# 2005/05/19 12:08:15 aw 172.16.58.3: #i39529# 2005/05/12 16:44:07 aw 192.168.127.12: #i39529#<commit_after>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: preview.cxx,v $
 *
 *  $Revision: 1.29 $
 *
 *  last change: $Author: ihi $ $Date: 2006-11-14 15:58:06 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/

// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"



// INCLUDE ---------------------------------------------------------------
#include <tools/pstm.hxx>
#include "scitems.hxx"
#include <svx/eeitem.hxx>
#define ITEMID_FIELD EE_FEATURE_FIELD

#include <svtools/colorcfg.hxx>
#include <svx/fmview.hxx>
#include <svx/sizeitem.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/dispatch.hxx>
#include <svtools/accessibilityoptions.hxx>
#include <svtools/itemset.hxx>
#include <tools/multisel.hxx>
#include <vcl/waitobj.hxx>
#include <vcl/sound.hxx>

#include "preview.hxx"
#include "prevwsh.hxx"
#include "prevloc.hxx"
#include "docsh.hxx"
#include "printfun.hxx"
#include "printopt.hxx"
#include "stlpool.hxx"
#include "drwlayer.hxx"
#include "scmod.hxx"
#include "globstr.hrc"
#include "sc.hrc"           // fuer ShellInvalidate
#include "AccessibleDocumentPagePreview.hxx"
#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_
#include <com/sun/star/accessibility/XAccessible.hpp>
#endif
#ifndef SC_ACCESSIBILITYHINTS_HXX
#include "AccessibilityHints.hxx"
#endif

#ifndef _SV_SVAPP_HXX //autogen
#include <vcl/svapp.hxx>
#endif

// STATIC DATA -----------------------------------------------------------

//==================================================================

#define SC_PREVIEW_SHADOWSIZE   2

long lcl_GetDisplayStart( SCTAB nTab, ScDocument* pDoc, long* pPages )
{
    long nDisplayStart = 0;
    for (SCTAB i=0; i<nTab; i++)
    {
        if ( pDoc->NeedPageResetAfterTab(i) )
            nDisplayStart = 0;
        else
            nDisplayStart += pPages[i];
    }
    return nDisplayStart;
}


ScPreview::ScPreview( Window* pParent, ScDocShell* pDocSh, ScPreviewShell* pViewSh ) :
    Window( pParent ),
    pDocShell( pDocSh ),
    pViewShell( pViewSh ),
    bInPaint( FALSE ),
    bValid( FALSE ),
    bStateValid( FALSE ),
    bLocationValid( FALSE ),
    bInGetState( FALSE ),
    pLocationData( NULL ),
    pDrawView( NULL ),
    nTabsTested( 0 ),
    nPageNo( 0 ),
    nZoom( 100 ),
    nTab( 0 ),
    nTotalPages( 0 ),
    nTabStart( 0 ),
    nDisplayStart( 0 )
{
    SetOutDevViewType( OUTDEV_VIEWTYPE_PRINTPREVIEW ); //#106611#
    SetBackground();

    SetHelpId( HID_SC_WIN_PREVIEW );
    SetUniqueId( HID_SC_WIN_PREVIEW );

    SetDigitLanguage( SC_MOD()->GetOptDigitLanguage() );
}


__EXPORT ScPreview::~ScPreview()
{
    delete pDrawView;
    delete pLocationData;
}

void ScPreview::UpdateDrawView()        // nTab muss richtig sein
{
    ScDocument* pDoc = pDocShell->GetDocument();
    ScDrawLayer* pModel = pDoc->GetDrawLayer();     // ist nicht 0

    // #114135#
    if ( pModel )
    {
        if ( pDrawView && !pDrawView->GetSdrPageView())
        {
            //  die angezeigte Page der DrawView umzustellen (s.u.) funktioniert nicht ?!?
            delete pDrawView;
            pDrawView = NULL;
        }

        if ( !pDrawView )                                   // neu anlegen?
        {
            pDrawView = new FmFormView( pModel, this );
            // #55259# die DrawView uebernimmt den Design-Modus vom Model
            // (Einstellung "Im Entwurfsmodus oeffnen"), darum hier zuruecksetzen
            pDrawView->SetDesignMode( TRUE );
            pDrawView->SetPrintPreview( TRUE );
            pDrawView->ShowSdrPage(pDrawView->GetModel()->GetPage(nTab));
        }
#if 0
        else if ( !pDrawView->GetSdrPageView())     // angezeigte Page umstellen
        {
            pDrawView->HideSdrPage();
            pDrawView->ShowSdrPage(pDrawView->GetModel()->GetPage(nTab));
        }
#endif
    }
{'fraction_non_alphanumeric': 0.17681022243256034, 'fraction_numerical': 0.038239469947941314, 'mean_word_length': 2.8660812294182216, 'pattern_counts': {'":': 0, '<': 36, '<?xml version=': 0, '>': 60, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 8, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1855655', 'n_tokens_mistral': 3747, 'n_tokens_neox': 3409, 'n_words': 872}