1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmlfiltertabpagebasic.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_filter.hxx"
33 #include <rtl/ustrbuf.hxx>
35 #include "xmlfilterdialogstrings.hrc"
36 #include "xmlfiltertabpagebasic.hxx"
37 #include "xmlfiltertabpagebasic.hrc"
38 #include "xmlfiltersettingsdialog.hxx"
39 #include "xmlfilterhelpids.hrc"
43 XMLFilterTabPageBasic::XMLFilterTabPageBasic( Window
* pParent
, ResMgr
& rResMgr
) :
44 TabPage( pParent
, ResId( RID_XML_FILTER_TABPAGE_BASIC
, rResMgr
) ),
45 maFTFilterName( this, ResId( FT_XML_FILTER_NAME
, rResMgr
) ),
46 maEDFilterName( this, ResId( ED_XML_FILTER_NAME
, rResMgr
) ),
47 maFTApplication( this, ResId( FT_XML_APPLICATION
, rResMgr
) ),
48 maCBApplication( this, ResId( CB_XML_APPLICATION
, rResMgr
) ),
49 maFTInterfaceName( this, ResId( FT_XML_INTERFACE_NAME
, rResMgr
) ),
50 maEDInterfaceName( this, ResId( ED_XML_INTERFACE_NAME
, rResMgr
) ),
51 maFTExtension( this, ResId( FT_XML_EXTENSION
, rResMgr
) ),
52 maEDExtension( this, ResId( ED_XML_EXTENSION
, rResMgr
) ),
53 maFTDescription( this, ResId( FT_XML_DESCRIPTION
, rResMgr
) ),
54 maEDDescription( this, ResId( ED_XML_DESCRIPTION
, rResMgr
) )
56 maCBApplication
.SetHelpId( HID_XML_FILTER_APPLICATION
);
57 maEDDescription
.SetHelpId( HID_XML_FILTER_DESCRIPTION
);
61 std::vector
< application_info_impl
* >& rInfos
= getApplicationInfos();
62 std::vector
< application_info_impl
* >::iterator
aIter( rInfos
.begin() );
63 while( aIter
!= rInfos
.end() )
65 XubString
aEntry( (*aIter
++)->maDocumentUIName
);
66 maCBApplication
.InsertEntry( aEntry
);
70 XMLFilterTabPageBasic::~XMLFilterTabPageBasic()
74 static OUString
checkExtensions( const String
& rExtensions
)
76 const sal_Unicode
* pSource
= rExtensions
.GetBuffer();
77 sal_Int32 nCount
= rExtensions
.Len();
84 case sal_Unicode(','):
85 aRet
+= sal_Unicode(';');
87 case sal_Unicode('.'):
88 case sal_Unicode('*'):
100 bool XMLFilterTabPageBasic::FillInfo( filter_info_impl
* pInfo
)
104 if( maEDFilterName
.GetText().Len() )
105 pInfo
->maFilterName
= maEDFilterName
.GetText();
107 if( maCBApplication
.GetText().Len() )
108 pInfo
->maDocumentService
= maCBApplication
.GetText();
110 if( maEDInterfaceName
.GetText().Len() )
111 pInfo
->maInterfaceName
= maEDInterfaceName
.GetText();
113 if( maEDExtension
.GetText().Len() )
114 pInfo
->maExtension
= checkExtensions( maEDExtension
.GetText() );
116 pInfo
->maComment
= string_encode( maEDDescription
.GetText() );
118 if( pInfo
->maDocumentService
.getLength() )
120 std::vector
< application_info_impl
* >& rInfos
= getApplicationInfos();
121 std::vector
< application_info_impl
* >::iterator
aIter( rInfos
.begin() );
122 while( aIter
!= rInfos
.end() )
124 if( pInfo
->maDocumentService
== (*aIter
)->maDocumentUIName
)
126 pInfo
->maDocumentService
= (*aIter
)->maDocumentService
;
127 pInfo
->maExportService
= (*aIter
)->maXMLExporter
;
128 pInfo
->maImportService
= (*aIter
)->maXMLImporter
;
139 void XMLFilterTabPageBasic::SetInfo(const filter_info_impl
* pInfo
)
143 maEDFilterName
.SetText( string_decode(pInfo
->maFilterName
) );
145 if( pInfo->maDocumentService.getLength() )
146 maCBApplication.SetText( getApplicationUIName( pInfo->maDocumentService ) );
148 if( pInfo
->maExportService
.getLength() )
149 maCBApplication
.SetText( getApplicationUIName( pInfo
->maExportService
) );
151 maCBApplication
.SetText( getApplicationUIName( pInfo
->maImportService
) );
152 maEDInterfaceName
.SetText( string_decode(pInfo
->maInterfaceName
) );
153 maEDExtension
.SetText( pInfo
->maExtension
);
154 maEDDescription
.SetText( string_decode( pInfo
->maComment
) );