From 8aac6ecc58fa2c475f34817e607efb6a31317898 Mon Sep 17 00:00:00 2001 From: Matteo Casalin Date: Sun, 30 Nov 2014 18:33:21 +0100 Subject: Use Any specializations for bool, instead of SetValue Change-Id: I7a5babe494bdb09a71164ea74d7be3f6bf985ff6 Reviewed-on: https://gerrit.libreoffice.org/13215 Tested-by: LibreOffice gerrit bot Reviewed-by: Michael Stahl --- sw/source/filter/xml/XMLRedlineImportHelper.cxx | 9 +++---- sw/source/filter/xml/swxml.cxx | 33 ++++++++----------------- sw/source/filter/xml/wrtxml.cxx | 18 ++++---------- sw/source/filter/xml/xmlexp.cxx | 7 +++--- sw/source/filter/xml/xmlimp.cxx | 10 ++------ sw/source/filter/xml/xmltexte.cxx | 6 ++--- 6 files changed, 25 insertions(+), 58 deletions(-) (limited to 'sw/source/filter/xml') diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx index 94d4ee26f3f8..2bf19fd5a95b 100644 --- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx +++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx @@ -289,10 +289,7 @@ XMLRedlineImportHelper::XMLRedlineImportHelper( // set redline mode to "don't record changes" if( bHandleRecordChanges ) { - Any aAny; - sal_Bool bTmp = sal_False; - aAny.setValue( &bTmp, ::getBooleanCppuType() ); - xModelPropertySet->setPropertyValue( sRecordChanges, aAny ); + xModelPropertySet->setPropertyValue( sRecordChanges, makeAny(false) ); } } @@ -354,13 +351,13 @@ XMLRedlineImportHelper::~XMLRedlineImportHelper() { Any aAny; - aAny.setValue( &bShowChanges, ::getBooleanCppuType() ); + aAny <<= bShowChanges; if ( bHandleShowChanges ) xModelPropertySet->setPropertyValue( sShowChanges, aAny ); else xImportInfoPropertySet->setPropertyValue( sShowChanges, aAny ); - aAny.setValue( &bRecordChanges, ::getBooleanCppuType() ); + aAny <<= bRecordChanges; if ( bHandleRecordChanges ) xModelPropertySet->setPropertyValue( sRecordChanges, aAny ); else diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index fddb41148834..c62994560d40 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -716,10 +716,7 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, c xInfoSet->setPropertyValue( "StyleInsertModeFamilies", makeAny(aFamiliesSeq) ); - sal_Bool bTmp = !aOpt.IsMerge(); - Any aAny; - aAny.setValue( &bTmp, ::getBooleanCppuType() ); - xInfoSet->setPropertyValue( "StyleInsertModeOverwrite", aAny ); + xInfoSet->setPropertyValue( "StyleInsertModeOverwrite", makeAny(!aOpt.IsMerge()) ); } else if( bInsertMode ) { @@ -736,17 +733,11 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, c if( IsBlockMode() ) { - sal_Bool bTmp = sal_True; - Any aAny; - aAny.setValue( &bTmp, ::getBooleanCppuType() ); - xInfoSet->setPropertyValue( "AutoTextMode", aAny ); + xInfoSet->setPropertyValue( "AutoTextMode", makeAny(true) ); } if( IsOrganizerMode() ) { - sal_Bool bTmp = sal_True; - Any aAny; - aAny.setValue( &bTmp, ::getBooleanCppuType() ); - xInfoSet->setPropertyValue( "OrganizerMode", aAny ); + xInfoSet->setPropertyValue( "OrganizerMode", makeAny(true) ); } // Set base URI @@ -783,19 +774,15 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, c sal_uInt32 nRet = 0; // save redline mode into import info property set - Any aAny; - sal_Bool bTmp; const OUString sShowChanges("ShowChanges"); const OUString sRecordChanges("RecordChanges"); const OUString sRedlineProtectionKey("RedlineProtectionKey"); - bTmp = IDocumentRedlineAccess::IsShowChanges( rDoc.getIDocumentRedlineAccess().GetRedlineMode() ); - aAny.setValue( &bTmp, ::getBooleanCppuType() ); - xInfoSet->setPropertyValue( sShowChanges, aAny ); - bTmp = IDocumentRedlineAccess::IsRedlineOn(rDoc.getIDocumentRedlineAccess().GetRedlineMode()); - aAny.setValue( &bTmp, ::getBooleanCppuType() ); - xInfoSet->setPropertyValue( sRecordChanges, aAny ); - aAny <<= rDoc.getIDocumentRedlineAccess().GetRedlinePassword(); - xInfoSet->setPropertyValue( sRedlineProtectionKey, aAny ); + xInfoSet->setPropertyValue( sShowChanges, + makeAny(IDocumentRedlineAccess::IsShowChanges(rDoc.getIDocumentRedlineAccess().GetRedlineMode())) ); + xInfoSet->setPropertyValue( sRecordChanges, + makeAny(IDocumentRedlineAccess::IsRedlineOn(rDoc.getIDocumentRedlineAccess().GetRedlineMode())) ); + xInfoSet->setPropertyValue( sRedlineProtectionKey, + makeAny(rDoc.getIDocumentRedlineAccess().GetRedlinePassword()) ); // force redline mode to "none" rDoc.getIDocumentRedlineAccess().SetRedlineMode_intern( nsRedlineMode_t::REDLINE_NONE ); @@ -910,7 +897,7 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, c aOpt.ResetAllFmtsOnly(); // redline password - aAny = xInfoSet->getPropertyValue( sRedlineProtectionKey ); + Any aAny = xInfoSet->getPropertyValue( sRedlineProtectionKey ); Sequence aKey; aAny >>= aKey; rDoc.getIDocumentRedlineAccess().SetRedlinePassword( aKey ); diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx index ff271930ff81..221e4fb9022b 100644 --- a/sw/source/filter/xml/wrtxml.cxx +++ b/sw/source/filter/xml/wrtxml.cxx @@ -179,16 +179,13 @@ sal_uInt32 SwXMLWriter::_Write( const uno::Reference < task::XStatusIndicator >& } SvtSaveOptions aSaveOpt; - sal_Bool bUsePrettyPrinting( aSaveOpt.IsPrettyPrinting() ); - aAny.setValue( &bUsePrettyPrinting, ::getBooleanCppuType() ); - xInfoSet->setPropertyValue( "UsePrettyPrinting", aAny ); + xInfoSet->setPropertyValue( "UsePrettyPrinting", makeAny(aSaveOpt.IsPrettyPrinting()) ); // save show redline mode ... const OUString sShowChanges("ShowChanges"); sal_uInt16 nRedlineMode = pDoc->getIDocumentRedlineAccess().GetRedlineMode(); - sal_Bool bShowChanges( IDocumentRedlineAccess::IsShowChanges( nRedlineMode ) ); - aAny.setValue( &bShowChanges, ::getBooleanCppuType() ); - xInfoSet->setPropertyValue( sShowChanges, aAny ); + xInfoSet->setPropertyValue( sShowChanges, + makeAny( IDocumentRedlineAccess::IsShowChanges( nRedlineMode ) ) ); // ... and hide redlines for export nRedlineMode &= ~nsRedlineMode_t::REDLINE_SHOW_MASK; nRedlineMode |= nsRedlineMode_t::REDLINE_SHOW_INSERT; @@ -208,10 +205,7 @@ sal_uInt32 SwXMLWriter::_Write( const uno::Reference < task::XStatusIndicator >& if( bBlock ) { - sal_Bool bTmp = sal_True; - Any aAny2; - aAny2.setValue( &bTmp, ::getBooleanCppuType() ); - xInfoSet->setPropertyValue( "AutoTextMode", aAny2 ); + xInfoSet->setPropertyValue( "AutoTextMode", makeAny(true) ); } // #i69627# @@ -499,9 +493,7 @@ bool SwXMLWriter::WriteThroughComponent( xSet->setPropertyValue("MediaType", aAny ); // even plain stream should be encrypted in encrypted documents - sal_Bool bTrue = sal_True; - aAny.setValue( &bTrue, ::getBooleanCppuType() ); - xSet->setPropertyValue( "UseCommonStoragePasswordEncryption", aAny ); + xSet->setPropertyValue( "UseCommonStoragePasswordEncryption", makeAny(true) ); // set buffer and create outputstream uno::Reference< io::XOutputStream > xOutputStream = xStream->getOutputStream(); diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index e399b3899c65..f43b8cb46289 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -381,7 +381,7 @@ void SwXMLExport::GetViewSettings(Sequence& aProps) // "show redline mode" cannot simply be read from the document // since it gets changed during execution. If it's in the info // XPropertySet, we take it from there. - sal_Bool bShowRedlineChanges = bSavedShowChanges; + bool bShowRedlineChanges = bSavedShowChanges; Reference xInfoSet( getExportInfo() ); if ( xInfoSet.is() ) { @@ -394,11 +394,10 @@ void SwXMLExport::GetViewSettings(Sequence& aProps) } pValue[nIndex].Name = "ShowRedlineChanges"; - pValue[nIndex++].Value.setValue( &bShowRedlineChanges, ::getBooleanCppuType() ); + pValue[nIndex++].Value <<= bShowRedlineChanges; - sal_Bool bInBrowse = pDoc->getIDocumentSettingAccess().get(IDocumentSettingAccess::BROWSE_MODE); pValue[nIndex].Name = "InBrowseMode"; - pValue[nIndex++].Value.setValue( &bInBrowse, ::getBooleanCppuType() ); + pValue[nIndex++].Value <<= pDoc->getIDocumentSettingAccess().get(IDocumentSettingAccess::BROWSE_MODE); if ( nIndex < NUM_EXPORTED_VIEW_SETTINGS ) aProps.realloc(nIndex); diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 4d276919abde..b7aa423c2c03 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -1292,18 +1292,12 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC if( !bUseOldNumbering ) { - Any aAny; - sal_Bool bOldNum = true; - aAny.setValue(&bOldNum, ::getBooleanCppuType()); - xProps->setPropertyValue( "UseOldNumbering", aAny ); + xProps->setPropertyValue( "UseOldNumbering", makeAny(true) ); } if( !bOutlineLevelYieldsOutlineRule ) { - Any aAny; - sal_Bool bTmp = true; - aAny.setValue(&bTmp, ::getBooleanCppuType()); - xProps->setPropertyValue( "OutlineLevelYieldsNumbering", aAny ); + xProps->setPropertyValue( "OutlineLevelYieldsNumbering", makeAny(true) ); } if( !bAddParaSpacingToTableCells ) diff --git a/sw/source/filter/xml/xmltexte.cxx b/sw/source/filter/xml/xmltexte.cxx index 3d9dab5c5385..e5eb86c057af 100644 --- a/sw/source/filter/xml/xmltexte.cxx +++ b/sw/source/filter/xml/xmltexte.cxx @@ -297,14 +297,12 @@ static void lcl_addFrameProperties( if( !bIsAutoScroll ) { - Any aAny2( &bIsScrollingMode, ::getBooleanCppuType() ); - *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_FRAME_DISPLAY_SCROLLBAR ), aAny2 ); + *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_FRAME_DISPLAY_SCROLLBAR ), makeAny(bIsScrollingMode) ); pStates++; } if( !bIsAutoBorder ) { - Any aAny2( &bIsBorderSet, ::getBooleanCppuType() ); - *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_FRAME_DISPLAY_BORDER ), aAny2 ); + *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_FRAME_DISPLAY_BORDER ), makeAny(bIsBorderSet) ); pStates++; } if( SIZE_NOT_SET != nWidth ) -- cgit v1.2.3