1*4bfbcde8SAndrew Rist /**************************************************************
2*4bfbcde8SAndrew Rist *
3*4bfbcde8SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*4bfbcde8SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*4bfbcde8SAndrew Rist * distributed with this work for additional information
6*4bfbcde8SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*4bfbcde8SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*4bfbcde8SAndrew Rist * "License"); you may not use this file except in compliance
9*4bfbcde8SAndrew Rist * with the License. You may obtain a copy of the License at
10*4bfbcde8SAndrew Rist *
11*4bfbcde8SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*4bfbcde8SAndrew Rist *
13*4bfbcde8SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*4bfbcde8SAndrew Rist * software distributed under the License is distributed on an
15*4bfbcde8SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*4bfbcde8SAndrew Rist * KIND, either express or implied. See the License for the
17*4bfbcde8SAndrew Rist * specific language governing permissions and limitations
18*4bfbcde8SAndrew Rist * under the License.
19*4bfbcde8SAndrew Rist *
20*4bfbcde8SAndrew Rist *************************************************************/
21cdf0e10cSrcweir
22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
23cdf0e10cSrcweir #include "precompiled_filter.hxx"
24cdf0e10cSrcweir
25cdf0e10cSrcweir #include "impsvgdialog.hxx"
26cdf0e10cSrcweir #include <cstdio>
27cdf0e10cSrcweir
28cdf0e10cSrcweir using namespace rtl;
29cdf0e10cSrcweir using namespace com::sun::star::uno;
30cdf0e10cSrcweir using namespace com::sun::star::beans;
31cdf0e10cSrcweir
implMap(Window &,sal_Int32 nVal)32cdf0e10cSrcweir inline sal_Int32 implMap( Window& /*rWnd*/, sal_Int32 nVal )
33cdf0e10cSrcweir {
34cdf0e10cSrcweir //return( rWnd.LogicToLogic( Size( nVal, nVal ) ).Height(), MAP_APPFONT, MAP_APPFONT );
35cdf0e10cSrcweir return( nVal << 1 );
36cdf0e10cSrcweir }
37cdf0e10cSrcweir
38cdf0e10cSrcweir // ----------------
39cdf0e10cSrcweir // - ImpSVGDialog -
40cdf0e10cSrcweir // ----------------
41cdf0e10cSrcweir
ImpSVGDialog(Window * pParent,Sequence<PropertyValue> & rFilterData)42cdf0e10cSrcweir ImpSVGDialog::ImpSVGDialog( Window* pParent/*, ResMgr& rResMgr*/, Sequence< PropertyValue >& rFilterData ) :
43cdf0e10cSrcweir ModalDialog( pParent/*KA, ResId( DLG_OPTIONS, &rResMgr*/ ),
44cdf0e10cSrcweir maFI( this ),
45cdf0e10cSrcweir maCBTinyProfile( this ),
46cdf0e10cSrcweir maCBEmbedFonts( this ),
47cdf0e10cSrcweir maCBUseNativeDecoration( this ),
48cdf0e10cSrcweir maBTOK( this, WB_DEF_OK ),
49cdf0e10cSrcweir maBTCancel( this ),
50cdf0e10cSrcweir maBTHelp( this ),
51cdf0e10cSrcweir maConfigItem( String( RTL_CONSTASCII_USTRINGPARAM( SVG_EXPORTFILTER_CONFIGPATH ) ), &rFilterData ),
52cdf0e10cSrcweir mbOldNativeDecoration( sal_False )
53cdf0e10cSrcweir {
54cdf0e10cSrcweir SetText( String( RTL_CONSTASCII_USTRINGPARAM( "SVG Export Options" ) ) );
55cdf0e10cSrcweir SetOutputSizePixel( Size( implMap( *this, 177 ), implMap( *this, 77 ) ) );
56cdf0e10cSrcweir
57cdf0e10cSrcweir maFI.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "Export" ) ) );
58cdf0e10cSrcweir maFI.SetPosSizePixel( Point( implMap( *this, 6 ), implMap( *this, 3 ) ),
59cdf0e10cSrcweir Size( implMap( *this, 165 ), implMap( *this, 8 ) ) );
60cdf0e10cSrcweir
61cdf0e10cSrcweir maCBTinyProfile.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "Use SVG Tiny profile" ) ) );
62cdf0e10cSrcweir maCBTinyProfile.SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 14 ) ),
63cdf0e10cSrcweir Size( implMap( *this, 142 ), implMap( *this, 10 ) ) );
64cdf0e10cSrcweir
65cdf0e10cSrcweir maCBEmbedFonts.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "Embed fonts" ) ) );
66cdf0e10cSrcweir maCBEmbedFonts.SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 27 ) ),
67cdf0e10cSrcweir Size( implMap( *this, 142 ), implMap( *this, 10 ) ) );
68cdf0e10cSrcweir
69cdf0e10cSrcweir maCBUseNativeDecoration.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "Use SVG native text decoration" ) ) );
70cdf0e10cSrcweir maCBUseNativeDecoration.SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 41 ) ),
71cdf0e10cSrcweir Size( implMap( *this, 142 ), implMap( *this, 10 ) ) );
72cdf0e10cSrcweir
73cdf0e10cSrcweir maCBTinyProfile.Check( maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( SVG_PROP_TINYPROFILE ) ), sal_False ) );
74cdf0e10cSrcweir maCBEmbedFonts.Check( maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( SVG_PROP_EMBEDFONTS ) ), sal_True ) );
75cdf0e10cSrcweir maCBUseNativeDecoration.Check( maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( SVG_PROP_NATIVEDECORATION ) ), sal_True ) );
76cdf0e10cSrcweir
77cdf0e10cSrcweir maBTOK.SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 57 ) ),
78cdf0e10cSrcweir Size( implMap( *this, 50 ), implMap( *this, 14 ) ) );
79cdf0e10cSrcweir maBTCancel.SetPosSizePixel( Point( implMap( *this, 65 ), implMap( *this, 57 ) ),
80cdf0e10cSrcweir Size( implMap( *this, 50 ), implMap( *this, 14 ) ) );
81cdf0e10cSrcweir maBTHelp.SetPosSizePixel( Point( implMap( *this, 121 ), implMap( *this, 57 ) ),
82cdf0e10cSrcweir Size( implMap( *this, 50 ), implMap( *this, 14 ) ) );
83cdf0e10cSrcweir
84cdf0e10cSrcweir maCBTinyProfile.SetToggleHdl( LINK( this, ImpSVGDialog, OnToggleCheckbox ) );
85cdf0e10cSrcweir OnToggleCheckbox( &maCBTinyProfile );
86cdf0e10cSrcweir
87cdf0e10cSrcweir maFI.Show();
88cdf0e10cSrcweir
89cdf0e10cSrcweir maCBTinyProfile.Show();
90cdf0e10cSrcweir maCBEmbedFonts.Show();
91cdf0e10cSrcweir maCBUseNativeDecoration.Show();
92cdf0e10cSrcweir
93cdf0e10cSrcweir maBTOK.Show();
94cdf0e10cSrcweir maBTCancel.Show();
95cdf0e10cSrcweir maBTHelp.Show();
96cdf0e10cSrcweir }
97cdf0e10cSrcweir
98cdf0e10cSrcweir // -----------------------------------------------------------------------------
99cdf0e10cSrcweir
~ImpSVGDialog()100cdf0e10cSrcweir ImpSVGDialog::~ImpSVGDialog()
101cdf0e10cSrcweir {
102cdf0e10cSrcweir }
103cdf0e10cSrcweir
104cdf0e10cSrcweir // -----------------------------------------------------------------------------
105cdf0e10cSrcweir
GetFilterData()106cdf0e10cSrcweir Sequence< PropertyValue > ImpSVGDialog::GetFilterData()
107cdf0e10cSrcweir {
108cdf0e10cSrcweir maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( SVG_PROP_TINYPROFILE ) ), maCBTinyProfile.IsChecked() );
109cdf0e10cSrcweir maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( SVG_PROP_EMBEDFONTS ) ), maCBEmbedFonts.IsChecked() );
110cdf0e10cSrcweir maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( SVG_PROP_NATIVEDECORATION ) ), maCBUseNativeDecoration.IsChecked() );
111cdf0e10cSrcweir
112cdf0e10cSrcweir return( maConfigItem.GetFilterData() );
113cdf0e10cSrcweir }
114cdf0e10cSrcweir
115cdf0e10cSrcweir // -----------------------------------------------------------------------------
116cdf0e10cSrcweir
IMPL_LINK(ImpSVGDialog,OnToggleCheckbox,CheckBox *,pBox)117cdf0e10cSrcweir IMPL_LINK( ImpSVGDialog, OnToggleCheckbox, CheckBox*, pBox )
118cdf0e10cSrcweir {
119cdf0e10cSrcweir if( pBox == &maCBTinyProfile )
120cdf0e10cSrcweir {
121cdf0e10cSrcweir if( pBox->IsChecked() )
122cdf0e10cSrcweir {
123cdf0e10cSrcweir mbOldNativeDecoration = maCBUseNativeDecoration.IsChecked();
124cdf0e10cSrcweir
125cdf0e10cSrcweir maCBUseNativeDecoration.Check( sal_False );
126cdf0e10cSrcweir maCBUseNativeDecoration.Disable();
127cdf0e10cSrcweir }
128cdf0e10cSrcweir else
129cdf0e10cSrcweir {
130cdf0e10cSrcweir maCBUseNativeDecoration.Enable();
131cdf0e10cSrcweir maCBUseNativeDecoration.Check( mbOldNativeDecoration );
132cdf0e10cSrcweir }
133cdf0e10cSrcweir }
134cdf0e10cSrcweir
135cdf0e10cSrcweir return 0;
136cdf0e10cSrcweir }
137