Kaydet (Commit) 3eb84bcb authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Simplify TKGet(TK_FOO) -> "FOO"

Change-Id: I06e3134aeef27f13969f6d9d7d81b916bc93e8e2
üst 48d72126
......@@ -83,21 +83,21 @@ void OptimizerSettings::SaveSettingsToConfiguration( const Reference< XNameRepla
if ( rSettings.is() )
{
OUString pNames[] = {
TKGet( TK_Name ),
TKGet( TK_JPEGCompression ),
TKGet( TK_JPEGQuality ),
TKGet( TK_RemoveCropArea ),
TKGet( TK_ImageResolution ),
TKGet( TK_EmbedLinkedGraphics ),
TKGet( TK_OLEOptimization ),
TKGet( TK_OLEOptimizationType ),
TKGet( TK_DeleteUnusedMasterPages ),
TKGet( TK_DeleteHiddenSlides ),
TKGet( TK_DeleteNotesPages ),
TKGet( TK_SaveAs ),
// TKGet( TK_SaveAsURL ),
// TKGet( TK_FilterName ),
TKGet( TK_OpenNewDocument ) };
"Name",
"JPEGCompression",
"JPEGQuality",
"RemoveCropArea",
"ImageResolution",
"EmbedLinkedGraphics",
"OLEOptimization",
"OLEOptimizationType",
"DeleteUnusedMasterPages",
"DeleteHiddenSlides",
"DeleteNotesPages",
"SaveAs",
// "SaveAsURL",
// "FilterName",
"OpenNewDocument" };
Any pValues[] = {
Any( maName ),
......@@ -153,7 +153,7 @@ ConfigurationAccess::ConfigurationAccess( const Reference< uno::XComponentContex
LoadStrings();
maSettings.push_back( pDefaultSettings ?
*pDefaultSettings : OptimizerSettings() );
maSettings.back().maName = TKGet( TK_LastUsedSettings );
maSettings.back().maName = "LastUsedSettings";
LoadConfiguration();
maInitialSettings = maSettings;
};
......@@ -199,7 +199,7 @@ void ConfigurationAccess::LoadStrings()
Reference< XInterface > xRoot( OpenConfiguration( true ) );
if ( !xRoot.is() )
break;
Reference< container::XNameAccess > xSet( GetConfigurationNode( xRoot, TKGet( TK_Strings ) ), UNO_QUERY );
Reference< container::XNameAccess > xSet( GetConfigurationNode( xRoot, "Strings" ), UNO_QUERY );
if ( xSet.is() )
{
const Sequence< OUString > aElements( xSet->getElementNames() );
......@@ -233,13 +233,13 @@ void ConfigurationAccess::LoadConfiguration()
Reference< XInterface > xRoot( OpenConfiguration( true ) );
if ( !xRoot.is() )
break;
Reference< container::XNameAccess > xSet( GetConfigurationNode( xRoot, TKGet( TK_LastUsedSettings ) ), UNO_QUERY );
Reference< container::XNameAccess > xSet( GetConfigurationNode( xRoot, "LastUsedSettings" ), UNO_QUERY );
if ( xSet.is() )
{
OptimizerSettings& rCurrent( maSettings.front() );
rCurrent.LoadSettingsFromConfiguration( xSet );
}
xSet = Reference< container::XNameAccess >( GetConfigurationNode( xRoot, TKGet( TK_Settings_Templates ) ), UNO_QUERY );
xSet = Reference< container::XNameAccess >( GetConfigurationNode( xRoot, "Settings/Templates" ), UNO_QUERY );
if ( xSet.is() )
{
const Sequence< OUString > aElements( xSet->getElementNames() );
......@@ -247,7 +247,7 @@ void ConfigurationAccess::LoadConfiguration()
{
try
{
OUString aPath( TKGet( TK_Settings_Templates_ ).concat( aElements[ i ] ) );
OUString aPath( "Settings/Templates/" + aElements[ i ] );
Reference< container::XNameAccess > xTemplates( GetConfigurationNode( xRoot, aPath ), UNO_QUERY );
if ( xTemplates.is() )
{
......@@ -279,12 +279,12 @@ void ConfigurationAccess::SaveConfiguration()
Reference<util::XChangesBatch> xRoot( OpenConfiguration( false ), UNO_QUERY_THROW );
// storing the last used settings
Reference< container::XNameReplace > xSet( GetConfigurationNode( xRoot, TKGet( TK_LastUsedSettings ) ), UNO_QUERY_THROW );
Reference< container::XNameReplace > xSet( GetConfigurationNode( xRoot, "LastUsedSettings" ), UNO_QUERY_THROW );
OptimizerSettings& rCurrent( maSettings.front() );
rCurrent.SaveSettingsToConfiguration( xSet );
// updating template elements
xSet = Reference< container::XNameReplace >( GetConfigurationNode( xRoot, TKGet( TK_Settings_Templates ) ), UNO_QUERY_THROW );
xSet = Reference< container::XNameReplace >( GetConfigurationNode( xRoot, "Settings/Templates" ), UNO_QUERY_THROW );
Reference< container::XNameContainer > xNameContainer( xSet, UNO_QUERY_THROW );
const Sequence< OUString > aElements( xSet->getElementNames() );
......@@ -294,12 +294,12 @@ void ConfigurationAccess::SaveConfiguration()
for( k = 1; k < maSettings.size(); k++ )
{
OptimizerSettings& rSettings( maSettings[ k ] );
OUString aElementName( TKGet( TK_Template ).concat( OUString::number( k ) ) );
OUString aElementName( "Template" + OUString::number( k ) );
Reference< lang::XSingleServiceFactory > xChildFactory ( xSet, UNO_QUERY_THROW );
Reference< container::XNameReplace > xChild( xChildFactory->createInstance(), UNO_QUERY_THROW );
xNameContainer->insertByName( aElementName, Any( xChild ) );
OUString aPath( TKGet( TK_Settings_Templates_ ).concat( aElementName ) );
OUString aPath( "Settings/Templates/" + aElementName );
Reference< container::XNameReplace > xTemplates( GetConfigurationNode( xRoot, aPath ), UNO_QUERY );
rSettings.SaveSettingsToConfiguration( xTemplates );
}
......@@ -468,35 +468,35 @@ Sequence< PropertyValue > ConfigurationAccess::GetConfigurationSequence()
{
Sequence< PropertyValue > aRet( 15 );
OptimizerSettings& rSettings( maSettings.front() );
aRet[ 0 ].Name = TKGet( TK_JPEGCompression );
aRet[ 0 ].Name = "JPEGCompression";
aRet[ 0 ].Value= Any( rSettings.mbJPEGCompression );
aRet[ 1 ].Name = TKGet( TK_JPEGQuality );
aRet[ 1 ].Name = "JPEGQuality";
aRet[ 1 ].Value= Any( rSettings.mnJPEGQuality );
aRet[ 2 ].Name = TKGet( TK_RemoveCropArea );
aRet[ 2 ].Name = "RemoveCropArea";
aRet[ 2 ].Value= Any( rSettings.mbRemoveCropArea );
aRet[ 3 ].Name = TKGet( TK_ImageResolution );
aRet[ 3 ].Name = "ImageResolution";
aRet[ 3 ].Value= Any( rSettings.mnImageResolution );
aRet[ 4 ].Name = TKGet( TK_EmbedLinkedGraphics );
aRet[ 4 ].Name = "EmbedLinkedGraphics";
aRet[ 4 ].Value= Any( rSettings.mbEmbedLinkedGraphics );
aRet[ 5 ].Name = TKGet( TK_OLEOptimization );
aRet[ 5 ].Name = "OLEOptimization";
aRet[ 5 ].Value= Any( rSettings.mbOLEOptimization );
aRet[ 6 ].Name = TKGet( TK_OLEOptimizationType );
aRet[ 6 ].Name = "OLEOptimizationType";
aRet[ 6 ].Value= Any( rSettings.mnOLEOptimizationType );
aRet[ 7 ].Name = TKGet( TK_DeleteUnusedMasterPages );
aRet[ 7 ].Name = "DeleteUnusedMasterPages";
aRet[ 7 ].Value= Any( rSettings.mbDeleteUnusedMasterPages );
aRet[ 8 ].Name = TKGet( TK_DeleteHiddenSlides );
aRet[ 8 ].Name = "DeleteHiddenSlides";
aRet[ 8 ].Value= Any( rSettings.mbDeleteHiddenSlides );
aRet[ 9 ].Name = TKGet( TK_DeleteNotesPages );
aRet[ 9 ].Name = "DeleteNotesPages";
aRet[ 9 ].Value= Any( rSettings.mbDeleteNotesPages );
aRet[ 10].Name = TKGet( TK_CustomShowName );
aRet[ 10].Name = "CustomShowName";
aRet[ 10].Value= Any( rSettings.maCustomShowName );
aRet[ 11].Name = TKGet( TK_SaveAsURL );
aRet[ 11].Name = "SaveAsURL";
aRet[ 11].Value= Any( rSettings.maSaveAsURL );
aRet[ 12].Name = TKGet( TK_FilterName );
aRet[ 12].Name = "FilterName";
aRet[ 12].Value= Any( rSettings.maFilterName );
aRet[ 13].Name = TKGet( TK_OpenNewDocument );
aRet[ 13].Name = "OpenNewDocument";
aRet[ 13].Value= Any( rSettings.mbOpenNewDocument );
aRet[ 14].Name = TKGet( TK_EstimatedFileSize );
aRet[ 14].Name = "EstimatedFileSize";
aRet[ 14].Value= Any( rSettings.mnEstimatedFileSize );
return aRet;
}
......
......@@ -93,16 +93,16 @@ void ImpAddGraphicEntity( const Reference< XComponentContext >& rxMSF, Reference
{
Reference< XGraphic > xGraphic;
Reference< XPropertySet > xShapePropertySet( rxShape, UNO_QUERY_THROW );
if ( xShapePropertySet->getPropertyValue( TKGet( TK_Graphic ) ) >>= xGraphic )
if ( xShapePropertySet->getPropertyValue( "Graphic" ) >>= xGraphic )
{
text::GraphicCrop aGraphicCropLogic( 0, 0, 0, 0 );
GraphicCollector::GraphicUser aUser;
aUser.mxShape = rxShape;
aUser.mbFillBitmap = sal_False;
xShapePropertySet->getPropertyValue( TKGet( TK_GraphicURL ) ) >>= aUser.maGraphicURL;
xShapePropertySet->getPropertyValue( TKGet( TK_GraphicStreamURL ) ) >>= aUser.maGraphicStreamURL;
xShapePropertySet->getPropertyValue( TKGet( TK_GraphicCrop ) ) >>= aGraphicCropLogic;
xShapePropertySet->getPropertyValue( "GraphicURL" ) >>= aUser.maGraphicURL;
xShapePropertySet->getPropertyValue( "GraphicStreamURL" ) >>= aUser.maGraphicStreamURL;
xShapePropertySet->getPropertyValue( "GraphicCrop" ) >>= aGraphicCropLogic;
awt::Size aLogicalSize( rxShape->getSize() );
// calculating the logical size, as if there were no cropping
......@@ -133,12 +133,12 @@ void ImpAddFillBitmapEntity( const Reference< XComponentContext >& rxMSF, const
try
{
FillStyle eFillStyle;
if ( rxPropertySet->getPropertyValue( TKGet( TK_FillStyle ) ) >>= eFillStyle )
if ( rxPropertySet->getPropertyValue( "FillStyle" ) >>= eFillStyle )
{
if ( eFillStyle == FillStyle_BITMAP )
{
Reference< XBitmap > xFillBitmap;
if ( rxPropertySet->getPropertyValue( TKGet( TK_FillBitmap ) ) >>= xFillBitmap )
if ( rxPropertySet->getPropertyValue( "FillBitmap" ) >>= xFillBitmap )
{
Reference< XGraphic > xGraphic( xFillBitmap, UNO_QUERY_THROW );
if ( xGraphic.is() )
......@@ -147,18 +147,18 @@ void ImpAddFillBitmapEntity( const Reference< XComponentContext >& rxMSF, const
Reference< XPropertySetInfo > axPropSetInfo( rxPropertySet->getPropertySetInfo() );
if ( axPropSetInfo.is() )
{
if ( axPropSetInfo->hasPropertyByName( TKGet( TK_FillBitmapMode ) ) )
if ( axPropSetInfo->hasPropertyByName( "FillBitmapMode" ) )
{
BitmapMode eBitmapMode;
if ( rxPropertySet->getPropertyValue( TKGet( TK_FillBitmapMode ) ) >>= eBitmapMode )
if ( rxPropertySet->getPropertyValue( "FillBitmapMode" ) >>= eBitmapMode )
{
if ( ( eBitmapMode == BitmapMode_REPEAT ) || ( eBitmapMode == BitmapMode_NO_REPEAT ) )
{
sal_Bool bLogicalSize = sal_False;
awt::Size aSize( 0, 0 );
if ( ( rxPropertySet->getPropertyValue( TKGet( TK_FillBitmapLogicalSize ) ) >>= bLogicalSize )
&& ( rxPropertySet->getPropertyValue( TKGet( TK_FillBitmapSizeX ) ) >>= aSize.Width )
&& ( rxPropertySet->getPropertyValue( TKGet( TK_FillBitmapSizeY ) ) >>= aSize.Height ) )
if ( ( rxPropertySet->getPropertyValue( "FillBitmapLogicalSize" ) >>= bLogicalSize )
&& ( rxPropertySet->getPropertyValue( "FillBitmapSizeX" ) >>= aSize.Width )
&& ( rxPropertySet->getPropertyValue( "FillBitmapSizeY" ) >>= aSize.Height ) )
{
if ( bLogicalSize )
{
......@@ -183,7 +183,7 @@ void ImpAddFillBitmapEntity( const Reference< XComponentContext >& rxMSF, const
}
GraphicCollector::GraphicUser aUser;
aUser.mxPropertySet = rxPropertySet;
rxPropertySet->getPropertyValue( TKGet( TK_FillBitmapURL ) ) >>= aUser.maGraphicURL;
rxPropertySet->getPropertyValue( "FillBitmapURL" ) >>= aUser.maGraphicURL;
aUser.mbFillBitmap = sal_True;
aUser.maLogicalSize = aLogicalSize;
aUser.mxPagePropertySet = rxPagePropertySet;
......@@ -204,11 +204,11 @@ void ImpCollectBackgroundGraphic( const Reference< XComponentContext >& rxMSF, c
{
awt::Size aLogicalSize( 28000, 21000 );
Reference< XPropertySet > xPropertySet( rxDrawPage, UNO_QUERY_THROW );
xPropertySet->getPropertyValue( TKGet( TK_Width ) ) >>= aLogicalSize.Width;
xPropertySet->getPropertyValue( TKGet( TK_Height ) ) >>= aLogicalSize.Height;
xPropertySet->getPropertyValue( "Width" ) >>= aLogicalSize.Width;
xPropertySet->getPropertyValue( "Height" ) >>= aLogicalSize.Height;
Reference< XPropertySet > xBackgroundPropSet;
if ( xPropertySet->getPropertyValue( TKGet( TK_Background ) ) >>= xBackgroundPropSet )
if ( xPropertySet->getPropertyValue( "Background" ) >>= xBackgroundPropSet )
ImpAddFillBitmapEntity( rxMSF, xBackgroundPropSet, aLogicalSize, rGraphicEntities, rGraphicSettings, xPropertySet );
}
catch( Exception& )
......@@ -252,12 +252,12 @@ awt::Size GraphicCollector::GetOriginalSize( const Reference< XComponentContext
{
awt::Size aSize100thMM( 0, 0 );
Reference< XPropertySet > xGraphicPropertySet( rxGraphic, UNO_QUERY_THROW );
if ( xGraphicPropertySet->getPropertyValue( TKGet( TK_Size100thMM ) ) >>= aSize100thMM )
if ( xGraphicPropertySet->getPropertyValue( "Size100thMM" ) >>= aSize100thMM )
{
if ( !aSize100thMM.Width && !aSize100thMM.Height )
{ // MAPMODE_PIXEL USED :-(
awt::Size aSourceSizePixel( 0, 0 );
if ( xGraphicPropertySet->getPropertyValue( TKGet( TK_SizePixel ) ) >>= aSourceSizePixel )
if ( xGraphicPropertySet->getPropertyValue( "SizePixel" ) >>= aSourceSizePixel )
{
const DeviceInfo& rDeviceInfo( GraphicCollector::GetDeviceInfo( rxMSF ) );
if ( rDeviceInfo.PixelPerMeterX && rDeviceInfo.PixelPerMeterY )
......@@ -364,7 +364,7 @@ void ImpCountGraphicObjects( const Reference< XComponentContext >& rxMSF, const
Reference< XPropertySet > xEmptyPagePropSet;
Reference< XPropertySet > xShapePropertySet( xShape, UNO_QUERY_THROW );
FillStyle eFillStyle;
if ( xShapePropertySet->getPropertyValue( TKGet( TK_FillStyle ) ) >>= eFillStyle )
if ( xShapePropertySet->getPropertyValue( "FillStyle" ) >>= eFillStyle )
{
if ( eFillStyle == FillStyle_BITMAP )
{
......@@ -385,14 +385,14 @@ void ImpCountBackgroundGraphic(
{
awt::Size aLogicalSize( 28000, 21000 );
Reference< XPropertySet > xPropertySet( rxDrawPage, UNO_QUERY_THROW );
xPropertySet->getPropertyValue( TKGet( TK_Width ) ) >>= aLogicalSize.Width;
xPropertySet->getPropertyValue( TKGet( TK_Height ) ) >>= aLogicalSize.Height;
xPropertySet->getPropertyValue( "Width" ) >>= aLogicalSize.Width;
xPropertySet->getPropertyValue( "Height" ) >>= aLogicalSize.Height;
Reference< XPropertySet > xBackgroundPropSet;
if ( xPropertySet->getPropertyValue( TKGet( TK_Background ) ) >>= xBackgroundPropSet )
if ( xPropertySet->getPropertyValue( "Background" ) >>= xBackgroundPropSet )
{
FillStyle eFillStyle;
if ( xBackgroundPropSet->getPropertyValue( TKGet( TK_FillStyle ) ) >>= eFillStyle )
if ( xBackgroundPropSet->getPropertyValue( "FillStyle" ) >>= eFillStyle )
{
if ( eFillStyle == FillStyle_BITMAP )
{
......
......@@ -62,14 +62,14 @@ OUString InsertFixedText( InformationDialog& rInformationDialog, const OUString&
sal_Int32 nXPos, sal_Int32 nYPos, sal_Int32 nWidth, sal_Int32 nHeight, sal_Bool bMultiLine, sal_Int16 nTabIndex )
{
OUString pNames[] = {
TKGet( TK_Height ),
TKGet( TK_Label ),
TKGet( TK_MultiLine ),
TKGet( TK_PositionX ),
TKGet( TK_PositionY ),
TKGet( TK_Step ),
TKGet( TK_TabIndex ),
TKGet( TK_Width ) };
"Height",
"Label",
"MultiLine",
"PositionX",
"PositionY",
"Step",
"TabIndex",
"Width" };
Any pValues[] = {
Any( nHeight ),
......@@ -101,13 +101,13 @@ OUString InsertImage(
sal_Bool bScale )
{
OUString pNames[] = {
TKGet( TK_Border ),
TKGet( TK_Height ),
TKGet( TK_ImageURL ),
TKGet( TK_PositionX ),
TKGet( TK_PositionY ),
TKGet( TK_ScaleImage ),
TKGet( TK_Width ) };
"Border",
"Height",
"ImageURL",
"PositionX",
"PositionY",
"ScaleImage",
"Width" };
Any pValues[] = {
Any( sal_Int16( 0 ) ),
......@@ -131,14 +131,14 @@ OUString InsertCheckBox( InformationDialog& rInformationDialog, const OUString&
sal_Int32 nXPos, sal_Int32 nYPos, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 nTabIndex )
{
OUString pNames[] = {
TKGet( TK_Enabled ),
TKGet( TK_Height ),
TKGet( TK_Label ),
TKGet( TK_PositionX ),
TKGet( TK_PositionY ),
TKGet( TK_Step ),
TKGet( TK_TabIndex ),
TKGet( TK_Width ) };
"Enabled",
"Height",
"Label",
"PositionX",
"PositionY",
"Step",
"TabIndex",
"Width" };
Any pValues[] = {
Any( sal_True ),
......@@ -165,15 +165,15 @@ OUString InsertButton( InformationDialog& rInformationDialog, const OUString& rC
sal_Int32 nXPos, sal_Int32 nYPos, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 nTabIndex, PPPOptimizerTokenEnum nResID )
{
OUString pNames[] = {
TKGet( TK_Enabled ),
TKGet( TK_Height ),
TKGet( TK_Label ),
TKGet( TK_PositionX ),
TKGet( TK_PositionY ),
TKGet( TK_PushButtonType ),
TKGet( TK_Step ),
TKGet( TK_TabIndex ),
TKGet( TK_Width ) };
"Enabled",
"Height",
"Label",
"PositionX",
"PositionY",
"PushButtonType",
"Step",
"TabIndex",
"Width" };
Any pValues[] = {
Any( sal_True ),
......@@ -217,13 +217,13 @@ void InformationDialog::InitDialog()
// setting the dialog properties
OUString pNames[] = {
TKGet( TK_Closeable ),
TKGet( TK_Height ),
TKGet( TK_Moveable ),
TKGet( TK_PositionX ),
TKGet( TK_PositionY ),
TKGet( TK_Title ),
TKGet( TK_Width ) };
"Closeable",
"Height",
"Moveable",
"PositionX",
"PositionY",
"Title",
"Width" };
Any pValues[] = {
Any( sal_True ),
......@@ -304,11 +304,11 @@ void InformationDialog::InitDialog()
5, 5, 25, 25, sal_False );
InsertFixedText( *this, OUString("fixedtext"), aInfoString, PAGE_POS_X, 6, PAGE_WIDTH, 24, sal_True, 0 );
if ( !maSaveAsURL.isEmpty() )
InsertCheckBox( *this, TKGet( TK_OpenNewDocument ), xItemListener, getString( STR_AUTOMATICALLY_OPEN ), PAGE_POS_X, 42, PAGE_WIDTH, 8, 1 );
InsertCheckBox( *this, "OpenNewDocument", xItemListener, getString( STR_AUTOMATICALLY_OPEN ), PAGE_POS_X, 42, PAGE_WIDTH, 8, 1 );
InsertButton( *this, OUString("button"), mxActionListener, DIALOG_WIDTH / 2 - 25, nDialogHeight - 20, 50, 14, 2, STR_OK );
sal_Bool bOpenNewDocument = mrbOpenNewDocument;
setControlProperty( TKGet( TK_OpenNewDocument ), TKGet( TK_State ), Any( (sal_Int16)bOpenNewDocument ) );
setControlProperty( "OpenNewDocument", "State", Any( (sal_Int16)bOpenNewDocument ) );
}
// -----------------------------------------------------------------------------
......@@ -348,7 +348,7 @@ sal_Bool InformationDialog::execute()
if ( !maSaveAsURL.isEmpty() )
{
sal_Int16 nInt16 = 0;
Any aAny( getControlProperty( TKGet( TK_OpenNewDocument ), TKGet( TK_State ) ) );
Any aAny( getControlProperty( "OpenNewDocument", "State" ) );
if ( aAny >>= nInt16 )
{
sal_Bool bOpenNewDocument = static_cast< sal_Bool >( nInt16 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment