summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2010-12-29 01:48:57 +0100
committerMichael Meeks <michael.meeks@novell.com>2011-01-06 16:02:10 +0000
commita2b5536328c2723a8145689b4cb3b36df9c4abc2 (patch)
tree73e3003f89337458bb3cb08085d3f7a5a4e19b0c
parent2022ee49a2efa90bb33224de91dad5fb8398b8bd (diff)
Show the license information in a separate, localizable dialog; fdo#32563.
-rw-r--r--sfx2/source/appl/app.hrc10
-rw-r--r--sfx2/source/appl/app.src54
-rw-r--r--sfx2/source/appl/appserv.cxx124
3 files changed, 141 insertions, 47 deletions
diff --git a/sfx2/source/appl/app.hrc b/sfx2/source/appl/app.hrc
index 1f9c125fb4..8229ec64fd 100644
--- a/sfx2/source/appl/app.hrc
+++ b/sfx2/source/appl/app.hrc
@@ -267,6 +267,16 @@
#define RID_SVXSTR_GRFILTER_FILTERERROR (RID_SFX_APP_START + 202)
#define RID_SVXSTR_GRFILTER_TOOBIG (RID_SFX_APP_START + 203)
+// For the License Information dialog box
+#define DLG_HELP_LICENSING (RID_SFX_APP_START + 204)
+#define STR_LICENSING_INFORMATION_1 (RID_SFX_APP_START + 205)
+#define STR_LICENSING_INFORMATION_2 (RID_SFX_APP_START + 206)
+#define STR_LICENSING_INFORMATION_3 (RID_SFX_APP_START + 207)
+#define STR_LICENSING_INFORMATION_4 (RID_SFX_APP_START + 208)
+#define STR_LICENSING_INFORMATION_5 (RID_SFX_APP_START + 209)
+#define PB_LICENSING_SHOW (RID_SFX_APP_START + 210)
+#define PB_LICENSING_CLOSE (RID_SFX_APP_START + 211)
+
#define MD_DDE_LINKEDIT (RID_SFX_APP_START + 1)
#endif // #ifndef _SFX_APP_HRC
diff --git a/sfx2/source/appl/app.src b/sfx2/source/appl/app.src
index e1c43c072e..3e76c0b87a 100644
--- a/sfx2/source/appl/app.src
+++ b/sfx2/source/appl/app.src
@@ -1092,3 +1092,57 @@ String RID_SVXSTR_GRFILTER_TOOBIG
Text [ en-US ] = "Not enough memory to insert graphic" ;
};
+ModalDialog DLG_HELP_LICENSING
+{
+ // Size is computed
+ Text [ en-US ] = "Licensing and Legal information";
+ MOVEABLE = TRUE ;
+ CLOSEABLE = TRUE ;
+ OUTPUTSIZE = TRUE ;
+ SVLOOK = TRUE ;
+ String STR_LICENSING_INFORMATION_1
+ {
+ Text [ en-US ] =
+ "%PRODUCTNAME is made available subject to the terms of GNU Lesser General Public\n"
+ "License Version 3. A copy of the LGPL license can be found at\n"
+ "http://www.gnu.org/licenses/lgpl-3.0.html" ;
+ };
+ String STR_LICENSING_INFORMATION_2
+ {
+ Text [ en-US ] =
+ "Third Party Code Additional copyright notices and license terms applicable to\n"
+ "portions of the Software are set forth in the THIRDPARTYLICENSEREADME.html\n"
+ "file; choose Show License to see exact details in English." ;
+ };
+ String STR_LICENSING_INFORMATION_3
+ {
+ Text [ en-US ] =
+ "All trademarks and registered trademarks mentioned herein are the property of\n"
+ "their respective owners." ;
+ };
+ String STR_LICENSING_INFORMATION_4
+ {
+ Text [ en-US ] =
+ "Copyright © 2000, 2010 LibreOffice contributors and/or their affiliates. All rights\n"
+ "reserved." ;
+ };
+ String STR_LICENSING_INFORMATION_5
+ {
+ Text [ en-US ] =
+ "This product was created by %OOOVENDOR, based on OpenOffice.org,\n"
+ "which is Copyright 2000, 2010 Oracle and/or its affiliates.\n"
+ "%OOOVENDOR acknowledges all community members, please see\n"
+ "http://www.libreoffice.org/ for more details." ;
+ };
+ OKButton PB_LICENSING_SHOW
+ {
+ // Position and size is computed
+ Text [ en-US ] = "~Show License" ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_LICENSING_CLOSE
+ {
+ // Position and size is computed
+ Text [ en-US ] = "~Close" ;
+ };
+};
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 3f1b44ee80..1aa897023c 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -157,20 +157,42 @@ long QuitAgain_Impl( void* pObj, void* pArg )
return 0;
}
-namespace {
- sal_Bool checkURL( const char *pName, rtl::OUString &rURL )
- {
- using namespace osl;
- DirectoryItem aDirItem;
-
- rURL = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("$BRAND_BASE_DIR/") );
- rURL += rtl::OUString::createFromAscii( pName );
- rtl::Bootstrap::expandMacros( rURL );
+/// Find the correct location of the document (LICENSE.odt, etc.), and return
+/// it in rURL if found.
+static sal_Bool checkURL( const char *pName, const char *pExt, rtl::OUString &rURL )
+{
+ using namespace osl;
+ DirectoryItem aDirItem;
+
+ rURL = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("$BRAND_BASE_DIR/") );
+ rURL += rtl::OUString::createFromAscii( pName );
+ rURL += rtl::OUString::createFromAscii( pExt );
+ rtl::Bootstrap::expandMacros( rURL );
+
+ if (rURL.getLength() != 0)
+ return DirectoryItem::get( rURL, aDirItem ) == DirectoryItem::E_None;
+ else
+ return sal_False;
+}
- if (rURL.getLength() != 0)
- return DirectoryItem::get( rURL, aDirItem ) == DirectoryItem::E_None;
- else
- return sal_False;
+/// Displays CREDITS or LICENSE in any of the available version
+static void showDocument( const char* pBaseName )
+{
+ try {
+ Reference < XComponentLoader > xLoader( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), UNO_QUERY );
+ Sequence < com::sun::star::beans::PropertyValue > args(2);
+ args[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ViewOnly"));
+ args[0].Value <<= sal_True;
+ args[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly"));
+ args[1].Value <<= sal_True;
+
+ rtl::OUString aURL;
+ if ( checkURL ( pBaseName, ".odt", aURL ) ||
+ checkURL ( pBaseName, ".html", aURL ) ||
+ checkURL ( pBaseName, "", aURL ) ) {
+ xLoader->loadComponentFromURL( aURL, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_blank")), 0, args );
+ }
+ } catch (const ::com::sun::star::uno::Exception &) {
}
}
@@ -356,43 +378,51 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
break;
}
- case SID_SHOW_CREDITS:
case SID_SHOW_LICENSE:
{
- try {
- Reference < XComponentLoader > xLoader( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), UNO_QUERY );
- Sequence < com::sun::star::beans::PropertyValue > args(2);
- args[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ViewOnly"));
- args[0].Value <<= sal_True;
- args[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly"));
- args[1].Value <<= sal_True;
-
- rtl::OUString aURL;
- char const** pNames;
- if( rReq.GetSlot() == SID_SHOW_LICENSE )
- {
- static char const* pLicenseStrings[] =
- {
- "LICENSE.odt", "LICENSE.html", "LICENSE"
- };
- pNames = pLicenseStrings;
- }
- else
- {
- static char const* pCreditsStrings[] =
- {
- "CREDITS.odt", "CREDITS.html", "CREDITS"
- };
- pNames = pCreditsStrings;
- }
-
- if ( checkURL ( pNames[0], aURL ) ||
- checkURL ( pNames[1], aURL ) ||
- checkURL ( pNames[2], aURL ) ) {
- xLoader->loadComponentFromURL( aURL, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_blank")), 0, args );
- }
- } catch (const ::com::sun::star::uno::Exception &) {
+ ModalDialog aDialog( NULL, SfxResId( DLG_HELP_LICENSING ) );
+
+ String aLicensing;
+ for ( int i = STR_LICENSING_INFORMATION_1; i <= STR_LICENSING_INFORMATION_5; ++i )
+ {
+ if ( i != STR_LICENSING_INFORMATION_1 )
+ aLicensing += String( RTL_CONSTASCII_USTRINGPARAM( "\n\n" ) );
+ aLicensing += String( SfxResId( i ) );
}
+
+ FixedText aText( &aDialog );
+ aText.SetText( aLicensing );
+ OKButton aShow( &aDialog, SfxResId( PB_LICENSING_SHOW ) );
+ CancelButton aClose( &aDialog, SfxResId( PB_LICENSING_CLOSE ) );
+
+ // positions and sizes are computed to always fit the language
+ Size aTextSize( aText.GetOptimalSize( WINDOWSIZE_PREFERRED ) );
+ Size aShowSize( aShow.GetOptimalSize( WINDOWSIZE_PREFERRED ) );
+ Size aCloseSize( aClose.GetOptimalSize( WINDOWSIZE_PREFERRED ) );
+
+ long nDelimX = 12;
+ long nDelimY = 12;
+ long nWidth = aTextSize.Width() + 2*nDelimX;
+ long nButtonY = aTextSize.Height() + 2*nDelimY;
+ Size aButtonSize( std::max( aShowSize.Width(), aCloseSize.Width() ) + nDelimX,
+ std::max( aShowSize.Height(), aCloseSize.Height() ) );
+
+ aDialog.SetSizePixel( Size( nWidth, aTextSize.Height() + 3*nDelimY + aButtonSize.Height() ) );
+ aText.SetPosSizePixel( Point( nDelimX, nDelimY ), aTextSize );
+ aShow.SetPosSizePixel( Point( ( nWidth - nDelimX ) / 2 - aButtonSize.Width(), nButtonY ), aButtonSize );
+ aClose.SetPosSizePixel( Point( aShow.GetPosPixel().X() + aButtonSize.Width() + nDelimX, nButtonY ), aButtonSize );
+
+ aText.Show();
+
+ if ( aDialog.Execute() == RET_OK )
+ showDocument( "LICENSE" );
+
+ break;
+ }
+
+ case SID_SHOW_CREDITS:
+ {
+ showDocument( "CREDITS" );
break;
}