Kaydet (Commit) 13f8d799 authored tarafından Marcel Metz's avatar Marcel Metz Kaydeden (comit) Michael Stahl

Replace SwTxtPortionTable with std::map.

üst 40fe511d
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <com/sun/star/linguistic2/XHyphenatedWord.hpp> #include <com/sun/star/linguistic2/XHyphenatedWord.hpp>
#include <com/sun/star/beans/PropertyValues.hpp> #include <com/sun/star/beans/PropertyValues.hpp>
#include <tools/table.hxx> #include <map>
#include "swtypes.hxx" #include "swtypes.hxx"
#include "txttypes.hxx" #include "txttypes.hxx"
...@@ -168,14 +168,14 @@ public: ...@@ -168,14 +168,14 @@ public:
* class SwTxtSizeInfo * class SwTxtSizeInfo
*************************************************************************/ *************************************************************************/
DECLARE_TABLE( SwTxtPortionTable, sal_IntPtr ) typedef ::std::map< sal_uLong, sal_IntPtr > SwTxtPortionMap;
class SwTxtSizeInfo : public SwTxtInfo class SwTxtSizeInfo : public SwTxtInfo
{ {
protected: protected:
// during formatting, a small database is built, mapping portion pointers // during formatting, a small database is built, mapping portion pointers
// to their maximum size (used for kana compression) // to their maximum size (used for kana compression)
SwTxtPortionTable aMaxWidth; SwTxtPortionMap aMaxWidth;
// for each line, an array of compression values is calculated // for each line, an array of compression values is calculated
// this array is passed over to the info structure // this array is passed over to the info structure
std::deque<sal_uInt16>* pKanaComp; std::deque<sal_uInt16>* pKanaComp;
...@@ -343,19 +343,24 @@ public: ...@@ -343,19 +343,24 @@ public:
// stored in aMaxWidth and discarded after a line has been formatted. // stored in aMaxWidth and discarded after a line has been formatted.
inline void SetMaxWidthDiff( sal_uLong nKey, sal_uInt16 nVal ) inline void SetMaxWidthDiff( sal_uLong nKey, sal_uInt16 nVal )
{ {
aMaxWidth.Insert( nKey, nVal ); aMaxWidth.insert( ::std::make_pair( nKey, nVal ) );
}; };
inline sal_uInt16 GetMaxWidthDiff( sal_uLong nKey ) inline sal_uInt16 GetMaxWidthDiff( sal_uLong nKey )
{ {
return (sal_uInt16)aMaxWidth.Get( nKey ); SwTxtPortionMap::iterator it = aMaxWidth.find( nKey );
if( it != aMaxWidth.end() )
return it->second;
else
return 0;
}; };
inline void ResetMaxWidthDiff() inline void ResetMaxWidthDiff()
{ {
aMaxWidth.Clear(); aMaxWidth.clear();
}; };
inline sal_Bool CompressLine() inline sal_Bool CompressLine()
{ {
return (sal_Bool)aMaxWidth.Count(); return (sal_Bool)!aMaxWidth.empty();
}; };
// //
......
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