diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2014-09-23 15:40:34 +0900 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-09-24 19:59:56 +0000 |
commit | f8ac4e2c436505304df7020a86dfc202851a9cab (patch) | |
tree | 3e5ce62ac2a5b674e351f57b5ef1ed7b59da9d1a /sw/source/uibase | |
parent | e16c8534f446a7cc311d6d5026aae5457e4f8e6c (diff) |
fdo#75757: remove inheritance to std::vector
from SwLabRecs, by typedef'ing it as boost::ptr_vector<SwLabRec>.
This is also a supposed fix for possible memory leaks in
SwLabDlg::_ReplaceGroup(), since erasing elements did not
delete pointers in the original code.
Change-Id: I1c8a0393cb5bdcfca3408e9c8dc770d306f6d334
Reviewed-on: https://gerrit.libreoffice.org/11597
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/uibase')
-rw-r--r-- | sw/source/uibase/envelp/labimp.hxx | 33 | ||||
-rw-r--r-- | sw/source/uibase/inc/label.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/inc/labelcfg.hxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/inc/labrec.hxx | 53 |
4 files changed, 54 insertions, 38 deletions
diff --git a/sw/source/uibase/envelp/labimp.hxx b/sw/source/uibase/envelp/labimp.hxx index caaf6068e501..982132fd3d32 100644 --- a/sw/source/uibase/envelp/labimp.hxx +++ b/sw/source/uibase/envelp/labimp.hxx @@ -72,43 +72,10 @@ #include <svtools/treelistbox.hxx> #include <label.hxx> #include <labimg.hxx> -#include <vector> #define GETFLDVAL(rField) (rField).Denormalize((rField).GetValue(FUNIT_TWIP)) #define SETFLDVAL(rField, lValue) (rField).SetValue((rField).Normalize(lValue), FUNIT_TWIP) -class SwLabRec -{ -public: - SwLabRec(): lHDist(0), lVDist(0), lWidth(0), lHeight(0), lLeft(0), lUpper(0), lPWidth(0), lPHeight(0), nCols(0), nRows(0), bCont(false) {} - - void SetFromItem( const SwLabItem& rItem ); - void FillItem( SwLabItem& rItem ) const; - - OUString aMake; - OUString aType; - long lHDist; - long lVDist; - long lWidth; - long lHeight; - long lLeft; - long lUpper; - long lPWidth; - long lPHeight; - sal_Int32 nCols; - sal_Int32 nRows; - bool bCont; -}; - -class SwLabRecs : public std::vector<SwLabRec*> { -public: - ~SwLabRecs() - { - for(const_iterator it = begin(); it != end(); ++it) - delete *it; - } -}; - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/label.hxx b/sw/source/uibase/inc/label.hxx index 838c1016c45e..61b452d245d4 100644 --- a/sw/source/uibase/inc/label.hxx +++ b/sw/source/uibase/inc/label.hxx @@ -24,8 +24,6 @@ #include <labelcfg.hxx> #include <vector> -class SwLabRec; -class SwLabRecs; class SwLabItem; class SwLabPrtPage; class SwDBManager; diff --git a/sw/source/uibase/inc/labelcfg.hxx b/sw/source/uibase/inc/labelcfg.hxx index 40bd8cea6192..0a8a162e077a 100644 --- a/sw/source/uibase/inc/labelcfg.hxx +++ b/sw/source/uibase/inc/labelcfg.hxx @@ -21,13 +21,11 @@ #include <unotools/configitem.hxx> #include "swdllapi.h" +#include "labrec.hxx" #include <map> #include <vector> -class SwLabRecs; -class SwLabRec; - struct SwLabelMeasure { OUString m_aMeasure; // string contains the label dimensions diff --git a/sw/source/uibase/inc/labrec.hxx b/sw/source/uibase/inc/labrec.hxx new file mode 100644 index 000000000000..3e5f124b1489 --- /dev/null +++ b/sw/source/uibase/inc/labrec.hxx @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_LABREC_HXX +#define INCLUDED_SW_SOURCE_UIBASE_INC_LABREC_HXX + +#include <boost/ptr_container/ptr_vector.hpp> + +class SwLabItem; + +class SwLabRec +{ +public: + SwLabRec(): lHDist(0), lVDist(0), lWidth(0), lHeight(0), lLeft(0), lUpper(0), lPWidth(0), lPHeight(0), nCols(0), nRows(0), bCont(false) {} + + void SetFromItem( const SwLabItem& rItem ); + void FillItem( SwLabItem& rItem ) const; + + OUString aMake; + OUString aType; + long lHDist; + long lVDist; + long lWidth; + long lHeight; + long lLeft; + long lUpper; + long lPWidth; + long lPHeight; + sal_Int32 nCols; + sal_Int32 nRows; + bool bCont; +}; + +typedef boost::ptr_vector<SwLabRec> SwLabRecs; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |