sw: std::vector<OUString*> considered silly

Change-Id: Ie5141a01b1a63c083d5fce1842a35a9a4b0d36e3
This commit is contained in:
Michael Stahl 2017-11-29 23:24:35 +01:00
parent 2c081e66cd
commit dfe635d4f5
7 changed files with 16 additions and 15 deletions

View file

@ -29,12 +29,13 @@ protected:
virtual SvXMLImportContext *CreateContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) override;
public:
std::vector<OUString*> &rSectionList;
std::vector<OUString> & m_rSectionList;
SwXMLSectionList(
const css::uno::Reference< css::uno::XComponentContext >& rContext,
std::vector<OUString*> &rNewSectionList );
std::vector<OUString> & rNewSectionList);
virtual ~SwXMLSectionList ( )
throw() override;

View file

@ -251,7 +251,7 @@ public:
// Read the sections of the document, which is equal to the medium.
// Returns the count of it
virtual size_t GetSectionList( SfxMedium& rMedium,
std::vector<OUString*>& rStrings ) const;
std::vector<OUString>& rStrings) const;
const tools::SvRef<SotStorage>& getSotStorageRef() { return pStg; };
void setSotStorageRef(const tools::SvRef<SotStorage>& pStgRef) { pStg = pStgRef; };

View file

@ -84,9 +84,9 @@ public:
SwXMLSectionList::SwXMLSectionList(
const uno::Reference< uno::XComponentContext >& rContext,
std::vector<OUString*> &rNewSectionList)
: SvXMLImport( rContext, "" ),
rSectionList ( rNewSectionList )
std::vector<OUString> &rNewSectionList)
: SvXMLImport(rContext, "")
, m_rSectionList(rNewSectionList)
{
// TODO: verify if these should match the same-name constants
// in xmloff/source/core/xmlimp.cxx ("_office" and "_office")
@ -143,7 +143,7 @@ SvXMLImportContextRef SvXMLSectionListContext::CreateChildContext(
sName = xAttrList->getValueByIndex( i );
}
if ( !sName.isEmpty() )
m_rImport.rSectionList.push_back( new OUString(sName) );
m_rImport.m_rSectionList.push_back(sName);
}
pContext = new SvXMLSectionListContext(m_rImport, nPrefix, rLocalName, xAttrList);

View file

@ -632,7 +632,7 @@ void Reader::ResetFrameFormats( SwDoc& rDoc )
// read the sections of the document, which is equal to the medium.
// returns the count of it
size_t Reader::GetSectionList( SfxMedium&, std::vector<OUString*>& ) const
size_t Reader::GetSectionList(SfxMedium&, std::vector<OUString>&) const
{
return 0;
}

View file

@ -50,7 +50,7 @@ public:
// read the sections of the document, which is equal to the medium.
// returns the count of it
virtual size_t GetSectionList( SfxMedium& rMedium,
std::vector<OUString*>& rStrings ) const override;
std::vector<OUString>& rStrings) const override;
};
// the special writers

View file

@ -957,7 +957,7 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con
// read the sections of the document, which is equal to the medium.
// returns the count of it
size_t XMLReader::GetSectionList( SfxMedium& rMedium,
std::vector<OUString*>& rStrings ) const
std::vector<OUString>& rStrings) const
{
uno::Reference< uno::XComponentContext > xContext =
comphelper::getProcessComponentContext();

View file

@ -1379,22 +1379,22 @@ IMPL_LINK( SwEditRegionDlg, SubRegionEventHdl, VclWindowEvent&, rEvent, void )
}
}
// helper function - read region names from medium
// helper function - read section names from medium
static void lcl_ReadSections( SfxMedium& rMedium, ComboBox& rBox )
{
rBox.Clear();
uno::Reference < embed::XStorage > xStg;
if( rMedium.IsStorage() && (xStg = rMedium.GetStorage()).is() )
{
std::vector<OUString*> aArr;
std::vector<OUString> aArr;
SotClipboardFormatId nFormat = SotStorage::GetFormatID( xStg );
if ( nFormat == SotClipboardFormatId::STARWRITER_60 || nFormat == SotClipboardFormatId::STARWRITERGLOB_60 ||
nFormat == SotClipboardFormatId::STARWRITER_8 || nFormat == SotClipboardFormatId::STARWRITERGLOB_8)
SwGetReaderXML()->GetSectionList( rMedium, aArr );
for(std::vector<OUString*>::const_iterator it(aArr.begin()); it != aArr.end(); ++it) {
rBox.InsertEntry( **it );
delete *it;
for (auto const& it : aArr)
{
rBox.InsertEntry(it);
}
}
}