<commit_before>/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * Copyright 2008 by Sun Microsystems, Inc.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * $RCSfile: dx_textlayout.hxx,v $
 * $Revision: 1.3 $
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org 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 version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/

#ifndef _DXCANVAS_TEXTLAYOUT_HXX
#define _DXCANVAS_TEXTLAYOUT_HXX

#include <cppuhelper/compbase2.hxx>
#include <comphelper/broadcasthelper.hxx>

#include <com/sun/star/lang/XServiceInfo.hpp>

#include <com/sun/star/rendering/XTextLayout.hpp>

#include <basegfx/vector/b2isize.hxx>

#include <boost/utility.hpp>

#include "dx_canvasfont.hxx"
#include "dx_surfacegraphics.hxx"
#include "dx_winstuff.hxx"
#include "dx_gdiplususer.hxx"

/* Definition of TextLayout class */
class DXBitmapSharedPtr;

namespace dxcanvas
{
    typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::rendering::XTextLayout,
                                               ::com::sun::star::lang::XServiceInfo > TextLayout_Base;

    class TextLayout : public ::comphelper::OBaseMutex,
                       public TextLayout_Base,
                       private ::boost::noncopyable
    {
    public:
        TextLayout( const ::com::sun::star::rendering::StringContext& aText,
                    sal_Int8                                                  nDirection,
                    sal_Int64                                                 nRandomSeed,
                    const CanvasFont::ImplRef&                                rFont );

        /// Dispose all internal references
        virtual void SAL_CALL disposing();

        // XTextLayout
        virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > > SAL_CALL queryTextShapes(  ) throw (::com::sun::star::uno::RuntimeException);
        virtual ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealRectangle2D > SAL_CALL queryInkMeasures(  ) throw (::com::sun::star::uno::RuntimeException);
        virtual ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealRectangle2D > SAL_CALL queryMeasures(  ) throw (::com::sun::star::uno::RuntimeException);
        virtual ::com::sun::star::uno::Sequence< double > SAL_CALL queryLogicalAdvancements(  ) throw (::com::sun::star::uno::RuntimeException);
        virtual void SAL_CALL applyLogicalAdvancements( const ::com::sun::star::uno::Sequence< double >& aAdvancements ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
        virtual ::com::sun::star::geometry::RealRectangle2D SAL_CALL queryTextBounds(  ) throw (::com::sun::star::uno::RuntimeException);
        virtual double SAL_CALL justify( double nSize ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
        virtual double SAL_CALL combinedJustify( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XTextLayout > >& aNextLayouts, double nSize ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
        virtual ::com::sun::star::rendering::TextHit SAL_CALL getTextHit( const ::com::sun::star::geometry::RealPoint2D& aHitPoint ) throw (::com::sun::star::uno::RuntimeException);
        virtual ::com::sun::star::rendering::Caret SAL_CALL getCaret( sal_Int32 nInsertionIndex, sal_Bool bExcludeLigatures ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
        virtual sal_Int32 SAL_CALL getNextInsertionIndex( sal_Int32 nStartIndex, sal_Int32 nCaretAdvancement, sal_Bool bExcludeLigatures ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
        virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > SAL_CALL queryVisualHighlighting( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
        virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > SAL_CALL queryLogicalHighlighting( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
        virtual double SAL_CALL getBaselineOffset(  ) throw (::com::sun::star::uno::RuntimeException);
        virtual sal_Int8 SAL_CALL getMainTextDirection(  ) throw (::com::sun::star::uno::RuntimeException);
        virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvasFont > SAL_CALL getFont(  ) throw (::com::sun::star::uno::RuntimeException);
        virtual ::com::sun::star::rendering::StringContext SAL_CALL getText(  ) throw (::com::sun::star::uno::RuntimeException);

        // XServiceInfo
        virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
        virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException );
        virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()  throw( ::com::sun::star::uno::RuntimeException );

        bool draw( const DXBitmapSharedPtr&                              rBitmap,
                   const ::com::sun::star::rendering::ViewState&         rViewState,
                   const ::com::sun::star::rendering::RenderState&       rRenderState,
                   const ::basegfx::B2ISize&                             rOutputOffset,
                   const ::com::sun::star::uno::Reference<
                         ::com::sun::star::rendering::XGraphicDevice >&  xGraphicDevice ) const;

    protected:
        ~TextLayout(); // we're a ref-counted UNO class. _We_ destroy ourselves.

    private:
        // NOTE: no need for GDIPlusUserSharedPtr, mpFont implicitely has one already

        ::com::sun::star::rendering::StringContext maText;
        ::com::sun::star::uno::Sequence< double >  maLogicalAdvancements;
        CanvasFont::ImplRef                        mpFont;
        sal_Int8                                   mnTextDirection;
    };

}

#endif /* _DXCANVAS_TEXTLAYOUT_HXX */
<commit_msg>INTEGRATION: CWS canvas05 (1.2.2); FILE MERGED 2008/04/21 07:30:48 thb 1.2.2.2: RESYNC: (1.2-1.3); FILE MERGED 2008/01/22 00:25:24 thb 1.2.2.1: #i81092# Making gdiplus and dx canvas more independent<commit_after>/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * Copyright 2008 by Sun Microsystems, Inc.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * $RCSfile: dx_textlayout.hxx,v $
 * $Revision: 1.4 $
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org 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 version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/

#ifndef _DXCANVAS_TEXTLAYOUT_HXX
#define _DXCANVAS_TEXTLAYOUT_HXX

#include <cppuhelper/compbase2.hxx>
#include <comphelper/broadcasthelper.hxx>

#include <com/sun/star/lang/XServiceInfo.hpp>

#include <com/sun/star/rendering/XTextLayout.hpp>

#include <basegfx/vector/b2isize.hxx>

#include <boost/utility.hpp>

#include "dx_canvasfont.hxx"
#include "dx_ibitmap.hxx"
#include "dx_winstuff.hxx"
#include "dx_gdiplususer.hxx"

/* Definition of TextLayout class */
class DXBitmapSharedPtr;

namespace dxcanvas
{
    typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::rendering::XTextLayout,
                                               ::com::sun::star::lang::XServiceInfo > TextLayout_Base;

    class TextLayout : public ::comphelper::OBaseMutex,
                       public TextLayout_Base,
                       private ::boost::noncopyable
    {
    public:
        TextLayout( const ::com::sun::star::rendering::StringContext& aText,
                    sal_Int8                                                  nDirection,
                    sal_Int64                                                 nRandomSeed,
                    const CanvasFont::ImplRef&                                rFont );

        /// Dispose all internal references
        virtual void SAL_CALL disposing();

        // XTextLayout
        virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > > SAL_CALL queryTextShapes(  ) throw (::com::sun::star::uno::RuntimeException);
        virtual ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealRectangle2D > SAL_CALL queryInkMeasures(  ) throw (::com::sun::star::uno::RuntimeException);
        virtual ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealRectangle2D > SAL_CALL queryMeasures(  ) throw (::com::sun::star::uno::RuntimeException);
        virtual ::com::sun::star::uno::Sequence< double > SAL_CALL queryLogicalAdvancements(  ) throw (::com::sun::star::uno::RuntimeException);
        virtual void SAL_CALL applyLogicalAdvancements( const ::com::sun::star::uno::Sequence< double >& aAdvancements ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
        virtual ::com::sun::star::geometry::RealRectangle2D SAL_CALL queryTextBounds(  ) throw (::com::sun::star::uno::RuntimeException);
        virtual double SAL_CALL justify( double nSize ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
        virtual double SAL_CALL combinedJustify( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XTextLayout > >& aNextLayouts, double nSize ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
        virtual ::com::sun::star::rendering::TextHit SAL_CALL getTextHit( const ::com::sun::star::geometry::RealPoint2D& aHitPoint ) throw (::com::sun::star::uno::RuntimeException);
        virtual ::com::sun::star::rendering::Caret SAL_CALL getCaret( sal_Int32 nInsertionIndex, sal_Bool bExcludeLigatures ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
        virtual sal_Int32 SAL_CALL getNextInsertionIndex( sal_Int32 nStartIndex, sal_Int32 nCaretAdvancement, sal_Bool bExcludeLigatures ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
        virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > SAL_CALL queryVisualHighlighting( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
        virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > SAL_CALL queryLogicalHighlighting( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
        virtual double SAL_CALL getBaselineOffset(  ) throw (::com::sun::star::uno::RuntimeException);
        virtual sal_Int8 SAL_CALL getMainTextDirection(  ) throw (::com::sun::star::uno::RuntimeException);
        virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvasFont > SAL_CALL getFont(  ) throw (::com::sun::star::uno::RuntimeException);
        virtual ::com::sun::star::rendering::StringContext SAL_CALL getText(  ) throw (::com::sun::star::uno::RuntimeException);

        // XServiceInfo
        virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
        virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException );
        virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()  throw( ::com::sun::star::uno::RuntimeException );

        bool draw( const GraphicsSharedPtr&                              rGraphics,
                   const ::com::sun::star::rendering::ViewState&         rViewState,
                   const ::com::sun::star::rendering::RenderState&       rRenderState,
                   const ::basegfx::B2ISize&                             rOutputOffset,
                   const ::com::sun::star::uno::Reference<
                   ::com::sun::star::rendering::XGraphicDevice >&        xGraphicDevice,
                   bool                                                  bAlphaSurface ) const;

    protected:
        ~TextLayout(); // we're a ref-counted UNO class. _We_ destroy ourselves.

    private:
        // NOTE: no need for GDIPlusUserSharedPtr, mpFont implicitely has one already

        ::com::sun::star::rendering::StringContext maText;
        ::com::sun::star::uno::Sequence< double >  maLogicalAdvancements;
        CanvasFont::ImplRef                        mpFont;
        sal_Int8                                   mnTextDirection;
    };

}

#endif /* _DXCANVAS_TEXTLAYOUT_HXX */
<|endoftext|>


<commit_before> /*************************************************************************
 *
 *  $RCSfile: impdialog.cxx,v $
 *
 *  $Revision: 1.10 $
 *
 *  last change: $Author: pjunck $ $Date: 2004-10-28 09:39:52 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 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
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/

#include "impdialog.hxx"
#include "impdialog.hrc"

#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_
#include <com/sun/star/uno/Sequence.h>
#endif
#ifndef _COM_SUN_STAR_TEXT_XTEXTRANGE_HPP_
#include <com/sun/star/text/XTextRange.hpp>
#endif
#ifndef _COM_SUN_STAR_DRAWING_XSHAPES_HPP_
#include <com/sun/star/drawing/XShapes.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_
#include <com/sun/star/container/XIndexAccess.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_XCONTROLLER_HPP_
#include <com/sun/star/frame/XController.hpp>
#endif
#ifndef _COM_SUN_STAR_VIEW_XSELECTIONSUPPLIER_HPP_
#include <com/sun/star/view/XSelectionSupplier.hpp>
#endif

// ----------------
// - ImpPDFDialog -
// ----------------

using namespace ::com::sun::star;

ImpPDFDialog::ImpPDFDialog( Window* pParent, ResMgr& rResMgr, Sequence< PropertyValue >& rFilterData, const Reference< XComponent >& rxDoc ) :
    ModalDialog( pParent, ResId( RID_PDF_EXPORT_DLG, &rResMgr ) ),
    maBtnOK( this, ResId( BT_OK ) ),
    maBtnCancel( this, ResId( BT_CANCEL ) ),
    maBtnHelp( this, ResId( BT_HELP ) ),
    maFlPages( this, ResId( FL_PAGES ) ),
    maRbAll( this, ResId( RB_ALL ) ),
    maRbRange( this, ResId( RB_RANGE ) ),
    maRbSelection( this, ResId( RB_SELECTION ) ),
    maEdPages( this, ResId( ED_PAGES ) ),
    maFlCompression( this, ResId( FL_IMAGES ) ),
    maRbLosslessCompression( this, ResId( RB_LOSSLESSCOMPRESSION ) ),
    maRbJPEGCompression( this, ResId( RB_JPEGCOMPRESSION ) ),
    maFtQuality( this, ResId( FT_QUALITY ) ),
    maNfQuality( this, ResId( NF_QUALITY ) ),
    maCbReduceImageResolution( this, ResId( CB_REDUCEIMAGERESOLUTION ) ),
    maFtReduceImageResolution( this, ResId( FT_REDUCEIMAGERESOLUTION ) ),
    maCoReduceImageResolution( this, ResId( CO_REDUCEIMAGERESOLUTION ) ),
    maFlGeneral( this, ResId( FL_GENERAL ) ),
    maCbTaggedPDF( this, ResId( CB_TAGGEDPDF ) ),
    maFtTaggedPDF( this, ResId( FT_TAGGEDPDF ) ),
    maCbExportNotes( this, ResId( CB_EXPORTNOTES ) ),
    maFtExportNotes( this, ResId( FT_EXPORTNOTES ) ),
    maCbTransitionEffects( this, ResId( CB_TRANSITIONEFFECTS ) ),
    maFtTransitionEffects( this, ResId( FT_TRANSITIONEFFECTS ) ),
    maFtFormsFormat( this, ResId( FT_FORMSFORMAT ) ),
    maLbFormsFormat( this, ResId( LB_FORMSFORMAT ) ),
    maConfigItem( String( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/PDF/Export/" ) ), &rFilterData ),
    mbIsPresentation( sal_False )
{
    FreeResource();
    maRbRange.SetToggleHdl( LINK( this, ImpPDFDialog, TogglePagesHdl ) );

    maRbAll.Check();
    TogglePagesHdl( NULL );

    maNfQuality.SetUnit( FUNIT_PERCENT );
    maNfQuality.SetMin( 1, FUNIT_PERCENT );
    maNfQuality.SetMax( 100, FUNIT_PERCENT );

    // check for selection
    try
    {
        Reference< frame::XController > xController( Reference< frame::XModel >( rxDoc, UNO_QUERY )->getCurrentController() );
        if( xController.is() )
        {
            Reference< view::XSelectionSupplier > xView( xController, UNO_QUERY );
            if( xView.is() )
                xView->getSelection() >>= maSelection;
        }
    }
    catch( RuntimeException )
    {
    }
    sal_Bool bHasSelection = maSelection.hasValue();
    if ( bHasSelection )
    {
        Reference< drawing::XShapes > xShapes;
        if ( ( maSelection >>= xShapes ) == sal_False ) // XShapes is always a selection
        {
            // even if nothing is selected in writer the selection is not empty
            Reference< container::XIndexAccess > xIndexAccess;
            if ( maSelection >>= xIndexAccess )
            {
                sal_Int32 nLen = xIndexAccess->getCount();
                if ( !nLen )
                    bHasSelection = sal_False;
                else if ( nLen == 1 )
                {
                    Reference< text::XTextRange > xTextRange( xIndexAccess->getByIndex( 0 ), UNO_QUERY );
                    if ( xTextRange.is() && ( xTextRange->getString().getLength() == 0 ) )
                        bHasSelection = sal_False;
                }
            }
        }
    }
    maRbSelection.Enable( bHasSelection );

    // check if source document is a presentation
    try
    {
        Reference< XServiceInfo > xInfo( rxDoc, UNO_QUERY );
        if ( xInfo.is() )
        {
            if ( xInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) ) )
                mbIsPresentation = sal_True;
        }
    }
    catch( RuntimeException )
    {
    }
    maCbTransitionEffects.Enable( mbIsPresentation );

//  SJ: Dont know if there are Notes available also for writer.
//  maCbExportNotes.Enable( bIsPresentation );

    maRbLosslessCompression.SetToggleHdl( LINK( this, ImpPDFDialog, ToggleCompressionHdl ) );
    const sal_Bool  bUseLosslessCompression = maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "UseLosslessCompression" ) ), sal_False );
    if ( bUseLosslessCompression )
        maRbLosslessCompression.Check();
    else
        maRbJPEGCompression.Check();
    maNfQuality.SetValue( maConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ), 90 ), FUNIT_PERCENT );
    maNfQuality.Enable( bUseLosslessCompression == sal_False );

    maCbReduceImageResolution.SetToggleHdl( LINK( this, ImpPDFDialog, ToggleReduceImageResolutionHdl ) );
    const sal_Bool  bReduceImageResolution = maConfigItem.ReadBool(  String( RTL_CONSTASCII_USTRINGPARAM( "ReduceImageResolution" ) ), sal_False );
    maCbReduceImageResolution.Check( bReduceImageResolution );
    String aStrRes( String::CreateFromInt32( maConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "MaxImageResolution" ) ), 300 ) ) );
    aStrRes.Append( String( RTL_CONSTASCII_USTRINGPARAM( " DPI" ) ) );
    maCoReduceImageResolution.SetText( aStrRes );
    maCoReduceImageResolution.Enable( bReduceImageResolution );

    maCbTaggedPDF.Check( maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "UseTaggedPDF" ) ), sal_False ) );

    if ( mbIsPresentation )
        maCbExportNotes.Check( maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "ExportNotesPages"  ) ), sal_False ) );
    else
        maCbExportNotes.Check( maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "ExportNotes"  ) ), sal_True ) );

    maCbTransitionEffects.Check( maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "UseTransitionEffects"  ) ), sal_True ) );

    sal_Int32 nFormsType = maConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "FormsType" ) ), 0 );
    if ( ( nFormsType < 0 ) || ( nFormsType > 3 ) )
        nFormsType = 0;
    maLbFormsFormat.SelectEntryPos( (sal_uInt16)nFormsType );
}

// -----------------------------------------------------------------------------

ImpPDFDialog::~ImpPDFDialog()
{
}

// -----------------------------------------------------------------------------

Sequence< PropertyValue > ImpPDFDialog::GetFilterData()
{
    // updating the FilterData sequence and storing FilterData to configuration
    maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseLosslessCompression" ) ), maRbLosslessCompression.IsChecked() );
    maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ), maNfQuality.GetValue() );
    maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ReduceImageResolution" ) ), maCbReduceImageResolution.IsChecked() );
    maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxImageResolution" ) ), maCoReduceImageResolution.GetText().ToInt32() );
    maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseTaggedPDF" ) ), maCbTaggedPDF.IsChecked() );
    if ( mbIsPresentation )
        maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotesPages" ) ), maCbExportNotes.IsChecked() );
    else
        maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotes" ) ), maCbExportNotes.IsChecked() );
    maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseTransitionEffects" ) ), maCbTransitionEffects.IsChecked() );
    maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "FormsType" ) ), maLbFormsFormat.GetSelectEntryPos() );

    Sequence< PropertyValue > aRet( maConfigItem.GetFilterData() );

    aRet.realloc( aRet.getLength() + 1 );

    if( maRbRange.IsChecked() )
    {
        aRet[ aRet.getLength() - 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) );
        aRet[ aRet.getLength() - 1 ].Value <<= OUString( maEdPages.GetText() );
    }
    else if( maRbSelection.IsChecked() )
    {
        aRet[ aRet.getLength() - 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Selection" ) );
        aRet[ aRet.getLength() - 1 ].Value <<= maSelection;
    }
    return aRet;
}

// -----------------------------------------------------------------------------

IMPL_LINK( ImpPDFDialog, TogglePagesHdl, void*, p )
{
    maEdPages.Enable( maRbRange.IsChecked() );
    maEdPages.SetReadOnly( !maRbRange.IsChecked() );

    return 0;
}

// -----------------------------------------------------------------------------

IMPL_LINK( ImpPDFDialog, ToggleCompressionHdl, void*, p )
{
    maNfQuality.Enable( maRbJPEGCompression.IsChecked() );
    return 0;
}

// -----------------------------------------------------------------------------

IMPL_LINK( ImpPDFDialog, ToggleReduceImageResolutionHdl, void*, p )
{
    maCoReduceImageResolution.Enable( maCbReduceImageResolution.IsChecked() );
    return 0;
}
<commit_msg>INTEGRATION: CWS sj12 (1.9.24); FILE MERGED 2004/11/16 17:35:09 sj 1.9.24.2: RESYNC: (1.9-1.10); FILE MERGED 2004/10/13 10:52:13 sj 1.9.24.1: #i34951# not using separate text for checkboxes<commit_after> /*************************************************************************
 *
 *  $RCSfile: impdialog.cxx,v $
 *
 *  $Revision: 1.11 $
 *
 *  last change: $Author: rt $ $Date: 2004-11-26 14:04:53 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 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
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/

#include "impdialog.hxx"
#include "impdialog.hrc"

#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_
#include <com/sun/star/uno/Sequence.h>
#endif
#ifndef _COM_SUN_STAR_TEXT_XTEXTRANGE_HPP_
#include <com/sun/star/text/XTextRange.hpp>
#endif
#ifndef _COM_SUN_STAR_DRAWING_XSHAPES_HPP_
#include <com/sun/star/drawing/XShapes.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_
#include <com/sun/star/container/XIndexAccess.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_XCONTROLLER_HPP_
#include <com/sun/star/frame/XController.hpp>
#endif
#ifndef _COM_SUN_STAR_VIEW_XSELECTIONSUPPLIER_HPP_
#include <com/sun/star/view/XSelectionSupplier.hpp>
#endif

// ----------------
// - ImpPDFDialog -
// ----------------

using namespace ::com::sun::star;

ImpPDFDialog::ImpPDFDialog( Window* pParent, ResMgr& rResMgr, Sequence< PropertyValue >& rFilterData, const Reference< XComponent >& rxDoc ) :
    ModalDialog( pParent, ResId( RID_PDF_EXPORT_DLG, &rResMgr ) ),
    maBtnOK( this, ResId( BT_OK ) ),
    maBtnCancel( this, ResId( BT_CANCEL ) ),
    maBtnHelp( this, ResId( BT_HELP ) ),
    maFlPages( this, ResId( FL_PAGES ) ),
    maRbAll( this, ResId( RB_ALL ) ),
    maRbRange( this, ResId( RB_RANGE ) ),
    maRbSelection( this, ResId( RB_SELECTION ) ),
    maEdPages( this, ResId( ED_PAGES ) ),
    maFlCompression( this, ResId( FL_IMAGES ) ),
    maRbLosslessCompression( this, ResId( RB_LOSSLESSCOMPRESSION ) ),
    maRbJPEGCompression( this, ResId( RB_JPEGCOMPRESSION ) ),
    maFtQuality( this, ResId( FT_QUALITY ) ),
    maNfQuality( this, ResId( NF_QUALITY ) ),
    maCbReduceImageResolution( this, ResId( CB_REDUCEIMAGERESOLUTION ) ),
    maCoReduceImageResolution( this, ResId( CO_REDUCEIMAGERESOLUTION ) ),
    maFlGeneral( this, ResId( FL_GENERAL ) ),
    maCbTaggedPDF( this, ResId( CB_TAGGEDPDF ) ),
    maCbExportNotes( this, ResId( CB_EXPORTNOTES ) ),
    maCbTransitionEffects( this, ResId( CB_TRANSITIONEFFECTS ) ),
    maFtFormsFormat( this, ResId( FT_FORMSFORMAT ) ),
    maLbFormsFormat( this, ResId( LB_FORMSFORMAT ) ),
    maConfigItem( String( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/PDF/Export/" ) ), &rFilterData ),
    mbIsPresentation( sal_False )
{
    FreeResource();
    maRbRange.SetToggleHdl( LINK( this, ImpPDFDialog, TogglePagesHdl ) );

    maRbAll.Check();
    TogglePagesHdl( NULL );

    maNfQuality.SetUnit( FUNIT_PERCENT );
    maNfQuality.SetMin( 1, FUNIT_PERCENT );
    maNfQuality.SetMax( 100, FUNIT_PERCENT );

    // check for selection
    try
    {
        Reference< frame::XController > xController( Reference< frame::XModel >( rxDoc, UNO_QUERY )->getCurrentController() );
        if( xController.is() )
        {
            Reference< view::XSelectionSupplier > xView( xController, UNO_QUERY );
            if( xView.is() )
                xView->getSelection() >>= maSelection;
        }
    }
    catch( RuntimeException )
    {
    }
    sal_Bool bHasSelection = maSelection.hasValue();
    if ( bHasSelection )
    {
        Reference< drawing::XShapes > xShapes;
        if ( ( maSelection >>= xShapes ) == sal_False ) // XShapes is always a selection
        {
            // even if nothing is selected in writer the selection is not empty
            Reference< container::XIndexAccess > xIndexAccess;
            if ( maSelection >>= xIndexAccess )
            {
                sal_Int32 nLen = xIndexAccess->getCount();
                if ( !nLen )
                    bHasSelection = sal_False;
                else if ( nLen == 1 )
                {
                    Reference< text::XTextRange > xTextRange( xIndexAccess->getByIndex( 0 ), UNO_QUERY );
                    if ( xTextRange.is() && ( xTextRange->getString().getLength() == 0 ) )
                        bHasSelection = sal_False;
                }
            }
        }
    }
    maRbSelection.Enable( bHasSelection );

    // check if source document is a presentation
    try
    {
        Reference< XServiceInfo > xInfo( rxDoc, UNO_QUERY );
        if ( xInfo.is() )
        {
            if ( xInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) ) )
                mbIsPresentation = sal_True;
        }
    }
    catch( RuntimeException )
    {
    }
    maCbTransitionEffects.Enable( mbIsPresentation );

//  SJ: Dont know if there are Notes available also for writer.
//  maCbExportNotes.Enable( bIsPresentation );

    maRbLosslessCompression.SetToggleHdl( LINK( this, ImpPDFDialog, ToggleCompressionHdl ) );
    const sal_Bool  bUseLosslessCompression = maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "UseLosslessCompression" ) ), sal_False );
    if ( bUseLosslessCompression )
        maRbLosslessCompression.Check();
    else
        maRbJPEGCompression.Check();
    maNfQuality.SetValue( maConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ), 90 ), FUNIT_PERCENT );
    maNfQuality.Enable( bUseLosslessCompression == sal_False );

    maCbReduceImageResolution.SetToggleHdl( LINK( this, ImpPDFDialog, ToggleReduceImageResolutionHdl ) );
    const sal_Bool  bReduceImageResolution = maConfigItem.ReadBool(  String( RTL_CONSTASCII_USTRINGPARAM( "ReduceImageResolution" ) ), sal_False );
    maCbReduceImageResolution.Check( bReduceImageResolution );
    String aStrRes( String::CreateFromInt32( maConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "MaxImageResolution" ) ), 300 ) ) );
    aStrRes.Append( String( RTL_CONSTASCII_USTRINGPARAM( " DPI" ) ) );
    maCoReduceImageResolution.SetText( aStrRes );
    maCoReduceImageResolution.Enable( bReduceImageResolution );

    maCbTaggedPDF.Check( maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "UseTaggedPDF" ) ), sal_False ) );

    if ( mbIsPresentation )
        maCbExportNotes.Check( maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "ExportNotesPages"  ) ), sal_False ) );
    else
        maCbExportNotes.Check( maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "ExportNotes"  ) ), sal_True ) );

    maCbTransitionEffects.Check( maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "UseTransitionEffects"  ) ), sal_True ) );

    sal_Int32 nFormsType = maConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "FormsType" ) ), 0 );
    if ( ( nFormsType < 0 ) || ( nFormsType > 3 ) )
        nFormsType = 0;
    maLbFormsFormat.SelectEntryPos( (sal_uInt16)nFormsType );
}

// -----------------------------------------------------------------------------

ImpPDFDialog::~ImpPDFDialog()
{
}

// -----------------------------------------------------------------------------

Sequence< PropertyValue > ImpPDFDialog::GetFilterData()
{
    // updating the FilterData sequence and storing FilterData to configuration
    maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseLosslessCompression" ) ), maRbLosslessCompression.IsChecked() );
    maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ), maNfQuality.GetValue() );
    maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ReduceImageResolution" ) ), maCbReduceImageResolution.IsChecked() );
    maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxImageResolution" ) ), maCoReduceImageResolution.GetText().ToInt32() );
    maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseTaggedPDF" ) ), maCbTaggedPDF.IsChecked() );
    if ( mbIsPresentation )
        maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotesPages" ) ), maCbExportNotes.IsChecked() );
    else
        maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotes" ) ), maCbExportNotes.IsChecked() );
    maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseTransitionEffects" ) ), maCbTransitionEffects.IsChecked() );
    maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "FormsType" ) ), maLbFormsFormat.GetSelectEntryPos() );

    Sequence< PropertyValue > aRet( maConfigItem.GetFilterData() );

    aRet.realloc( aRet.getLength() + 1 );

    if( maRbRange.IsChecked() )
    {
        aRet[ aRet.getLength() - 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) );
        aRet[ aRet.getLength() - 1 ].Value <<= OUString( maEdPages.GetText() );
    }
    else if( maRbSelection.IsChecked() )
    {
        aRet[ aRet.getLength() - 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Selection" ) );
        aRet[ aRet.getLength() - 1 ].Value <<= maSelection;
    }
    return aRet;
}

// -----------------------------------------------------------------------------

IMPL_LINK( ImpPDFDialog, TogglePagesHdl, void*, p )
{
    maEdPages.Enable( maRbRange.IsChecked() );
    maEdPages.SetReadOnly( !maRbRange.IsChecked() );

    return 0;
}

// -----------------------------------------------------------------------------

IMPL_LINK( ImpPDFDialog, ToggleCompressionHdl, void*, p )
{
    maNfQuality.Enable( maRbJPEGCompression.IsChecked() );
    return 0;
}

// -----------------------------------------------------------------------------

IMPL_LINK( ImpPDFDialog, ToggleReduceImageResolutionHdl, void*, p )
{
    maCoReduceImageResolution.Enable( maCbReduceImageResolution.IsChecked() );
    return 0;
}
<|endoftext|>


<commit_before> /*************************************************************************
 *
 *  $RCSfile: svgimport.cxx,v $
 *
 *  $Revision: 1.3 $
 *
 *  last change: $Author: ka $ $Date: 2003-12-15 13:57:22 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 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
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/

#include "svgfilter.hxx"

// -------------
// - SVGFilter -
// -------------

sal_Bool SVGFilter::implImport( const Sequence< PropertyValue >& rDescriptor )
    throw (RuntimeException)
{
    Reference< XMultiServiceFactory >   xServiceFactory( ::comphelper::getProcessServiceFactory() ) ;
    OUString                            aTmpFileName;
    String                              aFileName;
    sal_Int32                           nLength = rDescriptor.getLength();
    const PropertyValue*                pValue = rDescriptor.getConstArray();
    sal_Bool                            bRet = sal_False;

    for( sal_Int32 i = 0 ; ( i < nLength ) && !aTmpFileName.getLength(); i++)
        if( pValue[ i ].Name.equalsAscii( "FileName" ) )
            pValue[ i ].Value >>= aTmpFileName;

    if( aTmpFileName.getLength() && xServiceFactory.is() )
    {
        JavaVM*                 pJVM = NULL;
        Reference< XJavaVM >    xJavaVM( xServiceFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.java.JavaVirtualMachine") ) ), UNO_QUERY );
        Sequence< sal_Int8 >    aProcessID( 16 );
        String                  aLocalFile;

        if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( aTmpFileName, aLocalFile ) && aLocalFile.Len() )
        {
            rtl_getGlobalProcessId( (sal_uInt8 *) aProcessID.getArray() );
              Any aVMPtr( xJavaVM->getJavaVM( aProcessID ) );

            if( sizeof( pJVM) == sizeof( sal_Int32 ) )
            {
                sal_Int32 nP = 0;

                aVMPtr >>= nP;
                pJVM = reinterpret_cast< JavaVM* >( nP );
            }
            else if( sizeof( pJVM ) == sizeof( sal_Int64 ) )
            {
                sal_Int64 nP = 0;

                aVMPtr >>= nP;
                pJVM = reinterpret_cast< JavaVM* >( nP );
            }

            if( pJVM )
            {
                jobjectArray    aArgs;
                jclass          aClass;
                jmethodID       aMId;
                jstring         aJStr;

                Reference< XJavaThreadRegister_11 > xJavaThreadRegister_11( xJavaVM, UNO_QUERY );
                  sj2::TKTThreadAttach                aJEnv( pJVM, xJavaThreadRegister_11.get() );

                aClass = aJEnv.pEnv->FindClass( "SOTranscoder" );

                if( aClass && ( aMId = aJEnv.pEnv->GetStaticMethodID( aClass, "main", "([Ljava/lang/String;)V" ) ) )
                {
                    ::utl::TempFile aTempFile;
                    String          aOutputURL( aTempFile.GetURL() );
                    String          aOutputFile;

                    aTempFile.EnableKillingFile();

                    if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( aOutputURL, aOutputFile ) && aOutputFile.Len() )
                    {
                        aJStr = aJEnv.pEnv->NewStringUTF( ByteString( aLocalFile.GetBuffer(), RTL_TEXTENCODING_UTF8 ).GetBuffer() );
                        aArgs = aJEnv.pEnv->NewObjectArray( 2, aJEnv.pEnv->FindClass( "java/lang/String" ), aJStr );
                        aJStr = aJEnv.pEnv->NewStringUTF( ByteString( aOutputFile.GetBuffer(), RTL_TEXTENCODING_UTF8 ).GetBuffer() );
                        aJEnv.pEnv->SetObjectArrayElement( aArgs, 1, aJStr );
                        aJEnv.pEnv->CallStaticVoidMethod( aClass, aMId, aArgs );

                        Graphic     aGraphic;
                        SvStream*   pIStm = ::utl::UcbStreamHelper::CreateStream( aOutputURL, STREAM_READ );

                        if( pIStm )
                        {
                            GraphicConverter::Import( *pIStm, aGraphic );
                            delete pIStm;
                        }

                        Reference< XDrawPagesSupplier > xDrawPagesSupplier( mxDstDoc, UNO_QUERY );

                        if( xDrawPagesSupplier.is() && ( aGraphic.GetType() != GRAPHIC_NONE ) )
                        {
                            Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages() );

                            if( xDrawPages.is() && xDrawPages->getCount() )
                            {
                                Reference< XDrawPage >  xDrawPage;

                                if( xDrawPages->getByIndex( 0 ) >>= xDrawPage )
                                {
                                    Reference< XShapes >        xShapes( xDrawPage, UNO_QUERY );
                                    Reference< XPropertySet>    xPagePropSet( xDrawPage, UNO_QUERY );
                                    Reference< XShape >         xShape( Reference< XMultiServiceFactory >( mxDstDoc, UNO_QUERY )->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.GraphicObjectShape" ) ) ), UNO_QUERY );

                                    if( xPagePropSet.is() && xShapes.is() && xShape.is() )
                                    {
                                        Reference< XPropertySet >   xPropSet( xShape, UNO_QUERY );
                                        sal_Int32                   nPageWidth = 0, nPageHeight = 0;

                                        xPagePropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) >>= nPageWidth;
                                        xPagePropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) >>= nPageHeight;

                                        if( xPropSet.is() && nPageWidth && nPageHeight )
                                        {
                                            xShapes->add( xShape );

                                            ::com::sun::star::awt::Point    aPos;
                                            ::com::sun::star::awt::Size     aSize;
                                            GraphicObject                   aGraphObj( aGraphic );
                                            String                          aGraphURL( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) );
                                            Any                             aValue;
                                            Size                            aGraphicSize;
                                            const MapMode                   aTargetMapMode( MAP_100TH_MM );

                                            if( aGraphObj.GetPrefMapMode().GetMapUnit() == MAP_PIXEL )
                                                aGraphicSize = Application::GetDefaultDevice()->PixelToLogic( aGraphObj.GetPrefSize(), aTargetMapMode );
                                            else
                                                aGraphicSize = OutputDevice::LogicToLogic( aGraphObj.GetPrefSize(), aGraphObj.GetPrefMapMode(), aTargetMapMode );

                                            aGraphURL += String( aGraphObj.GetUniqueID(), RTL_TEXTENCODING_ASCII_US );
                                            aValue <<= OUString( aGraphURL );
                                            xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "GraphicURL" ) ), aValue );

                                            aPos.X = ( nPageWidth - aGraphicSize.Width() ) >> 1;
                                            aPos.Y = ( nPageHeight - aGraphicSize.Height() ) >> 1;

                                            aSize.Width = aGraphicSize.Width();
                                            aSize.Height = aGraphicSize.Height();

                                            xShape->setPosition( aPos );
                                            xShape->setSize( aSize );

                                            bRet = sal_True;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    return bRet;
}
<commit_msg>INTEGRATION: CWS jl3 (1.2.24); FILE MERGED 2004/02/17 12:14:55 jl 1.2.24.4: #111907# 2004/02/11 08:58:57 jl 1.2.24.3: #111907# 2004/02/09 14:22:37 jl 1.2.24.2: RESYNC: (1.2-1.3); FILE MERGED 2003/11/21 08:56:18 jl 1.2.24.1: #111907# replace TKTThreadAttach by jvmaccess::VirtualMachine<commit_after> /*************************************************************************
 *
 *  $RCSfile: svgimport.cxx,v $
 *
 *  $Revision: 1.4 $
 *
 *  last change: $Author: kz $ $Date: 2004-03-25 15:00:09 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 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
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/

#include "svgfilter.hxx"
#include "rtl/ref.hxx"
#include "jvmaccess/virtualmachine.hxx"
// -------------
// - SVGFilter -
// -------------

sal_Bool SVGFilter::implImport( const Sequence< PropertyValue >& rDescriptor )
    throw (RuntimeException)
{
    Reference< XMultiServiceFactory >   xServiceFactory( ::comphelper::getProcessServiceFactory() ) ;
    rtl::OUString                           aTmpFileName;
    String                              aFileName;
    sal_Int32                           nLength = rDescriptor.getLength();
    const PropertyValue*                pValue = rDescriptor.getConstArray();
    sal_Bool                            bRet = sal_False;

    for( sal_Int32 i = 0 ; ( i < nLength ) && !aTmpFileName.getLength(); i++)
        if( pValue[ i ].Name.equalsAscii( "FileName" ) )
            pValue[ i ].Value >>= aTmpFileName;

    if( aTmpFileName.getLength() && xServiceFactory.is() )
    {

        Reference< XJavaVM >    xJavaVM( xServiceFactory->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.java.JavaVirtualMachine") ) ), UNO_QUERY );
        Sequence< sal_Int8 >    aProcessID( 17 );
        String                  aLocalFile;

        if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( aTmpFileName, aLocalFile ) && aLocalFile.Len() )
        {
            rtl_getGlobalProcessId( (sal_uInt8 *) aProcessID.getArray() );
            aProcessID[16] = 0;

            OSL_ENSURE(sizeof (sal_Int64)
                       >= sizeof (jvmaccess::VirtualMachine *),
                       "Pointer cannot be represented as sal_Int64");
            sal_Int64 nPointer = reinterpret_cast< sal_Int64 >(
                static_cast< jvmaccess::VirtualMachine * >(0));
            xJavaVM->getJavaVM(aProcessID) >>= nPointer;
            rtl::Reference<jvmaccess::VirtualMachine> _virtualMachine =
                reinterpret_cast< jvmaccess::VirtualMachine * >(nPointer);
            if (!_virtualMachine.is())
                return bRet;

            jobjectArray    aArgs;
            jclass          aClass;
            jmethodID       aMId;
            jstring         aJStr;

            try
            {
                jvmaccess::VirtualMachine::AttachGuard vmGuard(_virtualMachine);

                JNIEnv * pEnv = vmGuard.getEnvironment();

                aClass = pEnv->FindClass( "SOTranscoder" );

                if( aClass && ( aMId = pEnv->GetStaticMethodID( aClass, "main", "([Ljava/lang/String;)V" ) ) )
                {
                    ::utl::TempFile aTempFile;
                    String          aOutputURL( aTempFile.GetURL() );
                    String          aOutputFile;

                    aTempFile.EnableKillingFile();

                    if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( aOutputURL, aOutputFile ) && aOutputFile.Len() )
                    {
                        aJStr = pEnv->NewStringUTF( ByteString( aLocalFile.GetBuffer(), RTL_TEXTENCODING_UTF8 ).GetBuffer() );
                        aArgs = pEnv->NewObjectArray( 2, pEnv->FindClass( "java/lang/String" ), aJStr );
                        aJStr = pEnv->NewStringUTF( ByteString( aOutputFile.GetBuffer(), RTL_TEXTENCODING_UTF8 ).GetBuffer() );
                        pEnv->SetObjectArrayElement( aArgs, 1, aJStr );
                        pEnv->CallStaticVoidMethod( aClass, aMId, aArgs );

                        Graphic     aGraphic;
                        SvStream*   pIStm = ::utl::UcbStreamHelper::CreateStream( aOutputURL, STREAM_READ );

                        if( pIStm )
                        {
                            GraphicConverter::Import( *pIStm, aGraphic );
                            delete pIStm;
                        }

                        Reference< XDrawPagesSupplier > xDrawPagesSupplier( mxDstDoc, UNO_QUERY );

                        if( xDrawPagesSupplier.is() && ( aGraphic.GetType() != GRAPHIC_NONE ) )
                        {
                            Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages() );

                            if( xDrawPages.is() && xDrawPages->getCount() )
                            {
                                Reference< XDrawPage >  xDrawPage;

                                if( xDrawPages->getByIndex( 0 ) >>= xDrawPage )
                                {
                                    Reference< XShapes >        xShapes( xDrawPage, UNO_QUERY );
                                    Reference< XPropertySet>    xPagePropSet( xDrawPage, UNO_QUERY );
                                    Reference< XShape >         xShape( Reference< XMultiServiceFactory >( mxDstDoc, UNO_QUERY )->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.GraphicObjectShape" ) ) ), UNO_QUERY );

                                    if( xPagePropSet.is() && xShapes.is() && xShape.is() )
                                    {
                                        Reference< XPropertySet >   xPropSet( xShape, UNO_QUERY );
                                        sal_Int32                   nPageWidth = 0, nPageHeight = 0;

                                        xPagePropSet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) >>= nPageWidth;
                                        xPagePropSet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) >>= nPageHeight;

                                        if( xPropSet.is() && nPageWidth && nPageHeight )
                                        {
                                            xShapes->add( xShape );

                                            ::com::sun::star::awt::Point    aPos;
                                            ::com::sun::star::awt::Size     aSize;
                                            GraphicObject                   aGraphObj( aGraphic );
                                            String                          aGraphURL( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) );
                                            Any                             aValue;
                                            Size                            aGraphicSize;
                                            const MapMode                   aTargetMapMode( MAP_100TH_MM );

                                            if( aGraphObj.GetPrefMapMode().GetMapUnit() == MAP_PIXEL )
                                                aGraphicSize = Application::GetDefaultDevice()->PixelToLogic( aGraphObj.GetPrefSize(), aTargetMapMode );
                                            else
                                                aGraphicSize = OutputDevice::LogicToLogic( aGraphObj.GetPrefSize(), aGraphObj.GetPrefMapMode(), aTargetMapMode );

                                            aGraphURL += String( aGraphObj.GetUniqueID(), RTL_TEXTENCODING_ASCII_US );
                                            aValue <<= rtl::OUString( aGraphURL );
                                            xPropSet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GraphicURL" ) ), aValue );

                                            aPos.X = ( nPageWidth - aGraphicSize.Width() ) >> 1;
                                            aPos.Y = ( nPageHeight - aGraphicSize.Height() ) >> 1;

                                            aSize.Width = aGraphicSize.Width();
                                            aSize.Height = aGraphicSize.Height();

                                            xShape->setPosition( aPos );
                                            xShape->setSize( aSize );

                                            bRet = sal_True;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &)
            {
            }
        }
    }
    return bRet;
}

<|endoftext|>


<commit_before>/**
 * This file is part of the "FnordMetric" project
 *   Copyright (c) 2014 Paul Asmuth, Google Inc.
 *
 * FnordMetric is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License v3.0. You should have received a
 * copy of the GNU General Public License along with this program. If not, see
 * <http://www.gnu.org/licenses/>.
 */
#include <fnordmetric/environment.h>
#include <fnordmetric/adminui.h>
#include <fnord/base/uri.h>

namespace fnordmetric {

std::unique_ptr<http::HTTPHandler> AdminUI::getHandler() {
  return std::unique_ptr<http::HTTPHandler>(new AdminUI());
}

AdminUI::AdminUI() :
    webui_bundle_("FnordMetric"),
    webui_mount_(&webui_bundle_, "/admin") {
  webui_bundle_.addComponent("fnord/3rdparty/codemirror.js");

  webui_bundle_.addComponent("fnord/3rdparty/fontawesome.woff");
  webui_bundle_.addComponent("fnord/3rdparty/fontawesome.css");
  webui_bundle_.addComponent("fnord/3rdparty/reset.css");

  webui_bundle_.addComponent("fnord/fnord.js");
  webui_bundle_.addComponent("fnord/themes/midnight-blue.css");
  webui_bundle_.addComponent("fnord/components/fn-appbar.html");
  webui_bundle_.addComponent("fnord/components/fn-button.html");
  webui_bundle_.addComponent("fnord/components/fn-icon.html");
  webui_bundle_.addComponent("fnord/components/fn-loader.html");
  webui_bundle_.addComponent("fnord/components/fn-menu.html");
  webui_bundle_.addComponent("fnord/components/fn-search.html");
  webui_bundle_.addComponent("fnord/components/fn-table.html");
  webui_bundle_.addComponent("fnord/components/fn-table.css");
  webui_bundle_.addComponent("fnord/components/fn-splitpane.html");
  webui_bundle_.addComponent("fnord/components/fn-codeeditor.html");
  webui_bundle_.addComponent("fnord/components/fn-dropdown.html");
  webui_bundle_.addComponent("fnord/components/fn-datepicker.html");
  webui_bundle_.addComponent("fnord/components/fn-timeinput.html");
  webui_bundle_.addComponent("fnord/components/fn-daterangepicker.html");
  webui_bundle_.addComponent("fnord/components/fn-popup.html");
  webui_bundle_.addComponent("fnord/components/fn-tabbar.html");
  webui_bundle_.addComponent("fnordmetric/fnordmetric-app.html");
  webui_bundle_.addComponent("fnordmetric/fnordmetric-console.html");
  webui_bundle_.addComponent("fnordmetric/fnordmetric-metric-list.html");
  webui_bundle_.addComponent("fnordmetric/fnordmetric-search.html");
  webui_bundle_.addComponent("fnordmetric/fnordmetric-query-editor.html");
  webui_bundle_.addComponent("fnordmetric/fnordmetric-metric-preview.html");
  webui_bundle_.addComponent("fnordmetric/fnordmetric-controls.html");
  webui_bundle_.addComponent("fnordmetric/fnordmetric-webui.html");
  webui_bundle_.addComponent("fnordmetric/fnordmetric-webui.css");
  webui_bundle_.addComponent("fnordmetric/fnordmetric-webui-util.js");
  webui_bundle_.addComponent(
      "fnordmetric-plugins/hosts/fnordmetric-plugin-hosts.html");
}

bool AdminUI::handleHTTPRequest(
    http::HTTPRequest* request,
    http::HTTPResponse* response) {

  if (env()->verbose()) {
    fnord::util::LogEntry log_entry;
    log_entry.append("__severity__", "DEBUG");
    log_entry.printf(
        "__message__",
        "HTTP request: %s %s",
        request->getMethod().c_str(),
        request->getUrl().c_str());

    env()->logger()->log(log_entry);
  }

  if (webui_mount_.handleHTTPRequest(request, response)) {
    return true;
  }

  fnord::URI uri(request->getUrl());
  auto path = uri.path();

  if (path == "/") {
    response->setStatus(http::kStatusFound);
    response->addHeader("Content-Type", "text/html; charset=utf-8");
    response->addHeader("Location", "/admin");
    return true;
  }

  return false;
}

}
<commit_msg>midnight blue fn-table<commit_after>/**
 * This file is part of the "FnordMetric" project
 *   Copyright (c) 2014 Paul Asmuth, Google Inc.
 *
 * FnordMetric is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License v3.0. You should have received a
 * copy of the GNU General Public License along with this program. If not, see
 * <http://www.gnu.org/licenses/>.
 */
#include <fnordmetric/environment.h>
#include <fnordmetric/adminui.h>
#include <fnord/base/uri.h>

namespace fnordmetric {

std::unique_ptr<http::HTTPHandler> AdminUI::getHandler() {
  return std::unique_ptr<http::HTTPHandler>(new AdminUI());
}

AdminUI::AdminUI() :
    webui_bundle_("FnordMetric"),
    webui_mount_(&webui_bundle_, "/admin") {
  webui_bundle_.addComponent("fnord/3rdparty/codemirror.js");

  webui_bundle_.addComponent("fnord/3rdparty/fontawesome.woff");
  webui_bundle_.addComponent("fnord/3rdparty/fontawesome.css");
  webui_bundle_.addComponent("fnord/3rdparty/reset.css");
  webui_bundle_.addComponent("fnord/components/fn-table.css");
  webui_bundle_.addComponent("fnord/themes/midnight-blue.css");

  webui_bundle_.addComponent("fnord/fnord.js");
  webui_bundle_.addComponent("fnord/components/fn-appbar.html");
  webui_bundle_.addComponent("fnord/components/fn-button.html");
  webui_bundle_.addComponent("fnord/components/fn-icon.html");
  webui_bundle_.addComponent("fnord/components/fn-loader.html");
  webui_bundle_.addComponent("fnord/components/fn-menu.html");
  webui_bundle_.addComponent("fnord/components/fn-search.html");
  webui_bundle_.addComponent("fnord/components/fn-table.html");
  webui_bundle_.addComponent("fnord/components/fn-splitpane.html");
  webui_bundle_.addComponent("fnord/components/fn-codeeditor.html");
  webui_bundle_.addComponent("fnord/components/fn-dropdown.html");
  webui_bundle_.addComponent("fnord/components/fn-datepicker.html");
  webui_bundle_.addComponent("fnord/components/fn-timeinput.html");
  webui_bundle_.addComponent("fnord/components/fn-daterangepicker.html");
  webui_bundle_.addComponent("fnord/components/fn-popup.html");
  webui_bundle_.addComponent("fnord/components/fn-tabbar.html");
  webui_bundle_.addComponent("fnordmetric/fnordmetric-app.html");
  webui_bundle_.addComponent("fnordmetric/fnordmetric-console.html");
  webui_bundle_.addComponent("fnordmetric/fnordmetric-metric-list.html");
  webui_bundle_.addComponent("fnordmetric/fnordmetric-search.html");
  webui_bundle_.addComponent("fnordmetric/fnordmetric-query-editor.html");
  webui_bundle_.addComponent("fnordmetric/fnordmetric-metric-preview.html");
  webui_bundle_.addComponent("fnordmetric/fnordmetric-controls.html");
  webui_bundle_.addComponent("fnordmetric/fnordmetric-webui.html");
  webui_bundle_.addComponent("fnordmetric/fnordmetric-webui.css");
  webui_bundle_.addComponent("fnordmetric/fnordmetric-webui-util.js");
  webui_bundle_.addComponent(
      "fnordmetric-plugins/hosts/fnordmetric-plugin-hosts.html");

}

bool AdminUI::handleHTTPRequest(
    http::HTTPRequest* request,
    http::HTTPResponse* response) {

  if (env()->verbose()) {
    fnord::util::LogEntry log_entry;
    log_entry.append("__severity__", "DEBUG");
    log_entry.printf(
        "__message__",
        "HTTP request: %s %s",
        request->getMethod().c_str(),
        request->getUrl().c_str());

    env()->logger()->log(log_entry);
  }

  if (webui_mount_.handleHTTPRequest(request, response)) {
    return true;
  }

  fnord::URI uri(request->getUrl());
  auto path = uri.path();

  if (path == "/") {
    response->setStatus(http::kStatusFound);
    response->addHeader("Content-Type", "text/html; charset=utf-8");
    response->addHeader("Location", "/admin");
    return true;
  }

  return false;
}

}
<|endoftext|>


<commit_before>//
// File:          edu_csdms_models_stm_DredgeSlotBW_Impl.hxx
// Symbol:        edu.csdms.models.stm.DredgeSlotBW-v0.0
// Symbol Type:   class
// Babel Version: 1.4.0 (Revision: 6607 release-1-4-0-branch)
// Description:   Server-side implementation for edu.csdms.models.stm.DredgeSlotBW
//
// WARNING: Automatically generated; only changes within splicers preserved
//
//

#ifndef included_edu_csdms_models_stm_DredgeSlotBW_Impl_hxx
#define included_edu_csdms_models_stm_DredgeSlotBW_Impl_hxx

#ifndef included_sidl_cxx_hxx
#include "sidl_cxx.hxx"
#endif
#ifndef included_edu_csdms_models_stm_DredgeSlotBW_IOR_h
#include "edu_csdms_models_stm_DredgeSlotBW_IOR.h"
#endif
#ifndef included_edu_csdms_models_stm_DredgeSlotBW_hxx
#include "edu_csdms_models_stm_DredgeSlotBW.hxx"
#endif
#ifndef included_edu_csdms_openmi_IElementSet_hxx
#include "edu_csdms_openmi_IElementSet.hxx"
#endif
#ifndef included_edu_csdms_openmi_IScalarSet_hxx
#include "edu_csdms_openmi_IScalarSet.hxx"
#endif
#ifndef included_edu_csdms_openmi_IValueSet_hxx
#include "edu_csdms_openmi_IValueSet.hxx"
#endif
#ifndef included_edu_csdms_openmi_ScalarSet_hxx
#include "edu_csdms_openmi_ScalarSet.hxx"
#endif
#ifndef included_edu_csdms_openmi_ValueSet_hxx
#include "edu_csdms_openmi_ValueSet.hxx"
#endif
#ifndef included_edu_csdms_ports_IRFPort_hxx
#include "edu_csdms_ports_IRFPort.hxx"
#endif
#ifndef included_edu_csdms_tools_ConfigDialog_hxx
#include "edu_csdms_tools_ConfigDialog.hxx"
#endif
#ifndef included_edu_csdms_tools_TemplateFiles_hxx
#include "edu_csdms_tools_TemplateFiles.hxx"
#endif
#ifndef included_gov_cca_CCAException_hxx
#include "gov_cca_CCAException.hxx"
#endif
#ifndef included_gov_cca_Component_hxx
#include "gov_cca_Component.hxx"
#endif
#ifndef included_gov_cca_ComponentRelease_hxx
#include "gov_cca_ComponentRelease.hxx"
#endif
#ifndef included_gov_cca_Services_hxx
#include "gov_cca_Services.hxx"
#endif
#ifndef included_gov_cca_ports_ParameterPortFactory_hxx
#include "gov_cca_ports_ParameterPortFactory.hxx"
#endif
#ifndef included_sidl_BaseClass_hxx
#include "sidl_BaseClass.hxx"
#endif
#ifndef included_sidl_BaseInterface_hxx
#include "sidl_BaseInterface.hxx"
#endif
#ifndef included_sidl_ClassInfo_hxx
#include "sidl_ClassInfo.hxx"
#endif
#ifndef included_sidl_RuntimeException_hxx
#include "sidl_RuntimeException.hxx"
#endif

// DO-NOT-DELETE splicer.begin(edu.csdms.models.stm.DredgeSlotBW._hincludes)
// Insert-Code-Here {edu.csdms.models.stm.DredgeSlotBW._hincludes} (includes or arbitrary code)
#include "Initialize.h"
#include "Run.h"
#include "Finalize.h"
#include "SaveDatatoMatrix.h"

// DO-NOT-DELETE splicer.end(edu.csdms.models.stm.DredgeSlotBW._hincludes)

namespace edu {
  namespace csdms {
    namespace models {
      namespace stm {

        /**
         * Symbol "edu.csdms.models.stm.DredgeSlotBW" (version 0.0)
         */
        class DredgeSlotBW_impl : public virtual
          ::edu::csdms::models::stm::DredgeSlotBW
        // DO-NOT-DELETE splicer.begin(edu.csdms.models.stm.DredgeSlotBW._inherits)
        // Insert-Code-Here {edu.csdms.models.stm.DredgeSlotBW._inherits} (optional inheritance here)
        // DO-NOT-DELETE splicer.end(edu.csdms.models.stm.DredgeSlotBW._inherits)

        {

        // All data marked protected will be accessable by
        // descendant Impl classes
        protected:

          bool _wrapped;

          // DO-NOT-DELETE splicer.begin(edu.csdms.models.stm.DredgeSlotBW._implementation)

  // Insert-UserCode-Here(edu.csdms.models.stm.DredgeSlotBW._implementation)
gov::cca::TypeMap userinput;

    int check, M, prints, iterates, k, m;
    double zeta[52], x[2002], eta[2002], ksi[2002], H[2002], Sf[2002], Hs[2002];
    double qb[2002], qs[2002], Ent[2002];
    double Qww, I, B, D50, D90, R, S, lamdap, L, Hslot, ru, rd;
    double au, dt, qw, dx, Rep, vs, dzeta, Hnorm, Hsnorm, Gbnorm;
    double Gsnorm, ustarr, Hr, qsint, ksid, qbf, qsf, Cnorm, MassIn;
    double MassStored, MassOut, FracDisc, time;

    double (*printmatrix)[2002], (*Hmatrix)[2002], (*ksimatrix)[2002];
    double (*qsmatrix)[2002], (*qbmatrix)[2002], (*Hsmatrix)[2002];

  // Bocca generated code. bocca.protected.begin(edu.csdms.models.stm.DredgeSlotBW._implementation)

   gov::cca::Services    d_services; // our cca handle.

  // Bocca generated code. bocca.protected.end(edu.csdms.models.stm.DredgeSlotBW._implementation)

          // DO-NOT-DELETE splicer.end(edu.csdms.models.stm.DredgeSlotBW._implementation)

        public:
          // default constructor, used for data wrapping(required)
          DredgeSlotBW_impl();
          // sidl constructor (required)
          // Note: alternate Skel constructor doesn't call addref()
          // (fixes bug #275)
            DredgeSlotBW_impl( struct edu_csdms_models_stm_DredgeSlotBW__object
              * ior ) : StubBase(ior,true),
            ::gov::cca::Port((ior==NULL) ? NULL : &((*ior).d_gov_cca_port)),
            ::edu::csdms::ports::IRFPort((ior==NULL) ? NULL : &((
              *ior).d_edu_csdms_ports_irfport)),
            ::gov::cca::Component((ior==NULL) ? NULL : &((
              *ior).d_gov_cca_component)),
          ::gov::cca::ComponentRelease((ior==NULL) ? NULL : &((
            *ior).d_gov_cca_componentrelease)) , _wrapped(false) {_ctor();}

          // user defined construction
          void _ctor();

          // virtual destructor (required)
          virtual ~DredgeSlotBW_impl() { _dtor(); }

          // user defined destruction
          void _dtor();

          // true if this object was created by a user newing the impl
          inline bool _isWrapped() {return _wrapped;}

          // static class initializer
          static void _load();

        public:

          /**
           * user defined non-static method.
           */
          void
          boccaSetServices_impl (
            /* in */::gov::cca::Services& services
          )
          // throws:
          //    ::gov::cca::CCAException
          //    ::sidl::RuntimeException
          ;

          /**
           * user defined non-static method.
           */
          void
          boccaReleaseServices_impl (
            /* in */::gov::cca::Services& services
          )
          // throws:
          //    ::gov::cca::CCAException
          //    ::sidl::RuntimeException
          ;

          /**
           *  This function should never be called, but helps babel generate better code.
           */
          void
          boccaForceUsePortInclude_impl (
            /* in */::gov::cca::ports::ParameterPortFactory& dummy0,
            /* in */::edu::csdms::openmi::ValueSet& dummy1,
            /* in */::edu::csdms::tools::TemplateFiles& dummy2,
            /* in */::edu::csdms::openmi::ScalarSet& dummy3,
            /* in */::edu::csdms::tools::ConfigDialog& dummy4,
            /* in */::edu::csdms::openmi::IScalarSet& dummy5
          )
          ;

          /**
           *  Starts up a component presence in the calling framework.
           * @param services the component instance's handle on the framework world.
           * Contracts concerning services and setServices:
           *
           * The component interaction with the CCA framework
           * and Ports begins on the call to setServices by the framework.
           *
           * This function is called exactly once for each instance created
           * by the framework.
           *
           * The argument services will never be nil/null.
           *
           * Those uses ports which are automatically connected by the framework
           * (so-called service-ports) may be obtained via getPort during
           * setServices.
           */
          void
          setServices_impl (
            /* in */::gov::cca::Services& services
          )
          // throws:
          //    ::gov::cca::CCAException
          //    ::sidl::RuntimeException
          ;

          /**
           * Shuts down a component presence in the calling framework.
           * @param services the component instance's handle on the framework world.
           * Contracts concerning services and setServices:
           *
           * This function is called exactly once for each callback registered
           * through Services.
           *
           * The argument services will never be nil/null.
           * The argument services will always be the same as that received in
           * setServices.
           *
           * During this call the component should release any interfaces
           * acquired by getPort().
           *
           * During this call the component should reset to nil any stored
           * reference to services.
           *
           * After this call, the component instance will be removed from the
           * framework. If the component instance was created by the
           * framework, it will be destroyed, not recycled, The behavior of
           * any port references obtained from this component instance and
           * stored elsewhere becomes undefined.
           *
           * Notes for the component implementor:
           * 1) The component writer may perform blocking activities
           * within releaseServices, such as waiting for remote computations
           * to shutdown.
           * 2) It is good practice during releaseServices for the component
           * writer to remove or unregister all the ports it defined.
           */
          void
          releaseServices_impl (
            /* in */::gov::cca::Services& services
          )
          // throws:
          //    ::gov::cca::CCAException
          //    ::sidl::RuntimeException
          ;

          /**
           * user defined non-static method.
           */
          void
          initialize_impl (
            /* in array<string> */::sidl::array< ::std::string>& properties
          )
          ;

          /**
           * user defined non-static method.
           */
          void
          run_impl (
            /* in */double time
          )
          ;

          /**
           * user defined non-static method.
           */
          void
          finalize_impl() ;
          /**
           * user defined non-static method.
           */
          int64_t
          getRaster_nx_impl() ;
          /**
           * user defined non-static method.
           */
          int64_t
          getRaster_ny_impl() ;
          /**
           * user defined non-static method.
           */
          double
          getRaster_dx_impl() ;
          /**
           * user defined non-static method.
           */
          double
          getRaster_dy_impl() ;
          /**
           * user defined non-static method.
           */
          double
          getRaster_ulx_impl() ;
          /**
           * user defined non-static method.
           */
          double
          getRaster_uly_impl() ;
          /**
           * user defined non-static method.
           */
          ::sidl::array<double>
          getRaster_grid_impl (
            /* in */const ::std::string& val_string
          )
          ;

          /**
           * user defined non-static method.
           */
          ::sidl::array<int32_t>
          get_raster_dimen_impl (
            /* in */const ::std::string& val_string
          )
          ;

          /**
           * user defined non-static method.
           */
          ::sidl::array<double>
          get_raster_res_impl (
            /* in */const ::std::string& val_string
          )
          ;

          /**
           * user defined non-static method.
           */
          ::sidl::basearray
          get_raster_data_impl (
            /* in */const ::std::string& val_string
          )
          ;

          /**
           * user defined non-static method.
           */
          ::sidl::array<double>
          get_time_span_impl() ;
          /**
           * user defined non-static method.
           */
          ::edu::csdms::openmi::IElementSet
          get_element_set_impl (
            /* in */const ::std::string& val_string
          )
          ;

          /**
           * user defined non-static method.
           */
          ::edu::csdms::openmi::IValueSet
          get_value_set_impl (
            /* in */const ::std::string& val_string
          )
          ;

          /**
           * user defined non-static method.
           */
          ::sidl::basearray
          get_value_set_data_impl (
            /* in */const ::std::string& val_string
          )
          ;

          /**
           * user defined non-static method.
           */
          void
          set_value_set_impl (
            /* in */const ::std::string& val_string,
            /* in */::edu::csdms::openmi::IValueSet& values
          )
          ;

        };  // end class DredgeSlotBW_impl

      } // end namespace stm
    } // end namespace models
  } // end namespace csdms
} // end namespace edu

// DO-NOT-DELETE splicer.begin(edu.csdms.models.stm.DredgeSlotBW._hmisc)
// Insert-Code-Here {edu.csdms.models.stm.DredgeSlotBW._hmisc} (miscellaneous things)
// DO-NOT-DELETE splicer.end(edu.csdms.models.stm.DredgeSlotBW._hmisc)

#endif
<commit_msg>all models done with tab dialog<commit_after>//
// File:          edu_csdms_models_stm_DredgeSlotBW_Impl.hxx
// Symbol:        edu.csdms.models.stm.DredgeSlotBW-v0.0
// Symbol Type:   class
// Babel Version: 1.4.0 (Revision: 6607 release-1-4-0-branch)
// Description:   Server-side implementation for edu.csdms.models.stm.DredgeSlotBW
//
// WARNING: Automatically generated; only changes within splicers preserved
//
//

#ifndef included_edu_csdms_models_stm_DredgeSlotBW_Impl_hxx
#define included_edu_csdms_models_stm_DredgeSlotBW_Impl_hxx

#ifndef included_sidl_cxx_hxx
#include "sidl_cxx.hxx"
#endif
#ifndef included_edu_csdms_models_stm_DredgeSlotBW_IOR_h
#include "edu_csdms_models_stm_DredgeSlotBW_IOR.h"
#endif
#ifndef included_edu_csdms_models_stm_DredgeSlotBW_hxx
#include "edu_csdms_models_stm_DredgeSlotBW.hxx"
#endif
#ifndef included_edu_csdms_openmi_IElementSet_hxx
#include "edu_csdms_openmi_IElementSet.hxx"
#endif
#ifndef included_edu_csdms_openmi_IScalarSet_hxx
#include "edu_csdms_openmi_IScalarSet.hxx"
#endif
#ifndef included_edu_csdms_openmi_IValueSet_hxx
#include "edu_csdms_openmi_IValueSet.hxx"
#endif
#ifndef included_edu_csdms_openmi_ScalarSet_hxx
#include "edu_csdms_openmi_ScalarSet.hxx"
#endif
#ifndef included_edu_csdms_openmi_ValueSet_hxx
#include "edu_csdms_openmi_ValueSet.hxx"
#endif
#ifndef included_edu_csdms_ports_IRFPort_hxx
#include "edu_csdms_ports_IRFPort.hxx"
#endif
#ifndef included_edu_csdms_tools_ConfigDialog_hxx
#include "edu_csdms_tools_ConfigDialog.hxx"
#endif
#ifndef included_edu_csdms_tools_TemplateFiles_hxx
#include "edu_csdms_tools_TemplateFiles.hxx"
#endif
#ifndef included_gov_cca_CCAException_hxx
#include "gov_cca_CCAException.hxx"
#endif
#ifndef included_gov_cca_Component_hxx
#include "gov_cca_Component.hxx"
#endif
#ifndef included_gov_cca_ComponentRelease_hxx
#include "gov_cca_ComponentRelease.hxx"
#endif
#ifndef included_gov_cca_Services_hxx
#include "gov_cca_Services.hxx"
#endif
#ifndef included_gov_cca_ports_ParameterPortFactory_hxx
#include "gov_cca_ports_ParameterPortFactory.hxx"
#endif
#ifndef included_sidl_BaseClass_hxx
#include "sidl_BaseClass.hxx"
#endif
#ifndef included_sidl_BaseInterface_hxx
#include "sidl_BaseInterface.hxx"
#endif
#ifndef included_sidl_ClassInfo_hxx
#include "sidl_ClassInfo.hxx"
#endif
#ifndef included_sidl_RuntimeException_hxx
#include "sidl_RuntimeException.hxx"
#endif

// DO-NOT-DELETE splicer.begin(edu.csdms.models.stm.DredgeSlotBW._hincludes)
// Insert-Code-Here {edu.csdms.models.stm.DredgeSlotBW._hincludes} (includes or arbitrary code)
#include "Initialize.h"
#include "Run.h"
#include "Finalize.h"
#include "SaveDatatoMatrix.h"

// DO-NOT-DELETE splicer.end(edu.csdms.models.stm.DredgeSlotBW._hincludes)

namespace edu {
  namespace csdms {
    namespace models {
      namespace stm {

        /**
         * Symbol "edu.csdms.models.stm.DredgeSlotBW" (version 0.0)
         */
        class DredgeSlotBW_impl : public virtual
          ::edu::csdms::models::stm::DredgeSlotBW
        // DO-NOT-DELETE splicer.begin(edu.csdms.models.stm.DredgeSlotBW._inherits)
        // Insert-Code-Here {edu.csdms.models.stm.DredgeSlotBW._inherits} (optional inheritance here)
        // DO-NOT-DELETE splicer.end(edu.csdms.models.stm.DredgeSlotBW._inherits)

        {

        // All data marked protected will be accessable by
        // descendant Impl classes
        protected:

          bool _wrapped;

          // DO-NOT-DELETE splicer.begin(edu.csdms.models.stm.DredgeSlotBW._implementation)

  // Insert-UserCode-Here(edu.csdms.models.stm.DredgeSlotBW._implementation)
gov::cca::TypeMap userinput;

    int check, M, prints, iterates, k, m;
    double zeta[52], x[2002], eta[2002], ksi[2002], H[2002], Sf[2002], Hs[2002];
    double qb[2002], qs[2002], Ent[2002];
    double Qww, I, B, D50, D90, R, S, lamdap, L, Hslot, ru, rd;
    double au, dt, qw, dx, Rep, vs, dzeta, Hnorm, Hsnorm, Gbnorm;
    double Gsnorm, ustarr, Hr, qsint, ksid, qbf, qsf, Cnorm, MassIn;
    double MassStored, MassOut, FracDisc, __time;

    double (*printmatrix)[2002], (*Hmatrix)[2002], (*ksimatrix)[2002];
    double (*qsmatrix)[2002], (*qbmatrix)[2002], (*Hsmatrix)[2002];

  // Bocca generated code. bocca.protected.begin(edu.csdms.models.stm.DredgeSlotBW._implementation)

   gov::cca::Services    d_services; // our cca handle.

  // Bocca generated code. bocca.protected.end(edu.csdms.models.stm.DredgeSlotBW._implementation)

          // DO-NOT-DELETE splicer.end(edu.csdms.models.stm.DredgeSlotBW._implementation)

        public:
          // default constructor, used for data wrapping(required)
          DredgeSlotBW_impl();
          // sidl constructor (required)
          // Note: alternate Skel constructor doesn't call addref()
          // (fixes bug #275)
            DredgeSlotBW_impl( struct edu_csdms_models_stm_DredgeSlotBW__object
              * ior ) : StubBase(ior,true),
            ::gov::cca::Port((ior==NULL) ? NULL : &((*ior).d_gov_cca_port)),
            ::edu::csdms::ports::IRFPort((ior==NULL) ? NULL : &((
              *ior).d_edu_csdms_ports_irfport)),
            ::gov::cca::Component((ior==NULL) ? NULL : &((
              *ior).d_gov_cca_component)),
          ::gov::cca::ComponentRelease((ior==NULL) ? NULL : &((
            *ior).d_gov_cca_componentrelease)) , _wrapped(false) {_ctor();}

          // user defined construction
          void _ctor();

          // virtual destructor (required)
          virtual ~DredgeSlotBW_impl() { _dtor(); }

          // user defined destruction
          void _dtor();

          // true if this object was created by a user newing the impl
          inline bool _isWrapped() {return _wrapped;}

          // static class initializer
          static void _load();

        public:

          /**
           * user defined non-static method.
           */
          void
          boccaSetServices_impl (
            /* in */::gov::cca::Services& services
          )
          // throws:
          //    ::gov::cca::CCAException
          //    ::sidl::RuntimeException
          ;

          /**
           * user defined non-static method.
           */
          void
          boccaReleaseServices_impl (
            /* in */::gov::cca::Services& services
          )
          // throws:
          //    ::gov::cca::CCAException
          //    ::sidl::RuntimeException
          ;

          /**
           *  This function should never be called, but helps babel generate better code.
           */
          void
          boccaForceUsePortInclude_impl (
            /* in */::gov::cca::ports::ParameterPortFactory& dummy0,
            /* in */::edu::csdms::openmi::ValueSet& dummy1,
            /* in */::edu::csdms::tools::TemplateFiles& dummy2,
            /* in */::edu::csdms::openmi::ScalarSet& dummy3,
            /* in */::edu::csdms::tools::ConfigDialog& dummy4,
            /* in */::edu::csdms::openmi::IScalarSet& dummy5
          )
          ;

          /**
           *  Starts up a component presence in the calling framework.
           * @param services the component instance's handle on the framework world.
           * Contracts concerning services and setServices:
           *
           * The component interaction with the CCA framework
           * and Ports begins on the call to setServices by the framework.
           *
           * This function is called exactly once for each instance created
           * by the framework.
           *
           * The argument services will never be nil/null.
           *
           * Those uses ports which are automatically connected by the framework
           * (so-called service-ports) may be obtained via getPort during
           * setServices.
           */
          void
          setServices_impl (
            /* in */::gov::cca::Services& services
          )
          // throws:
          //    ::gov::cca::CCAException
          //    ::sidl::RuntimeException
          ;

          /**
           * Shuts down a component presence in the calling framework.
           * @param services the component instance's handle on the framework world.
           * Contracts concerning services and setServices:
           *
           * This function is called exactly once for each callback registered
           * through Services.
           *
           * The argument services will never be nil/null.
           * The argument services will always be the same as that received in
           * setServices.
           *
           * During this call the component should release any interfaces
           * acquired by getPort().
           *
           * During this call the component should reset to nil any stored
           * reference to services.
           *
           * After this call, the component instance will be removed from the
           * framework. If the component instance was created by the
           * framework, it will be destroyed, not recycled, The behavior of
           * any port references obtained from this component instance and
           * stored elsewhere becomes undefined.
           *
           * Notes for the component implementor:
           * 1) The component writer may perform blocking activities
           * within releaseServices, such as waiting for remote computations
           * to shutdown.
           * 2) It is good practice during releaseServices for the component
           * writer to remove or unregister all the ports it defined.
           */
          void
          releaseServices_impl (
            /* in */::gov::cca::Services& services
          )
          // throws:
          //    ::gov::cca::CCAException
          //    ::sidl::RuntimeException
          ;

          /**
           * user defined non-static method.
           */
          void
          initialize_impl (
            /* in array<string> */::sidl::array< ::std::string>& properties
          )
          ;

          /**
           * user defined non-static method.
           */
          void
          run_impl (
            /* in */double time
          )
          ;

          /**
           * user defined non-static method.
           */
          void
          finalize_impl() ;
          /**
           * user defined non-static method.
           */
          int64_t
          getRaster_nx_impl() ;
          /**
           * user defined non-static method.
           */
          int64_t
          getRaster_ny_impl() ;
          /**
           * user defined non-static method.
           */
          double
          getRaster_dx_impl() ;
          /**
           * user defined non-static method.
           */
          double
          getRaster_dy_impl() ;
          /**
           * user defined non-static method.
           */
          double
          getRaster_ulx_impl() ;
          /**
           * user defined non-static method.
           */
          double
          getRaster_uly_impl() ;
          /**
           * user defined non-static method.
           */
          ::sidl::array<double>
          getRaster_grid_impl (
            /* in */const ::std::string& val_string
          )
          ;

          /**
           * user defined non-static method.
           */
          ::sidl::array<int32_t>
          get_raster_dimen_impl (
            /* in */const ::std::string& val_string
          )
          ;

          /**
           * user defined non-static method.
           */
          ::sidl::array<double>
          get_raster_res_impl (
            /* in */const ::std::string& val_string
          )
          ;

          /**
           * user defined non-static method.
           */
          ::sidl::basearray
          get_raster_data_impl (
            /* in */const ::std::string& val_string
          )
          ;

          /**
           * user defined non-static method.
           */
          ::sidl::array<double>
          get_time_span_impl() ;
          /**
           * user defined non-static method.
           */
          ::edu::csdms::openmi::IElementSet
          get_element_set_impl (
            /* in */const ::std::string& val_string
          )
          ;

          /**
           * user defined non-static method.
           */
          ::edu::csdms::openmi::IValueSet
          get_value_set_impl (
            /* in */const ::std::string& val_string
          )
          ;

          /**
           * user defined non-static method.
           */
          ::sidl::basearray
          get_value_set_data_impl (
            /* in */const ::std::string& val_string
          )
          ;

          /**
           * user defined non-static method.
           */
          void
          set_value_set_impl (
            /* in */const ::std::string& val_string,
            /* in */::edu::csdms::openmi::IValueSet& values
          )
          ;

        };  // end class DredgeSlotBW_impl

      } // end namespace stm
    } // end namespace models
  } // end namespace csdms
} // end namespace edu

// DO-NOT-DELETE splicer.begin(edu.csdms.models.stm.DredgeSlotBW._hmisc)
// Insert-Code-Here {edu.csdms.models.stm.DredgeSlotBW._hmisc} (miscellaneous things)
// DO-NOT-DELETE splicer.end(edu.csdms.models.stm.DredgeSlotBW._hmisc)

#endif
<|endoftext|>